ace-8.0.4+dfsg.orig/0000755000175000017500000000000015046037655013176 5ustar sudipsudipace-8.0.4+dfsg.orig/netsvcs/0000755000175000017500000000000015046037655014663 5ustar sudipsudipace-8.0.4+dfsg.orig/netsvcs/ACE-netsvcs.html0000644000175000017500000007342115027201773017624 0ustar sudipsudip Overview of the ACE Network Services

Overview of the ACE Network Services

ACE provides a standard library of network services:

These services play two roles in ACE:

The heart of the ACE network services is the Service Configurator, which is an object-oriented framework that automates the configuration and reconfiguration of multi-service daemons. All the ACE network services are configured using the Service Configurator. Please refer to the online documentation for more information on installing and testing the ACE network services.


Overview of Naming Service

A Naming Service associates names with values in a distributed system. Clients can query these values using these names as keys. Such a name-to-value association is called a Name Binding . Name bindings are defined relative to a Naming Context . A naming context is a collection that contains a set of name bindings in which each name is unique. Different names can be bound to the same value in the same or different naming contexts at the same time. There are three types of naming contexts:

  1. Process Local Naming Context: Name bindings are accessible from processes with the same name running on the same host.

  2. Node Local Naming Context: Name bindings are accessible from all processes running on the same host.

  3. Network Local Naming Context: Name bindings are accessible from all processes running on any machine within a (sub)network.

To bind a name is to create a name binding in a given context. Querying a value using a name determines the value associated with the name in a given context. Note that a name is always bound relative to a context. Thus, there are no absolute names.

The following are the key classes in the ACE Naming Service:

The following describes how to configure the Name_Server server and client test applications.


Overview of Time Service

Time Service provides accurate, fault-tolerant clock synchronization for computers collaborating in local area networks and wide area networks. Synchronized time services are important in distributed systems that require multiple hosts to maintain accurate global time. The architecture of the distributed time service contains the following Time Server, Clerk, and Client components:

The following are the key classes in the ACE Time Service:

The following is a description of how to configure the Time Server clerk and server services:


Token Service

The ACE Token Service provides local and remote mutexes and readers/writer locks. For information regarding the deadlock detection algorithm, check out ACE_Token_Manager.h. For information about an implementation of the Composite Pattern for Tokens, check out Token_Collection.h. The classes which implement the local and remote synchronization primitives are listed below:

The Token Server provides distributed mutex and readers/writer lock semantics to the ACE Token library. ACE_Remote_Mutex, ACE_Remote_RLock, and ACE_Remote_WLock, are proxies to the Token Server. The following are the key classes in the ACE Token Server:

The following describes how to configure the Token Server:

Note:


Overview of Server Logging Service

The Server Logging Service provides a concurrent, multi-service daemon that processes logging records received from one or more client hosts simultaneously. The object-oriented design of the Server Logging Service is decomposed into several modular components that perform well-defined tasks.

The following are the key classes in the Server Logging Service:

The following describes how to configure the Logging Server:

Note:


Overview of Client Logging Service

The Client Logging Service multiplexes messages received from different applications to the Server Logging Daemon running on a designated host in a network/internetwork. The following are the key classes in the Client Logging Service:

The following describes how to configure the Logging Client:

Note:


Overview of Logging Strategy Service

The Logging Strategy Service can be used to control the output of all the network services. It can be invoked with certain flags that determine where the output of all the services should go. The Logging Strategy Service sets the flags in ACE_Log_Msg, which controls all the streams through macros such as ACE_DEBUG, ACE_ERROR, and ACE_ERROR_RETURN. If default behavior is required, the Logging Strategy Service need not be invoked or it can be invoked with no parameters.

The following describes how to configure the Logging Strategy Service:


Back to the ACE home page. ace-8.0.4+dfsg.orig/netsvcs/lib/0000755000175000017500000000000015046037655015431 5ustar sudipsudipace-8.0.4+dfsg.orig/netsvcs/lib/Base_Optimizer.h0000644000175000017500000000146315027201773020513 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Base_Optimizer.h * * @author Per Andersson. */ //============================================================================= #ifndef BASE_OPTIMIZER_H #define BASE_OPTIMIZER_H #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ /** * @class Base_Optimizer * * Thanks to Nathan Myers and Fergus Henderson for this little * beauty. */ template class Base_Optimizer : public Base { public: Base_Optimizer (); Base_Optimizer (const Base &base); Base_Optimizer (const Base &base, const Member &member); Member m_; }; #include "Base_Optimizer.cpp" #endif /* BASE_OPTIMIZER_H */ ace-8.0.4+dfsg.orig/netsvcs/lib/Server_Logging_Handler_T.h0000644000175000017500000001472615027201773022441 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Server_Logging_Handler_T.h * * @author Doug Schmidt and Per Andersson */ //============================================================================= #ifndef ACE_SERVER_LOGGING_HANDLER_T_H #define ACE_SERVER_LOGGING_HANDLER_T_H #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/TLI_Acceptor.h" #include "ace/SOCK_Acceptor.h" #include "ace/Svc_Handler.h" #include "ace/Acceptor.h" #include "ace/SString.h" #include "ace/Atomic_Op.h" #if !defined (__GNUG__) #include "Base_Optimizer.h" #endif /* ! __GNUG__ */ /** * @class ACE_Server_Logging_Handler_T * * @brief Product object created by an . An * receives, and frames logging * records. The logging record is then processed by the * * * Defines the classes that perform server logging daemon * functionality. */ template class ACE_Server_Logging_Handler_T : public ACE_Svc_Handler { public: /// Constructor. ACE_Server_Logging_Handler_T (ACE_Thread_Manager *, const LOG_MESSAGE_RECEIVER &receiver ); /// Process remote logging records. virtual int handle_input (ACE_HANDLE = ACE_INVALID_HANDLE); protected: /// Receive the logging record from a client. int handle_logging_record (); /// Common parts of open function, sets hostname and diables NONBLOCK in peer /// called from derived classes open method. int open_common (); /// Count the number of logging records that arrive. static COUNTER request_count_; #if !defined (__GNUG__) /** * Packs a LOG_MESSAGE_RECEIVER and ACE_CString attribute together * in a optimized fashion. The LOG_MESSAGE_RECEIVER class is often * a class with no instance data. */ Base_Optimizer receiver_; #else LOG_MESSAGE_RECEIVER receiver_; ACE_TString host_name_; #endif /* ! __GNUG__ */ /// Name of the host we are connected to. const ACE_TCHAR *host_name (); /// The receiver of log records LOG_MESSAGE_RECEIVER &receiver () { return receiver_; } }; #if 1 //!defined (ACE_HAS_TLI) #define LOGGING_PEER_ACCEPTOR ACE_SOCK_ACCEPTOR #define LOGGING_PEER_STREAM ACE_SOCK_STREAM #else /* use sockets */ #define LOGGING_PEER_ACCEPTOR ACE_TLI_ACCEPTOR #define LOGGING_PEER_STREAM ACE_TLI_STREAM #endif /* ACE_HAS_TLI */ /** * @class ACE_Server_Logging_Acceptor_T * * @brief Factory that creates s scheduled with * and logging records proccessed by a * * * This class contains the service-specific methods that can't * easily be factored into the . */ template class ACE_Server_Logging_Acceptor_T : public ACE_Strategy_Acceptor { public: /// Dynamic linking hook. ACE_Server_Logging_Acceptor_T (); virtual int init (int argc, ACE_TCHAR *argv[]); protected: /// Parse svc.conf arguments. int parse_args (int argc, ACE_TCHAR *argv[]); /** * Factory that creates a new . We need to * specialize this since the held by this Acceptor must be * passed into the . */ virtual int make_svc_handler (SERVER_LOGGING_HANDLER *&); private: // At the moment each ACE_Server_Logging_Acceptor_T contains // a attribute that is passed to the // at construction. A better idea might // be to have accessor class as template argument. The accessor // should be a factory/strategy that hands the // ACE_Server_Logging_Acceptor_T instance references // to a . This makes it possible // to change how are created without chaning the // ACE_Server_Logging_Acceptor_T code. #if !defined (__GNUG__) /** * Packs a LOG_MESSAGE_RECEIVER and ACE_CString attribute together * in a optimized fashion. The LOG_MESSAGE_RECEIVER class is often a * class with no instance data. */ Base_Optimizer receiver_; #else LOG_MESSAGE_RECEIVER receiver_; SCHEDULE_STRATEGY schedule_strategy_; #endif /* ! __GNUG__ */ /// The scheduling strategy for the service. SCHEDULE_STRATEGY &scheduling_strategy (); /// The receiver of log records LOG_MESSAGE_RECEIVER &receiver (); }; /** * @class ACE_Server_Logging_Handler * * @brief Product object created by a * >. An * ACE_Server_Logging_Handler receives, frames. The logging record * is then processed by the * * All clients are handled in the same thread. */ template class ACE_Server_Logging_Handler : public ACE_Server_Logging_Handler_T { public: ACE_Server_Logging_Handler (ACE_Thread_Manager * = 0); ACE_Server_Logging_Handler (ACE_Thread_Manager *, const LOG_MESSAGE_RECEIVER &receiver); virtual int open (void* = 0); }; #if defined (ACE_HAS_THREADS) typedef ACE_Atomic_Op ACE_LOGGER_COUNTER; #define ACE_LOGGER_SYNCH ACE_MT_SYNCH #else typedef u_long ACE_LOGGER_COUNTER; #define ACE_LOGGER_SYNCH ACE_NULL_SYNCH #endif /* ACE_HAS_THREADS */ /** * @class ACE_Thr_Server_Logging_Handler * * @brief Product object created by a * * >. An ACE_Thr_Server_Logging_Handler receives, frames. The * logging record is then processed by the * * Each client is handled in its own separate thread. */ template class ACE_Thr_Server_Logging_Handler : public ACE_Server_Logging_Handler_T { public: ACE_Thr_Server_Logging_Handler (ACE_Thread_Manager * = 0); ACE_Thr_Server_Logging_Handler (ACE_Thread_Manager *, const LOG_MESSAGE_RECEIVER &receiver); virtual int open (void * = 0); virtual int svc (); }; #include "Server_Logging_Handler_T.cpp" #endif /* ACE_SERVER_LOGGING_HANDLER_T_H */ ace-8.0.4+dfsg.orig/netsvcs/lib/TS_Clerk_Handler.h0000644000175000017500000001655215027201773020707 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file TS_Clerk_Handler.h * * @author Prashant Jain */ //============================================================================= #ifndef ACE_TS_CLERK_HANDLER_H #define ACE_TS_CLERK_HANDLER_H #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/SOCK_Connector.h" #include "ace/Svc_Handler.h" #include "ace/Connector.h" #include "ace/MMAP_Memory_Pool.h" #include "ace/Malloc_T.h" #include "ace/Null_Mutex.h" #include "ace/svc_export.h" #include "ace/os_include/os_dirent.h" #include "Time_Request_Reply.h" /** * @class ACE_Time_Info * * @brief A simple struct containing delta time and a sequence number. */ class ACE_Time_Info { public: time_t delta_time_; ACE_UINT32 sequence_num_; }; class ACE_TS_Clerk_Processor; // forward declaration #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT template class ACE_Svc_Export ACE_Svc_Handler; #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ /** * @class ACE_TS_Clerk_Handler * * @brief The Clerk Handler provides the interface that is used by the * Clerk Processor to send time update requests to all the * servers. It obtains these updates from the servers and passes * the updates to the Clerk Processor * * The Clerk Processor uses send_request() to send a request for * time update to a server. The Clerk Handler internally computes * the round trip delay for the reply to come back. Once it gets * the reply back from the server (handle_input), it adjusts the * system time using the round trip delay estimate and then * passes the delta time by reference back to the Clerk * Processor. */ class ACE_Svc_Export ACE_TS_Clerk_Handler : public ACE_Svc_Handler { public: /// Default constructor. ACE_TS_Clerk_Handler (ACE_TS_Clerk_Processor *processor = 0, ACE_INET_Addr &addr = (ACE_INET_Addr &) ACE_Addr::sap_any); // = Set/get the current state enum State { IDLE = 1, // Prior to initialization. CONNECTING, // During connection establishment. ESTABLISHED, // Connection is established and active. DISCONNECTING, // In the process of disconnecting. FAILED // Connection has failed. }; // = Set/get the current state. State state (); void state (State); // = Set/get the current retry timeout delay. long timeout (); void timeout (long); // = Set/get the maximum retry timeout delay. long max_timeout (); void max_timeout (long); /// Activate this instance of the /// (called by the ). virtual int open (void * = 0); /// Return the handle of the message_fifo_; virtual ACE_HANDLE get_handle () const; /// Called when object is removed from the ACE_Reactor virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); /// Receive time update from a server. virtual int handle_input (ACE_HANDLE); /// Restart connection asynchronously when timeout occurs. virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg); /// Get/Set remote addr void remote_addr (ACE_INET_Addr &addr); ACE_INET_Addr &remote_addr (); /// Send request for time update to the server as well as return the /// current time info by reference. int send_request (ACE_UINT32 sequence_num, ACE_Time_Info &time_info); protected: /// Handle SIGPIPE. virtual int handle_signal (int signum, siginfo_t *, ucontext_t *); static void stderr_output (int = 0); enum { MAX_RETRY_TIMEOUT = 300 // 5 minutes is the maximum timeout. }; private: /// Receive a reply from a server containing time update int recv_reply (ACE_Time_Request &reply); /// Reinitiate connection with the server int reinitiate_connection (); /// The current state of the connection State state_; /// Amount of time to wait between reconnection attempts long timeout_; /// Maximum amount of time to wait between reconnection attempts long max_timeout_; /// Remote Addr used for connecting to the server ACE_INET_Addr remote_addr_; /// Instance of Clerk Processor used for re-establishing connections ACE_TS_Clerk_Processor *processor_; /// Time at which request was sent (used to compute round trip delay) time_t start_time_; /// Next sequence number of time request (waiting for this update from /// the server). ACE_UINT32 cur_sequence_num_; /// Record of current delta time and current sequence number ACE_Time_Info time_info_; }; /** * @class ACE_TS_Clerk_Processor * * @brief This class manages all the connections to the servers along * with querying them periodically for time updates. * * The Clerk Processor creates connections to all the servers and * creates an ACE_TS_Clerk_Handler for each connection to handle * the requests and replies. It periodically sends a request for * time update through each of the handlers and uses the replies * for computing a synchronized system time. */ class ACE_TS_Clerk_Processor : public ACE_Connector { public: /// Default constructor ACE_TS_Clerk_Processor (); /// Query servers for time periodically (timeout value) virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg); /// Set up connections to all servers int initiate_connection (ACE_TS_Clerk_Handler *, ACE_Synch_Options &); protected: // = Dynamic linking hooks. /// Called when service is linked. virtual int init (int argc, ACE_TCHAR *argv[]); /// Called when service is unlinked. virtual int fini (); /// Called to determine info about the service. virtual int info (ACE_TCHAR **strp, size_t length) const; // = Scheduling hooks. virtual int suspend (); virtual int resume (); private: /// Parse svc.conf arguments. int parse_args (int argc, ACE_TCHAR *argv[]); /// Allocate entry in shared memory for system time void alloc (); /// Update delta_time using times obtained from all servers int update_time (); /// Allocator (used for reading/writing system time from/to shared memory) typedef ACE_Malloc MALLOC; typedef ACE_Allocator_Adapter ALLOCATOR; ALLOCATOR *shmem_; /// Set of TS_Clerk_Handlers and iterator over the set. typedef ACE_Unbounded_Set HANDLER_SET; typedef ACE_Unbounded_Set_Iterator HANDLER_SET_ITERATOR; HANDLER_SET handler_set_; struct System_Time { time_t *delta_time_; // Diff between system time and local time time_t *last_local_time_; // Last local time }; /// Clerk system time containing pointers to entries in shared memory System_Time system_time_; /// Timer id returned by Reactor long timer_id_; /// Time period for updating system time long timeout_; /// Pool name for backing store ACE_TCHAR poolname_[MAXNAMLEN + 1]; /// Do a blocking/non-blocking connect int blocking_semantics_; /// Sequence number of next expected update from servers ACE_UINT32 cur_sequence_num_; }; ACE_SVC_FACTORY_DECLARE (ACE_TS_Clerk_Processor) #endif /* ACE_TS_CLERK_HANDLER_H */ ace-8.0.4+dfsg.orig/netsvcs/lib/lib.mpc0000644000175000017500000000071415027201773016673 0ustar sudipsudip// -*- MPC -*- project(netsvcs): ace_output, acelib { avoids += ace_for_tao sharedname = netsvcs dynamicflags += ACE_BUILD_SVC_DLL Source_Files { Time_Request_Reply.cpp TS_Server_Handler.cpp TS_Clerk_Handler.cpp Client_Logging_Handler.cpp Name_Handler.cpp Log_Message_Receiver.cpp Server_Logging_Handler.cpp Token_Handler.cpp } Template_Files { Base_Optimizer.cpp Server_Logging_Handler_T.cpp } } ace-8.0.4+dfsg.orig/netsvcs/lib/Log_Message_Receiver.h0000644000175000017500000001621315027201773021607 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Log_Message_Receiver.h * * @author Per Andersson */ //============================================================================= #ifndef LOG_MESSAGE_RECEIVER_H #define LOG_MESSAGE_RECEIVER_H #include "ace/Log_Record.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Synch_Traits.h" #include "ace/Guard_T.h" #if defined (ACE_HAS_THREADS) # include "ace/Thread_Mutex.h" #else # include "ace/Null_Mutex.h" #endif /* ACE_HAS_THREADS */ // ==========================================================================// //------------- General Requirements on a Log Message Receiver --------------// // ==========================================================================// // The requirements on a log manager receiver, T, are quite simple. // 1: There must exist one "log_record" member function with the following // prototype: // void log_record(const ACE_TCHAR *hostname, // ACE_Log_Record &record); // // 2: There must exist a public destructor. // 3: There must exist a public copy constructor. // 4: There must exist a default constructor. (for now) // // The semantics are also simple. A log message receiver should // behave as an accessor object (smart pointer or envelope class). // It should be very cheap to copy and the should be no noticeable // difference when using either the new copy or the old log message // receiver. // // Methods: // void log_record(const ACE_TCHAR* hostname, // ACE_Log_Record& record) // Description: // Processes the log record "record" from the host "hostname" // Precondition: // hostname != 0; // Requirements: // Record must be a valid ACE_Log_Record. // // ==========================================================================// // ==========================================================================// // ------------ General Description of a Log Message Receiver -------------- // // ==========================================================================// // Log Message Receivers, LRMs, are processing log records. It is the // LRM that writes a log message to stderr, stdout, a log file and maybee // converts some of the log messages to notifications, warnings, alarms // and forwards them to some operation and maintenance system (PATROL). // // The client logging handler and server logging handler are responsible // for forwarding, receiving, framing, processing log records. // That is a very usable service, but it should also be possible to change // how log records are processed without having to rewrite code in // the server log handler. This code should instead be written as a // separate entity, a Log Message Receiver. // // A simple LMR should be very easy to write but it should also // be possible to write more complex LMRs, like one that creates // a new log file each day or keeps a fixed size, round robin, // log file. It should also be possible to have separate LMRs // of the same type that uses different log files. // // ==========================================================================// // Type based log message receiver /** * @class Static_Log_Message_Receiver * * @brief Static_Log_Message_Receiver is a simple log message receiver. It * has no instance data and only static member * functions. Static/typed based receivers are best when all LMR * should do exactly the same thing. * * This class contains a static log_record member function that * prints the content of log_records on stderr. */ template class Static_Log_Message_Receiver { public: /// Prints the log_record to stderr using record.print (hostname, 0, stderr). /// Serializes the output by using a ACE_SYNCH_MUTEX. static void log_record(const ACE_TCHAR *hostname, ACE_Log_Record &record); /// Prints the log_record to a user specified ostream. static void log_output(const ACE_TCHAR *hostname, ACE_Log_Record &record, ostream *output); }; // Instance based log message receiver // ------------------------ Log_Message_Receiver --------------------------- // // Log_Message_Receiver is little more complicated log message receiver. // It is instance based and have a reference counted implementation. // Log_Message_Receiver is the envelope class for Log_Message_Receiver_Impl. // // ------------------------------------------------------------------------- // //Forward declaration template class Log_Message_Receiver_Impl; /** * @class Log_Message_Receiver * * @brief Log_Message_Receiver is a little more complicated log message * receiver. It is instance based and have a reference counted * implementation. Log_Message_Receiver is the envelope class for * Log_Message_Receiver_Impl. The difference between * Static_Log_Message_Receiver and Log_Message_Receiver is that is * possible to have instance data in Log_Message_Receiver. * Comment: * The practical usage of this is limited with the current * ACE_Server_Logging_Acceptor_T design. Since * ACE_Server_Logging_Acceptor_T will create the * Log_Message_Receiver using the default constructor. The main * reason for inclusion right now is to ensure that the code in * ACE_Server_Logging_Handler_T works both with type and instance * based LMRs. * * This class contains a log_record member function that prints the * content of log_records on stderr. */ template class Log_Message_Receiver { public: /// Creates a new Log_Message_Receiver Log_Message_Receiver (); Log_Message_Receiver(Log_Message_Receiver const &rhs); ~Log_Message_Receiver (); void log_record (const ACE_TCHAR *hostname, ACE_Log_Record &record); void log_output(const ACE_TCHAR *hostname, ACE_Log_Record &record, ostream *output); private: void operator= (const Log_Message_Receiver &rhs) = delete; /// Attributes Log_Message_Receiver_Impl *receiver_impl_; }; /** * @class Log_Message_Receiver_Impl * * @brief Implementation with reference count. */ template class Log_Message_Receiver_Impl { public: // Methods for handling reference count and instance lifetime static Log_Message_Receiver_Impl *create (); static Log_Message_Receiver_Impl *attach (Log_Message_Receiver_Impl *body); static void detach (Log_Message_Receiver_Impl *body); void log_record (const ACE_TCHAR *hostname, ACE_Log_Record &record); void log_output(const ACE_TCHAR *hostname, ACE_Log_Record &record, ostream *output); protected: Log_Message_Receiver_Impl (); ~Log_Message_Receiver_Impl (); /// Attributes int count_; ACE_SYNCH_MUTEX_T print_lock_; private: static ACE_SYNCH_MUTEX_T copy_lock_; void operator= (const Log_Message_Receiver_Impl &) = delete; Log_Message_Receiver_Impl (const Log_Message_Receiver_Impl &) = delete; }; #include "Log_Message_Receiver.cpp" #endif /* LOG_MESSAGE_RECEIVER_H */ ace-8.0.4+dfsg.orig/netsvcs/lib/TS_Server_Handler.cpp0000644000175000017500000001646615027201773021454 0ustar sudipsudip#include "ace/SString.h" #include "ace/Containers.h" #include "ace/Get_Opt.h" #include "TS_Server_Handler.h" #include "ace/OS_NS_time.h" #include "ace/Signal.h" int ACE_TS_Server_Acceptor::parse_args (int argc, ACE_TCHAR *argv[]) { ACE_TRACE ("ACE_TS_Server_Acceptor::parse_args"); int service_port = ACE_DEFAULT_SERVER_PORT; ACE_LOG_MSG->open (ACE_TEXT ("Time Service")); ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("p:"), 0); for (int c; (c = get_opt ()) != -1; ) { switch (c) { case 'p': service_port = ACE_OS::atoi (get_opt.opt_arg ()); break; default: ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%n:\n[-p server-port]\n"), 1), -1); } } this->service_addr_.set (service_port); return 0; } int ACE_TS_Server_Acceptor::init (int argc, ACE_TCHAR *argv[]) { ACE_TRACE ("ACE_TS_Server_Acceptor::init"); // Use the options hook to parse the command line arguments and set // options. this->parse_args (argc, argv); // Set the acceptor endpoint into listen mode (use the Singleton // global Reactor...). if (this->open (this->service_addr_, ACE_Reactor::instance (), 0, 0, 0, &this->scheduling_strategy_, ACE_TEXT ("Time Server"), ACE_TEXT ("ACE time service")) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%n: %p on port %d\n"), ACE_TEXT ("acceptor::open failed"), this->service_addr_.get_port_number ()), -1); // Ignore SIGPIPE so that each can handle this on its // own. ACE_Sig_Action sig ((ACE_SignalHandler) SIG_IGN, SIGPIPE); ACE_UNUSED_ARG (sig); ACE_INET_Addr server_addr; // Figure out what port we're really bound to. if (this->acceptor ().get_local_addr (server_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("get_local_addr")), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("starting up Time Server at port %d on handle %d\n"), server_addr.get_port_number (), this->acceptor ().get_handle ())); return 0; } // The following is a "Factory" used by the ACE_Service_Config and // svc.conf file to dynamically initialize the state of the Time Server ACE_SVC_FACTORY_DEFINE (ACE_TS_Server_Acceptor) // Default constructor. ACE_TS_Server_Handler::ACE_TS_Server_Handler (ACE_Thread_Manager *tm) : ACE_Svc_Handler (tm) { ACE_TRACE ("ACE_TS_Server_Handler::ACE_TS_Server_Handler"); } // Activate this instance of the ACE_TS_Server_Handler (called by the // ACE_TS_Server_Acceptor). /* VIRTUAL */ int ACE_TS_Server_Handler::open (void *) { ACE_TRACE ("ACE_TS_Server_Handler::open"); ACE_INET_Addr client_addr; // Determine the address of the client and display it. if (this->peer ().get_remote_addr (client_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("get_remote_addr")), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) accepted connection from host %C on fd %d\n"), client_addr.get_host_name (), this->peer ().get_handle ())); // Call down to our parent to register ourselves with the Reactor. if (ACE_Svc_Handler::open (0) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), -1); return 0; } /* VIRTUAL */ int ACE_TS_Server_Handler::send_request (ACE_Time_Request &request) { ACE_TRACE ("ACE_TS_Server_Handler::send_request"); void *buffer; ssize_t length = request.encode (buffer); if (length == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("encode failed")), -1); // Transmit request via a blocking send. if (this->peer ().send_n (buffer, length) != length) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("send_n failed")), -1); return 0; } // Give up waiting (e.g., when a timeout occurs or a client shuts down // unexpectedly). /* VIRTUAL */ int ACE_TS_Server_Handler::abandon () { ACE_TRACE ("ACE_TS_Server_Handler::abandon"); // Note we are using the time field to report the errno in case of // failure. ACE_Time_Request rq (-1, errno); return this->send_request (rq); } // Enable clients to limit the amount of time they'll wait /* VIRTUAL */ int ACE_TS_Server_Handler::handle_timeout (const ACE_Time_Value &, const void *) { ACE_TRACE ("ACE_TS_Server_Handler::handle_timeout"); return this->abandon (); } // Return the underlying ACE_HANDLE. /* VIRTUAL */ ACE_HANDLE ACE_TS_Server_Handler::get_handle () const { ACE_TRACE ("ACE_TS_Server_Handler::get_handle"); return this->peer ().get_handle (); } // Dispatch the appropriate operation to handle the client request. /* VIRTUAL */ int ACE_TS_Server_Handler::dispatch () { ACE_TRACE ("ACE_TS_Server_Handler::dispatch"); // Get the system time and then create an ACE_Time_Request time_t t = ACE_OS::time (0); ACE_Time_Request rq (ACE_Time_Request::TIME_UPDATE, t); return this->send_request (rq); } // Receive, frame, and decode the client's request. Note, this method // should use non-blocking I/O. /* VIRTUAL */ int ACE_TS_Server_Handler::recv_request () { ACE_TRACE ("ACE_TS_Server_Handler::recv_request"); ssize_t const bytes_expected = this->time_request_.size (); // Since Time_Request messages are fixed size, read the entire // message in one go. ssize_t const n = this->peer ().recv ((void *) &this->time_request_, bytes_expected); if (n != bytes_expected) { switch (n) { case -1: ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("****************** recv_request returned -1\n"))); ACE_FALLTHROUGH; default: ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p got %d bytes, expected %d bytes\n"), ACE_TEXT ("recv failed"), n, bytes_expected)); ACE_FALLTHROUGH; case 0: // We've shutdown unexpectedly, let's abandon the // connection. this->abandon (); return -1; /* NOTREACHED */ } } else { // Decode the request into host byte order. if (this->time_request_.decode () == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("decode failed"))); return this->abandon (); } } return 0; } // Callback method invoked by the ACE_Reactor when events arrive from // the client. /* VIRTUAL */ int ACE_TS_Server_Handler::handle_input (ACE_HANDLE) { ACE_TRACE ("ACE_TS_Server_Handler::handle_input"); if (this->recv_request () == -1) return -1; else return this->dispatch (); } ACE_TS_Server_Handler::~ACE_TS_Server_Handler () { ACE_TRACE ("ACE_TS_Server_Handler::~ACE_TS_Server_Handler"); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("closing down Handle %d\n"), this->get_handle ())); } ace-8.0.4+dfsg.orig/netsvcs/lib/Server_Logging_Handler.h0000644000175000017500000000714615027201773022154 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Server_Logging_Handler.h * * @author Doug Schmidt and Per Andersson */ //============================================================================= #ifndef ACE_SERVER_LOGGING_HANDLER_H #define ACE_SERVER_LOGGING_HANDLER_H #include "Log_Message_Receiver.h" #include "Server_Logging_Handler_T.h" #include "ace/svc_export.h" // Typedefs for Logging Handlers & acceptors using a static type based // log message receivers. // Synched and NULL synched message receivers typedef Static_Log_Message_Receiver Null_Synch_Static_Receiver; typedef Static_Log_Message_Receiver Synch_Static_Receiver; // NULL synched logging handler typedef ACE_Server_Logging_Handler Null_Synch_Logging_Handler_Static_Receiver; // synched logging handlers typedef ACE_Server_Logging_Handler Synch_Logging_Handler_Static_Receiver; typedef ACE_Thr_Server_Logging_Handler Synch_Thr_Logging_Handler_Static_Receiver; // NULL synched logging acceptor typedef ACE_Server_Logging_Acceptor_T > Null_Synch_Logging_Handler_Static_Receiver_Acceptor; // NULL synched logging acceptors typedef ACE_Server_Logging_Acceptor_T > Synch_Logging_Handler_Static_Receiver_Acceptor; typedef ACE_Server_Logging_Acceptor_T > Synch_Thr_Logging_Handler_Static_Receiver_Acceptor; // typedefs for Logging Handlers & acceptors using a instance based // log message receivers. // Synched message receivers typedef Log_Message_Receiver Synch_Receiver; // synched logging handlers typedef ACE_Server_Logging_Handler Synch_Logging_Handler_Receiver; typedef ACE_Thr_Server_Logging_Handler Synch_Thr_Logging_Handler_Receiver; // synched logging acceptors typedef ACE_Server_Logging_Acceptor_T > Synch_Logging_Handler_Receiver_Acceptor; typedef ACE_Server_Logging_Acceptor_T > Synch_Thr_Logging_Handler_Receiver_Acceptor; // Define external acceptors // Acceptors that use static/type based log message receiver. typedef Null_Synch_Logging_Handler_Static_Receiver_Acceptor ACE_Server_Logging_Acceptor; typedef Synch_Thr_Logging_Handler_Static_Receiver_Acceptor ACE_Thr_Server_Logging_Acceptor; ACE_SVC_FACTORY_DECLARE (ACE_Server_Logging_Acceptor) ACE_SVC_FACTORY_DECLARE (ACE_Thr_Server_Logging_Acceptor) #endif /* ACE_SERVER_LOGGING_HANDLER_H */ ace-8.0.4+dfsg.orig/netsvcs/lib/Client_Logging_Handler.cpp0000644000175000017500000005300315027201773022450 0ustar sudipsudip#include "ace/Get_Opt.h" #include "ace/Acceptor.h" #include "ace/SOCK_Connector.h" #include "ace/SOCK_Acceptor.h" #include "ace/SPIPE_Acceptor.h" #include "ace/Log_Record.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_sys_socket.h" #include "ace/OS_NS_unistd.h" #include "ace/CDR_Stream.h" #include #include "ace/SString.h" #include "ace/INET_Addr.h" #include "Client_Logging_Handler.h" ACE_Client_Logging_Handler::ACE_Client_Logging_Handler (ACE_HANDLE output_handle) : logging_output_ (output_handle) { // Register ourselves to receive SIGPIPE so we can attempt // reconnections. #if !defined (ACE_LACKS_UNIX_SIGNALS) if (ACE_Reactor::instance ()->register_handler (SIGPIPE, this) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%n: %p\n"), ACE_TEXT ("register_handler (SIGPIPE)"))); #endif /* !ACE_LACKS_UNIX_SIGNALS */ } // This is called when a to the logging server fails... int ACE_Client_Logging_Handler::handle_signal (int signum, siginfo_t *, ucontext_t *) { if (signum == SIGPIPE) return 0; else return -1; } // This function is called every time a client connects to us. int ACE_Client_Logging_Handler::open (void *) { LOGGING_ADDR server_addr; // Register ourselves to receive callbacks when // clients send us logging records. Note that since we're really a // Singleton, this->peer() will change after each connect, so we // need to grab the value now. if (ACE_Reactor::instance ()->register_handler (this->peer ().get_handle (), this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::EXCEPT_MASK) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%n: %p\n"), ACE_TEXT ("register_handler")), -1); // Figure out what remote port we're really bound to. if (this->peer ().get_remote_addr (server_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("get_remote_addr")), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Connected to client on handle %u\n"), this->peer ().get_handle ())); return 0; } /* VIRTUAL */ ACE_HANDLE ACE_Client_Logging_Handler::get_handle () const { ACE_TRACE ("ACE_Client_Logging_Handler::get_handle"); ACE_ERROR ((LM_ERROR, ACE_TEXT ("get_handle() shouldn't be called\n"))); return ACE_INVALID_HANDLE; } // Receive a logging record from an application. int ACE_Client_Logging_Handler::handle_input (ACE_HANDLE handle) { #if 0 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("in ACE_Client_Logging_Handler::handle_input, handle = %u\n"), handle)); #endif /* 0 */ if (handle == this->logging_output_) // We're getting a message from the logging server! ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Received data from server!\n")), -1); ACE_Log_Record log_record; // We need to use the old two-read trick here since TCP sockets // don't support framing natively. Allocate a message block for the // payload; initially at least large enough to hold the header, but // needs some room for alignment. ACE_Message_Block *payload_p = 0; ACE_Message_Block *header_p = 0; ACE_NEW_RETURN (header_p, ACE_Message_Block (ACE_DEFAULT_CDR_BUFSIZE), -1); std::unique_ptr header (header_p); // Align the Message Block for a CDR stream ACE_CDR::mb_align (header.get ()); #if (ACE_HAS_STREAM_LOG_MSG_IPC == 1) // We're getting a logging message from a local application using // STREAM pipes, which are nicely prioritized for us. ACE_Str_Buf header_msg (header->wr_ptr (), 0, 8); ACE_SPIPE_Stream spipe; spipe.set_handle (handle); int flags = 0; // We've got a framed IPC mechanism, so we can just to a . ssize_t result = spipe.recv (&header_msg, (ACE_Str_Buf *) 0, &flags); if (result < 0 || header_msg.len == 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("client closing down unexpectedly\n"))); if (ACE_Reactor::instance ()->remove_handler (handle, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::EXCEPT_MASK | ACE_Event_Handler::DONT_CALL) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%n: %p\n"), ACE_TEXT ("remove_handler")), -1); spipe.close (); return 0; } #else // We're getting a logging message from a local application using // sockets pipes, which are NOT prioritized for us. ssize_t const count = ACE::recv_n (handle, header->wr_ptr (), 8); switch (count) { // Handle shutdown and error cases. default: case -1: case 0: ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("client closing down\n"))); if (ACE_Reactor::instance ()->remove_handler (handle, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::EXCEPT_MASK | ACE_Event_Handler::DONT_CALL) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%n: %p\n"), ACE_TEXT ("remove_handler")), 0); if (handle == this->peer ().get_handle ()) this->peer ().close (); else ACE_OS::closesocket (handle); // Release the memory to prevent a leak. return 0; /* NOTREACHED */ case 8: // Just fall through in this case.. break; } #endif /* ACE_HAS_STREAM_LOG_MSG_IPC == 1 */ // Reflect addition of 8 bytes for the header. header->wr_ptr (8); // Create a CDR stream to parse the 8-byte header. ACE_InputCDR header_cdr (header.get ()); // Extract the byte-order and use helper methods to disambiguate // octet, booleans, and chars. ACE_CDR::Boolean byte_order; if (!(header_cdr >> ACE_InputCDR::to_boolean (byte_order))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Can't extract byte_order\n"))); return 0; } // Set the byte-order on the stream... header_cdr.reset_byte_order (byte_order); // Extract the length ACE_CDR::ULong length; if (!(header_cdr >> length)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Can't extract length\n"))); return 0; } ACE_NEW_RETURN (payload_p, ACE_Message_Block (length), -1); std::unique_ptr payload (payload_p); // Ensure there's sufficient room for log record payload. ACE_CDR::grow (payload.get (), 8 + ACE_CDR::MAX_ALIGNMENT + length); #if (ACE_HAS_STREAM_LOG_MSG_IPC == 1) ACE_Str_Buf payload_msg (payload->wr_ptr (), 0, length); // We've got a framed IPC mechanism, so we can just do a . result = spipe.recv ((ACE_Str_Buf *) 0, &payload_msg, &flags); if (result < 0 || payload_msg.len != (int)length) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%p\n"), ACE_TEXT ("client closing down due to error\n"))); if (ACE_Reactor::instance ()->remove_handler (handle, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::EXCEPT_MASK | ACE_Event_Handler::DONT_CALL) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%n: result %d, length %d %p\n"), result, payload_msg.len, ACE_TEXT ("remove_handler")), -1); spipe.close (); return 0; } #else // Use to obtain the contents. if (ACE::recv_n (handle, payload->wr_ptr (), length) <= 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("recv_n()"))); if (ACE_Reactor::instance ()->remove_handler (handle, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::EXCEPT_MASK | ACE_Event_Handler::DONT_CALL) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%n: %p\n"), ACE_TEXT ("remove_handler"))); ACE_OS::closesocket (handle); return 0; } #endif /* ACE_HAS_STREAM_LOG_MSG_IPC == 1 */ // Reflect additional bytes for the message. payload->wr_ptr (length); ACE_InputCDR payload_cdr (payload.get ()); payload_cdr.reset_byte_order (byte_order); if (!(payload_cdr >> log_record)) // Finally extract the ACE_log_record. { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Can't extract log_record\n"))); return 0; } log_record.length (length); // Forward the logging record to the server. if (this->send (log_record) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("send"))); return 0; } // Receive a logging record from an application send via a non-0 // MSG_BAND... This just calls handle_input(). int ACE_Client_Logging_Handler::handle_exception (ACE_HANDLE handle) { return this->handle_input (handle); } // Called when object is removed from the ACE_Reactor int ACE_Client_Logging_Handler::close (u_long) { if (this->logging_output_ != ACE_STDERR) ACE_OS::closesocket (this->logging_output_); this->destroy (); return 0; } int ACE_Client_Logging_Handler::handle_output (ACE_HANDLE) { return 0; } // Encodes the contents of log_record object using network byte-order // and sends it to the logging server. int ACE_Client_Logging_Handler::send (ACE_Log_Record &log_record) { ostream *orig_ostream = ACE_Log_Msg::instance ()->msg_ostream (); // This logic must occur before we do the encode() on // since otherwise the values of the fields will be in // network byte order. if (orig_ostream) log_record.print (ACE_TEXT (""), ACE_Log_Msg::instance ()->flags (), *orig_ostream); if (this->logging_output_ == ACE_STDERR) { log_record.print (ACE_TEXT (""), ACE_Log_Msg::instance ()->flags (), stderr); } else { // Serialize the log record using a CDR stream, allocate enough // space for the complete . size_t const max_payload_size = 4 // type() + 8 // timestamp + 4 // process id + 4 // data length + ACE_Log_Record::MAXLOGMSGLEN // data + ACE_CDR::MAX_ALIGNMENT; // padding; // Insert contents of into payload stream. ACE_OutputCDR payload (max_payload_size); if (!(payload << log_record)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Can't insert log_record\n"))); return -1; } // Get the number of bytes used by the CDR stream. ACE_CDR::ULong const length = payload.total_length (); // Send a header so the receiver can determine the byte order and // size of the incoming CDR stream. ACE_OutputCDR header (ACE_CDR::MAX_ALIGNMENT + 8); if (!(header << ACE_OutputCDR::from_boolean (ACE_CDR_BYTE_ORDER))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Can't insert byte order\n"))); return -1; } // Store the size of the payload that follows if (!(header << ACE_CDR::ULong (length))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Can't insert length\n"))); return -1; } // Use an iovec to send both buffer and payload simultaneously. iovec iov[2]; iov[0].iov_base = header.begin ()->rd_ptr (); iov[0].iov_len = 8; iov[1].iov_base = payload.begin ()->rd_ptr (); iov[1].iov_len = length; // We're running over sockets, so send header and payload // efficiently using "gather-write". if (ACE::sendv_n (this->logging_output_,iov, 2) == -1) { ACE_DEBUG ((LM_DEBUG, "Something about the sendv_n() failed, so switch to stderr\n")); if (ACE_Log_Msg::instance ()->msg_ostream () == 0) // Switch over to logging to stderr for now. At some // point, we'll improve the implementation to queue up the // message, try to reestablish a connection, and then send // the queued data once we've reconnect to the logging // server. If you'd like to implement this functionality // and contribute it back to ACE that would be great! this->logging_output_ = ACE_STDERR; } else ACE_DEBUG ((LM_DEBUG, "Sent logging message %s successfully to Server Logging Daemon!\n", log_record.priority_name (ACE_Log_Priority (log_record.type ())))); } return 0; } class ACE_Client_Logging_Acceptor : public ACE_Acceptor { // = TITLE // This factory creates connections with the // . // // = DESCRIPTION // This class contains the service-specific methods that can't // easily be factored into the . public: ACE_Client_Logging_Acceptor (); // Default constructor. protected: // = Dynamic linking hooks. virtual int init (int argc, ACE_TCHAR *argv[]); // Called when service is linked. virtual int fini (); // Called when service is unlinked. virtual int info (ACE_TCHAR **strp, size_t length) const; // Called to determine info about the service. virtual int make_svc_handler (ACE_Client_Logging_Handler *&sh); // Factory that always returns the . // = Scheduling hooks. virtual int suspend (); virtual int resume (); private: int parse_args (int argc, ACE_TCHAR *argv[]); // Parse svc.conf arguments. const ACE_TCHAR *server_host_; // Host where the logging server is located. u_short server_port_; // Port number where the logging server is listening for // connections. ACE_INET_Addr server_addr_; // Address to connect to the server logging daemon. ACE_INET_Addr local_addr_; // Local IP/port number to use for the connection to the server logging // daemon. const ACE_TCHAR *logger_key_; // Communication endpoint where the client logging daemon will // listen for connections from clients. ACE_Client_Logging_Handler *handler_; // Pointer to the singleton handler that receives messages from // clients and forwards to the server. }; int ACE_Client_Logging_Acceptor::fini () { this->close (); if (this->handler_ != 0) this->handler_->close (0); // Try to unlink the logger key so weird things don't happen if // we're using STREAM pipes. ACE_OS::unlink (this->logger_key_); // This memory was allocated by . ACE_OS::free ((void *) this->logger_key_); ACE_OS::free ((void *) this->server_host_); return 0; } int ACE_Client_Logging_Acceptor::make_svc_handler (ACE_Client_Logging_Handler *&sh) { // Always return a pointer to the Singleton handler. sh = this->handler_; return 0; } int ACE_Client_Logging_Acceptor::info (ACE_TCHAR **strp, size_t length) const { ACE_TCHAR buf[BUFSIZ]; ACE_OS::sprintf (buf, ACE_TEXT ("%d/%s %s"), this->server_addr_.get_port_number (), "tcp", "# client logging daemon\n"); if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0) return -1; else ACE_OS::strncpy (*strp, buf, length); return ACE_OS::strlen (buf); } ACE_Client_Logging_Acceptor::ACE_Client_Logging_Acceptor () : server_host_ (ACE_OS::strdup (ACE_DEFAULT_SERVER_HOST)), server_port_ (ACE_DEFAULT_LOGGING_SERVER_PORT), logger_key_ (ACE_OS::strdup (ACE_DEFAULT_LOGGER_KEY)), handler_ (0) { } int ACE_Client_Logging_Acceptor::init (int argc, ACE_TCHAR *argv[]) { // We'll log *our* error and debug messages to stderr! if (ACE_LOG_MSG->open (ACE_TEXT ("Client Logging Service")) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Can't open ACE_Log_Msg\n")), -1); // Use the options hook to parse the command line arguments and set // options. this->parse_args (argc, argv); // Try to unlink the logger key so weird things don't happen if // we're using STREAM pipes. ACE_OS::unlink (this->logger_key_); // Initialize the acceptor endpoint. if (this->open (LOGGING_ADDR (this->logger_key_)) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), this->logger_key_), -1); // Establish connection with the server. ACE_SOCK_Connector con; ACE_SOCK_Stream stream; ACE_INET_Addr server_addr; #if (ACE_HAS_STREAM_LOG_MSG_IPC == 1) ACE_SPIPE_Addr lserver_addr; // Figure out what local port we're really bound to. if (this->acceptor ().get_local_addr (lserver_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("get_local_addr")), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Starting up Client Logging Daemon, ") ACE_TEXT ("bounded to STREAM addr %s on handle %u\n"), lserver_addr.get_path_name (), this->acceptor ().get_handle ())); #else ACE_INET_Addr lserver_addr; // Figure out what local port we're really bound to. if (this->acceptor ().get_local_addr (lserver_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("get_local_addr")), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Starting up Client Logging Daemon, ") ACE_TEXT ("bounded to local port %d on handle %u\n"), lserver_addr.get_port_number (), this->acceptor ().get_handle ())); #endif /* ACE_HAS_STREAM_LOG_MSG_IPC == 1 */ if (con.connect (stream, this->server_addr_, 0, this->local_addr_) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Can't connect to logging server %C on port %d: ") ACE_TEXT ("%m, using stderr\n"), this->server_addr_.get_host_name (), this->server_addr_.get_port_number (), ACE_ERRNO_GET)); if (ACE_Log_Msg::instance ()->msg_ostream () == 0) // If we can't connect to the server then we'll send the logging // messages to stderr. stream.set_handle (ACE_STDERR); } else { // Figure out what remote port we're really bound to. if (stream.get_remote_addr (server_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("get_remote_addr")), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Client Logging Daemon is connected to Server ") ACE_TEXT ("Logging Daemon %C on port %d on handle %u\n"), server_addr.get_host_name (), server_addr.get_port_number (), stream.get_handle ())); } // Create the Singleton . ACE_NEW_RETURN (this->handler_, ACE_Client_Logging_Handler (stream.get_handle ()), -1); return 0; } int ACE_Client_Logging_Acceptor::parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("h:k:p:l:"), 0); ACE_TString local_addr_str; for (int c; (c = get_opt ()) != -1; ) { switch (c) { case 'h': ACE_OS::free ((void *) this->server_host_); this->server_host_ = ACE_OS::strdup (get_opt.opt_arg ()); break; case 'k': ACE_OS::free ((void *) this->logger_key_); this->logger_key_ = ACE_OS::strdup (get_opt.opt_arg ()); break; case 'p': this->server_port_ = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'l': local_addr_str = get_opt.opt_arg (); break; default: ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%n:\n[-p server-port]\n") ACE_TEXT ("[-l local-ip[:local-port]]\n")), -1); } } this->local_addr_.set ((u_short)0); // "any" if (local_addr_str.length () > 0) { if (local_addr_str.rfind (ACE_TCHAR(':')) == ACE_TString::npos) local_addr_str += ACE_TEXT (":0"); ACE_TCHAR *local_addr_cstr = local_addr_str.rep (); if (-1 == local_addr_.string_to_addr (ACE_TEXT_ALWAYS_CHAR (local_addr_cstr))) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), local_addr_cstr)); delete [] local_addr_cstr; } if (this->server_addr_.set (this->server_port_, this->server_host_) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), this->server_host_), -1); return 0; } int ACE_Client_Logging_Acceptor::suspend () { // To be done... return 0; } int ACE_Client_Logging_Acceptor::resume () { // To be done... return 0; } // The following is a "Factory" used by the ACE_Service_Config and // svc.conf file to dynamically initialize the state of the // single-threaded logging server. ACE_SVC_FACTORY_DEFINE (ACE_Client_Logging_Acceptor) ace-8.0.4+dfsg.orig/netsvcs/lib/Client_Logging_Handler.h0000644000175000017500000000602415027201773022116 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Client_Logging_Handler.h * * @author Doug Schmidt */ //============================================================================= #ifndef ACE_CLIENT_LOGGER_H #define ACE_CLIENT_LOGGER_H #include "ace/SPIPE_Stream.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/SOCK_Stream.h" #include "ace/Svc_Handler.h" #include "ace/svc_export.h" #if (ACE_HAS_STREAM_LOG_MSG_IPC == 1) #define LOGGING_STREAM ACE_SPIPE_STREAM #define LOGGING_ACCEPTOR ACE_SPIPE_ACCEPTOR #define LOGGING_ADDR ACE_SPIPE_Addr #else #define LOGGING_STREAM ACE_SOCK_STREAM #define LOGGING_ACCEPTOR ACE_SOCK_ACCEPTOR #define LOGGING_ADDR ACE_INET_Addr #endif /* ACE_HAS_STREAM_LOG_MSG_IPC == 1 */ #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT template class ACE_Svc_Export ACE_Svc_Handler; #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ /** * @class ACE_Client_Logging_Handler * * @brief This client logging daemon is a mediator that receives logging * records from local applications processes and forwards them to * the server logging daemon running on another host. * * The default implementation uses an ACE_SPIPE_Stream to * receive the logging message from the application and an * ACE_SOCK_Stream to forward the logging message to the * server. However, on platforms that don't support * (e.g., Win32) we use sockets instead. */ class ACE_Svc_Export ACE_Client_Logging_Handler : public ACE_Svc_Handler { public: /// Default constructor. @a handle is where the output is sent. ACE_Client_Logging_Handler (ACE_HANDLE handle = ACE_STDERR); /// Activate this instance of the ACE_Client_Logging_Handler /// (called by the ACE_Client_Logging_Acceptor). virtual int open (void * = 0); /// Return the handle of the IPC endpoint. virtual ACE_HANDLE get_handle () const; /// Called when object is removed from the ACE_Reactor. virtual int close (u_long); private: /// Handle SIGPIPE. virtual int handle_signal (int signum, siginfo_t *, ucontext_t *); /// Receive logging records from applications. virtual int handle_input (ACE_HANDLE); /** * Receive logging records from applications. This is necessary to * handle madness with UNIX select, which can't deal with MSG_BAND * data easily due to its overly simple interface... This just * calls handle_input(). */ virtual int handle_exception (ACE_HANDLE); /// Called back when it's ok to send. virtual int handle_output (ACE_HANDLE); /// Send the @a log_record to the logging server. int send (ACE_Log_Record &log_record); /// This is either a SOCKET (if we're connected to a logging server) /// or ACE_STDERR. ACE_HANDLE logging_output_; }; ACE_SVC_FACTORY_DECLARE (ACE_Client_Logging_Acceptor) #endif /* ACE_CLIENT_LOGGER_H */ ace-8.0.4+dfsg.orig/netsvcs/lib/Log_Message_Receiver.cpp0000644000175000017500000001077315027201773022147 0ustar sudipsudip#if !defined (LOG_MESSAGE_RECEIVER_CPP) #define LOG_MESSAGE_RECEIVER_CPP #include "ace/Log_Msg.h" #include "Log_Message_Receiver.h" // Type based log message receiver template void Static_Log_Message_Receiver::log_record (const ACE_TCHAR *hostname, ACE_Log_Record &record) { #if defined (ACE_HAS_THREADS) static ACE_SYNCH_MUTEX_T lock_; ACE_GUARD (ACE_SYNCH_MUTEX_T, guard, lock_); #endif /* ACE_HAS_THREADS */ record.print (hostname, ACE_Log_Msg::instance ()->flags (), stderr); } template void Static_Log_Message_Receiver::log_output (const ACE_TCHAR *hostname, ACE_Log_Record &record, ostream *outputfile) { if (outputfile != 0) { #if defined (ACE_HAS_THREADS) static ACE_SYNCH_MUTEX_T lock_; ACE_GUARD (ACE_SYNCH_MUTEX_T, guard, lock_); #endif /* ACE_HAS_THREADS */ record.print (hostname, ACE_Log_Msg::instance ()->flags (), *outputfile); } } template ACE_SYNCH_MUTEX_T Log_Message_Receiver_Impl::copy_lock_; template Log_Message_Receiver_Impl::Log_Message_Receiver_Impl () : count_ (0) { } template Log_Message_Receiver_Impl * Log_Message_Receiver_Impl::create () { return new Log_Message_Receiver_Impl; } template Log_Message_Receiver_Impl * Log_Message_Receiver_Impl::attach (Log_Message_Receiver_Impl *body) { ACE_ASSERT (body != 0); #if defined (ACE_HAS_THREADS) ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, guard, copy_lock_, 0); #endif /* ACE_HAS_THREADS */ ++body->count_; return body; } template void Log_Message_Receiver_Impl::detach (Log_Message_Receiver_Impl *body) { ACE_ASSERT (body != 0); #if defined (ACE_HAS_THREADS) ACE_GUARD (ACE_SYNCH_MUTEX_T, guard, copy_lock_); #endif /* ACE_HAS_THREADS */ if (body->count_-- == 0) delete body; } // Type based log message receiver template void Log_Message_Receiver_Impl::log_record (const ACE_TCHAR *hostname, ACE_Log_Record &record) { ACE_GUARD (ACE_SYNCH_MUTEX_T, guard, print_lock_); record.print (hostname, ACE_Log_Msg::instance ()->flags (), stderr); } template void Log_Message_Receiver_Impl::log_output (const ACE_TCHAR *hostname, ACE_Log_Record &record, ostream *outputfile) { if (outputfile != 0) { ACE_GUARD (ACE_SYNCH_MUTEX_T, guard, print_lock_); record.print (hostname, ACE_Log_Msg::instance ()->flags (), *outputfile); } } template Log_Message_Receiver_Impl::~Log_Message_Receiver_Impl () { ACE_ASSERT (count_ == 0 - 1); } template Log_Message_Receiver::Log_Message_Receiver () : receiver_impl_ (Log_Message_Receiver_Impl::create ()) { ACE_ASSERT (receiver_impl_ != 0); } template Log_Message_Receiver::Log_Message_Receiver (Log_Message_Receiver const &rhs) : receiver_impl_ (Log_Message_Receiver_Impl::attach (rhs.receiver_impl_)) { ACE_ASSERT (receiver_impl_ != 0); } // Type based log message receiver template void Log_Message_Receiver::log_record(const ACE_TCHAR *hostname, ACE_Log_Record &record) { ACE_ASSERT (receiver_impl_ != 0); receiver_impl_->log_record (hostname, record); } template void Log_Message_Receiver::log_output(const ACE_TCHAR *hostname, ACE_Log_Record &record, ostream *outputfile) { ACE_ASSERT (receiver_impl_ != 0); receiver_impl_->log_output (hostname, record, outputfile); } template Log_Message_Receiver::~Log_Message_Receiver () { ACE_ASSERT (receiver_impl_ != 0); Log_Message_Receiver_Impl::detach (receiver_impl_); } #endif /* LOG_MESSAGE_RECEIVER_CPP */ ace-8.0.4+dfsg.orig/netsvcs/lib/Token_Handler.cpp0000644000175000017500000004113715027201773020651 0ustar sudipsudip#include "ace/Get_Opt.h" #include "Token_Handler.h" #if defined (ACE_HAS_TOKENS_LIBRARY) #include "ace/Signal.h" int ACE_Token_Acceptor::parse_args (int argc, ACE_TCHAR *argv[]) { ACE_TRACE ("ACE_Token_Acceptor::parse_args"); u_short svc_port = ACE_DEFAULT_SERVER_PORT; ACE_LOG_MSG->open (ACE_TEXT ("Token Service")); ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("p:"), 0); for (int c; (c = get_opt ()) != -1; ) { switch (c) { case 'p': svc_port = static_cast (ACE_OS::atoi (get_opt.opt_arg ())); break; default: ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%n:\n[-p server-port]\n"), 1), -1); } } this->service_addr_.set (svc_port); return 0; } int ACE_Token_Acceptor::init (int argc, ACE_TCHAR *argv[]) { ACE_TRACE ("ACE_Token_Acceptor::init"); // Use the options hook to parse the command line arguments and set // options. this->parse_args (argc, argv); // Set the acceptor endpoint into listen mode (use the Singleton // global Reactor...). if (this->open (this->service_addr_, ACE_Reactor::instance (), 0, 0, 0, &this->scheduling_strategy_, ACE_TEXT ("Token Server"), ACE_TEXT ("ACE token service")) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%n: %p on port %d\n"), ACE_TEXT ("acceptor::open failed"), this->service_addr_.get_port_number ()), -1); // Ignore SIGPIPE so that each can handle this on its // own. ACE_Sig_Action sig ((ACE_SignalHandler) SIG_IGN, SIGPIPE); ACE_UNUSED_ARG (sig); ACE_INET_Addr server_addr; if (this->acceptor ().get_local_addr (server_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("get_remote_addr")), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("starting up Token Server at port %d on handle %d\n"), server_addr.get_port_number (), this->acceptor ().get_handle ())); return 0; } // The following is a "Factory" used by the ACE_Service_Config and // svc.conf file to dynamically initialize the state of the Naming // Server. ACE_SVC_FACTORY_DEFINE (ACE_Token_Acceptor) // Default constructor. ACE_Token_Handler::ACE_Token_Handler (ACE_Thread_Manager *tm) : ACE_Svc_Handler (tm), collection_ (1), timeout_id_ (0) { ACE_TRACE ("ACE_Token_Handler::ACE_Token_Handler"); } // Create and send a reply to the client. /* VIRTUAL */ int ACE_Token_Handler::send_reply (ACE_UINT32 err) { ACE_TRACE ("ACE_Token_Handler::send_reply"); void *buf; size_t len; ssize_t n; this->token_reply_.errnum (err); len = this->token_reply_.encode (buf); n = this->peer ().send (buf, len); if (n != (ssize_t) len) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p, expected len = %d, actual len = %d\n"), ACE_TEXT ("send failed"), len, n), -1); else return 0; } // Acquire the token. /* VIRTUAL */ int ACE_Token_Handler::acquire (ACE_Token_Proxy *proxy) { ACE_TRACE ("ACE_Token_Handler::acquire"); #if 0 ACE_DEBUG ((LM_DEBUG, "in acquire for client id = %s\n", proxy->client_id ())); #endif /* 0 */ // @@ add notify in token request reply if (proxy->acquire (0, 0, ACE_Synch_Options::asynch) == -1) { if (errno != EWOULDBLOCK) // bad bad bad return this->send_reply (errno); // acquire would block if (request_options_[ACE_Synch_Options::USE_TIMEOUT] == 1) { // check for polling if ((request_options_.timeout ().sec () == 0) && (request_options_.timeout ().usec () == 0)) return this->send_reply (EWOULDBLOCK); // schedule a timer this->timeout_id_ = this->reactor ()->schedule_timer (this, (void *) proxy, request_options_.timeout ()); if (timeout_id_ == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("schedule_timer"))); return this->send_reply (errno); } } // send no reply. wait until we acquire it or until the timer // goes off. return 0; } else // success return this->send_reply (0); } // Try to acquire the token. Never block. /* VIRTUAL */ int ACE_Token_Handler::try_acquire (ACE_Token_Proxy *proxy) { ACE_TRACE ("ACE_Token_Handler::try_acquire"); #if 0 ACE_DEBUG ((LM_DEBUG, "in try_acquire for client id = %s\n", proxy->client_id ())); #endif /* 0 */ // @@ add notify in token request reply if (proxy->tryacquire () == -1) return this->send_reply (errno); else return this->send_reply (0); } // Release the token and allow the next client that is waiting to // proceed. /* VIRTUAL */ int ACE_Token_Handler::release (ACE_Token_Proxy *proxy) { ACE_TRACE ("ACE_Token_Handler::release"); #if 0 ACE_DEBUG ((LM_DEBUG, "in release for client id = %s\n", proxy->client_id ())); #endif /* 0 */ if (proxy->release (ACE_Synch_Options::asynch) == -1) // oops, it failed return this->send_reply (ACE_LOG_MSG->errnum ()); // success if (this->timeout_id_ != 0) { this->reactor ()->cancel_timer (timeout_id_); this->timeout_id_ = 0; } return this->send_reply (0); } // Yield the token if any clients are waiting, otherwise keep the // token. /* VIRTUAL */ int ACE_Token_Handler::renew (ACE_Token_Proxy *proxy) { ACE_TRACE ("ACE_Token_Handler::renew"); #if 0 ACE_DEBUG ((LM_DEBUG, "in renew for client id = %s\n", proxy->client_id ())); #endif /* 0 */ if (proxy->renew (token_request_.requeue_position (), ACE_Synch_Options::asynch) == -1) { int result = ACE_LOG_MSG->errnum (); if (result != EWOULDBLOCK) // bad bad bad return this->send_reply (result); // acquire would block if (request_options_[ACE_Synch_Options::USE_TIMEOUT] == 1) { this->timeout_id_ = this->reactor ()->schedule_timer (this, 0, request_options_.timeout ()); if (timeout_id_ == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("schedule_timer"))); return this->send_reply (ACE_LOG_MSG->errnum ()); } } // Send no reply. wait until we acquire it or until the timer // goes off. return 0; } else // Success, we still hold the token. return this->send_reply (0); } /* VIRTUAL */ int ACE_Token_Handler::remove (ACE_Token_Proxy * /* proxy */) { ACE_TRACE ("ACE_Token_Handler::remove"); #if 0 ACE_DEBUG ((LM_DEBUG, "in remove for client id = %s\n", proxy->client_id ())); #endif /* 0 */ ACE_ERROR ((LM_ERROR, ACE_TEXT ("sorry: ACE_Token_Handler::remove() is not implemented"))); return this->send_reply (ENOTSUP); } // Enable clients to limit the amount of time they'll wait for a // token. /* VIRTUAL */ int ACE_Token_Handler::handle_timeout (const ACE_Time_Value &, const void *tp) { ACE_TRACE ("ACE_Token_Handler::handle_timeout"); this->timeout_id_ = 0; // @@ add a try acquire here! // Try to acquire the token, but if we can't get it immediately // then abandon the wait. // if (this->try_acquire (&token_entry) == -1) // return this->abandon (token_entry); ACE_Token_Proxy *proxy = (ACE_Token_Proxy *) tp; #if 0 ACE_DEBUG ((LM_DEBUG, "in handle_timeout for client id = %s\n", proxy->client_id ())); #endif /* 0 */ // Remove ourselves from the waiter list. proxy->release (); this->send_reply (ETIME); return 0; } // Dispatch the appropriate operation to handle the client request. ACE_Token_Proxy * ACE_Token_Handler::get_proxy () { ACE_TRACE ("ACE_Token_Handler::get_proxy"); // See if the proxy already exists in the collection. ACE_Token_Proxy *proxy = collection_.is_member (token_request_.token_name ()); // If not, create one. if (proxy == 0) { proxy = this->create_proxy (); // Put the new_proxy in this client_id's collection. if (collection_.insert (*proxy) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("insert failed\n")), 0); // Delete our copy (one was created in the collection). delete proxy; proxy = collection_.is_member (token_request_.token_name ()); if (proxy == 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("is_member failed\n")), 0); // Set the client_id (it was set to 1 since we're // single-threaded. proxy->client_id (token_request_.client_id ()); } return proxy; } ACE_Token_Proxy * ACE_Token_Handler::create_proxy () { ACE_TRACE ("ACE_Token_Handler::create_proxy"); ACE_Token_Proxy *proxy; switch (token_request_.token_type ()) { case ACE_Tokens::RWLOCK: if (token_request_.proxy_type () == ACE_RW_Token::READER) ACE_NEW_RETURN (proxy, ACE_TS_RLock (token_request_.token_name (), this), 0); else ACE_NEW_RETURN (proxy, ACE_TS_WLock (token_request_.token_name (), this), 0); break; case ACE_Tokens::MUTEX: ACE_NEW_RETURN (proxy, ACE_TS_Mutex (token_request_.token_name (), this), 0); break; default: // Nonexistent token type. errno = EINVAL; return 0; } // Check for failed new. if (proxy == 0) errno = ENOMEM; return proxy; } int ACE_Token_Handler::dispatch () { ACE_TRACE ("ACE_Token_Handler::dispatch"); ACE_Token_Proxy *proxy = this->get_proxy (); if (proxy == 0) return -1; // Dispatch the appropriate request. switch (this->token_request_.operation_type ()) { case ACE_Token_Request::ACQUIRE: return this->acquire (proxy); case ACE_Token_Request::TRY_ACQUIRE: return this->try_acquire (proxy); case ACE_Token_Request::RELEASE: return this->release (proxy); case ACE_Token_Request::RENEW: return this->renew (proxy); case ACE_Token_Request::REMOVE: return this->remove (proxy); default: ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("invalid type = %d\n"), this->token_request_.operation_type ()), -1); /* NOTREACHED */ } } // Receive, frame, and decode the client's request. // Note, this method should use non-blocking I/O. /* VIRTUAL */ int ACE_Token_Handler::recv_request () { ACE_TRACE ("ACE_Token_Handler::recv_request"); ssize_t n; // Read the first 4 bytes to get the length of the message // This implementation assumes that the first 4 bytes are // the length of the message. n = this->peer ().recv ((void *) &this->token_request_, sizeof (ACE_UINT32)); switch (n) { case -1: ACE_FALLTHROUGH; default: ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p got %d bytes, expected %d bytes\n"), ACE_TEXT ("recv failed"), n, sizeof (ACE_UINT32))); ACE_FALLTHROUGH; case 0: // We've shutdown unexpectedly, let's abandon the connection. this->abandon (0); return -1; /* NOTREACHED */ case sizeof (ACE_UINT32): { // Transform the length into host byte order. ssize_t length = this->token_request_.length (); // Do a sanity check on the length of the message. if (length > (ssize_t) sizeof this->token_request_) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("length %d too long\n"), length)); return this->abandon (1); } // Receive the rest of the request message. // @@ beware of blocking read!!!. n = this->peer ().recv ((void *) (((char *) &this->token_request_) + sizeof (ACE_UINT32)), length - sizeof (ACE_UINT32)); // Subtract off the size of the part we skipped over... if (n != (length - (ssize_t) sizeof (ACE_UINT32))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p expected %d, got %d\n"), ACE_TEXT ("invalid length"), length, n)); return this->abandon (1); } // Decode the request into host byte order. if (this->token_request_.decode () == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("decode failed"))); return this->abandon (1); } // if (OS::debug) this->token_request_.dump (); } } return 0; } // Callback method invoked by the ACE_Reactor when // events arrive from the client. /* VIRTUAL */ int ACE_Token_Handler::handle_input (ACE_HANDLE) { ACE_TRACE ("ACE_Token_Handler::handle_input"); #if 0 ACE_DEBUG ((LM_DEBUG, "****************** in handle_input\n")); #endif /* 0 */ if (this->recv_request () == -1) return -1; else return this->dispatch (); } void ACE_Token_Handler::sleep_hook () { ACE_TRACE ("ACE_Token_Handler::sleep_hook"); // @@ what should we do? return; } void ACE_Token_Handler::token_acquired (ACE_TPQ_Entry *) { ACE_TRACE ("ACE_Token_Handler::token_acquired"); if (this->timeout_id_ != 0) { this->reactor ()->cancel_timer (this->timeout_id_); this->timeout_id_ = 0; } this->send_reply (0); } int ACE_Token_Handler::abandon (int send_error) { ACE_TRACE ("ACE_Token_Handler::abandon"); // Release ownership or remove us from the waiter list. if (this->timeout_id_ != 0) { this->reactor ()->cancel_timer (timeout_id_); this->timeout_id_ = 0; } // @@ release all tokens collection_.release (); if (send_error) return this->send_reply (EIO); else return -1; } // ************************************************************ // ************************************************************ // ************************************************************ ACE_TS_Mutex::ACE_TS_Mutex (const ACE_TCHAR *name, ACE_Token_Handler *th) : ACE_Local_Mutex (name, 0, 1), // The 1 is debug. th_ (th) { ACE_TRACE ("ACE_TS_Mutex::ACE_TS_Mutex"); } ACE_TS_Mutex::ACE_TS_Mutex (const ACE_TS_Mutex &m) : ACE_Local_Mutex (m), th_ (m.th_) { ACE_TRACE ("ACE_TS_Mutex::ACE_TS_Mutex"); this->open (m.name (), m.ignore_deadlock_, m.debug_); } void ACE_TS_Mutex::sleep_hook () { ACE_TRACE ("ACE_TS_Mutex::sleep_hook"); th_->sleep_hook (); return; } void ACE_TS_Mutex::token_acquired (ACE_TPQ_Entry *e) { ACE_TRACE ("ACE_TS_Mutex::token_acquired"); // Notify the token handler. th_->token_acquired (e); return; } ACE_Token_Proxy * ACE_TS_Mutex::clone () const { ACE_TRACE ("ACE_TS_Mutex::clone"); ACE_Token_Proxy *temp; ACE_NEW_RETURN (temp, ACE_TS_Mutex (*this), 0); return temp; } // ************************************************************ ACE_TS_RLock::ACE_TS_RLock (const ACE_TCHAR *name, ACE_Token_Handler *th) : ACE_Local_RLock (name, 0, 1), // The 1 is debug. th_ (th) { ACE_TRACE ("ACE_TS_RLock::ACE_TS_RLock"); } ACE_TS_RLock::ACE_TS_RLock (const ACE_TS_RLock &r) : ACE_Local_RLock (r), th_ (r.th_) { ACE_TRACE ("ACE_TS_RLock::ACE_TS_RLock"); this->open (r.name (), r.ignore_deadlock_, r.debug_); } void ACE_TS_RLock::sleep_hook () { ACE_TRACE ("ACE_TS_RLock::sleep_hook"); th_->sleep_hook (); return; } void ACE_TS_RLock::token_acquired (ACE_TPQ_Entry *e) { ACE_TRACE ("ACE_TS_RLock::token_acquired"); // Notify the token handler. th_->token_acquired (e); return; } ACE_Token_Proxy * ACE_TS_RLock::clone () const { ACE_TRACE ("ACE_TS_RLock::clone"); ACE_Token_Proxy *temp; ACE_NEW_RETURN (temp, ACE_TS_RLock (*this), 0); return temp; } // ************************************************************ ACE_TS_WLock::ACE_TS_WLock (const ACE_TCHAR *name, ACE_Token_Handler *th) : ACE_Local_WLock (name, 0, 1), // The 1 is debug. th_ (th) { ACE_TRACE ("ACE_TS_WLock::ACE_TS_WLock"); } ACE_TS_WLock::ACE_TS_WLock (const ACE_TS_WLock &w) : ACE_Local_WLock (w), th_ (w.th_) { ACE_TRACE ("ACE_TS_WLock::ACE_TS_WLock"); this->open (w.name (), w.ignore_deadlock_, w.debug_); } void ACE_TS_WLock::sleep_hook () { ACE_TRACE ("ACE_TS_WLock::sleep_hook"); th_->sleep_hook (); return; } void ACE_TS_WLock::token_acquired (ACE_TPQ_Entry *e) { ACE_TRACE ("ACE_TS_WLock::token_acquired"); // Notify the token handler. th_->token_acquired (e); return; } ACE_Token_Proxy * ACE_TS_WLock::clone () const { ACE_TRACE ("ACE_TS_WLock::clone"); ACE_Token_Proxy *temp; ACE_NEW_RETURN (temp, ACE_TS_WLock (*this), 0); return temp; } #endif /* ACE_HAS_TOKENS_LIBRARY */ ace-8.0.4+dfsg.orig/netsvcs/lib/Token_Handler.h0000644000175000017500000001743715027201773020324 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Token_Handler.h * * @author Douglas C. Schmidt (d.schmidt@vanderbilt.edu) * Tim Harrison (harrison@cs.wustl.edu) */ //============================================================================= #ifndef ACE_TOKEN_HANDLER_H #define ACE_TOKEN_HANDLER_H #include "ace/Acceptor.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/SOCK_Acceptor.h" #include "ace/Local_Tokens.h" #include "ace/Token_Collection.h" #include "ace/Token_Request_Reply.h" #include "ace/svc_export.h" #if defined (ACE_HAS_TOKENS_LIBRARY) /** * @class ACE_Token_Handler * * @brief Product object created by an . A * exchanges messages with a object * on the client-side. * * This class is the main workhorse of the ACE Token service. It * receives token operation requests from remote clients and turns * them into calls on local tokens (acquire, release, renew, and * remove). In OMG CORBA terms, it is an object adapter. It also * schedules and handles timeouts that are used to support "timed * waits." Clients used timed waits to bound the amount of time * they block trying to get a token. */ class ACE_Svc_Export ACE_Token_Handler : public ACE_Svc_Handler { public: /// Default constructor. ACE_Token_Handler (ACE_Thread_Manager * = 0); // = Accessor and mutator methods. // = Remote operations "exported" to a client. /** * Try to acquire the token. * Precondition: client *may* hold the token already (i.e., * supports recursive acquisitions). */ virtual int acquire (ACE_Token_Proxy *proxy); /// Try to acquire the token. virtual int try_acquire (ACE_Token_Proxy *proxy); /// Release the token and allow the next client that is waiting to /// proceed. Preconditions: client must hold the token. virtual int release (ACE_Token_Proxy *proxy); /// Yield the token if any clients are waiting, otherwise keep the /// token. Preconditions: client must hold the token. virtual int renew (ACE_Token_Proxy *proxy); /** * Remove the specified token from the Token_Map. Preconditions: * ACE_Token must exist. @@ Any other preconditions, e.g., must * client hold token, must there be no waiters, etc.? */ virtual int remove (ACE_Token_Proxy *proxy); /// Called by TS_[Mutex,RLock,WLock] when we hold the mutex and /// someone wants it. void sleep_hook (); /// Called by TS_[Mutex,RLock,WLock] when we are waiting and acquire /// the mutex. void token_acquired (ACE_TPQ_Entry *); protected: // = Low level routines for framing requests, dispatching // operations, and returning replies. /// Our connection has been closed. virtual int abandon (int send_error); /// Receive, frame, and decode the client's request. virtual int recv_request (); /// Dispatch the appropriate operation to handle the client's /// request. virtual int dispatch (); /// Create and send a reply to the client. virtual int send_reply (ACE_UINT32 errnum); // = Demultiplexing hooks. /// Callback method invoked by the when client events /// arrive. virtual int handle_input (ACE_HANDLE); // = Timer hook. /// Enable clients to limit the amount of time they wait for a token. virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg); /// return a proxy for the calling client_id and token name. ACE_Token_Proxy *get_proxy (); private: /// Switches on the type of token_request_ and creates a new /// Token_Proxy. virtual ACE_Token_Proxy *create_proxy (); /// Keeps track of the synchronization options (i.e., the timeout /// interval). ACE_Synch_Options request_options_; /// collection of the client's token proxies. ACE_Token_Collection collection_; /// ID returned by the Reactor that is used to kill registered timers /// when a token operation times out. long timeout_id_; /// Cache request from the client. ACE_Token_Request token_request_; /// Cache reply to the client. ACE_Token_Reply token_reply_; }; // = DESCRIPTION of ACE_TS_* classes: // When Tokens are released, waiting token proxies are notified // when the releasing thread calls token_acquired on the waiting // proxy. The Token Server specializes ACE_Token_Proxy to // redefine the implementation of token_acquired. When // token_acquired is called, the Token_Handler can then send the // response back over the socket connection to unblock the // client side. // Since only the Token_Handler uses ACE_TS_Mutex, we've moved // the definition to the .cpp file. /** * @class ACE_TS_Mutex * * @brief ACE_TS_Mutex -- ACE_*T*oken_*S*erver_Mutex */ class ACE_TS_Mutex : public ACE_Local_Mutex { public: /// Creation. ACE_TS_Mutex (const ACE_TCHAR *name, ACE_Token_Handler *th); protected: /// Somebody wants our token! virtual void sleep_hook (); /** * We've been taken off the waiters list and given the token! Call * the Token_Handler associated at construction, so it can tell the * remote client. */ virtual void token_acquired (ACE_TPQ_Entry *); /// Duplication. ACE_TS_Mutex (const ACE_TS_Mutex &); /// Return a deep copy. virtual ACE_Token_Proxy *clone () const; private: /// The Token Handler associated with this proxy. Set at /// construction and notified when blocking acquires succeed. ACE_Token_Handler* th_; }; /** * @class ACE_TS_RLock * * @brief ACE_TS_RLock -- ACE_*T*oken_*S*erver_RLock */ class ACE_TS_RLock : public ACE_Local_RLock { public: /// Creation. ACE_TS_RLock (const ACE_TCHAR *name, ACE_Token_Handler *th); protected: /// Somebody wants our token! virtual void sleep_hook (); /** * We've been taken off the waiters list and given the token! Call * the Token_Handler associated at construction, so it can tell the * remote client. */ virtual void token_acquired (ACE_TPQ_Entry *); /// Duplication. ACE_TS_RLock (const ACE_TS_RLock&); /// Return a deep copy. virtual ACE_Token_Proxy *clone () const; private: /// the Token Handler associated with this proxy. Set at /// construction and notified when blocking acquires succeed. ACE_Token_Handler* th_; }; /** * @class ACE_TS_WLock * * @brief ACE_TS_WLock -- ACE_*T*oken_*S*erver_WLock */ class ACE_TS_WLock : public ACE_Local_WLock { public: /// Creation. ACE_TS_WLock (const ACE_TCHAR *name, ACE_Token_Handler *th); protected: /// Somebody wants our token! virtual void sleep_hook (); /** * We've been taken off the waiters list and given the token! Call * the Token_Handler associated at construction, so it can tell the * remote client. */ virtual void token_acquired (ACE_TPQ_Entry *); /// Duplication. ACE_TS_WLock (const ACE_TS_WLock&); /// Return a deep copy. virtual ACE_Token_Proxy *clone () const; private: /// the Token Handler associated with this proxy. Set at /// construction and notified when blocking acquires succeed. ACE_Token_Handler* th_; }; /** * @class ACE_Token_Acceptor * * @brief This class contains the service-specific methods that can't * easily be factored into the . */ class ACE_Token_Acceptor : public ACE_Strategy_Acceptor { public: /// Dynamic linking hook. virtual int init (int argc, ACE_TCHAR *argv[]); /// Parse svc.conf arguments. int parse_args (int argc, ACE_TCHAR *argv[]); private: /// The scheduling strategy is designed for Reactive services. ACE_Schedule_All_Reactive_Strategy scheduling_strategy_; }; ACE_SVC_FACTORY_DECLARE (ACE_Token_Acceptor) #endif /* ACE_HAS_TOKENS_LIBRARY */ #endif /* ACE_TOKEN_HANDLER_H */ ace-8.0.4+dfsg.orig/netsvcs/lib/Time_Request_Reply.cpp0000644000175000017500000001244215027201773021712 0ustar sudipsudip#include "ace/Basic_Types.h" #include "ace/CDR_Base.h" #include "ace/Log_Msg.h" #include "ace/Truncate.h" #include "ace/os_include/netinet/os_in.h" #include "ace/os_include/arpa/os_inet.h" #include "Time_Request_Reply.h" // Default "do nothing" constructor. ACE_Time_Request::ACE_Time_Request () { ACE_TRACE ("ACE_Time_Request::ACE_Time_Request"); } // Create a ACE_Time_Request message. ACE_Time_Request::ACE_Time_Request (ACE_INT32 t, // Type of request. const time_t time, ACE_Time_Value *timeout) // Max time waiting for request. { ACE_TRACE ("ACE_Time_Request::ACE_Time_Request"); this->msg_type (t); // If timeout is a NULL pointer, then block forever... if (timeout == 0) { this->transfer_.block_forever_ = 1; this->transfer_.sec_timeout_ = 0; this->transfer_.usec_timeout_ = 0; } else // Do a "timed wait." { 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 (); } // Copy time into request this->transfer_.time_ = this->time_ = time; } // Get the fixed size of message ssize_t ACE_Time_Request::size () const { ACE_TRACE ("ACE_Time_Request::size"); return sizeof (this->transfer_); } // = Set/get the type of the message. ACE_INT32 ACE_Time_Request::msg_type () const { ACE_TRACE ("ACE_Time_Request::msg_type"); return this->transfer_.msg_type_; } void ACE_Time_Request::msg_type (ACE_INT32 t) { ACE_TRACE ("ACE_Time_Request::msg_type"); this->transfer_.msg_type_ = t; } // = Set/get the blocking semantics. ACE_UINT32 ACE_Time_Request::block_forever () const { ACE_TRACE ("ACE_Time_Request::block_forever"); return this->transfer_.block_forever_; } void ACE_Time_Request::block_forever (ACE_UINT32 bs) { ACE_TRACE ("ACE_Time_Request::block_forever"); this->transfer_.block_forever_ = bs; } // = Set/get the timeout. ACE_Time_Value ACE_Time_Request::timeout () const { ACE_TRACE ("ACE_Time_Request::timeout"); time_t sec = ACE_Utils::truncate_cast (this->transfer_.sec_timeout_); return ACE_Time_Value (sec, this->transfer_.usec_timeout_); } void ACE_Time_Request::timeout (const ACE_Time_Value& timeout) { ACE_TRACE ("ACE_Time_Request::timeout"); this->transfer_.sec_timeout_ = timeout.sec (); this->transfer_.usec_timeout_ = timeout.usec (); } // = Set/get the time time_t ACE_Time_Request::time () const { ACE_TRACE ("ACE_Time_Request::time"); return this->time_; } void ACE_Time_Request::time (time_t t) { ACE_TRACE ("ACE_Time_Request::time"); this->time_ = t; } // Encode the transfer buffer into network byte order // so that it can be sent to the server. int ACE_Time_Request::encode (void *&buf) { ACE_TRACE ("ACE_Time_Request::encode"); // Compute the length *before* doing the marshaling. buf = (void *) &this->transfer_; this->transfer_.block_forever_ = ACE_HTONL (this->transfer_.block_forever_); this->transfer_.usec_timeout_ = ACE_HTONL (this->transfer_.usec_timeout_); this->transfer_.msg_type_ = ACE_HTONL (this->transfer_.msg_type_); #if defined (ACE_LITTLE_ENDIAN) ACE_UINT64 secs = this->transfer_.sec_timeout_; ACE_CDR::swap_8 ((const char *)&secs, (char *)&this->transfer_.sec_timeout_); secs = this->transfer_.time_; ACE_CDR::swap_8 ((const char *)&secs, (char *)&this->transfer_.time_); #endif return this->size (); // Always fixed } // Decode the transfer buffer into host byte byte order // so that it can be used by the server. int ACE_Time_Request::decode () { ACE_TRACE ("ACE_Time_Request::decode"); // Decode this->transfer_.block_forever_ = ACE_NTOHL (this->transfer_.block_forever_); this->transfer_.usec_timeout_ = ACE_NTOHL (this->transfer_.usec_timeout_); this->transfer_.msg_type_ = ACE_NTOHL (this->transfer_.msg_type_); #if defined (ACE_LITTLE_ENDIAN) ACE_UINT64 secs = this->transfer_.sec_timeout_; ACE_CDR::swap_8 ((const char *)&secs, (char *)&this->transfer_.sec_timeout_); secs = this->transfer_.time_; ACE_CDR::swap_8 ((const char *)&secs, (char *)&this->transfer_.time_); #endif this->time_ = ACE_Utils::truncate_cast (this->transfer_.time_); return 0; } // Print out the current values of the ACE_Time_Request. void ACE_Time_Request::dump () const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_Time_Request::dump"); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("*******\nlength = %d\n"), this->size ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("message-type = "))); switch (this->msg_type ()) { case ACE_Time_Request::TIME_UPDATE: ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TIME_UPDATE\n"))); break; default: ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" = %d\n"), this->msg_type ())); break; } if (this->block_forever ()) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("blocking forever\n"))); else { #if !defined (ACE_NLOGGING) ACE_Time_Value tv = this->timeout (); #endif /* ! ACE_NLOGGING */ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("waiting for %d secs and %d usecs\n"), (int)(tv.sec ()), tv.usec ())); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("*******\ntime = %d\n"), (int)(this->time ()))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("+++++++\n"))); #endif /* ACE_HAS_DUMP */ } ace-8.0.4+dfsg.orig/netsvcs/lib/Name_Handler.cpp0000644000175000017500000004767315027201773020464 0ustar sudipsudip#include "ace/Containers.h" #include "ace/Get_Opt.h" #include "ace/Singleton.h" #include #include "Name_Handler.h" #include "ace/Signal.h" #include "ace/OS_NS_string.h" // Simple macro that does bitwise AND -- useful in table lookup #define ACE_TABLE_MAP(INDEX, MASK) (INDEX & MASK) // Simple macro that does bitwise AND and then right shift bits by 3 #define ACE_LIST_MAP(INDEX, MASK) (((unsigned long) (INDEX & MASK)) >> 3) int ACE_Name_Acceptor::parse_args (int argc, ACE_TCHAR *argv[]) { ACE_TRACE ("ACE_Name_Acceptor::parse_args"); int service_port = ACE_DEFAULT_SERVER_PORT; ACE_LOG_MSG->open (ACE_TEXT ("Name Service")); this->naming_context()->name_options()->parse_args( argc, argv ); service_port = this->naming_context()->name_options()->nameserver_port(); // dont allow to connect to another name serever if(this->naming_context()->name_options()->context() == ACE_Naming_Context::NET_LOCAL) this->naming_context()->name_options()->nameserver_host(ACE_TEXT ("localhost")); if (this->naming_context()->open( this->naming_context()->name_options()->context() ) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%n:\n open naming context failed.\n")), -1); this->service_addr_.set (service_port); return 0; } int ACE_Name_Acceptor::init (int argc, ACE_TCHAR *argv[]) { ACE_TRACE ("ACE_Name_Acceptor::init"); // Use the options hook to parse the command line arguments and set // options. if( this->parse_args (argc, argv) == -1 ) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_Name_Acceptor::parse_args failed")), -1); // Set the acceptor endpoint into listen mode (use the Singleton // global Reactor...). if (this->open (this->service_addr_, ACE_Reactor::instance (), 0, 0, 0, &this->scheduling_strategy_, ACE_TEXT ("Name Server"), ACE_TEXT ("ACE naming service")) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%n: %p on port %d\n"), ACE_TEXT ("acceptor::open failed"), this->service_addr_.get_port_number ()), -1); // Ignore SIGPIPE so that each can handle this on its // own. ACE_Sig_Action sig ((ACE_SignalHandler) SIG_IGN, SIGPIPE); ACE_UNUSED_ARG (sig); ACE_INET_Addr server_addr; // Figure out what port we're really bound to. if (this->acceptor ().get_local_addr (server_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("get_local_addr")), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("starting up Name Server at port %d on handle %d\n"), server_addr.get_port_number (), this->acceptor ().get_handle ())); return 0; } // The following is a "Factory" used by the ACE_Service_Config and // svc.conf file to dynamically initialize the state of the Naming // Server. ACE_SVC_FACTORY_DEFINE (ACE_Name_Acceptor) // Default constructor. ACE_Name_Handler::ACE_Name_Handler (ACE_Thread_Manager *tm) : ACE_Svc_Handler (tm) { ACE_TRACE ("ACE_Name_Handler::ACE_Name_Handler"); // Set up pointers to member functions for the top-level dispatching // of client requests. this->op_table_[ACE_Name_Request::BIND] = &ACE_Name_Handler::bind; this->op_table_[ACE_Name_Request::REBIND] = &ACE_Name_Handler::rebind; this->op_table_[ACE_Name_Request::RESOLVE] = &ACE_Name_Handler::resolve; this->op_table_[ACE_Name_Request::UNBIND] = &ACE_Name_Handler::unbind; this->op_table_[ACE_Name_Request::LIST_NAMES] = &ACE_Name_Handler::lists; this->op_table_[ACE_Name_Request::LIST_NAME_ENTRIES] = &ACE_Name_Handler::lists_entries; // Assign references to simplify subsequent code. LIST_ENTRY &list_names_ref = this->list_table_[ACE_LIST_MAP (ACE_Name_Request::LIST_NAMES, ACE_Name_Request::LIST_OP_MASK)]; LIST_ENTRY &list_values_ref = this->list_table_[ACE_LIST_MAP (ACE_Name_Request::LIST_VALUES, ACE_Name_Request::LIST_OP_MASK)]; LIST_ENTRY &list_types_ref = this->list_table_[ACE_LIST_MAP (ACE_Name_Request::LIST_TYPES, ACE_Name_Request::LIST_OP_MASK)]; // Set up pointers to member functions for dispatching within the // LIST_{NAMES,VALUES,TYPES} methods. list_names_ref.operation_ = &ACE_Naming_Context::list_names; list_names_ref.request_factory_ = &ACE_Name_Handler::name_request; list_names_ref.description_ = "request for LIST_NAMES\n"; list_values_ref.operation_ = &ACE_Naming_Context::list_values; list_values_ref.request_factory_ = &ACE_Name_Handler::value_request; list_values_ref.description_ = "request for LIST_VALUES\n"; list_types_ref.operation_ = &ACE_Naming_Context::list_types; list_types_ref.request_factory_ = &ACE_Name_Handler::type_request; list_types_ref.description_ = "request for LIST_TYPES\n"; } // Activate this instance of the ACE_Name_Handler (called by the // ACE_Name_Acceptor). /* VIRTUAL */ int ACE_Name_Handler::open (void * v) { ACE_TRACE ("ACE_Name_Handler::open"); // Call down to our parent to register ourselves with the Reactor. if (ACE_Svc_Handler::open (0) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), -1); ACE_Name_Acceptor* acceptor_ = static_cast(v); naming_context_ = acceptor_->naming_context(); return 0; } // Create and send a reply to the client. /* VIRTUAL */ int ACE_Name_Handler::send_reply (ACE_INT32 status, ACE_UINT32 err) { ACE_TRACE ("ACE_Name_Handler::send_reply"); void *buf; this->name_reply_.msg_type (status); this->name_reply_.errnum (err); this->name_reply_.init (); int len = this->name_reply_.encode (buf); if (len == -1) return -1; ssize_t n = this->peer ().send (buf, len); if (n != len) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n, expected len = %d, actual len = %d"), ACE_TEXT ("send failed"), len, n), -1); else return 0; } /* VIRTUAL */ int ACE_Name_Handler::send_request (ACE_Name_Request &request) { ACE_TRACE ("ACE_Name_Handler::send_request"); void *buffer; ssize_t length = request.encode (buffer); if (length == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("encode failed")), -1); // Transmit request via a blocking send. if (this->peer ().send_n (buffer, length) != length) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("send_n failed")), -1); return 0; } // Give up waiting (e.g., when a timeout occurs or a client shuts down // unexpectedly). /* VIRTUAL */ int ACE_Name_Handler::abandon () { ACE_TRACE ("ACE_Name_Handler::abandon"); return this->send_reply (-1, errno); } // Enable clients to limit the amount of time they'll wait /* VIRTUAL */ int ACE_Name_Handler::handle_timeout (const ACE_Time_Value &, const void *) { ACE_TRACE ("ACE_Name_Handler::handle_timeout"); return this->abandon (); } // Return the underlying ACE_HANDLE. /* VIRTUAL */ ACE_HANDLE ACE_Name_Handler::get_handle () const { ACE_TRACE ("ACE_Name_Handler::get_handle"); return this->peer ().get_handle (); } // Dispatch the appropriate operation to handle the client request. /* VIRTUAL */ int ACE_Name_Handler::dispatch () { ACE_TRACE ("ACE_Name_Handler::dispatch"); // Dispatch the appropriate request. int index = this->name_request_.msg_type (); // Invoke the appropriate member function obtained by indexing into // the op_table_. ACE_TABLE_MAP returns the same index (by bitwise // AND) for list_names, list_values, and list_types since they are // all handled by the same method. Similarly, it returns the same // index for list_name_entries, list_value_entries, and // list_type_entries. return (this->*op_table_[ACE_TABLE_MAP (index, ACE_Name_Request::OP_TABLE_MASK)]) (); } // Receive, frame, and decode the client's request. Note, this method // should use non-blocking I/O. /* VIRTUAL */ int ACE_Name_Handler::recv_request () { ACE_TRACE ("ACE_Name_Handler::recv_request"); // Read the first 4 bytes to get the length of the message This // implementation assumes that the first 4 bytes are the length of // the message. ssize_t n = this->peer ().recv ((void *) &this->name_request_, sizeof (ACE_UINT32)); switch (n) { case -1: ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("****************** recv_request returned -1\n"))); ACE_FALLTHROUGH; default: ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p got %d bytes, expected %d bytes\n"), ACE_TEXT ("recv failed"), n, sizeof (ACE_UINT32))); ACE_FALLTHROUGH; case 0: // We've shutdown unexpectedly, let's abandon the connection. this->abandon (); return -1; /* NOTREACHED */ case sizeof (ACE_UINT32): { // Transform the length into host byte order. ssize_t length = ACE_NTOHL (this->name_request_.length ()); // Do a sanity check on the length of the message. if (length > (ssize_t) sizeof this->name_request_) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("length %d too long\n"), length)); return this->abandon (); } // Receive the rest of the request message. // @@ beware of blocking read!!!. n = this->peer ().recv ((void *) (((char *) &this->name_request_) + sizeof (ACE_UINT32)), length - sizeof (ACE_UINT32)); // Subtract off the size of the part we skipped over... if (n != (length - (ssize_t) sizeof (ACE_UINT32))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p expected %d, got %d\n"), ACE_TEXT ("invalid length"), length, n)); return this->abandon (); } // Decode the request into host byte order. if (this->name_request_.decode () == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("decode failed"))); return this->abandon (); } } } return 0; } // Callback method invoked by the ACE_Reactor when events arrive from // the client. /* VIRTUAL */ int ACE_Name_Handler::handle_input (ACE_HANDLE) { ACE_TRACE ("ACE_Name_Handler::handle_input"); if (this->recv_request () == -1) return -1; else return this->dispatch (); } int ACE_Name_Handler::bind () { ACE_TRACE ("ACE_Name_Handler::bind"); return this->shared_bind (0); } int ACE_Name_Handler::rebind () { ACE_TRACE ("ACE_Name_Handler::rebind"); int result = this->shared_bind (1); return result == 1 ? 0 : result; } int ACE_Name_Handler::shared_bind (int rebind) { ACE_TRACE ("ACE_Name_Handler::shared_bind"); ACE_NS_WString a_name (this->name_request_.name (), this->name_request_.name_len () / sizeof (ACE_WCHAR_T)); ACE_NS_WString a_value (this->name_request_.value (), this->name_request_.value_len () / sizeof (ACE_WCHAR_T)); int result; if (rebind == 0) { #if 0 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("request for BIND\n"))); #endif /* 0 */ result = this->naming_context ()->bind (a_name, a_value, this->name_request_.type ()); } else { #if 0 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("request for REBIND\n"))); #endif /* 0 */ result = this->naming_context ()->rebind (a_name, a_value, this->name_request_.type ()); if (result == 1) result = 0; } if (result == 0) return this->send_reply (0); else return this->send_reply (-1); } int ACE_Name_Handler::resolve () { ACE_TRACE ("ACE_Name_Handler::resolve"); #if 0 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("request for RESOLVE\n"))); #endif /* 0 */ ACE_NS_WString a_name (this->name_request_.name (), this->name_request_.name_len () / sizeof (ACE_WCHAR_T)); // The following will deliver our reply back to client we // pre-suppose success (indicated by type RESOLVE). ACE_NS_WString avalue; char *atype; if (this->naming_context ()->resolve (a_name, avalue, atype) == 0) { std::unique_ptr avalue_urep (avalue.rep ()); ACE_Name_Request nrq (ACE_Name_Request::RESOLVE, 0, 0, avalue_urep.get (), avalue.length () * sizeof (ACE_WCHAR_T), atype, ACE_OS::strlen (atype)); delete[] atype; return this->send_request (nrq); } ACE_Name_Request nrq (ACE_Name_Request::BIND, 0, 0, 0, 0, 0, 0); this->send_request (nrq); return 0; } int ACE_Name_Handler::unbind () { ACE_TRACE ("ACE_Name_Handler::unbind"); #if 0 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("request for UNBIND\n"))); #endif /* 0 */ ACE_NS_WString a_name (this->name_request_.name (), this->name_request_.name_len () / sizeof (ACE_WCHAR_T)); if (this->naming_context ()->unbind (a_name) == 0) return this->send_reply (0); else return this->send_reply (-1); } ACE_Name_Request ACE_Name_Handler::name_request (ACE_NS_WString *one_name) { ACE_TRACE ("ACE_Name_Handler::name_request"); std::unique_ptr one_name_urep (one_name->rep ()); return ACE_Name_Request (ACE_Name_Request::LIST_NAMES, one_name_urep.get (), one_name->length () * sizeof (ACE_WCHAR_T), 0, 0, 0, 0); } ACE_Name_Request ACE_Name_Handler::value_request (ACE_NS_WString *one_value) { ACE_TRACE ("ACE_Name_Handler::value_request"); std::unique_ptr one_value_urep (one_value->rep ()); return ACE_Name_Request (ACE_Name_Request::LIST_VALUES, 0, 0, one_value_urep.get (), one_value->length () * sizeof (ACE_WCHAR_T), 0, 0); } ACE_Name_Request ACE_Name_Handler::type_request (ACE_NS_WString *one_type) { ACE_TRACE ("ACE_Name_Handler::type_request"); return ACE_Name_Request (ACE_Name_Request::LIST_TYPES, 0, 0, 0, 0, std::unique_ptr (one_type->char_rep ()).get (), one_type->length ()); } int ACE_Name_Handler::lists () { ACE_TRACE ("ACE_Name_Handler::lists"); ACE_PWSTRING_SET set; ACE_NS_WString pattern (this->name_request_.name (), this->name_request_.name_len () / sizeof (ACE_WCHAR_T)); // Get the index into the list table int index = ACE_LIST_MAP (this->name_request_.msg_type (), ACE_Name_Request::LIST_OP_MASK); // Print the message type ACE_DEBUG ((LM_DEBUG, list_table_[index].description_)); // Call the appropriate method if ((this->naming_context ()->*list_table_[index].operation_) (set, pattern) != 0) { // None found so send blank request back ACE_Name_Request end_rq (ACE_Name_Request::MAX_ENUM, 0, 0, 0, 0, 0, 0); if (this->send_request (end_rq) == -1) return -1; } else { ACE_NS_WString *one_entry = 0; for (ACE_Unbounded_Set_Iterator set_iterator (set); set_iterator.next (one_entry) !=0; set_iterator.advance()) { ACE_Name_Request nrq ((this->*list_table_[index].request_factory_) (one_entry)); // Create a request by calling the appropriate method obtained // by accessing into the table. Then send the request across. if (this->send_request (nrq) == -1) return -1; } // Send last message indicator. ACE_Name_Request nrq (ACE_Name_Request::MAX_ENUM, 0, 0, 0, 0, 0, 0); return this->send_request (nrq); } return 0; } int ACE_Name_Handler::lists_entries () { ACE_TRACE ("ACE_Name_Handler::lists_entries"); ACE_BINDING_SET set; ACE_NS_WString pattern (this->name_request_.name (), this->name_request_.name_len () / sizeof (ACE_WCHAR_T)); int result = -1; const ACE_Name_Request::Constants msg_type = static_cast (this->name_request_.msg_type ()); // NOTE: This multi-branch conditional statement used to be // (and should be) a switch statement. However, it caused // Internal compiler error 980331 with egcs 1.1 (2.91.57). // So, the pointer-to-member-function temporary has been removed. if (msg_type == ACE_Name_Request::LIST_NAME_ENTRIES) { #if 0 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("request for LIST_NAME_ENTRIES\n"))); #endif /* 0 */ result = this->naming_context ()-> ACE_Naming_Context::list_name_entries (set, pattern); } else if (msg_type == ACE_Name_Request::LIST_VALUE_ENTRIES) { #if 0 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("request for LIST_VALUE_ENTRIES\n"))); #endif /* 0 */ result = this->naming_context ()-> ACE_Naming_Context::list_value_entries (set, pattern); } else if (msg_type == ACE_Name_Request::LIST_TYPE_ENTRIES) { #if 0 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("request for LIST_TYPE_ENTRIES\n"))); #endif /* 0 */ result = this->naming_context ()-> ACE_Naming_Context::list_type_entries (set, pattern); } else return -1; if (result == 0) { ACE_Name_Binding *one_entry = 0; for (ACE_Unbounded_Set_Iterator set_iterator (set); set_iterator.next (one_entry) !=0; set_iterator.advance()) { std::unique_ptr name_urep (one_entry->name_.rep ()); std::unique_ptr value_urep (one_entry->value_.rep ()); ACE_Name_Request mynrq (this->name_request_.msg_type (), name_urep.get (), one_entry->name_.length () * sizeof (ACE_WCHAR_T), value_urep.get (), one_entry->value_.length () * sizeof (ACE_WCHAR_T), one_entry->type_, ACE_OS::strlen (one_entry->type_)); if (this->send_request (mynrq) == -1) return -1; } // send last message indicator ACE_Name_Request nrq (ACE_Name_Request::MAX_ENUM, 0, 0, 0, 0, 0, 0); if (this->send_request (nrq) == -1) return -1; } else { // None found so send blank request back. ACE_Name_Request end_rq (ACE_Name_Request::MAX_ENUM, 0, 0, 0, 0, 0, 0); if (this->send_request (end_rq) == -1) return -1; } return 0; } ACE_Naming_Context * ACE_Name_Handler::naming_context () { return naming_context_; } ACE_Naming_Context * ACE_Name_Acceptor::naming_context () { return &naming_context_; } ACE_Name_Handler::~ACE_Name_Handler () { ACE_TRACE ("ACE_Name_Handler::~ACE_Name_Handler"); #if 0 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("closing down Handle %d\n"), this->get_handle ())); #endif /* 0 */ } ace-8.0.4+dfsg.orig/netsvcs/lib/Server_Logging_Handler.cpp0000644000175000017500000000146415027201773022504 0ustar sudipsudip#if !defined (ACE_SERVER_LOGGING_HANDLER_C) #define ACE_SERVER_LOGGING_HANDLER_C #include "Server_Logging_Handler.h" // The following are "Factories" used by the ACE_Service_Config and // svc.conf file to dynamically initialize the state of the // single-threaded and multi-threaded logging server. ACE_SVC_FACTORY_DEFINE (ACE_Server_Logging_Acceptor) ACE_SVC_FACTORY_DEFINE (ACE_Thr_Server_Logging_Acceptor) #if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) template u_long ACE_Server_Logging_Handler_T::request_count_; #endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */ #endif /* ACE_SERVER_LOGGING_HANDLER_C */ ace-8.0.4+dfsg.orig/netsvcs/lib/Base_Optimizer.cpp0000644000175000017500000000103015027201773021034 0ustar sudipsudip#if !defined (BASE_OPTIMIZER_CPP) #define BASE_OPTIMIZER_CPP #include "Base_Optimizer.h" template Base_Optimizer::Base_Optimizer () { } template Base_Optimizer::Base_Optimizer (const Base &base, const Member &member) : Base (base), m_ (member) { } template Base_Optimizer::Base_Optimizer (const Base &base) : Base (base) { } #endif /* BASE_OPTIMIZER_CPP */ ace-8.0.4+dfsg.orig/netsvcs/lib/Name_Handler.h0000644000175000017500000001352015027201773020111 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Name_Handler.h * * @author Prashant Jain * @author Gerhard Lenzer * @author and Douglas C. Schmidt */ //============================================================================= #ifndef ACE_NAME_HANDLER_H #define ACE_NAME_HANDLER_H #include "ace/Acceptor.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/SOCK_Acceptor.h" #include "ace/SString.h" #include "ace/Svc_Handler.h" #include "ace/Naming_Context.h" #include "ace/Name_Request_Reply.h" #include "ace/Null_Mutex.h" #include "ace/svc_export.h" #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT template class ACE_Svc_Export ACE_Svc_Handler; #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ /** * @class ACE_Name_Handler * * @brief Product object created by . An * exchanges messages with a * object on the client-side. * * This class is the main workhorse of the . It * handles client requests to bind, rebind, resolve, and unbind * names. It also schedules and handles timeouts that are used to * support "timed waits." Clients used timed waits to bound the * amount of time they block trying to get a name. */ class ACE_Svc_Export ACE_Name_Handler : public ACE_Svc_Handler { public: /// Pointer to a member function of ACE_Name_Handler returning int typedef int (ACE_Name_Handler::*OPERATION) (); /// Pointer to a member function of ACE_Naming_Context returning int typedef int (ACE_Naming_Context::*LIST_OP) (ACE_PWSTRING_SET &, const ACE_NS_WString &); /// Pointer to a member function of ACE_Name_Handler returning ACE_Name_Request typedef ACE_Name_Request (ACE_Name_Handler::*REQUEST) (ACE_NS_WString *); /// Default constructor. ACE_Name_Handler (ACE_Thread_Manager * = 0); /// Activate this instance of the (called by the /// ). virtual int open (void * = 0); protected: // = Helper routines for the operations exported to clients. /// Give up waiting (e.g., when a timeout occurs or a client shuts /// down unexpectedly). virtual int abandon (); // = Low level routines for framing requests, dispatching // operations, and returning replies. /// Receive, frame, and decode the client's request. virtual int recv_request (); /// Dispatch the appropriate operation to handle the client's /// request. virtual int dispatch (); /// Create and send a reply to the client. virtual int send_reply (ACE_INT32 status, ACE_UINT32 errnum = 0); /// Special kind of reply virtual int send_request (ACE_Name_Request &); // = Demultiplexing hooks. /// Return the underlying . virtual ACE_HANDLE get_handle () const; /// Callback method invoked by the when client events /// arrive. virtual int handle_input (ACE_HANDLE); // = Timer hook. /// Enable clients to limit the amount of time they wait for a name. virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg); /// Ensure dynamic allocation... ~ACE_Name_Handler (); private: /// Table of pointers to member functions OPERATION op_table_[ACE_Name_Request::MAX_ENUM]; struct LIST_ENTRY { LIST_OP operation_; // A member function pointer that performs the appropriate // operation (e.g., LIST_NAMES, LIST_VALUES, or LIST_TYPES). REQUEST request_factory_; // A member function pointer that serves as a factory to create a // request that is passed back to the client. const char *description_; // Name of the operation we're dispatching (used for debugging). }; /// This is the table of pointers to functions that we use to /// simplify the handling of list requests. LIST_ENTRY list_table_[ACE_Name_Request::MAX_LIST]; /// Cache request from the client. ACE_Name_Request name_request_; /// Special kind of reply for resolve and listnames. ACE_Name_Request name_request_back_; /// Cache reply to the client. ACE_Name_Reply name_reply_; /// Address of client we are connected with. ACE_INET_Addr addr_; /// Naming Context ACE_Naming_Context *naming_context_; ACE_Naming_Context *naming_context (); /// Handle binds. int bind (); /// Handle rebinds. int rebind (); /// Handle binds and rebinds. int shared_bind (int rebind); /// Handle find requests. int resolve (); /// Handle unbind requests. int unbind (); /// Handle LIST_NAMES, LIST_VALUES, and LIST_TYPES requests. int lists (); /// Handle LIST_NAME_ENTRIES, LIST_VALUE_ENTRIES, and /// LIST_TYPE_ENTRIES requests. int lists_entries (); /// Create a name request. ACE_Name_Request name_request (ACE_NS_WString *one_name); /// Create a value request. ACE_Name_Request value_request (ACE_NS_WString *one_name); /// Create a type request. ACE_Name_Request type_request (ACE_NS_WString *one_name); }; /** * @class ACE_Name_Acceptor * * @brief This class contains the service-specific methods that can't * easily be factored into the . */ class ACE_Name_Acceptor : public ACE_Strategy_Acceptor { public: /// Dynamic linking hook. virtual int init (int argc, ACE_TCHAR *argv[]); /// Parse svc.conf arguments. int parse_args (int argc, ACE_TCHAR *argv[]); /// Naming context for acceptor /for the listening port/ ACE_Naming_Context *naming_context (); private: /// The scheduling strategy is designed for Reactive services. ACE_Schedule_All_Reactive_Strategy scheduling_strategy_; /// The Naming Context ACE_Naming_Context naming_context_; }; ACE_SVC_FACTORY_DECLARE (ACE_Name_Acceptor) #endif /* ACE_NAME_HANDLER_H */ ace-8.0.4+dfsg.orig/netsvcs/lib/TS_Server_Handler.h0000644000175000017500000000577015027201773021115 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file TS_Server_Handler.h * * @author Prashant Jain */ //============================================================================= #ifndef ACE_TS_SERVER_HANDLER_H #define ACE_TS_SERVER_HANDLER_H #include "ace/Acceptor.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/SOCK_Acceptor.h" #include "ace/Svc_Handler.h" #include "ace/svc_export.h" #include "Time_Request_Reply.h" #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT template class ACE_Svc_Export ACE_Svc_Handler; #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ /** * @class ACE_TS_Server_Handler * * @brief Product object created by . */ class ACE_Svc_Export ACE_TS_Server_Handler : public ACE_Svc_Handler { public: /// Default constructor. ACE_TS_Server_Handler (ACE_Thread_Manager * = 0); /// Activate this instance of the (called by the /// ). virtual int open (void * = 0); protected: /// Must be allocated dynamically. ~ACE_TS_Server_Handler (); // = Helper routines for the operations exported to clients. /// Give up waiting (e.g., when a timeout occurs or a client shuts /// down unexpectedly). virtual int abandon (); // = Low level routines for framing requests, dispatching // operations, and returning replies. /// Receive, frame, and decode the client's request. virtual int recv_request (); /// Dispatch the appropriate operation to handle the client's /// request. virtual int dispatch (); /// Special kind of reply virtual int send_request (ACE_Time_Request &); // = Demultiplexing hooks. /// Return the underlying . virtual ACE_HANDLE get_handle () const; /// Callback method invoked by the when client events /// arrive. virtual int handle_input (ACE_HANDLE); // = Timer hook. /// Enable clients to limit the amount of time they wait. virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg); private: /// Cache request from the client. ACE_Time_Request time_request_; /// Address of client we are connected with. ACE_INET_Addr addr_; }; /** * @class ACE_TS_Server_Acceptor * * @brief This class contains the service-specific methods that can't * easily be factored into the . */ class ACE_TS_Server_Acceptor : public ACE_Strategy_Acceptor { public: /// Dynamic linking hook. virtual int init (int argc, ACE_TCHAR *argv[]); /// Parse svc.conf arguments. int parse_args (int argc, ACE_TCHAR *argv[]); private: /// The scheduling strategy is designed for Reactive services. ACE_Schedule_All_Reactive_Strategy scheduling_strategy_; }; ACE_SVC_FACTORY_DECLARE (ACE_TS_Server_Acceptor) #endif /* ACE_TS_SERVER_HANDLER_H */ ace-8.0.4+dfsg.orig/netsvcs/lib/Time_Request_Reply.h0000644000175000017500000000566115027201773021364 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Time_Request_Reply.h * * Define the format used to exchange messages between the * ACE time server and clerks. * * @author Prashant Jain */ //============================================================================= #ifndef ACE_TIME_REQUEST_REPLY_H #define ACE_TIME_REQUEST_REPLY_H #include /**/ "ace/pre.h" #include "ace/Time_Value.h" #include "ace/svc_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ /** * @class ACE_Time_Request * * @brief Message format for delivering requests to the ACE_Time Server. * * This class is implemented to minimize data copying. * In particular, all marshaling is done in situ... */ class ACE_Svc_Export ACE_Time_Request { public: enum Constants { /// Request message types. TIME_UPDATE = 01, /// Class-specific constant values. MAX_TIME_LEN = MAXPATHLEN + 1 }; /// Default constructor. ACE_Time_Request (); /** * Create a ACE_Time_Request message. * @param msg_type Type of request. * @param time Time. * @param timeout Max time waiting for request. */ ACE_Time_Request (ACE_INT32 msg_type, const time_t time, ACE_Time_Value *timeout = 0); // Get the fixed size of message ssize_t size () const; /// Get the type of the message. ACE_INT32 msg_type () const; /// Set the type of the message. void msg_type (ACE_INT32); /// Get the time time_t time () const; // Set the time void time (time_t t); /// Get the blocking semantics. ACE_UINT32 block_forever () const; /// Set the blocking semantics. void block_forever (ACE_UINT32); /// Get the timeout. ACE_Time_Value timeout () const; /// Set the timeout. void timeout (const ACE_Time_Value& timeout); /// Encode the message before transmission. int encode (void *&); /// Decode message after reception. int decode (); /// Print out the values of the message for debugging purposes. void dump () const; private: // = The 5 fields in the struct are transmitted to the server. // The remaining 2 fields are not tranferred -- they are used only on // the server-side to simplify lookups. struct Transfer { /// Type of the request (i.e., ) ACE_INT32 msg_type_; /// Indicates if we should block forever. If 0, then sec_timeout_ /// and usec_timeout_ indicates how long we should wait. ACE_UINT32 block_forever_; /// Max seconds willing to wait for name if not blocking forever. ACE_UINT64 sec_timeout_; /// Max micro seconds to wait for name if not blocking forever. ACE_UINT32 usec_timeout_; /// The data portion contains ACE_UINT64 time_; }; /// Transfer buffer. Transfer transfer_; /// Time time_t time_; }; #include /**/ "ace/post.h" #endif /* ACE_TIME_REQUEST_REPLY_H */ ace-8.0.4+dfsg.orig/netsvcs/lib/TS_Clerk_Handler.cpp0000644000175000017500000004536715027201773021250 0ustar sudipsudip#include "ace/Get_Opt.h" #include "TS_Clerk_Handler.h" #include "ace/Lib_Find.h" #include "ace/Signal.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_time.h" #include "ace/os_include/os_netdb.h" ACE_TS_Clerk_Handler::ACE_TS_Clerk_Handler (ACE_TS_Clerk_Processor *processor, ACE_INET_Addr &addr) : state_ (ACE_TS_Clerk_Handler::IDLE), timeout_ (ACE_DEFAULT_TIMEOUT), max_timeout_ (ACE_TS_Clerk_Handler::MAX_RETRY_TIMEOUT), remote_addr_ (addr), processor_ (processor) { ACE_TRACE ("ACE_TS_Clerk_Handler::ACE_TS_Clerk_Handler"); this->time_info_.delta_time_ = 0; this->time_info_.sequence_num_ = 0; } // Set the connection state void ACE_TS_Clerk_Handler::state (ACE_TS_Clerk_Handler::State state) { ACE_TRACE ("ACE_TS_Clerk_Handler::state"); this->state_ = state; } // Get the connection state ACE_TS_Clerk_Handler::State ACE_TS_Clerk_Handler::state () { ACE_TRACE ("ACE_TS_Clerk_Handler::state"); return this->state_; } // Sets the timeout delay. void ACE_TS_Clerk_Handler::timeout (long to) { ACE_TRACE ("ACE_TS_Clerk_Handler::timeout"); if (to > this->max_timeout_) to = this->max_timeout_; this->timeout_ = to; } // Recalculate the current retry timeout delay using exponential // backoff. Returns the original timeout (i.e., before the // recalculation). long ACE_TS_Clerk_Handler::timeout () { ACE_TRACE ("ACE_TS_Clerk_Handler::timeout"); long old_timeout = this->timeout_; this->timeout_ *= 2; if (this->timeout_ > this->max_timeout_) this->timeout_ = this->max_timeout_; return old_timeout; } // This is called when a to the logging server fails... int ACE_TS_Clerk_Handler::handle_signal (int, siginfo_t *, ucontext_t *) { return -1; } // Set the max timeout delay. void ACE_TS_Clerk_Handler::max_timeout (long mto) { ACE_TRACE ("ACE_TS_Clerk_Handler::max_timeout"); this->max_timeout_ = mto; } // Gets the max timeout delay. long ACE_TS_Clerk_Handler::max_timeout () { ACE_TRACE ("ACE_TS_Clerk_Handler::max_timeout"); return this->max_timeout_; } int ACE_TS_Clerk_Handler::open (void *) { ACE_TRACE ("ACE_TS_Clerk_Handler::open"); ACE_INET_Addr server_addr; // Set connection state as established this->state (ACE_TS_Clerk_Handler::ESTABLISHED); // Register ourselves to receive SIGPIPE so we can attempt // reconnections. #if !defined (ACE_WIN32) if (ACE_Reactor::instance ()->register_handler (SIGPIPE, this) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%n: %p\n"), ACE_TEXT ("register_handler (SIGPIPE)")), -1); #endif /* ACE_WIN32 */ // Register ourselves with the reactor to receive input if (ACE_Reactor::instance ()->register_handler (this->get_handle (), this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::EXCEPT_MASK) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%n: %p\n"), ACE_TEXT ("register_handler (this)"))); // Figure out what remote port we're really bound to. else if (this->peer ().get_remote_addr (server_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("get_remote_addr")), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TS Clerk Daemon connected to port %d on handle %d\n"), server_addr.get_port_number (), this->peer ().get_handle ())); return 0; } ACE_HANDLE ACE_TS_Clerk_Handler::get_handle () const { ACE_TRACE ("ACE_TS_Clerk_Handler::get_handle"); return this->peer().get_handle (); } int ACE_TS_Clerk_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask mask) { ACE_TRACE ("ACE_TS_Clerk_Handler::handle_close"); ACE_UNUSED_ARG (mask); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) shutting down on handle %d\n"), this->get_handle ())); return this->reinitiate_connection (); } int ACE_TS_Clerk_Handler::reinitiate_connection () { ACE_TRACE ("ACE_TS_Clerk_Handler::reinitiate_connection"); // Skip over deactivated descriptors. // Set state to connecting so that we don't try to send anything // using this handler this->state (ACE_TS_Clerk_Handler::CONNECTING); if (this->get_handle () != ACE_INVALID_HANDLE) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Scheduling reinitiation of connection\n"))); // Reschedule ourselves to try and connect again. ACE_Time_Value const timeout (this->timeout ()); if (ACE_Reactor::instance ()->schedule_timer (this, 0, timeout) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("schedule_timer")), -1); } return 0; } // Receive a time update from a server int ACE_TS_Clerk_Handler::handle_input (ACE_HANDLE) { ACE_TRACE ("ACE_TS_Clerk_Handler::handle_input"); // We're getting a time update message from a server ACE_Time_Request reply; if (this->recv_reply (reply) != 0) return -1; else { // Get current local time time_t local_time = ACE_OS::time (0); // Compure delta time (difference between current local time and // system time obtained from the server) time_t t = reply.time () - local_time; // Compute round trip delay and adjust time accordingly time_t one_way_time = (local_time - this->start_time_)/2; t += one_way_time; // Now update time info (to be retrieved by Clerk_Processor) this->time_info_.delta_time_ = t; this->time_info_.sequence_num_ = this->cur_sequence_num_; } return 0; } // Restart connection asynchronously when timeout occurs. int ACE_TS_Clerk_Handler::handle_timeout (const ACE_Time_Value &, const void *) { ACE_TRACE ("ACE_TS_Clerk_Handler::handle_timeout"); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) attempting to reconnect to server with timeout = %d\n"), this->timeout_)); // Close down peer to reclaim descriptor if need be. Note this is // necessary to reconnect. this->peer ().close (); return this->processor_->initiate_connection (this, ACE_Synch_Options::asynch); } void ACE_TS_Clerk_Handler::remote_addr (ACE_INET_Addr &addr) { ACE_TRACE ("ACE_TS_Clerk_Handler::remote_addr"); this->remote_addr_ = addr; } ACE_INET_Addr & ACE_TS_Clerk_Handler::remote_addr () { ACE_TRACE ("ACE_TS_Clerk_Handler::remote_addr"); return this->remote_addr_; } int ACE_TS_Clerk_Handler::recv_reply (ACE_Time_Request &reply) { ACE_TRACE ("ACE_TS_Clerk_Handler::recv_reply"); const int bytes_expected = reply.size (); // Since Time_Request messages are fixed size, read the entire // message in one go. ssize_t n = this->peer ().recv ((void *) &reply, bytes_expected); if (n != bytes_expected) { switch (n) { case -1: ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("****************** recv_reply returned -1\n"))); ACE_FALLTHROUGH; default: ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p got %d bytes, expected %d bytes\n"), ACE_TEXT ("recv failed"), n, bytes_expected)); ACE_FALLTHROUGH; case 0: // We've shutdown unexpectedly return -1; // NOTREACHED } } else if (reply.decode () == -1) // Decode the request into host byte order. ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("decode failed")), -1); return 0; } int ACE_TS_Clerk_Handler::send_request (ACE_UINT32 sequence_num, ACE_Time_Info &time_info) { ACE_TRACE ("ACE_TS_Clerk_Handler::send_request"); void *buffer; ssize_t length; // Update current sequence number this->cur_sequence_num_ = sequence_num; // First update the current time info. time_info.delta_time_ = this->time_info_.delta_time_; time_info.sequence_num_ = this->time_info_.sequence_num_; // Now prepare a new time update request ACE_Time_Request request (ACE_Time_Request::TIME_UPDATE, 0, 0); if ((length = request.encode (buffer)) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("encode failed")), -1); // Compute start time of sending request (needed to compute // roundtrip delay) this->start_time_ = ACE_OS::time (0); // Send the request if (this->peer ().send_n (buffer, length) != length) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("send_n failed")), -1); return 0; } ACE_TS_Clerk_Processor::ACE_TS_Clerk_Processor () : timeout_ (ACE_DEFAULT_TIMEOUT), blocking_semantics_ (0), cur_sequence_num_ (0) { #if defined (ACE_DEFAULT_BACKING_STORE) // Create a temporary file. ACE_OS::strcpy (this->poolname_, ACE_DEFAULT_BACKING_STORE); #else /* ACE_DEFAULT_BACKING_STORE */ if (ACE::get_temp_dir (this->poolname_, MAXPATHLEN - 17) == -1) // -17 for ace-malloc-XXXXXX { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Temporary path too long, ") ACE_TEXT ("defaulting to current directory\n"))); this->poolname_[0] = 0; } // Add the filename to the end ACE_OS::strcat (this->poolname_, ACE_TEXT ("ace-malloc-XXXXXX")); #endif /* ACE_DEFAULT_BACKING_STORE */ } void ACE_TS_Clerk_Processor::alloc () { ACE_TRACE ("ACE_TS_Clerk_Processor::alloc"); ACE_NEW (this->shmem_, ALLOCATOR (this->poolname_)); void *temp = 0; // Only create the state if it doesn't already exist. if (this->shmem_->find (ACE_DEFAULT_TIME_SERVER_STR, temp) == -1) { // Allocate the space out of shared memory for the system time entry temp = (this->shmem_->malloc (2 * sizeof (time_t))); // Give it a name binding this->shmem_->bind (ACE_DEFAULT_TIME_SERVER_STR, temp); } // Set up pointers. Note that we add one to get to the second // field in the structure time_t *time_p = (time_t *)temp; this->system_time_.delta_time_ = time_p; this->system_time_.last_local_time_ = time_p + 1; // Initialize *(this->system_time_.delta_time_) = 0; *(this->system_time_.last_local_time_) = ACE_OS::time (0); } // Query the servers for the latest time int ACE_TS_Clerk_Processor::handle_timeout (const ACE_Time_Value &, const void *) { ACE_TRACE ("ACE_TS_Clerk_Processor::handle_timeout"); return this->update_time (); } int ACE_TS_Clerk_Processor::update_time () { ACE_TRACE ("ACE_TS_Clerk_Processor::update_time"); ACE_UINT32 expected_sequence_num = this->cur_sequence_num_; // Increment sequence number this->cur_sequence_num_++; int count = 0; time_t total_delta = 0; ACE_Time_Info time_info; // Call send_request() on all handlers ACE_TS_Clerk_Handler **handler = 0; for (HANDLER_SET_ITERATOR set_iterator (this->handler_set_); set_iterator.next (handler) != 0; set_iterator.advance ()) { if ((*handler)->state () == ACE_TS_Clerk_Handler::ESTABLISHED) { if ((*handler)->send_request (this->cur_sequence_num_, time_info) == -1) return -1; // Check if sequence numbers match; otherwise discard else if (expected_sequence_num != 0 && time_info.sequence_num_ == expected_sequence_num) { count++; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("[%d] Delta time: %d\n"), count, time_info.delta_time_)); // #### Can check here if delta value falls within a threshold #### total_delta += time_info.delta_time_; } } } // Update system_time_ using average of times obtained from all the servers. // Note that we are keeping two things in shared memory: the delta // time (difference between our system clock and the local clock), // and the last local time if (count > 0) { // At least one server is out there *(this->system_time_.delta_time_) = total_delta/count; } else { // No servers are out there (or this is the first time around // computing the time) so set delta time to zero. This // would mean that clients would use the actual local system time. *(this->system_time_.delta_time_) = 0; } // Update the last local time *(this->system_time_.last_local_time_) = ACE_OS::time (0); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Average delta time: %d\n"), (int)(*(this->system_time_.delta_time_)))); return 0; } int ACE_TS_Clerk_Processor::fini () { ACE_TRACE ("ACE_TS_Clerk_Processor::fini"); // Cancel the timer if (this->timer_id_ != -1) ACE_Reactor::instance ()->cancel_timer (this->timer_id_); // Destroy all the handlers ACE_TS_Clerk_Handler **handler = 0; for (HANDLER_SET_ITERATOR set_iterator (this->handler_set_); set_iterator.next (handler) != 0; set_iterator.advance ()) { if ((*handler)->state () != ACE_TS_Clerk_Handler::IDLE) // Mark state as DISCONNECTING so we don't try to reconnect... (*handler)->state (ACE_TS_Clerk_Handler::DISCONNECTING); // Deallocate resources. (*handler)->destroy (); // Will trigger a delete } // Remove the backing store this->shmem_->remove (); ACE_Connector ::fini (); return 0; } int ACE_TS_Clerk_Processor::info (ACE_TCHAR **, size_t) const { ACE_TRACE ("ACE_TS_Clerk_Processor::info"); return 0; } int ACE_TS_Clerk_Processor::init (int argc, ACE_TCHAR *argv[]) { ACE_TRACE ("ACE_TS_Clerk_Processor::init"); // Use the options hook to parse the command line arguments and set // options. this->parse_args (argc, argv); this->alloc (); #if !defined (ACE_WIN32) // Ignore SIPPIPE so each Output_Channel can handle it. ACE_Sig_Action sig ((ACE_SignalHandler) SIG_IGN, SIGPIPE); ACE_UNUSED_ARG (sig); #endif /* ACE_WIN32 */ ACE_Synch_Options &synch_options = this->blocking_semantics_ == 0 ? ACE_Synch_Options::asynch : ACE_Synch_Options::synch; // Now set up connections to all servers ACE_TS_Clerk_Handler **handler = 0; for (HANDLER_SET_ITERATOR set_iterator (this->handler_set_); set_iterator.next (handler) != 0; set_iterator.advance ()) { this->initiate_connection (*handler, synch_options); } // Now set up timer to receive updates from server // set the timer to go off after timeout value this->timer_id_ = ACE_Reactor::instance ()->schedule_timer (this, 0, ACE_Time_Value (this->timeout_), ACE_Time_Value (this->timeout_)); return 0; } int ACE_TS_Clerk_Processor::initiate_connection (ACE_TS_Clerk_Handler *handler, ACE_Synch_Options &synch_options) { ACE_TRACE ("ACE_TS_Clerk_Processor::initiate_connection"); ACE_TCHAR buf[MAXHOSTNAMELEN + 1]; // Mark ourselves as idle so that the various iterators will ignore // us until we are connected/reconnected. handler->state (ACE_TS_Clerk_Handler::IDLE); if (handler->remote_addr ().addr_to_string (buf, MAXHOSTNAMELEN) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("can't obtain peer's address")), -1); // Establish connection with the server. if (this->connect (handler, handler->remote_addr (), synch_options) == -1) { if (errno != EWOULDBLOCK) { handler->state (ACE_TS_Clerk_Handler::FAILED); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) %p on address %s\n"), ACE_TEXT ("connect"), buf)); // Reschedule ourselves to try and connect again. if (synch_options[ACE_Synch_Options::USE_REACTOR]) { ACE_Time_Value const handler_timeout (handler->timeout ()); if (ACE_Reactor::instance ()->schedule_timer (handler, 0, handler_timeout) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("schedule_timer")), -1); } else // Failures on synchronous connects are reported as errors // so that the caller can decide how to proceed. return -1; } else { handler->state (ACE_TS_Clerk_Handler::CONNECTING); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) in the process of connecting %s to %s\n"), synch_options[ACE_Synch_Options::USE_REACTOR] ? ACE_TEXT ("asynchronously") : ACE_TEXT ("synchronously"), buf)); } } else { handler->state (ACE_TS_Clerk_Handler::ESTABLISHED); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) connected to %s on %d\n"), buf, handler->get_handle ())); } return 0; } int ACE_TS_Clerk_Processor::parse_args (int argc, ACE_TCHAR *argv[]) { ACE_TRACE ("ACE_TS_Clerk_Processor::parse_args"); ACE_INET_Addr server_addr; ACE_TS_Clerk_Handler *handler; ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("h:t:p:b"), 0); for (int c; (c = get_opt ()) != -1; ) { switch (c) { case 'h': // Get the hostname:port and create an ADDR server_addr.set (get_opt.opt_arg ()); // Create a new handler ACE_NEW_RETURN (handler, ACE_TS_Clerk_Handler (this, server_addr), -1); // Cache the handler this->handler_set_.insert (handler); break; case 't': // Get the timeout value this->timeout_ = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'p': // Get the poolname ACE_OS::strncpy (this->poolname_, get_opt.opt_arg (), sizeof this->poolname_ / sizeof (ACE_TCHAR)); break; case 'b': // Blocking semantics this->blocking_semantics_ = 1; break; default: ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%n:\n[-h hostname:port] [-t timeout] [-p poolname]\n")), -1); } } return 0; } int ACE_TS_Clerk_Processor::suspend () { ACE_TRACE ("ACE_TS_Clerk_Processor::suspend"); return 0; } int ACE_TS_Clerk_Processor::resume () { ACE_TRACE ("ACE_TS_Clerk_Processor::resume"); return 0; } // The following is a "Factory" used by the ACE_Service_Config and // svc.conf file to dynamically initialize the state of the TS_Clerk. ACE_SVC_FACTORY_DEFINE (ACE_TS_Clerk_Processor) ace-8.0.4+dfsg.orig/netsvcs/lib/Server_Logging_Handler_T.cpp0000644000175000017500000003554215027201773022773 0ustar sudipsudip#ifndef ACE_SERVER_LOGGING_HANDLERT_C #define ACE_SERVER_LOGGING_HANDLERT_C #include "ace/config-all.h" #include #include "ace/Get_Opt.h" #include "ace/Log_Record.h" #include "ace/CDR_Stream.h" #include "Server_Logging_Handler_T.h" #include "ace/Signal.h" // Track number of requests. template COUNTER ACE_Server_Logging_Handler_T::request_count_ = (COUNTER) 0; template ACE_Server_Logging_Handler_T::ACE_Server_Logging_Handler_T (ACE_Thread_Manager *, LMR const &receiver) // Initialize the CString to something that is not the empty string // to avoid problems when calling fast_rep() #if !defined (__GNUG__) : receiver_ (receiver, ACE_TString (ACE_TEXT(" "), 1)) #else : receiver_ (receiver), host_name_ (ACE_TString (ACE_TEXT (" "), 1)) #endif /* ! __GNUG__ */ { } // Callback routine for handling the reception of remote logging // transmissions. template int ACE_Server_Logging_Handler_T::handle_input (ACE_HANDLE) { int result = this->handle_logging_record (); return result >= 0 ? 0 : -1; } template const ACE_TCHAR * ACE_Server_Logging_Handler_T::host_name () { #if !defined (__GNUG__) return this->receiver_.m_.fast_rep (); #else return this->host_name_.fast_rep (); #endif /* ! __GNUG__ */ } template int ACE_Server_Logging_Handler_T::handle_logging_record () { ACE_Log_Record log_record; // We need to use the old two-read trick here since TCP sockets // don't support framing natively. Allocate a message block for the // payload; initially at least large enough to hold the header, but // needs some room for alignment. ACE_Message_Block *payload_p = 0; ACE_Message_Block *header_p = 0; ACE_NEW_RETURN (header_p, ACE_Message_Block (ACE_DEFAULT_CDR_BUFSIZE), -1); std::unique_ptr header (header_p); // Align the Message Block for a CDR stream ACE_CDR::mb_align (header.get ()); ACE_CDR::Boolean byte_order; ACE_CDR::ULong length; ssize_t count = ACE::recv_n (this->peer ().get_handle (), header->wr_ptr (), 8); switch (count) { // Handle shutdown and error cases. default: case -1: case 0: ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("server logging daemon closing down at host %s\n"), this->host_name ())); return -1; /* NOTREACHED */ case 8: // Just fall through in this case.. break; } header->wr_ptr (8); // Reflect addition of 8 bytes. // Create a CDR stream to parse the 8-byte header. ACE_InputCDR header_cdr (header.get ()); // Extract the byte-order and use helper methods to disambiguate // octet, booleans, and chars. if (!(header_cdr >> ACE_InputCDR::to_boolean (byte_order))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Can't extract byte_order\n"))); return 0; } // Set the byte-order on the stream... header_cdr.reset_byte_order (byte_order); // Extract the length if (!(header_cdr >> length)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Can't extract length\n"))); return 0; } ACE_NEW_RETURN (payload_p, ACE_Message_Block (length), -1); std::unique_ptr payload (payload_p); // Ensure there's sufficient room for log record payload. ACE_CDR::grow (payload.get (), 8 + ACE_CDR::MAX_ALIGNMENT + length); // Use to obtain the contents. if (ACE::recv_n (this->peer ().get_handle (), payload->wr_ptr (), length) <= 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("recv_n()"))); return -1; } payload->wr_ptr (length); // Reflect additional bytes ACE_InputCDR payload_cdr (payload.get ()); payload_cdr.reset_byte_order (byte_order); if (!(payload_cdr >> log_record)) // Finally extract the . { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Can't extract log_record\n"))); return 0; } log_record.length (length); // Send the log record to the log message receiver for processing. if (ACE_BIT_ENABLED (ACE_Log_Msg::instance ()->flags (), ACE_Log_Msg::STDERR)) receiver ().log_record (this->host_name (), log_record); ostream *orig_ostream = ACE_Log_Msg::instance ()->msg_ostream (); receiver ().log_output (this->host_name (), log_record, orig_ostream); return 0; #if 0 ACE_INT32 length; // We need to use the ol' two-read trick here since TCP sockets // don't support framing natively. Note that the first call is just // a "peek" -- we don't actually remove the data until the second // call. Note that this code is portable as long as ACE_UNIT32 is // always 32 bits on both the sender and receiver side. switch (this->peer ().recv ((void *) &length, sizeof length, MSG_PEEK)) { default: case -1: ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p at host %s\n"), ACE_TEXT ("server logger"), this->host_name ()), -1); /* NOTREACHED */ case 0: ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("closing log daemon at host %C\n"), this->host_name ()), -1); /* NOTREACHED */ case sizeof length: { ACE_Log_Record lp; // Use ACE_NTOHL to get around bug in egcs 2.91.6x. length = ACE_NTOHL (length); ++this->request_count_; u_long count = this->request_count_; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("request count = %d, length = %d\n"), count, length)); // Perform the actual this time. ssize_t n = this->peer ().recv_n ((void *) &lp, length); if (n != length) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%d != %d, %p at host %C\n"), n, length, ACE_TEXT ("server logger"), this->host_name ()), -1); lp.decode (); if (lp.length () == n) { // Send the log record to the log message receiver for // processing. if (ACE_BIT_ENABLED (ACE_Log_Msg::instance ()->flags (), ACE_Log_Msg::STDERR)) receiver ().log_record (this->host_name (), lp); ostream *orig_ostream = ACE_Log_Msg::instance ()->msg_ostream (); receiver ().log_output (this->host_name (), lp, orig_ostream); } else ACERROR ((LM_ERROR, ACE_TEXT ("error, lp.length = %d, n = %d\n"), lp.length (), n)); return n; } } #endif ACE_NOTREACHED (return -1;) } // Hook called by Server_Logging_Acceptor when connection is // established. template int ACE_Server_Logging_Handler_T::open_common () { // Shut off non-blocking IO if it was enabled... if (this->peer ().disable (ACE_NONBLOCK) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("disable")), -1); ACE_PEER_STREAM_ADDR client_addr; // Determine the address of the client and display it. if (this->peer ().get_remote_addr (client_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("get_remote_addr")), -1); #if !defined (__GNUG__) this->receiver_.m_ = ACE_TString (ACE_TEXT_CHAR_TO_TCHAR (client_addr.get_host_name ())); #else this->host_name_ = ACE_TString (ACE_TEXT_CHAR_TO_TCHAR (client_addr.get_host_name ())); #endif /* ! __GNUG__ */ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) accepted connection from host %C on fd %d\n"), client_addr.get_host_name (), this->peer ().get_handle ())); return 0; } template ACE_Server_Logging_Acceptor_T::ACE_Server_Logging_Acceptor_T () { } template LMR & ACE_Server_Logging_Acceptor_T::receiver () { return receiver_; } template SST & ACE_Server_Logging_Acceptor_T::scheduling_strategy () { #if !defined (__GNUG__) return receiver_.m_; #else return schedule_strategy_; #endif /* ! __GNUG__ */ } template int ACE_Server_Logging_Acceptor_T::init (int argc, ACE_TCHAR *argv[]) { ACE_TRACE ("ACE_Server_Logging_Acceptor_T::init"); // Use the options hook to parse the command line arguments and set // options. this->parse_args (argc, argv); // Set the acceptor endpoint into listen mode (use the Singleton // global Reactor...). if (this->open (this->service_addr_, ACE_Reactor::instance (), 0, 0, 0, &this->scheduling_strategy(), ACE_TEXT ("Logging Server"), ACE_TEXT ("ACE logging service")) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%n: %p on port %d\n"), ACE_TEXT ("acceptor::open failed"), this->service_addr_.get_port_number ()), -1); // Ignore SIGPIPE so that each can handle this on its // own. ACE_Sig_Action sig ((ACE_SignalHandler) SIG_IGN, SIGPIPE); ACE_UNUSED_ARG (sig); ACE_INET_Addr server_addr; // Figure out what port we're really bound to. if (this->acceptor ().get_local_addr (server_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("get_local_addr")), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("starting up Logging Server at port %d on handle %d\n"), server_addr.get_port_number (), this->acceptor ().get_handle ())); return 0; } template int ACE_Server_Logging_Acceptor_T::parse_args (int argc, ACE_TCHAR *argv[]) { ACE_TRACE ("ACE_Server_Logging_Acceptor_T::parse_args"); int service_port = ACE_DEFAULT_SERVER_PORT; ACE_LOG_MSG->open (ACE_TEXT ("Logging Service"), ACE_LOG_MSG->flags ()); ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("p:"), 0); for (int c; (c = get_opt ()) != -1; ) { switch (c) { case 'p': service_port = ACE_OS::atoi (get_opt.opt_arg ()); break; default: ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%n:\n[-p server-port]\n")), -1); } } this->service_addr_.set (service_port); return 0; } template int ACE_Server_Logging_Acceptor_T ::make_svc_handler (SERVER_LOGGING_HANDLER *&handler) { ACE_NEW_RETURN (handler, SERVER_LOGGING_HANDLER (ACE_Thread_Manager::instance (), this->receiver()), -1); return 0; } template ACE_Server_Logging_Handler::ACE_Server_Logging_Handler (ACE_Thread_Manager * tm, LOG_MESSAGE_RECEIVER const& receiver) : ACE_Server_Logging_Handler_T(tm, receiver) { } template ACE_Server_Logging_Handler::ACE_Server_Logging_Handler(ACE_Thread_Manager * tm) : ACE_Server_Logging_Handler_T(tm, LOG_MESSAGE_RECEIVER()) { } template int ACE_Server_Logging_Handler::open (void *) { // call base class open_common if (this->open_common () != 0) return -1; // Register ourselves with the Reactor to enable subsequent // dispatching. if (ACE_Reactor::instance ()->register_handler (this, ACE_Event_Handler::READ_MASK) == -1) return -1; return 0; } template ACE_Thr_Server_Logging_Handler::ACE_Thr_Server_Logging_Handler (ACE_Thread_Manager *tm, LOG_MESSAGE_RECEIVER const &receiver) : ACE_Server_Logging_Handler_T(tm, receiver) { } template ACE_Thr_Server_Logging_Handler::ACE_Thr_Server_Logging_Handler (ACE_Thread_Manager *tm) : ACE_Server_Logging_Handler_T(tm, LOG_MESSAGE_RECEIVER ()) { } template int ACE_Thr_Server_Logging_Handler::open (void *) { // call base class open_common if (this->open_common () != 0) return -1; // Spawn a new thread of control to handle logging records with the // client using a thread-per-connection concurrency model. Note // that this implicitly uses the to // control all the threads. if (this->activate (THR_BOUND | THR_DETACHED) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("spawn")), -1); return 0; } // Process remote logging records. template int ACE_Thr_Server_Logging_Handler::svc () { int result = 0; // Loop until the client terminates the connection or an error occurs. while ((result = this->handle_input ()) == 0) continue; return result; } #endif /* ACE_SERVER_LOGGING_HANDLER_TT_C */ ace-8.0.4+dfsg.orig/netsvcs/lib/README0000644000175000017500000002333715027201773016312 0ustar sudipsudip This directory provides a number of network services that utilize the ACE wrapper features. . Logging_Strategy -- Controls the output of all services that are invoked along with the Logging_Strategy service. Please see below for details on how to control the output. . [Thr_]Server_Logging_Handler.* -- Implements server portion of the ACE distributed logging service. Both multi-threaded and single-threaded implementations are provided. . Client_Logging_Handler.* -- Implements the client portion of the ACE distributed logging service. . Name_Handler.* -- Implements a distributed name service that allows applications to bind, find, and unbind names in a distributed system. . Token_Handler.* -- Implements a distributed token service that allows applications to acquire and release locks in a distributed system. . Time_Handler.* -- Implements a distributed time service that allows distributed applications to synchronize their time. The remainder of this README file explains how these services work. ==================== Logging_Strategy Service ==================== The Logging_Strategy Service can be used to control the output of all the network services. It can be invoked with certain flags that determine where the output of all the services should go. The Logging_Strategy Service sets the flags in ACE_Log_Msg which in turn controls all the streams through macros such as ACE_DEBUG, ACE_ERROR, and ACE_ERROR_RETURN. If default behavior is required, the Logging_Strategy Service need not be invoked or it can be invoked with no paramaters. Here are the command line arguments that can be given to the Logging_Strategy Service: -f || (etc...) where a flag can be any of the following: STDERR -- Write messages to stderr. LOGGER -- Write messages to the local client logger deamon. OSTREAM -- Write messages to the ostream that gets created by specifying a filename (see below) VERBOSE -- Display messages in a verbose manner SILENT -- Do not print messages at all Note: If more than one flag is specified, the flags need to be 'OR'ed as above syntax shows. Make sure there is no space in between the flag and '|'. -s filename If the OSTREAM flag is set, this can be used to specify the filename where the output should be directed. Note that if the OSTREAM flag is set and no filename is specified, ACE_DEFAULT_LOGFILE will be used to write the output to. Examples: To direct output only to STDERR, specify command line arguments as: "-f STDERR" To direct output to both STDERR and a file called "mylog", specify command line arguments as: "-f STDERR|OSTREAM -s mylog" ==================== Name Service ==================== This file describes the principles of the Name_Server server test application. 1. Startup configuration --------------------- To communicate with the server process, a client needs to know the INET_Addr, where the server offers its service. Class Name_Options holds all the configuration information of the Name Service. This consists of : - nameserver_port : Port number where the server process expects requests - nameserver_host : hostname where the server process resides - namespace_dir : directory that holds the NameBinding databases - process_name : name of the client process (argv[0]), NameBindings of a ProcessLocal namespace are stored in file "namespace_dir/process_name". NameBindings of NodeGlobal namespace are stored in "namespace_dir/localnames". NameBindings of Net_Local namespace are stored in file "namespace_dir/globalnames" on the server host. These configuration parameters are passed to the process as commandline arguments to main: -p nameserver port -h nameserver host -l namespace directory The main program _must_ initialize an instance of Name_Options with name name_options (since the shared libraries depend on this). Main should look like : #include "ace/Name_Options.h" Name_Options name_options; int main(int argc, char **argv) { name_options.process_name(argv[0]); name_options.parse_args (argc, argv); ...... } See the examples in the tests subdirectory of ...Name_Server/Client-Server/client and ...Name_Server/Client-Server/server 2. Class Naming_Context ------------------- This is the main workhorse of the Name Service. It is used by client processes as well as by the server process. It manages all accesses to the appropriate NameBinding database (that is the file where NameBindings are stored) and it also manages the communication between a client process and the server (by using class Name_Proxy, which is a private member of Naming_Context). (Note: no IPC is necessary, if a client process runs on the same host as the server). The strategy for all public methods of Naming_Context is common : 1. Transform the format of the arguments to ACE_SString (which is internally used) if necessary. 2. check if work can be done locally : -> call the appropriate local_* method otherwise call the appropriate global_* method. Removing Name_Bindings from the database (either with unbind or rebind) uses the ACE_Malloc class configured with the ACE_MMAP_Memory_Pool. This allows memory to be reclaimed when name/value tuples are unbound. 3. Class Name_Server ---------------- The Name_Server registers in its run method its Name_Acceptor (instantiated with the INET_Addr) at the Reactor, to receive incoming requests. 4. Class Name_Acceptor ------------------ The Name_Acceptor allocates in its handle_input routine a new instance of class Name_Handler on the heap, and accepts connections into this Name_Handler. 5. Class Name_Handler ----------------- The Name_Handler represents the server side of communication between client and server. It interprets incoming requests to the Net_Local namespace and dele- gates the requests to its own Naming_Context (which is the Net_Local namespace on the current host). For communication it uses the helper classes Name_Request (which up to now needs not only contain the request from the client, but also the appropriate reply from the server) and Name_Reply. Note that I want to change the usage of these classes to make the structure of the software clearer. 6. Dependencies ------------ As the Name service must be able to handle wide character strings, it uses ACE_WString String classes. ==================== Time Service ==================== The following is a description of the Time Server clerk and server services: 1. Startup configuration --------------------- Configuring a server requires specifying the port number of the server. This can be specified as a command line argument as follows: -p A clerk communicates with one or more server processes. To communicate with the server process, a client needs to know the INET_Addr, where the server offers its service. The configuration parameters namely the server port and server host are passed as command line arguments when starting up the clerk service as follows: -h : -h : ... Note that multiple servers can be specified in this manner for the clerk to connect to when it starts up. The server name and the port number need to be concatenated and separated by a ":". In addition, the timeout value can also be specified as a command line argument as follows: -t timeout The timeout value specifies the time interval at which the clerk should query the servers for time updates. By default a Clerk does a non-blocking connect to a server. This can be overridden and a Clerk can be made to do a blocking connect by using the -b flag. Here is what a config file would look like for starting up a server at port 20202: dynamic Time_Service Service_Object * ../lib/netsvcs:_make_ACE_TS_Server_Acceptor() "-p 20202" Here is what a config file would look like for starting up a clerk that needs to connect to two servers, one at tango and one at lambada: dynamic Time_Server_test Service_Object *../lib/netsvcs:_make_ACE_TS_Clerk_Processor () "-h tango:20202 -h lambada:20202 -t 4" 2. Class TS_Server_Handler ----------------------- TS_Server_Handler represents the server side of communication between clerk and server. It interprets incoming requests for time updates, gets the system time, creates a reply in response to the request and then sends the reply to the clerk from which it received the request. For communication it uses the helper class Time_Request. 3. Class TS_Server_Acceptor ------------------------ TS_Server_Acceptor allocates in its handle_input routine a new instance of class TS_Server_Handler on the heap, and accepts connections into this TS_Server_Handler. 4. Class TS_Clerk_Handler ---------------------- TS_Clerk_Handler represents the clerk side of communication between clerk and server. It generates requests for time updates every timeout period and then sends these requests to all the servers it is connected to asynchronously. It receives the replies to these requests from the servers through its handle_input method and then adjusts the time using the roundtrip estimate. It caches this time which is later retrieved by TS_Clerk_Processor. 5. Class TS_Clerk_Processor ------------------------ TS_Clerk_Processor creates a new instance of TS_Clerk_Handler for every server connection it needs to create. It periodically calls send_request() of every TS_Clerk_Handler to send a request for time update to all the servers. In the process, it retrieves the latest time cached by each TS_Clerk_Handler and then uses it to compute its notion of the local system time. 6. Algorithms ---------- Currently, updating the system time involves taking the average of all the times received from the servers. ace-8.0.4+dfsg.orig/netsvcs/servers/0000755000175000017500000000000015046037655016354 5ustar sudipsudipace-8.0.4+dfsg.orig/netsvcs/servers/svc.conf0000644000175000017500000000236615027201773020016 0ustar sudipsudip # These are the services that can be linked into ACE. # Note that you can append the "netsvcs" with # a relative path if you idn't set your LD search path correctly -- # ACE will locate this for you automatically by reading your LD search # path. Moreover, ACE will automatically insert the correct suffix # (e.g., ".dll", ".so", etc.). In addition, you can replace the # hardcoded "-p 20xxx" with "-p $PORTxxx" if you set your environment # variables correctly. dynamic Logger Service_Object * ACE:_make_ACE_Logging_Strategy() "-w -s foobar -f STDERR|OSTREAM|VERBOSE" dynamic Time_Service Service_Object * netsvcs:_make_ACE_TS_Server_Acceptor() "-p 20222" dynamic Name_Server Service_Object * netsvcs:_make_ACE_Name_Acceptor() "-p 20006" # This service is disabled by default -- only enable it ACE is compiled with ACE_HAS_TOKENS_LIBRARY. # dynamic Token_Service Service_Object * netsvcs:_make_ACE_Token_Acceptor() "-p 20202" dynamic Server_Logging_Service Service_Object * netsvcs:_make_ACE_Server_Logging_Acceptor() active "-p 20009" dynamic Thr_Server_Logging_Service Service_Object * netsvcs:_make_ACE_Thr_Server_Logging_Acceptor() active "-p 20020" dynamic Client_Logging_Service Service_Object * netsvcs:_make_ACE_Client_Logging_Acceptor() active "-p 20009" ace-8.0.4+dfsg.orig/netsvcs/servers/servers.mpc0000644000175000017500000000035615027201773020543 0ustar sudipsudip// -*- MPC -*- project(Netsvcs_server) : aceexe, avoids_ace_for_tao { exename = ace_netsvcs libs += netsvcs after += netsvcs includes += $(ACE_ROOT)/netsvcs/lib avoids += ace_for_tao Source_Files { main.cpp } } ace-8.0.4+dfsg.orig/netsvcs/servers/main.cpp0000644000175000017500000001546715027201773020012 0ustar sudipsudip#include "ace/Service_Config.h" #include "ace/Logging_Strategy.h" #include "ace/Sig_Adapter.h" #include "TS_Clerk_Handler.h" #include "TS_Server_Handler.h" #include "Client_Logging_Handler.h" #include "Name_Handler.h" #include "Token_Handler.h" #include "Server_Logging_Handler.h" int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { // Try to link in the svc.conf entries dynamically, enabling the // "ignore_debug_flag" as the last parameter so that we can override // the default ACE_Log_Priority settings in the svc.conf file. // // Warning - do not try to move the ACE_Reactor signal handling work // up to before this call - if the user specified -b (be a daemon), // all handles will be closed, including the Reactor's pipe. if (ACE_Service_Config::open (argc, argv, ACE_DEFAULT_LOGGER_KEY, 1, 0, 1) == -1) { if (errno != ENOENT) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), 1); else // Use static linking. { if (ACE::debug () == 0) ACE_LOG_MSG->priority_mask (~LM_DEBUG, ACE_Log_Msg::PROCESS); // Calling ACE_SVC_INVOKE to create a new Service_Object. // Stash the newly created Service_Object into an // ACE_Service_Object_Ptr which is an specialized // for ACE_Service_Object. ACE_TCHAR *l_argv[3]; ACE_TCHAR name_port[] = ACE_TEXT ("-p ") ACE_TEXT (ACE_DEFAULT_NAME_SERVER_PORT_STR); l_argv[0] = name_port; l_argv[1] = 0; ACE_Service_Object_Ptr sp_1 = ACE_SVC_INVOKE (ACE_Name_Acceptor); if (sp_1->init (1, l_argv) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Name Service")), 1); ACE_TCHAR time_port[] = ACE_TEXT ("-p ") ACE_TEXT (ACE_DEFAULT_TIME_SERVER_PORT_STR); l_argv[0] = time_port; l_argv[1] = 0; ACE_Service_Object_Ptr sp_2 = ACE_SVC_INVOKE (ACE_TS_Server_Acceptor); if (sp_2->init (1, l_argv) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("TS Server Acceptor")), 1); ACE_TCHAR clerk_port[] = ACE_TEXT ("-p 10011"); l_argv[0] = argv[0]; l_argv[1] = clerk_port; l_argv[2] = 0; ACE_Service_Object_Ptr sp_3 = ACE_SVC_INVOKE (ACE_TS_Clerk_Processor); if (sp_3->init (2, l_argv) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("TS Clerk Processor")), 1); #if defined (ACE_HAS_TOKENS_LIBRARY) ACE_TCHAR token_port[] = ACE_TEXT ("-p ") ACE_TEXT (ACE_DEFAULT_TOKEN_SERVER_PORT_STR); l_argv[0] = token_port; l_argv[1] = 0; ACE_Service_Object_Ptr sp_4 = ACE_SVC_INVOKE (ACE_Token_Acceptor); if (sp_4->init (1, l_argv) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Token Service")), 1); #endif /* ACE_HAS_TOKENS_LIBRARY */ ACE_TCHAR thr_logging_port[] = ACE_TEXT ("-p ") ACE_TEXT (ACE_DEFAULT_THR_LOGGING_SERVER_PORT_STR); l_argv[0] = thr_logging_port; l_argv[1] = 0; ACE_Service_Object_Ptr sp_5 = ACE_SVC_INVOKE (ACE_Thr_Server_Logging_Acceptor); if (sp_5->init (1, l_argv) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Threaded Logging Server")), 1); ACE_TCHAR logging_port[] = ACE_TEXT ("-p ") ACE_TEXT (ACE_DEFAULT_LOGGING_SERVER_PORT_STR); l_argv[0] = logging_port; l_argv[1] = 0; ACE_Service_Object_Ptr sp_6 = ACE_SVC_INVOKE (ACE_Server_Logging_Acceptor); if (sp_6->init (1, l_argv) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Logging Server")), 1); l_argv[0] = logging_port; l_argv[1] = 0; ACE_Service_Object_Ptr sp_7 = ACE_SVC_INVOKE (ACE_Client_Logging_Acceptor); if (sp_7->init (1, l_argv) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Logging Client")), 1); // Run forever, performing the configured services until we // are shut down by a SIGINT/SIGQUIT signal. // Create an adapter to end the event loop. ACE_Sig_Adapter sa ((ACE_Sig_Handler_Ex) ACE_Reactor::end_event_loop); ACE_Sig_Set sig_set; sig_set.sig_add (SIGINT); sig_set.sig_add (SIGQUIT); if (ACE_Reactor::instance ()->register_handler (sig_set, &sa) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("register signals")), 1); } else { ACE_Reactor::instance ()->run_reactor_event_loop (); // Back from running the reactor we have to remove our signal handler ACE_Reactor::instance ()->remove_handler (sig_set); } // Destructors of ACE_Service_Object_Ptr's automagically // call fini(). } } else // Use dynamic linking. { // Run forever, performing the configured services until we are // shut down by a SIGINT/SIGQUIT signal. // Create an adapter to end the event loop. ACE_Sig_Adapter sa ((ACE_Sig_Handler_Ex) ACE_Reactor::end_event_loop); ACE_Sig_Set sig_set; sig_set.sig_add (SIGINT); sig_set.sig_add (SIGQUIT); // Register ourselves to receive signals so we can shut down // gracefully. if (ACE_Reactor::instance ()->register_handler (sig_set, &sa) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("register signals2")), 1); } else { ACE_Reactor::instance ()->run_reactor_event_loop (); // Back from running the reactor we have to remove our signal handler ACE_Reactor::instance ()->remove_handler (sig_set); } } return 0; } ace-8.0.4+dfsg.orig/netsvcs/servers/README0000644000175000017500000000312115027201773017222 0ustar sudipsudip This directory contains the driver program that links the various services together, either statically or dynamically, to form complete server programs. You can configure the following ACE network services into the driver program by changing how the svc.conf file is setup: . Logger -- Controls the output of all services that are invoked along with the Logger service. Please see the README file in /netsvcs/lib for details on how to control the output. . [Thr_]Server_Logging_Handler.* -- Implements server portion of the ACE distributed logging service. Both multi-threaded and single-threaded implementations are provided. . Client_Logging_Handler.* -- Implements the client portion of the ACE distributed logging service. Note that you generally will run a netsvc daemon that's configured with *either* the server portion of the logging service or the client portion of the logging service, but not both in the same process. In other words, you'll need to have separate svc.conf files to configure the client logging process and the server logging process independently. . Name_Handler.* -- Implements a distributed name service that allows applications to bind, find, and unbind names in a distributed system. . Token_Handler.* -- Implements a distributed token service that allows distributed applications to acquire and release locks in a distributed system. . Time_Handler.* -- Implements a distributed time service that allows distributed applications to synchronize their time. ace-8.0.4+dfsg.orig/netsvcs/servers/svc.conf.xml0000644000175000017500000000342515027201773020612 0ustar sudipsudip ace-8.0.4+dfsg.orig/netsvcs/README0000644000175000017500000000161415027201773015536 0ustar sudipsudip This directory contains the ACE network service implementations and sample driver programs for dynamically configuring them into client and server processes. The subdirectories include the following: . lib -- contains implementations of the ACE network services. These services include a logging service, a name service, a distributed locking service, and a distributed time service. These can be built as shared libraries (i.e., DLLs), which are then linked into applications either statically or dynamically. . servers -- contains the driver program that links the various services together, either statically or dynamically, to form complete server programs. . clients -- contains a number of test programs that illustrate how to write clients for the various ACE network services. Please see the ACE-netsvcs.html file for an overview of the various services. ace-8.0.4+dfsg.orig/netsvcs/clients/0000755000175000017500000000000015046037655016324 5ustar sudipsudipace-8.0.4+dfsg.orig/netsvcs/clients/Naming/0000755000175000017500000000000015046037655017535 5ustar sudipsudipace-8.0.4+dfsg.orig/netsvcs/clients/Naming/Dump_Restore/0000755000175000017500000000000015046037655022145 5ustar sudipsudipace-8.0.4+dfsg.orig/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.mpc0000644000175000017500000000024415027201773025247 0ustar sudipsudip// -*- MPC -*- project(Netsvcs_Dump_Restore) : aceexe { avoids += ace_for_tao exename = dump_restore Source_Files { main.cpp Dump_Restore.cpp } } ace-8.0.4+dfsg.orig/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.h0000644000175000017500000000353715027201773024727 0ustar sudipsudip// -*- C++ -*- #include "ace/Event_Handler.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Reactor.h" #include "ace/Naming_Context.h" class Dump_Restore : public ACE_Event_Handler { public: enum Operation_Type { BIND, UNBIND, REBIND }; Dump_Restore (int argc, ACE_TCHAR *argv[]); // Initialize name options and naming context ~Dump_Restore (); virtual int handle_input (ACE_HANDLE handle); // Handle user entered commands void dump (); private: ACE_TCHAR hostname_[MAXHOSTNAMELEN + 1]; // Cache the hostname and port number for remote case void display_menu (); // Display user menu. int set_proc_local (); // Set options to use PROC_LOCAL naming context. int set_node_local (); // Set options to use NODE_LOCAL naming context. int set_host (const ACE_TCHAR *hostname, int port); // Set options to use NET_LOCAL naming context specifying host name // and port number. int quit (); // Gracefully exit. int populate (Dump_Restore::Operation_Type op); int doit (Dump_Restore::Operation_Type op, const char *name, const char *value, const char *type = ""); int bind (const char *key, const char *value, const char *type = ""); int unbind (const char *key); int rebind (const char *key, const char *value, const char *type = ""); char filename_[MAXPATHLEN + 1]; char dump_filename_[MAXPATHLEN + 1]; u_short port_; // port server is listening on ACE_Naming_Context *ns_context_; // Current naming context ACE_Naming_Context::Context_Scope_Type ns_scope_; // Defines the scope of the naming context FILE *infile_; // input file ACE_Name_Options *name_options_; // Name Options associated with the Naming Context }; ace-8.0.4+dfsg.orig/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.cpp0000644000175000017500000003016215027201773025254 0ustar sudipsudip#include "ace/Malloc_Base.h" #include "ace/Read_Buffer.h" #include "ace/Thread_Manager.h" // FUZZ: disable check_for_streams_include #include "ace/streams.h" /* Because dump () uses ofstream. */ #include "Dump_Restore.h" #include "ace/OS_NS_signal.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" Dump_Restore::Dump_Restore (int argc, ACE_TCHAR *argv[]) : infile_ (0) { ACE_NEW (this->ns_context_, ACE_Naming_Context); // Cache the name options this->name_options_ = this->ns_context_->name_options (); this->name_options_->parse_args (argc, argv); //determine name context if (ACE_OS::strcmp (this->name_options_->nameserver_host (), ACE_TEXT ("localhost")) == 0) { if (ns_context_->open (ACE_Naming_Context::PROC_LOCAL) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ns_context_->open"))); } else { // Don't really need to do this but it's a hack to fix the // problme of Display () not printing the right hostname ACE_OS::strcpy (this->hostname_, this->name_options_->nameserver_host ()); this->port_ = this->name_options_->nameserver_port (); if (this->ns_context_->open (ACE_Naming_Context::NET_LOCAL) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ns_context_->open"))); } this->display_menu (); if (ACE_Event_Handler::register_stdin_handler (this, ACE_Reactor::instance (), ACE_Thread_Manager::instance ()) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("register_stdin_handler"))); } Dump_Restore::~Dump_Restore () { // Deregister this handler with the ACE_Reactor. ACE_Reactor::instance ()->remove_handler (ACE_STDIN, ACE_Event_Handler::DONT_CALL | ACE_Event_Handler::READ_MASK); ACE_OS::fclose (this->infile_); } int Dump_Restore::handle_input (ACE_HANDLE) { char option[BUFSIZ]; char buf1[BUFSIZ]; u_short port; if (::scanf ("%s", option) <= 0) { ACE_DEBUG ((LM_ERROR, ACE_TEXT ("try again\n"))); return 0; } switch (option[0]) { case 'P' : case 'p' : set_proc_local (); break; case 'N' : case 'n' : set_node_local (); break; case 'H' : case 'h' : if (::scanf ("%s %hu", buf1, &port) <= 0) break; set_host (ACE_TEXT_CHAR_TO_TCHAR (buf1), port); break; case 'F': case 'f': if (::scanf ("%s", filename_) <= 0) break; if (this->infile_) ACE_OS::fclose (this->infile_); this->infile_ = ACE_OS::fopen(filename_, ACE_TEXT("r")); break; case 'B' : case 'b' : populate (Dump_Restore::BIND); break; case 'U' : case 'u' : populate (Dump_Restore::UNBIND); break; case 'R' : case 'r' : populate (Dump_Restore::REBIND); break; case 'D': case 'd': if (::scanf ("%s", dump_filename_) <= 0) break; this->dump (); break; case 'Q' : case 'q' : quit (); break; default : ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Unrecognized command.\n"))); } display_menu (); return 0; } void Dump_Restore::display_menu () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Name Service Main Menu\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("----------------------\n"))); // Check if using local name space or remote name space if (ACE_OS::strcmp (this->name_options_->nameserver_host (), ACE_TEXT ("localhost")) == 0) { if (this->ns_scope_ == ACE_Naming_Context::PROC_LOCAL) ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" *** Using Process Local Database ***\n\n"))); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" *** Using Node Local Database ***\n\n"))); } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Hostname: %s\n"), this->hostname_)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Port Number: %d\n"), this->port_)); } if (this->infile_) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Input File: %C\n"), this->filename_)); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("** No Input File Specified **\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("

Use Process Local Database\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Use Node Local Database\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Set Remote Name server and \n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Set Input File \n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Bind\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Unbind\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Rebind\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Dump \n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" or ^C (exit)\n"))); } int Dump_Restore::set_proc_local () { // Set Name Options this->name_options_->nameserver_host (ACE_TEXT ("localhost")); this->name_options_->nameserver_port (0); // Set Naming Context scope this->ns_scope_ = ACE_Naming_Context::PROC_LOCAL; // Remove old naming context delete this->ns_context_; // Create new Naming Context ACE_NEW_RETURN (this->ns_context_, ACE_Naming_Context, -1); if (this->ns_context_->open (ACE_Naming_Context::PROC_LOCAL) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ns_context_->open")), -1); return 0; } int Dump_Restore::set_node_local () { // Set Name Options this->name_options_->nameserver_host (ACE_TEXT ("localhost")); this->name_options_->nameserver_port (0); // Set Naming Context scope this->ns_scope_ = ACE_Naming_Context::NODE_LOCAL; // Remove old naming context delete this->ns_context_; // Create new Naming Context ACE_NEW_RETURN (this->ns_context_, ACE_Naming_Context, -1); if (ns_context_->open (ACE_Naming_Context::NODE_LOCAL) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ns_context_->open")), -1); return 0; } int Dump_Restore::set_host (const ACE_TCHAR *hostname, int port) { // Set Name Options this->name_options_->nameserver_host (hostname); this->name_options_->nameserver_port (port); // Don't really need to do this but it's a hack to fix the problme // of Display () not printing the right hostname ACE_OS::strcpy (this->hostname_, hostname); this->port_ = port; this->ns_scope_ = ACE_Naming_Context::NET_LOCAL; // remove old naming context delete this->ns_context_; // Create new Naming Context ACE_NEW_RETURN (this->ns_context_, ACE_Naming_Context, -1); // assume net_local context if (ns_context_->open (ACE_Naming_Context::NET_LOCAL) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ns_context_->open")), -1); return 0; } int Dump_Restore::doit (Dump_Restore::Operation_Type op, const char *name, const char *value, const char *type) { int result = -1; switch (op) { case Dump_Restore::BIND: { result = this->bind (name, value, type); break; } case Dump_Restore::UNBIND: { result = this->unbind (name); break; } case Dump_Restore::REBIND: { result = this->rebind (name, value, type); break; } } return result; } int Dump_Restore::populate (Dump_Restore::Operation_Type op) { if (this->infile_) { int result = -1; enum State { NAME, VALUE, TYPE }; State state = NAME; // reset file pointer ACE_OS::rewind (this->infile_); ACE_Allocator *allocator = ACE_Allocator::instance (); ACE_Read_Buffer read_buffer (this->infile_, 0, allocator); for (char *temp; (temp = read_buffer.read ('\n')) != 0; ) { char *name = 0; const char *actual_name = 0; char *value = 0; const char *actual_value = 0; char *type = 0; const char *actual_type = 0; switch (state) { case NAME: name = temp; ACE_OS::strtok (name, "="); actual_name = ACE_OS::strtok (0, "="); state = VALUE; break; case VALUE: value = temp; ACE_OS::strtok (value, "="); actual_value = ACE_OS::strtok (0, "="); state = TYPE; break; case TYPE: type = temp; ACE_OS::strtok (type, "="); actual_type = ACE_OS::strtok (0, "="); if (actual_type) result = this->doit (op, actual_name, actual_value, actual_type); else result = this->doit (op, actual_name, actual_value); if (name) allocator->free(name); if (value) allocator->free(value); if (type) allocator->free(type); state = NAME; break; default: ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("populate")), -1); /* NOTREACHED */ } } return result; } else return -1; } int Dump_Restore::bind (const char *key, const char *value, const char *type) { int result = ns_context_->bind (key, value, type); if (result == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ns_context_->bind")), -1); else if (result == 1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%s%s%s\n"), ACE_TEXT ("key <"), key, ACE_TEXT ("> already bound")), 1); return 0; } int Dump_Restore::unbind (const char *key) { int result = ns_context_->unbind (key); if (result == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ns_context_->unbind")), -1); return 0; } int Dump_Restore::rebind (const char *key, const char *value, const char *type) { if (ns_context_->rebind (key, value, type) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ns_context_->rebind")), -1); return 0; } int Dump_Restore::quit () { return ACE_OS::kill (ACE_OS::getpid (), SIGINT); } void Dump_Restore::dump () { ofstream output_file (dump_filename_); ostream *orig_stream = ACE_Log_Msg::instance ()->msg_ostream (); ACE_Log_Msg::instance ()->msg_ostream (&output_file); ACE_Log_Msg::instance ()->clr_flags (ACE_Log_Msg::STDERR | ACE_Log_Msg::LOGGER ); ACE_Log_Msg::instance ()->set_flags (ACE_Log_Msg::OSTREAM); ns_context_->dump (); ACE_Log_Msg::instance ()->msg_ostream (orig_stream); ACE_Log_Msg::instance ()->clr_flags (ACE_Log_Msg::STDERR); } ace-8.0.4+dfsg.orig/netsvcs/clients/Naming/Dump_Restore/createfile.cpp0000644000175000017500000000121415027201773024743 0ustar sudipsudip#include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/ACE.h" int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { FILE *infile, *outfile; char buf[BUFSIZ]; if ((infile = ACE_OS::fopen (argv[1], "r")) == 0) return -1; if ((outfile = ACE_OS::fopen (argv[2], "w")) == 0) return -1; int count = 0; while (ACE_OS::fgets (buf, BUFSIZ, infile)) { buf[ACE_OS::strlen(buf) - 1] = '\0'; ACE_OS::fputs (buf, outfile); if (count % 2 == 0) ACE_OS::fputs (" ", outfile); else ACE_OS::fputs ("\n", outfile); count++; } ACE_OS::fclose (outfile); ACE_OS::fclose (infile); } ace-8.0.4+dfsg.orig/netsvcs/clients/Naming/Dump_Restore/main.cpp0000644000175000017500000000072215027201773023567 0ustar sudipsudip// Test the client-side of the ACE Name Server... #include "ace/Service_Config.h" #include "ace/Log_Msg.h" #include "Dump_Restore.h" int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { ACE_Service_Config daemon (argv[0]); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("entering main\n"))); // Get a handler Dump_Restore client_handler (argc, argv); ACE_Reactor::run_event_loop (); /* NOTREACHED */ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("leaving main\n"))); return 0; } ace-8.0.4+dfsg.orig/netsvcs/clients/Naming/Dump_Restore/README0000644000175000017500000000434415027201773023023 0ustar sudipsudip This file describes the usage of the Dump-Restore utility for the ACE Name Server. Similar to the test application provided in the ../Client/ directory, a simple ASCII menu-driven interface is provided to the user: Name Service Main Menu ---------------------- *** Using Process Local Database *** ** No Input File Specified **

Use Process Local Database Use Node Local Database Set Remote Name server and Set Input File Bind Unbind Rebind Dump or ^C (exit) Initially, the user can select the type of database from the menu:

uses the process local database (i.e., the database is called the same name as the process and stored in /tmp). uses the node local database (which defaults to /tmp/localnames). uses the net local database by specifying host and port number (by default this is stored in a file called /tmp/globalnames on the server). Sets the name of the input file that will be used by the test application to populate the database. The format of the file should be: name= value= type=[] name= value= type=[] . . . Note that the type field is optional. However, if no type information is associated with a name binding, a null entry still needs to be present (i.e., type=). Once the input file has been specified, the user can then do one of the following: Bind -- bind all the bindings in the file to the database. This can be used to "restore" the state of the Name Server. Unbind -- unbind all the bindings in the file from the database. Rebind -- rebind all the bindings in the file to the database. Dump -- dump the state of the database to . or ^C (exit) -- exit gracefully, saving the contents of the Name Server in persistent shared memory. Note that the dump file is stored in ASCII with exactly the same format as the input file. Also, one can easily change the test application so that a call to Dump results in the state of the database dumped to standard output instead of a file. ace-8.0.4+dfsg.orig/netsvcs/clients/Naming/Client/0000755000175000017500000000000015046037655020753 5ustar sudipsudipace-8.0.4+dfsg.orig/netsvcs/clients/Naming/Client/Client.mpc0000644000175000017500000000023715027201773022665 0ustar sudipsudip// -*- MPC -*- project(Netsvcs_Client_Test) : aceexe { avoids += ace_for_tao exename = client_test Source_Files { main.cpp Client_Test.cpp } } ace-8.0.4+dfsg.orig/netsvcs/clients/Naming/Client/svc.conf0000644000175000017500000000040415027201773022404 0ustar sudipsudip # Note that $PORT is an environment variable that is # automatically interpreted and substituted by ACE! # static ACE_Naming_Context "main -p $PORT -h tango" dynamic ACE_Naming_Context Service_Object * ACE:_make_ACE_Naming_Context () "main -p $PORT -h tango" ace-8.0.4+dfsg.orig/netsvcs/clients/Naming/Client/Client_Test.cpp0000644000175000017500000003425015027201773023671 0ustar sudipsudip#include "ace/Service_Config.h" #include "ace/Naming_Context.h" #include "ace/Dynamic_Service.h" #include "ace/Thread_Manager.h" #include "ace/Reactor.h" #include "ace/os_include/os_ctype.h" #include "ace/OS_NS_signal.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_ctype.h" #include "ace/os_include/os_assert.h" #include "Client_Test.h" // Get the instance of Name_Service using Dynamic_Service //inline Name_Service * //NAME_SERVICE () inline ACE_Naming_Context * NAMING_CONTEXT () { return ACE_Dynamic_Service::instance ("ACE_Naming_Context"); } Client_Test::Client_Test () { ACE_DEBUG ((LM_DEBUG, "Client_Test::Client_Test\n")); } int Client_Test::open () { // Cache the name options. this->name_options_ = NAMING_CONTEXT ()->name_options (); this->display_menu (); if (ACE_Event_Handler::register_stdin_handler (this, ACE_Reactor::instance (), ACE_Thread_Manager::instance ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "register_stdin_handler"), -1); return 0; } int Client_Test::close () { // Deregister this handler with the ACE_Reactor. return ACE_Reactor::instance ()->remove_handler (ACE_STDIN, ACE_Event_Handler::DONT_CALL | ACE_Event_Handler::READ_MASK); } int Client_Test::handle_input (ACE_HANDLE) { char option[BUFSIZ]; char buf1[BUFSIZ]; char buf2[BUFSIZ]; char buf3[BUFSIZ]; char *temp_buf; int port; char input[1024]; if (::scanf ("%s", option) <= 0) ACE_ERROR_RETURN ((LM_ERROR, "%p Try again!\n", "Client_Test::handle_input"), 0); int result = -1; switch (ACE_OS::ace_isupper (option[0]) ? ACE_OS::ace_tolower (option[0]) : option[0]) { case 'p' : result = this->set_proc_local (); break; case 'n' : result = this->set_node_local (); break; case 'h' : if (::scanf ("%s %d", buf1, &port) <= 0) break; result = this->set_host (buf1, port); break; case 'b' : // get the input from stdin ACE_OS::fgets (input, sizeof input, stdin); // get the key if (0 != (temp_buf = ACE_OS::strtok (input, " "))) { ACE_OS::strcpy (buf1, temp_buf); temp_buf = ACE_OS::strtok (0, " "); // get the value if (temp_buf) { ACE_OS::strcpy (buf2, temp_buf); temp_buf = ACE_OS::strtok (0, " "); // get the type (if entered). if (temp_buf) { ACE_OS::strcpy (buf3, temp_buf); result = this->bind (buf1, buf2, buf3); } else result = this->bind (buf1, buf2); } else ACE_ERROR ((LM_ERROR, "Bind Failed! Value not entered.\n")); } else ACE_ERROR ((LM_ERROR, "Bind Failed! Key and Value not entered.\n")); break; case 'u' : if (::scanf ("%s", buf1) <= 0) break; result = this->unbind (buf1); break; case 'r' : // get the input from stdin ACE_OS::fgets (input, sizeof input, stdin); temp_buf = ACE_OS::strtok (input, " "); // get the key if (temp_buf) { ACE_OS::strcpy (buf1, temp_buf); temp_buf = ACE_OS::strtok (0, " "); // get the value if (temp_buf) { ACE_OS::strcpy (buf2, temp_buf); temp_buf = ACE_OS::strtok (0, " "); // get the type (if entered) if (temp_buf) { ACE_OS::strcpy (buf3, temp_buf); result = this->rebind (buf1, buf2, buf3); } else result = this->rebind (buf1, buf2); } else ACE_ERROR ((LM_ERROR, "Rebind Failed! Value not entered.\n")); } else ACE_ERROR ((LM_ERROR, "Reind Failed! Key and value not entered.\n")); break; case 'f' : if (::scanf ("%s", buf1) <= 0) break; result = this->find (buf1); break; case 'j' : if (::scanf ("%s", buf1) <= 0) break; else result = this->list_names (buf1); break; case 'k' : if (::scanf ("%s", buf1) <= 0) break; else result = this->list_values (buf1); break; case 'l' : if (::scanf ("%s", buf1) <= 0) break; else result = this->list_types (buf1); break; case 'c' : if (::scanf ("%s", buf1) <= 0) break; else result = this->list_name_entries (buf1); break; case 'd' : if (::scanf ("%s", buf1) <= 0) break; else result = this->list_value_entries (buf1); break; case 'e' : if (::scanf ("%s", buf1) <= 0) break; else result = this->list_type_entries (buf1); break; case 'q' : result = -1; break; default : ACE_DEBUG ((LM_DEBUG, "Unrecognized command.\n")); } if (result == -1) ACE_Reactor::instance ()->end_reactor_event_loop (); else this->display_menu (); return result; } void Client_Test::display_menu () { ACE_DEBUG ((LM_DEBUG, "\n")); this->list_options (); ACE_DEBUG ((LM_DEBUG, " Name Service Main Menu\n")); ACE_DEBUG ((LM_DEBUG, " ----------------------\n")); ACE_DEBUG ((LM_DEBUG, "

Use Process Local Database\n")); ACE_DEBUG ((LM_DEBUG, " Use Node Local Database\n")); ACE_DEBUG ((LM_DEBUG, " Set Remote Name server and \n\n")); ACE_DEBUG ((LM_DEBUG, " Bind []\n")); ACE_DEBUG ((LM_DEBUG, " Unbind \n")); ACE_DEBUG ((LM_DEBUG, " Rebind []\n")); ACE_DEBUG ((LM_DEBUG, " Find \n")); ACE_DEBUG ((LM_DEBUG, " Lookup keys matching \n")); ACE_DEBUG ((LM_DEBUG, " Lookup values matching \n")); ACE_DEBUG ((LM_DEBUG, " Lookup types matching \n")); ACE_DEBUG ((LM_DEBUG, " Complete lookup keys matching \n")); ACE_DEBUG ((LM_DEBUG, " Complete lookup values matching \n")); ACE_DEBUG ((LM_DEBUG, " Complete lookup types matching \n")); ACE_DEBUG ((LM_DEBUG, " or ^C (exit)\n")); } void Client_Test::list_options () { switch (this->name_options_->context ()) { case ACE_Naming_Context::PROC_LOCAL: ACE_DEBUG ((LM_DEBUG, " *** Using Process Local Database\n")); break; case ACE_Naming_Context::NODE_LOCAL: ACE_DEBUG ((LM_DEBUG, " *** Using Node Local Database\n")); break; case ACE_Naming_Context::NET_LOCAL: ACE_DEBUG ((LM_DEBUG, " *** Hostname: %s\n", this->name_options_->nameserver_host ())); ACE_DEBUG ((LM_DEBUG, " *** Port Number: %d\n", this->name_options_->nameserver_port ())); break; default: ACE_ERROR ((LM_ERROR, "ERROR: shouldn't occur!\n")); break; } ACE_DEBUG ((LM_DEBUG, " *** Namespace directory is %s ***\n", this->name_options_->namespace_dir ())); } int Client_Test::set_proc_local () { // Close down original name space NAMING_CONTEXT ()->close (); this->name_options_->nameserver_host (ACE_TEXT ("localhost")); this->name_options_->context (ACE_Naming_Context::PROC_LOCAL); return NAMING_CONTEXT ()->open (ACE_Naming_Context::PROC_LOCAL); } int Client_Test::set_node_local () { // Close down original name space NAMING_CONTEXT ()->close (); this->name_options_->nameserver_host (ACE_TEXT ("localhost")); this->name_options_->context (ACE_Naming_Context::NODE_LOCAL); return NAMING_CONTEXT ()->open (ACE_Naming_Context::NODE_LOCAL); } int Client_Test::set_host (const char *hostname, int port) { // Close down original name space NAMING_CONTEXT ()->close (); this->name_options_->context (ACE_Naming_Context::NET_LOCAL); // Set Name Options this->name_options_->nameserver_host (ACE_TEXT_CHAR_TO_TCHAR (hostname)); this->name_options_->nameserver_port (port); return NAMING_CONTEXT ()->open (ACE_Naming_Context::NET_LOCAL); } int Client_Test::bind (const char *key, const char *value, const char *type) { if (NAMING_CONTEXT ()->bind (key, value, type) != 0) ACE_ERROR_RETURN ((LM_ERROR, "%p Bind failed! Key %s exists\n", "Client_Test::bind", key), 0); return 0; } int Client_Test::unbind (const char *key) { if (NAMING_CONTEXT ()->unbind (key) != 0) ACE_ERROR_RETURN ((LM_ERROR, "%p Unbind failed! Key %s not found\n", "Client_Test::unbind", key), 0); return 0; } int Client_Test::rebind (const char *key, const char *value, const char *type) { int result = NAMING_CONTEXT ()->rebind (key, value, type ); return result == 1 ? 0 : result; } int Client_Test::list_names (const char *pattern) { ACE_PWSTRING_SET set; if (NAMING_CONTEXT ()->list_names (set, pattern) != 0) ACE_ERROR_RETURN ((LM_ERROR, "%p Pattern matching failed!\n", "Client_Test::list_names"), 0); else { ACE_PWSTRING_ITERATOR set_iterator (set); for (ACE_NS_WString *name = 0; set_iterator.next (name) !=0; set_iterator.advance()) ACE_DEBUG ((LM_DEBUG, "%s\n", name->char_rep ())); } return 0; } int Client_Test::list_values (const char *pattern) { ACE_PWSTRING_SET set; if (NAMING_CONTEXT ()->list_values (set, pattern) != 0) ACE_ERROR_RETURN ((LM_ERROR, "%p Pattern matching failed!\n", "Client_Test::list_values"), 0); else { ACE_PWSTRING_ITERATOR set_iterator (set); for (ACE_NS_WString *value = 0; set_iterator.next (value) !=0; set_iterator.advance()) ACE_DEBUG ((LM_DEBUG, "%s\n", value->char_rep ())); } return 0; } int Client_Test::list_types (const char *pattern) { ACE_PWSTRING_SET set; if (NAMING_CONTEXT ()->list_types (set, pattern) != 0) ACE_ERROR_RETURN ((LM_ERROR, "%p Pattern matching failed!\n", "Client_Test::list_types"), 0); else { ACE_PWSTRING_ITERATOR set_iterator (set); for (ACE_NS_WString *type = 0; set_iterator.next (type) !=0; set_iterator.advance()) ACE_DEBUG ((LM_DEBUG, "%s\n", type->char_rep ())); } return 0; } int Client_Test::list_name_entries (const char *pattern) { ACE_BINDING_SET set; if (NAMING_CONTEXT ()->list_name_entries (set, pattern) != 0) ACE_ERROR_RETURN ((LM_ERROR, "%p Pattern matching failed!\n", "Client_Test::list_names"), 0); else { ACE_BINDING_ITERATOR set_iterator (set); for (ACE_Name_Binding *entry = 0; set_iterator.next (entry) !=0; set_iterator.advance()) { ACE_DEBUG ((LM_DEBUG, "%s\t", entry->name_.char_rep ())); ACE_DEBUG ((LM_DEBUG, "%s\t", entry->value_.char_rep ())); if (entry->type_) ACE_DEBUG ((LM_DEBUG, "%s\n", entry->type_)); } } return 0; } int Client_Test::list_value_entries (const char *pattern) { ACE_BINDING_SET set; if (NAMING_CONTEXT ()->list_value_entries (set, pattern) != 0) ACE_ERROR_RETURN ((LM_ERROR, "%p Pattern matching failed!\n", "Client_Test::list_values"), 0); else { ACE_BINDING_ITERATOR set_iterator (set); for (ACE_Name_Binding *entry = 0; set_iterator.next (entry) !=0; set_iterator.advance()) { ACE_DEBUG ((LM_DEBUG, "%s\t", entry->name_.char_rep ())); ACE_DEBUG ((LM_DEBUG, "%s\t", entry->value_.char_rep ())); if (entry->type_) ACE_DEBUG ((LM_DEBUG, "%s\n", entry->type_)); } } return 0; } int Client_Test::list_type_entries (const char *pattern) { ACE_BINDING_SET set; if (NAMING_CONTEXT ()->list_type_entries (set, pattern) != 0) ACE_ERROR_RETURN ((LM_ERROR, "%p Pattern matching failed!\n", "Client_Test::list_types"), 0); else { ACE_BINDING_ITERATOR set_iterator (set); for (ACE_Name_Binding *entry = 0; set_iterator.next (entry) !=0; set_iterator.advance()) { ACE_DEBUG ((LM_DEBUG, "%s\t", entry->name_.char_rep ())); ACE_DEBUG ((LM_DEBUG, "%s\t", entry->value_.char_rep ())); ACE_DEBUG ((LM_DEBUG, "%s\n", entry->type_)); } } return 0; } int Client_Test::find (const char *key) { char *value = 0; char *type = 0; if (NAMING_CONTEXT ()->resolve (key, value, type) != 0) ACE_ERROR_RETURN ((LM_ERROR, "%p Find failed! Key %s not found\n", "Client_Test::list_find", key), 0); else { ACE_DEBUG ((LM_DEBUG, "Binding for %s : value = %s\ttype = %s\n", key, value, type)); if (type) delete [] type; return 0; } } ace-8.0.4+dfsg.orig/netsvcs/clients/Naming/Client/Client_Test.h0000644000175000017500000000345715027201773023343 0ustar sudipsudip// -*- C++ -*- #include "ace/Event_Handler.h" #include "ace/Naming_Context.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ class Client_Test : public ACE_Event_Handler { public: Client_Test (); int open (); // Cache reactor and then register self with reactor int close (); // Close things down and free up resources. virtual int handle_input (ACE_HANDLE handle); // Handle user entered commands void list_options (); // Print name options int bind (const char *key, const char *value, const char *type = ""); // Bind a key to a value int unbind (const char *key); // Unbind a name binding int rebind (const char *key, const char *value, const char *type = ""); // Rebind a name binding int find (const char *key); // Find the value associated with a key int list_names (const char *pattern); // Find all names that match pattern int list_values (const char *pattern); // Find all values that match pattern int list_types (const char *pattern); // Find all types that match pattern int list_name_entries (const char *pattern); // Find all names that match pattern int list_value_entries (const char *pattern); // Find all values that match pattern int list_type_entries (const char *pattern); // Find all types that match pattern private: ACE_Name_Options *name_options_; // Name Options associated with the Naming Context void display_menu (); // Display user menu int set_proc_local (); // Set options to use PROC_LOCAL naming context int set_node_local (); // Set options to use NODE_LOCAL naming context int set_host (const char *hostname, int port); // Set options to use NET_LOCAL naming context specifying host name // and port number }; ace-8.0.4+dfsg.orig/netsvcs/clients/Naming/Client/svc2.conf0000644000175000017500000000070515027201773022472 0ustar sudipsudip # Note that $DB and $PORT are environment variables that are # automatically interpreted and substituted by ACE! In addition, note # how you can give a relative name for the libACE_svcs.so and ACE will # locate this for you automatically by reading your LD search path! dynamic ACE_Naming_Context Service_Object * ACE:_make_ACE_Naming_Context () "main -s $DB" dynamic ACE_Naming_Context2 Service_Object * ACE:_make_ACE_Naming_Context () "main -s $DB" ace-8.0.4+dfsg.orig/netsvcs/clients/Naming/Client/main.cpp0000644000175000017500000000354415027201773022402 0ustar sudipsudip// Test the client-side of the ACE Name Server... #include "ace/Service_Config.h" #include "ace/Naming_Context.h" #include "ace/ARGV.h" #include "ace/Log_Msg.h" #include "ace/Reactor.h" #include "Client_Test.h" int ACE_TMAIN (int, ACE_TCHAR *argv[]) { ACE_Service_Config daemon; ACE_ARGV new_args; // Load the existing into our new one. new_args.add (argv); // Enable loading of static services. new_args.add (ACE_TEXT ("-y")); // Enable debugging within dynamically linked services. new_args.add (ACE_TEXT ("-d")); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("argc = %d\n"), new_args.argc ())); // Print the contents of the combined . for (int i = 0; i < new_args.argc (); i++) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d) %s\n"), i, new_args.argv ()[i])); if (daemon.open (new_args.argc (), new_args.argv ()) == -1) { if (errno != ENOENT) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), 1); else // Use static binding. { ACE_ARGV args; args.add (argv[0]); args.add (ACE_TEXT ("-p10011")); // Port number. ACE_Service_Object *so = ACE_SVC_INVOKE (ACE_Naming_Context); if (so->init (args.argc (), args.argv ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_Naming_Context")), 1); } } Client_Test test_body; if (test_body.open () == -1) return 1; // Run forever, performing the configured services until we are shut // down by a SIGINT/SIGQUIT signal. ACE_Reactor::instance ()->run_reactor_event_loop (); test_body.close (); return 0; } ace-8.0.4+dfsg.orig/netsvcs/clients/Naming/Client/README0000644000175000017500000001172315027201773021630 0ustar sudipsudip This directory contains a test for the ACE_Name_Server library. This test program also illustrates how to use the ACE Service_Config mechanism, which enables the client code to be dynamically linked into the process at installation-time or run-time. The client test is an application that allows the user to vary the test parameters through the following menu driven interface: Name Service Main Menu ---------------------- *** Using Process Local Database ***

Use Process Local Database Use Node Local Database Set Remote Name server and Bind [] Unbind Rebind [] Find Lookup keys matching Lookup values matching Lookup types matching Complete lookup keys matching Complete lookup values matching Complete lookup types matching or ^C (exit) Initially, the user can select the type of database -- process local, node local, or net local -- from the menu.

uses the process local database (i.e., the database is called the same name as the process and stored in /tmp). uses the node local database (which defaults to /tmp/localnames). uses the net local database by specifying host and port number (by default this is stored in a file called /tmp/globalnames on the server). The user can then create new bindings, delete existing bindings, or rebind bindings: Bind [] -- binds the key to the value and adds the binding to the database. Note that type information is optional. Unbind -- unbind a binding whose key is Rebind [] -- rebind to . Once again is optional. Find -- find the binding associated with key or ^C (exit) -- exit gracefully, saving the contents of the Name Server in persistent shared memory. In addition, the user can do pattern matching for keys, values, and types. Note that pattern matching is supported using regular expressions. Lookup keys matching -- find all keys that match Lookup values matching -- find all values that match Lookup types matching -- find all types that match Complete lookup keys matching -- find all bindings whose keys match Complete lookup values matching -- find all bindings whose values match Complete lookup types matching -- find all bindings whose types match ------------------------- Running the tests: The test program uses a DLL supported by the svc.conf file, which allows them to configure the client-side dynamically. The client test program accomplishes this by making use of a Singleton proxy object (Name_Service) to provide an interface to the client-side. The test programs rely on svc.conf to provide the necessary parameters for dynamically linking the Name Service library and then executing. In the absence of svc.conf, the test programs would use static binding. client: The client test can be started without any parameters. However, if the user wants to use the net local database, the hostname and the port number of the server containing the net local database can be given at "command line" in the svc.conf file, e.g.: dynamic ACE_Naming_Context Service_Object * libACE.so:_make_ACE_Naming_Context () "main -h tango.cs -p 7891" dynamic Name_Server_test Service_Object * .shobj/Client_Test.so:_make_Client_Test () "" The above example starts the client test application and sets up a connection to port 7891 to a Name Server running on tango.cs, which has the net local database. The Client_Test directive must come after ACE_Naming_Context since it relies on the ACE_Naming_Context having been dynamically linked. Note that you can also use environment variables in the "command line", as follows: dynamic ACE_Naming_Context Service_Object * libACE.so:_make_ACE_Naming_Context () "main -s $DB -p $PORT -h tango" dynamic Name_Server_test Service_Object * .shobj/Client_Test.so:_make_Client_Test () "" In this example, $DB and $PORT are environment variables that are automatically interpreted and substituted by ACE. In addition, note how you can give a relative name for the libACE_svcs.so and ACE will locate this for you automatically by reading your LD search path. server: The name server is needed only in the case where the net local database needs to be accessed. The server test needs to run on the machine that contains the net local database. To execute the server test, the user has to specify the port number at which the server will be listening in the svc.conf file. An implementation of a name service for ACE is available in the $ACE_ROOT/netsvcs/{lib,servers} directories. Please see the README files there for an explanation of how to run the server. ace-8.0.4+dfsg.orig/netsvcs/clients/Tokens/0000755000175000017500000000000015046037655017567 5ustar sudipsudipace-8.0.4+dfsg.orig/netsvcs/clients/Tokens/deadlock/0000755000175000017500000000000015046037655021335 5ustar sudipsudipace-8.0.4+dfsg.orig/netsvcs/clients/Tokens/deadlock/README0000644000175000017500000000657415027201773022222 0ustar sudipsudip deadlock_detection_test This example contains two deadlock tests, mutex and rwlock tests. % ./deadlock_detection_test -u ./deadlock_detection_test: [-r test readers/writer locks] [-n ] [-h ] [-p ] [-i ignore deadlock] For both mutex and rwlock tests, -h and -p specify to use remote mutexes. -i specifies to ignore deadlock. -n is repetitions through the respective algorithms (default 100). Both tests also use Token Invariants to ensure correctness of the mutexes and readers/writer locks. ------------------------------------------------------------ If you run ./deadlock_detection_test without -r, then the following mutex test is run. The mutex test spawns two threads which attempt to deadlock. Logically, there are two tokens A and B. Here is what both threads try to do: Thread 1 Thread 2 -------- -------- Repeat 100 times Repeat 100 times acquire A acquire B acquire B acquire A release A and B release A and B repeat repeat Notice that A and B are reversed in 1 and 2. If the token manager (which is not in the public interface, but hidden behind ACE_Local_Mutex) works properly, they should detect the deadlock. If a thread detects deadlock, the resources held are released, and it starts the whole process over again. What can be confusing about the test program is all the other tricks I'm pulling to test other aspects of the library. For instance, I'm using both "global" and "local" ACE_Local_Mutexes. This is to test the ability to have multiple threads using one token proxy as well as multiple threads each using their own proxies. All the while, the same logical token is being used. If this doesn't make sense, don't worry about it. Just use the ACE_Local_Mutex any way you want. Another confusing trick is that I'm testing recursive acquisition. (Two acquires in a row.) I have to make sure that the token manager doesn't detect a recursive acquire as deadlock. To run a test, simply type: % ./deadlock_detection_test This should run 100 times through the above pseudo code. If the application halts, then we have trouble. It should never ever halt. I've included a little flag with the ACE_Local_Mutex class to allow deadlock detection to be ignored. So, if you run the test as follows, deadlock detection will be ignored. % ./deadlock_detection_test -i In this case, the application should only run about a second before deadlock occurs and the application halts. This is good. ------------------------------------------------------------ If you run ./deadlock_detection_test *with* -r, then the following rwlock test is run: There are four tokens and four threads in the rwlock test. The readers/writer tokens are: reader first writer first 1 writer first 2 writer first 3 There are three reader threads that only acquire reader locks on the above tokens. Each of the reader threads first acquire "reader first" and then one "writer first " (where is the corresponding thread's id). So reader thread 1 acquires "reader first" and then "writer first 1". There is a single writer thread that uses the following algorithm: repeat 100 acquire "writer first 1" acquire "reader first" acquire "writer first 2" acquire "reader first" acquire "writer first 3" acquire "reader first" This strange mix of readers and writer create an interesting graph of tokens that the deadlock detection algorithm must traverse. ace-8.0.4+dfsg.orig/netsvcs/clients/Tokens/deadlock/deadlock_detection_test.cpp0000644000175000017500000002253515027201773026704 0ustar sudipsudip //============================================================================= /** * @file deadlock_detection_test.cpp * * @author Tim Harrison */ //============================================================================= #include "ace/Token_Manager.h" #include "ace/Remote_Tokens.h" #include "ace/Thread.h" #include "ace/Thread_Manager.h" #include "ace/Get_Opt.h" #include "ace/Token_Invariants.h" #if defined (ACE_HAS_THREADS) && defined (ACE_HAS_THREADS_LIBRARY) typedef ACE_Token_Invariant_Manager ACE_TOKEN_INVARIANTS; static ACE_Token_Proxy *global_mutex; struct Two_Tokens { public: Two_Tokens (ACE_Thread_Manager *tm): thr_mgr_ (tm) {} ACE_Token_Proxy *first_; ACE_Token_Proxy *second_; ACE_Thread_Manager *thr_mgr_; }; struct Four_Tokens { public: Four_Tokens (ACE_Thread_Manager *tm): thr_mgr_ (tm) {} ACE_Token_Proxy *first1_; ACE_Token_Proxy *first2_; ACE_Token_Proxy *first3_; ACE_Token_Proxy *second_; ACE_Thread_Manager *thr_mgr_; }; static int ignore_deadlock = 0; static int remote_mutexes = 0; static const char *server_host = ACE_DEFAULT_SERVER_HOST; static int server_port = ACE_DEFAULT_SERVER_PORT; static int iterations = 100; static int rwlocks = 0; static void * two_token_thread (void *vp) { Two_Tokens* tm = (Two_Tokens *) vp; for (int x = 0; x < iterations; x++) { if (tm->first_->acquire () == -1) { ACE_DEBUG ((LM_DEBUG, "Deadlock detected\n")); continue; } if (ACE_TOKEN_INVARIANTS::instance ()->acquired (tm->first_) == 0) { tm->first_->dump (); ACE_ERROR_RETURN ((LM_ERROR, "violated invariant.\n"), 0); } if (tm->second_->acquire () == -1) { ACE_DEBUG ((LM_DEBUG, "Deadlock Detected\n")); goto G1; } if (ACE_TOKEN_INVARIANTS::instance ()->acquired (tm->second_) == 0) { tm->second_->dump (); ACE_ERROR_RETURN ((LM_ERROR, "violated invariant.\n"), 0); } ACE_TOKEN_INVARIANTS::instance ()->releasing (tm->second_); tm->second_->release (); G1: ACE_TOKEN_INVARIANTS::instance ()->releasing (tm->first_); tm->first_->release (); } ACE_DEBUG ((LM_DEBUG, "thread %t exiting\n")); return 0; } static void * run_writer (void *vp) { Four_Tokens *ft = (Four_Tokens *) vp; int acquire_number = 0; for (int x = 0; x < iterations; x++) { // Cycle through each of the first three tokens. ACE_Token_Proxy *t = 0; switch (acquire_number) { case 0: t = ft->first1_; break; case 1: t = ft->first2_; break; case 2: t = ft->first3_; break; } acquire_number = (acquire_number + 1) % 3; if (t->acquire () == -1) { ACE_ASSERT (errno == EDEADLK); ACE_DEBUG ((LM_DEBUG, "Deadlock detected.\n")); continue; } if (ACE_TOKEN_INVARIANTS::instance ()->acquired (t) == 0) { t->dump (); ACE_ERROR_RETURN ((LM_ERROR, "violated invariant.\n"), 0); } if (ft->second_->acquire () == -1) { ACE_ASSERT (errno == EDEADLK); ACE_DEBUG ((LM_DEBUG, "Deadlock Detected..\n")); goto G1; } if (ACE_TOKEN_INVARIANTS::instance ()->acquired (ft->second_) == 0) { ft->second_->dump (); ACE_ERROR_RETURN ((LM_ERROR, "violated invariant.\n"), 0); } ACE_TOKEN_INVARIANTS::instance ()->releasing (ft->second_); ft->second_->release (); G1: ACE_TOKEN_INVARIANTS::instance ()->releasing (t); t->release (); } ACE_DEBUG ((LM_DEBUG, "thread %t exiting\n")); return 0; } static int parse_args (int argc, ACE_TCHAR *argv[]) { ACE_LOG_MSG->open (argv[0]); ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("iuh:rp:n:"), 1); for (int c; (c = get_opt ()) != -1; ) { switch (c) { case 'r': rwlocks = 1; break; case 'i': ignore_deadlock = 1; break; case 'h': server_host = get_opt.opt_arg (); remote_mutexes = 1; break; case 'p': server_port = ACE_OS::atoi (get_opt.opt_arg ()); remote_mutexes = 1; break; case 'n': iterations = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'u': default: ACE_ERROR_RETURN ((LM_ERROR, "%n:\n" "[-r test readers/writer locks]\n" "[-n ]\n" "[-h ]\n" "[-p ]\n" "[-i ignore deadlock]\n%a", 1), -1); } } return 0; } int mutex_test () { ACE_Thread_Manager thr_mgr; Two_Tokens one (&thr_mgr); Two_Tokens two (&thr_mgr); if (remote_mutexes == 0) { global_mutex = new ACE_Local_Mutex ("global proxy", ignore_deadlock, 1); one.first_ = new ACE_Local_Mutex ("local proxy", ignore_deadlock, 1); two.second_ = new ACE_Local_Mutex ("local proxy", ignore_deadlock, 1); } else { ACE_Remote_Mutex::set_server_address (ACE_INET_Addr (server_port, server_host)); global_mutex = new ACE_Remote_Mutex ("global proxy", ignore_deadlock, 1); one.first_ = new ACE_Remote_Mutex ("local proxy", ignore_deadlock, 1); two.second_ = new ACE_Remote_Mutex ("local proxy", ignore_deadlock, 1); } one.second_ = global_mutex; two.first_ = global_mutex; // Tell the token manager to be verbose when reporting deadlock. ACE_Token_Manager::instance ()->debug (1); if (thr_mgr.spawn (ACE_THR_FUNC (two_token_thread), (void *) &one, THR_BOUND) == -1) ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "first spawn"), -1); if (thr_mgr.spawn (ACE_THR_FUNC (two_token_thread), (void *) &two, THR_BOUND) == -1) ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "second spawn"), -1); // Wait for all threads to exit. thr_mgr.wait (); return 0; } static int rwlock_test () { ACE_Thread_Manager thr_mgr; Two_Tokens reader1 (&thr_mgr); Two_Tokens reader2 (&thr_mgr); Two_Tokens reader3 (&thr_mgr); Four_Tokens writer (&thr_mgr); if (remote_mutexes == 0) { reader1.first_ = new ACE_Local_RLock ("reader first", ignore_deadlock, 1); reader1.second_ = new ACE_Local_RLock ("writer first 1", ignore_deadlock, 1); reader2.first_ = new ACE_Local_RLock ("reader first", ignore_deadlock, 1); reader2.second_ = new ACE_Local_RLock ("writer first 2", ignore_deadlock, 1); reader3.first_ = new ACE_Local_RLock ("reader first", ignore_deadlock, 1); reader3.second_ = new ACE_Local_RLock ("writer first 3", ignore_deadlock, 1); writer.first1_ = new ACE_Local_WLock ("writer first 1", ignore_deadlock, 1); writer.first2_ = new ACE_Local_WLock ("writer first 2", ignore_deadlock, 1); writer.first3_ = new ACE_Local_WLock ("writer first 3", ignore_deadlock, 1); writer.second_ = new ACE_Local_WLock ("reader first", ignore_deadlock, 1); } else { ACE_Remote_Mutex::set_server_address (ACE_INET_Addr (server_port, server_host)); reader1.first_ = new ACE_Remote_RLock ("writer first 1", ignore_deadlock, 1); reader1.second_ = new ACE_Remote_RLock ("reader first", ignore_deadlock, 1); reader2.first_ = new ACE_Remote_RLock ("writer first 2", ignore_deadlock, 1); reader2.second_ = new ACE_Remote_RLock ("reader first", ignore_deadlock, 1); reader3.first_ = new ACE_Remote_RLock ("writer first 3", ignore_deadlock, 1); reader3.second_ = new ACE_Remote_RLock ("reader first", ignore_deadlock, 1); writer.first1_ = new ACE_Remote_WLock ("writer first 1", ignore_deadlock, 1); writer.first2_ = new ACE_Remote_WLock ("writer first 2", ignore_deadlock, 1); writer.first3_ = new ACE_Remote_WLock ("writer first 3", ignore_deadlock, 1); writer.second_ = new ACE_Remote_WLock ("reader first", ignore_deadlock, 1); } // Tell the token manager to be verbose when reporting deadlock. ACE_Token_Manager::instance ()->debug (1); if (thr_mgr.spawn (ACE_THR_FUNC (two_token_thread), (void *) &reader1, THR_BOUND) == -1) ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "first spawn"), -1); if (thr_mgr.spawn (ACE_THR_FUNC (two_token_thread), (void *) &reader2, THR_BOUND) == -1) ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "first spawn"), -1); if (thr_mgr.spawn (ACE_THR_FUNC (two_token_thread), (void *) &reader3, THR_BOUND) == -1) ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "first spawn"), -1); if (thr_mgr.spawn (ACE_THR_FUNC (run_writer), (void *) &writer, THR_BOUND) == -1) ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "second spawn"), -1); // Wait for all threads to exit. thr_mgr.wait (); return 0; } int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { if (parse_args (argc, argv) == -1) return -1; if (rwlocks) rwlock_test (); else mutex_test (); ACE_DEBUG ((LM_DEBUG, "test exiting.\n")); return 0; } #else int ACE_TMAIN(int, ACE_TCHAR *[]) { ACE_ERROR_RETURN ((LM_ERROR, "threads not supported on this platform\n"), -1); } #endif /* ACE_HAS_THREADS */ ace-8.0.4+dfsg.orig/netsvcs/clients/Tokens/rw_lock/0000755000175000017500000000000015046037655021227 5ustar sudipsudipace-8.0.4+dfsg.orig/netsvcs/clients/Tokens/rw_lock/rw_locks.cpp0000644000175000017500000001601415027201773023551 0ustar sudipsudip //============================================================================= /** * @file rw_locks.cpp * * test_rw_locks shows how to use ACE_Local_RLock, ACE_Local_WLock, * ACE_Remote_RLock, and ACE_Remote_WLock. * * @author Tim Harrison */ //============================================================================= #include "ace/Get_Opt.h" #include "ace/Local_Tokens.h" #include "ace/Remote_Tokens.h" #include "ace/Thread_Manager.h" #include "ace/Token_Invariants.h" #if defined (ACE_HAS_THREADS) && defined (ACE_HAS_THREADS_LIBRARY) typedef ACE_Token_Invariant_Manager ACE_TOKEN_INVARIANTS; static ACE_Token_Proxy *global_rlock; static ACE_Token_Proxy *global_wlock; static const char *server_host = ACE_DEFAULT_SERVER_HOST; static int server_port = ACE_DEFAULT_SERVER_PORT; static int ignore_deadlock = 0; static int threads = 2; static int iterations = 50; static int debug = 0; static int remote = 0; static int reads = 4; static int write_sleep = 0; static int renew = 0; static void * run_thread (void *) { for (int x = 0; x < iterations; x++) { int y = 0; for (; y < reads; y++) { if (global_rlock->acquire () == -1) { if (ACE_Log_Msg::instance ()->errnum () == EDEADLK) { ACE_DEBUG ((LM_DEBUG, "rlock deadlock detected\n")); goto READ_DEADLOCK; } else return 0; } if (ACE_TOKEN_INVARIANTS::instance ()->acquired (global_rlock) == 0) ACE_ERROR_RETURN ((LM_ERROR, "reader acquire violated invariant.\n"), 0); ACE_DEBUG ((LM_DEBUG, "(%t) rlock acquired.\n")); } if (renew) { ACE_TOKEN_INVARIANTS::instance ()->releasing (global_rlock); if (global_rlock->renew () == -1) { if (ACE_Log_Msg::instance ()->errnum () == EDEADLK) { ACE_DEBUG ((LM_DEBUG, "rlock deadlock detected during renew\n")); goto READ_DEADLOCK; } else return 0; } ACE_DEBUG ((LM_DEBUG, "(%t) rlock renewed.\n")); if (ACE_TOKEN_INVARIANTS::instance ()->acquired (global_rlock) == 0) ACE_ERROR_RETURN ((LM_ERROR, "reader renew violated invariant.\n"), 0); } READ_DEADLOCK: for (; y > 0; y--) { ACE_TOKEN_INVARIANTS::instance ()->releasing (global_rlock); if (global_rlock->release () == 0) ACE_DEBUG ((LM_DEBUG, "(%t) r-released.\n")); } if (global_wlock->acquire () == -1) ACE_DEBUG ((LM_DEBUG, "wlock deadlock detected\n")); else { if (write_sleep) ACE_OS::sleep (1); ACE_DEBUG ((LM_DEBUG, "\t\t(%t) wlock acquired.\n")); if (ACE_TOKEN_INVARIANTS::instance ()->acquired (global_wlock) == 0) ACE_ERROR_RETURN ((LM_ERROR, "writer acquire violated invariant.\n"), 0); if (renew) { ACE_TOKEN_INVARIANTS::instance ()->releasing (global_wlock); if (global_wlock->renew () == -1) { if (ACE_Log_Msg::instance ()->errnum () == EDEADLK) { ACE_DEBUG ((LM_DEBUG, "wlock deadlock detected during renew\n")); } else return 0; } ACE_DEBUG ((LM_DEBUG, "(%t) rlock renewed.\n")); if (ACE_TOKEN_INVARIANTS::instance ()->acquired (global_wlock) == 0) ACE_ERROR_RETURN ((LM_ERROR, "writer renew violated invariant.\n"), 0); } ACE_TOKEN_INVARIANTS::instance ()->releasing (global_wlock); if (global_wlock->release () == 0) ACE_DEBUG ((LM_DEBUG, "\t\t(%t) w-released.\n")); } } ACE_DEBUG ((LM_DEBUG, "(%t) thread exiting.\n")); return 0; } static int parse_args (int argc, ACE_TCHAR *argv[]) { ACE_LOG_MSG->open (argv[0], ACE_Log_Msg::STDERR); // | ACE_Log_Msg::VERBOSE); ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("t:iun:dr:sp:h:R"), 1); for (int c; (c = get_opt ()) != -1; ) { switch (c) { case 'h': // specify the host machine on which the server is running server_host = get_opt.opt_arg (); remote = 1; break; case 'p': // specify the port on which the server is running server_port = ACE_OS::atoi (get_opt.opt_arg ()); remote = 1; break; case 't': threads = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'R': renew = 1; break; case 'r': reads = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'd': debug = 1; break; case 's': write_sleep = 1; break; case 'n': iterations = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'i': ignore_deadlock = 1; break; case 'u': // usage same as unknown. ACE_FALLTHROUGH; default: ACE_ERROR_RETURN ((LM_ERROR, "%n:\n" "[-h ]\n" "[-p ]\n" "[-i ignore deadlock]\n" "[-n ]\n" "[-R perform renews]\n" "[-r ]\n" "[-d debug]\n" "[-s sleep during writes]\n" "[-t \n", 1), -1); } } return 0; } #if defined (ACE_HAS_PTHREADS) #define SUSPEND 0 #else #define SUSPEND THR_SUSPENDED #endif int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { if (parse_args (argc, argv) == -1) return -1; if (remote) { ACE_Remote_Mutex::set_server_address (ACE_INET_Addr (server_port, server_host)); global_rlock = (ACE_Token_Proxy *) new ACE_Remote_RLock ("THE_TOKEN", ignore_deadlock, debug); global_wlock = (ACE_Token_Proxy *) new ACE_Remote_WLock ("THE_TOKEN", ignore_deadlock, debug); } else { global_rlock = (ACE_Token_Proxy *) new ACE_Local_RLock ("THE_TOKEN", ignore_deadlock, debug); global_wlock = (ACE_Token_Proxy *) new ACE_Local_WLock ("THE_TOKEN", ignore_deadlock, debug); } ACE_Thread_Manager mgr; if (mgr.spawn_n (threads, ACE_THR_FUNC (run_thread), (void *) 0, THR_BOUND | SUSPEND) == -1) ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "spawn failed"), -1); #if ! defined (ACE_HAS_PTHREADS) if (mgr.resume_all () == -1) ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "resume failed"), -1); #endif mgr.wait (); return 0; } #else int ACE_TMAIN(int, ACE_TCHAR *[]) { ACE_ERROR_RETURN ((LM_ERROR, "threads not supported on this platform\n"), -1); } #endif /* ACE_HAS_THREADS */ ace-8.0.4+dfsg.orig/netsvcs/clients/Tokens/rw_lock/README0000644000175000017500000000157215027201773022105 0ustar sudipsudip test_rw_locks shows how to use ACE_Local_RLock, ACE_Local_WLock, ACE_Remote_RLock, and ACE_Remote_WLock. Here are the options to test_rw_locks: % ./test_rw_lock -u -i ignore deadlock -n -r -d debug -s sleep during writes -t test_rw_locks spawns number of threads which perform the following algorithm: for { for acquire read lock for release read lock acquire write lock if (sleep during writes) sleep for 1 second release write lock } The output should show that multiple readers can acquire the lock for reading simultaneously (note that this also tests recursive acquisition.) When a writer lock is acquired, the output should show that no thread holds a reader lock. To run a test, simply type: % ./test_rw_lock This should show output as described above. ace-8.0.4+dfsg.orig/netsvcs/clients/Tokens/mutex/0000755000175000017500000000000015046037655020731 5ustar sudipsudipace-8.0.4+dfsg.orig/netsvcs/clients/Tokens/mutex/test_mutex.cpp0000644000175000017500000000660115027201773023632 0ustar sudipsudip //============================================================================= /** * @file test_mutex.cpp * * @author Tim Harrison */ //============================================================================= #include "ace/Get_Opt.h" #include "ace/Local_Tokens.h" #include "ace/Remote_Tokens.h" #include "ace/Thread.h" #include "ace/Thread_Manager.h" #if defined (ACE_HAS_THREADS) && defined (ACE_HAS_THREADS_LIBRARY) static ACE_Token_Proxy *mutex; static int remote_mutexes = 0; static const char *server_host = ACE_DEFAULT_SERVER_HOST; static int server_port = ACE_DEFAULT_SERVER_PORT; static int iterations = 100; static int spawn_count = 2; static void * run_test (void *) { int count = iterations; // test recursive acquisition of a global proxy while (count--) { if (mutex->acquire () == -1) { ACE_ERROR ((LM_ERROR, "(%t) %p acquire failed\n","test_mutex")); return (void *) -1; } // mutex->acquire (); if (mutex->renew () == -1) { ACE_ERROR ((LM_ERROR, "(%t) %p renew failed\n","test_mutex")); return (void *) -1; } if (mutex->release () == -1) { ACE_ERROR ((LM_ERROR, "(%t) %p release failed\n","test_mutex")); return (void *) -1; } // mutex->release (); } return 0; } static int parse_args (int argc, ACE_TCHAR *argv[]) { ACE_LOG_MSG->open (argv[0]); ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("t:uh:p:n:"), 1); for (int c; (c = get_opt ()) != -1; ) { switch (c) { case 't': spawn_count = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'h': // specify the host machine on which the server is running server_host = get_opt.opt_arg (); remote_mutexes = 1; break; case 'p': // specify the port on which the server is running server_port = ACE_OS::atoi (get_opt.opt_arg ()); remote_mutexes = 1; break; case 'n': // specify the port on which the server is running iterations = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'u': default: ACE_ERROR_RETURN ((LM_ERROR, "%n:\n" "[-h ]\n" "[-p ]\n" "[-n ]\n" "[-t ]\n" "[-h ]\n" "[-p ]\n", 1), -1); /* NOTREACHED */ } } return 0; } int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { ACE_Thread_Manager thread_mgr; if (parse_args (argc, argv) == -1) return -1; if (remote_mutexes) { ACE_Remote_Mutex::set_server_address (ACE_INET_Addr (server_port, server_host)); mutex = new ACE_Remote_Mutex ("Remote TOKEN", 0, 1); } else { mutex = new ACE_Local_Mutex ("Local TOKEN", 0, 1); } if (thread_mgr.spawn_n (spawn_count, ACE_THR_FUNC (run_test), 0, THR_BOUND) == -1) ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "spawn"), -1); thread_mgr.wait (); return 0; } #else int ACE_TMAIN (int, ACE_TCHAR *[]) { ACE_ERROR_RETURN ((LM_ERROR, "you must have threads to run this test program\n"), -1); } #endif /* ACE_HAS_THREADS */ ace-8.0.4+dfsg.orig/netsvcs/clients/Tokens/mutex/README0000644000175000017500000000114115027201773021577 0ustar sudipsudip test_mutex test_mutex tests ACE_Local_Mutex and ACE_Remote_Mutex with both local and global proxies. "Local proxies" mean that each thread uses its own proxy (but same logical token.) "Global proxy" means that all threads access the same proxy (and, of course, the same logical token.) test_mutex can take the number of threads to run from the command-line. Thus, to run the test with one thread and local mutexes, type: % ./test_mutex To run the test with 10 threads and local mutexes, type: % ./test_mutex -t 10 To run the test with 10 threads and remote mutexes, type: % ./test_mutex -t 10 -r ace-8.0.4+dfsg.orig/netsvcs/clients/Tokens/manual/0000755000175000017500000000000015046037655021044 5ustar sudipsudipace-8.0.4+dfsg.orig/netsvcs/clients/Tokens/manual/manual.cpp0000644000175000017500000002102715027201773023020 0ustar sudipsudip //============================================================================= /** * @file manual.cpp * * Allows manual operations on local and remote tokens. * * @author Tim Harrison */ //============================================================================= #include "ace/Get_Opt.h" #include "ace/Local_Tokens.h" #include "ace/Remote_Tokens.h" #include "ace/Singleton.h" #include "ace/Thread_Manager.h" #include "ace/Token_Invariants.h" #include "ace/Token_Collection.h" #include "ace/Map_Manager.h" #include "ace/Service_Config.h" #if defined (ACE_HAS_THREADS) && defined (ACE_HAS_THREADS_LIBRARY) typedef ACE_Token_Invariant_Manager ACE_TOKEN_INVARIANTS; /** * @class STDIN_Token * * @brief STDIN Token * * Translates STDIN commands to ACE Token commands. */ class STDIN_Token : public ACE_Event_Handler { public: /// Construction. STDIN_Token (); /// Parse command-line arguments. int parse_args (int argc, ACE_TCHAR *argv[]); //FUZZ: disable check_for_lack_ACE_OS /// Register with whatever event dispatcher is needed and run. ///FUZZ: enable check_for_lack_ACE_OS int open (int argc, char *argv[]); // = Event_Handler methods. int handle_input (ACE_HANDLE); int handle_exception (ACE_HANDLE); typedef ACE_CString TID; private: /// Display options. void display_menu (); /// Get or make a proxy to with a client id. ACE_Token_Proxy *get_proxy (const char *tid, const char *token, char type); /// Create a proxy to with a client id. ACE_Token_Proxy *create_proxy (const char *token, char type); // = Mapping from tid to Token_Collection. /// COLLECTION maintains a mapping from tid to a collection. typedef ACE_Map_Manager COLLECTIONS; /// Allows iterations through collections_. typedef ACE_Map_Iterator COLLECTIONS_ITERATOR; /// Allows iterations through collections_. typedef ACE_Map_Entry COLLECTIONS_ENTRY; /// A collection for each . COLLECTIONS collections_; const char *server_host_; int server_port_; int ignore_deadlock_; int debug_; int remote_; }; STDIN_Token::STDIN_Token () : server_host_ (ACE_DEFAULT_SERVER_HOST), server_port_ (ACE_DEFAULT_SERVER_PORT), ignore_deadlock_ (0), debug_ (0), remote_ (0) { } int STDIN_Token::parse_args (int argc, ACE_TCHAR *argv[]) { ACE_LOG_MSG->open (argv[0], ACE_Log_Msg::STDERR); ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("h:p:diu"), 1); for (int c; (c = get_opt ()) != -1; ) { switch (c) { case 'h': // specify the host machine on which the server is running server_host_ = get_opt.opt_arg (); remote_ = 1; break; case 'p': // specify the port on which the server is running server_port_ = ACE_OS::atoi (get_opt.opt_arg ()); remote_ = 1; break; case 'd': debug_ = 1; break; case 'i': ignore_deadlock_ = 1; break; case 'u': // usage same as unknown ACE_FALLTHROUGH; default: ACE_ERROR_RETURN ((LM_ERROR, "%n:\n" "[-h ]\n" "[-p ]\n" "[-i ignore deadlock]\n" "[-d debug]\n", 1), -1); } } if (remote_) ACE_Remote_Mutex::set_server_address (ACE_INET_Addr (server_port_, server_host_)); return 0; } int STDIN_Token::open (int argc, char *argv[]) { if (this->parse_args (argc, argv) == -1) return -1; // Register for signals. if (ACE_Reactor::instance ()->register_handler (SIGINT, this) == -1) ACE_DEBUG ((LM_DEBUG, "Can't register signal handler\n")); #if defined (ACE_WIN32) #else // Register for STDIN events with Reactor. if (ACE_Reactor::instance ()->register_handler (ACE_STDIN, this, ACE_Event_Handler::READ_MASK) == -1) ACE_ERROR_RETURN ((LM_DEBUG, "Can't register signal handler\n"), 0); #endif /* ACE_WIN32 */ this->display_menu (); #if defined (ACE_WIN32) #else ACE_Reactor::run_event_loop (); #endif /* ACE_WIN32 */ ACE_OS::printf ("Exiting...\n"); return 0; } int STDIN_Token::handle_input (ACE_HANDLE fd) { ACE_UNUSED_ARG (fd); char tid[BUFSIZ]; char token[BUFSIZ]; char type[16]; char operation[16]; if (::scanf ("%s %s %s %s", tid, token, type, operation) <= 0) { ACE_OS::printf ("Try again.\n"); return 0; } ACE_Token_Proxy *proxy = this->get_proxy (tid, token, type[0]); if (proxy == 0) return -1; switch (operation[0]) { case 'a': case 'A': if (proxy->acquire () == 0) { ACE_OS::printf ("Succeeded.\n"); if (ACE_TOKEN_INVARIANTS::instance ()->acquired (proxy) == 0) ACE_OS::printf ("Violated invariant.\n"); } else ACE_ERROR ((LM_ERROR, "%p.\n", "Acquire failed")); break; case 'n': case 'N': ACE_TOKEN_INVARIANTS::instance ()->releasing (proxy); if (proxy->renew () == 0) { ACE_OS::printf ("Succeeded.\n"); if (ACE_TOKEN_INVARIANTS::instance ()->acquired (proxy) == 0) ACE_OS::printf ("Violated invariant.\n"); } else ACE_ERROR ((LM_ERROR, "%p.\n", "Renew failed")); break; case 'r': case 'R': ACE_TOKEN_INVARIANTS::instance ()->releasing (proxy); if (proxy->release () == 0) ACE_OS::printf ("Succeeded.\n"); else ACE_ERROR ((LM_ERROR, "%p.\n", "Release failed")); break; case 't': case 'T': if (proxy->tryacquire () == 0) { ACE_OS::printf ("Succeeded.\n"); if (ACE_TOKEN_INVARIANTS::instance ()->acquired (proxy) == 0) ACE_OS::printf ("Violated invariant.\n"); } else ACE_ERROR ((LM_ERROR, "%p.\n", "Tryacquire failed")); break; } this->display_menu (); return 0; } void STDIN_Token::display_menu () { ACE_OS::printf (" \n"); } int STDIN_Token::handle_exception (ACE_HANDLE fd) { ACE_UNUSED_ARG (fd); ACE_Reactor::run_event_loop (); return -1; } ACE_Token_Proxy * STDIN_Token::get_proxy (const char *_tid, const char *token, char type) { ACE_Token_Collection *proxy_collection; TID tid (_tid); if (collections_.find (tid, proxy_collection) == -1) // We did not find a proxy_collection. { // Make one. proxy_collection = new ACE_Token_Collection (debug_, "no name collection"); // Put it in the collections. if (collections_.bind (tid, proxy_collection) == -1) { delete proxy_collection; return 0; } } // Either way, we have a proxy_collection now. // See if the proxy already exists in the collection. ACE_Token_Proxy *proxy = proxy_collection->is_member (token); // If not, create one. if (proxy == 0) { proxy = this->create_proxy (token, type); // Put the new_proxy in this tid's collection. if (proxy_collection->insert (*proxy) == -1) ACE_ERROR_RETURN ((LM_ERROR, "insert failed\n"), 0); // Delete our copy (one was created in the collection). delete proxy; proxy = proxy_collection->is_member (token); if (proxy == 0) ACE_ERROR_RETURN ((LM_ERROR, "is_member failed\n"), 0); // Set the client_id (it was set to 1 since we're // single-threaded. proxy->client_id (_tid); } return proxy; } ACE_Token_Proxy * STDIN_Token::create_proxy (const char *token, char type) { switch (type) { case 'm': case 'M': if (remote_) return new ACE_Remote_Mutex (token, ignore_deadlock_, debug_); else return new ACE_Local_Mutex (token, ignore_deadlock_, debug_); case 'r': case 'R': if (remote_) return new ACE_Remote_RLock (token, ignore_deadlock_, debug_); else return new ACE_Local_RLock (token, ignore_deadlock_, debug_); case 'w': case 'W': if (remote_) return new ACE_Remote_WLock (token, ignore_deadlock_, debug_); else return new ACE_Local_WLock (token, ignore_deadlock_, debug_); } // should never get here, but this avoids a compiler warning . . . return 0; } int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { STDIN_Token st; return st.open (argc, argv); } #else int ACE_TMAIN(int, ACE_TCHAR *[]) { ACE_ERROR_RETURN ((LM_ERROR, "threads or ACE_HAS_TOKENS_LIBRARY not supported on this platform\n"), -1); } #endif /* ACE_HAS_THREADS && ACE_HAS_TOKENS_LIBRARY */ ace-8.0.4+dfsg.orig/netsvcs/clients/Tokens/manual/README0000644000175000017500000000433015027201773021715 0ustar sudipsudip ./manual gives users a text-based interactive interface to local or remote tokens. This is extremely useful for manually testing the token server and setting up deadlock scenarios. Run it as follows % ./manual -u ./manual: [-h ] [-p ] [-i ignore deadlock] [-d debug] ./manual gives you the following prompt. This is the client id of the current operation. This is set manually by ./manual for every operation. Be careful when using multiple 's during a remote session (see BUGS below). This is the name of the token for the operation. This is the type of the token. This can be: M - Corresponds to a Mutex lock. R - Corresponds to Readers/Writer lock. W - Corresponds to Readers/Writer lock. Obviously, a single can be M or it can R and/or W. If you perform and operation like this "tid1 tokenA M A" then don't do this "tid1 tokenA R A". This doesn't make sense. This is the operation to perform on the -- proxy. These include: A - acquire. N - renew. R - release. T - tryacquire. BUGS!!!! When performing remote tests, be careful when using a single running ./manual to impersonate two 's. The Token Server client connection policy is currently, one per thread. The Token Server assumes that the same is always on the other end of a connection. If you do something like the following, you will break it: lambada:Tokens/manual> ./manual -h tango -p 20202 tid1 tokenA M A ACE_TSS_Connection new connection (1) acquired tokenA remotely. Succeeded. tid2 tokenA M A (1) acquired tokenA remotely. <------ This is remote BADness!!! Succeeded. Violated invariant. <------ Locally detected badness. Notice that the local side discovered that this was incorrect. However, the Token Server thinks it was a recursive acquisition for tid1. Keep in mind that this is not a problem with the Token library. It is just a problem with how this primitive ./manual application maps STDIN to the ACE Token API. ace-8.0.4+dfsg.orig/netsvcs/clients/Tokens/invariant/0000755000175000017500000000000015046037655021562 5ustar sudipsudipace-8.0.4+dfsg.orig/netsvcs/clients/Tokens/invariant/invariant.cpp0000644000175000017500000001345215027201773024257 0ustar sudipsudip //============================================================================= /** * @file invariant.cpp * * @author Tim Harrison */ //============================================================================= #include "ace/Get_Opt.h" #include "ace/Singleton.h" #include "ace/Thread_Manager.h" #include "ace/Token_Invariants.h" #if defined (ACE_HAS_THREADS) && defined (ACE_HAS_THREADS_LIBRARY) typedef ACE_Token_Invariant_Manager ACE_TOKEN_INVARIANTS; static const char *rwname = "reader/writer"; static const char *mutexname = "mutex"; static void * run_reader_writer (void *) { for (int x = 0; x < 50; x++) { int y = 0; for (; y < 5; y++) { if (ACE_TOKEN_INVARIANTS::instance ()->reader_acquired (rwname) == 0) ACE_ERROR_RETURN ((LM_ERROR, "reader acquire violated invariant.\n"), 0); ACE_DEBUG ((LM_DEBUG, "(%t) rlock acquired.\n")); } ACE_TOKEN_INVARIANTS::instance ()->rwlock_releasing (rwname); if (ACE_TOKEN_INVARIANTS::instance ()->reader_acquired (rwname) == 0) ACE_ERROR_RETURN ((LM_ERROR, "reader renew violated invariant.\n"), 0); ACE_DEBUG ((LM_DEBUG, "(%t) rlock renewed.\n")); for (; y > 0; y--) { ACE_TOKEN_INVARIANTS::instance ()->rwlock_releasing (rwname); ACE_DEBUG ((LM_DEBUG, "(%t) r-released.\n")); } if (ACE_TOKEN_INVARIANTS::instance ()->writer_acquired (rwname) == 0) ACE_ERROR_RETURN ((LM_ERROR, "writer acquire violated invariant.\n"), 0); ACE_DEBUG ((LM_DEBUG, "\t\t(%t) wlock acquired.\n")); ACE_TOKEN_INVARIANTS::instance ()->rwlock_releasing (rwname); if (ACE_TOKEN_INVARIANTS::instance ()->writer_acquired (rwname) == 0) ACE_ERROR_RETURN ((LM_ERROR, "writer renew violated invariant.\n"), 0); ACE_DEBUG ((LM_DEBUG, "(%t) rlock renewed.\n")); ACE_TOKEN_INVARIANTS::instance ()->rwlock_releasing (rwname); } ACE_DEBUG ((LM_DEBUG, "(%t) thread exiting.\n")); return 0; } static void * run_mutex (void *) { for (int x = 0; x < 50; x++) { if (ACE_TOKEN_INVARIANTS::instance ()->mutex_acquired (mutexname) == 0) ACE_ERROR_RETURN ((LM_ERROR, "mutex acquire violated invariant.\n"), 0); ACE_DEBUG ((LM_DEBUG, "(%t) mutex acquired.\n")); ACE_TOKEN_INVARIANTS::instance ()->mutex_releasing (mutexname); if (ACE_TOKEN_INVARIANTS::instance ()->mutex_acquired (mutexname) == 0) ACE_ERROR_RETURN ((LM_ERROR, "mutex renew violated invariant.\n"), 0); ACE_DEBUG ((LM_DEBUG, "(%t) mutex renewed.\n")); ACE_TOKEN_INVARIANTS::instance ()->mutex_releasing (mutexname); ACE_DEBUG ((LM_DEBUG, "(%t) mutex released.\n")); } ACE_DEBUG ((LM_DEBUG, "(%t) thread exiting.\n")); return 0; } static int run_final_test () { ACE_DEBUG ((LM_DEBUG, "starting mutex tests 1 & 2\n")); // Mutex tests. if (ACE_TOKEN_INVARIANTS::instance ()->mutex_acquired ("testing mutex") == 0) ACE_ERROR_RETURN ((LM_ERROR, "mutex test 1 failed.\n"), 0); if (ACE_TOKEN_INVARIANTS::instance ()->mutex_acquired ("testing mutex2") == 0) ACE_ERROR_RETURN ((LM_ERROR, "mutex test 2 failed.\n"), 0); if (ACE_TOKEN_INVARIANTS::instance ()->mutex_acquired ("testing mutex") == 0) ACE_DEBUG ((LM_DEBUG, "mutex test 1 succeeded.\n")); else ACE_ERROR_RETURN ((LM_ERROR, "mutex test 1 failed..\n"), 0); if (ACE_TOKEN_INVARIANTS::instance ()->mutex_acquired ("testing mutex2") == 0) ACE_DEBUG ((LM_DEBUG, "mutex test 2 succeeded.\n")); else ACE_ERROR_RETURN ((LM_ERROR, "mutex test 2 failed..\n"), 0); // RW tests. ACE_DEBUG ((LM_DEBUG, "starting rwlock tests 1 & 2\n")); // Multiple readers. if (ACE_TOKEN_INVARIANTS::instance ()->reader_acquired ("testing rwlock") == 0) ACE_ERROR_RETURN ((LM_ERROR, "rwlock test 1 failed.\n"), 0); if (ACE_TOKEN_INVARIANTS::instance ()->reader_acquired ("testing rwlock 2") == 0) ACE_ERROR_RETURN ((LM_ERROR, "rwlock test 2 failed.\n"), 0); if (ACE_TOKEN_INVARIANTS::instance ()->reader_acquired ("testing rwlock") == 0) ACE_ERROR_RETURN ((LM_ERROR, "rwlock test 1 failed..\n"), 0); if (ACE_TOKEN_INVARIANTS::instance ()->reader_acquired ("testing rwlock 2") == 0) ACE_ERROR_RETURN ((LM_ERROR, "rwlock test 2 failed..\n"), 0); // Writer. if (ACE_TOKEN_INVARIANTS::instance ()->writer_acquired ("testing rwlock") == 0) ACE_DEBUG ((LM_ERROR, "rwlock test 1 succeded.\n")); else ACE_ERROR_RETURN ((LM_ERROR, "rwlock test 1 failed...\n"), 0); // Releasing reader. ACE_TOKEN_INVARIANTS::instance ()->rwlock_releasing ("testing rwlock 2"); ACE_TOKEN_INVARIANTS::instance ()->rwlock_releasing ("testing rwlock 2"); // Writer. if (ACE_TOKEN_INVARIANTS::instance ()->writer_acquired ("testing rwlock 2") == 0) ACE_ERROR_RETURN ((LM_ERROR, "rwlock test 2 failed....\n"), 0); // Reader. if (ACE_TOKEN_INVARIANTS::instance ()->reader_acquired ("testing rwlock 2") == 0) ACE_DEBUG ((LM_DEBUG, "rwlock test 2 succeeded.\n")); else ACE_ERROR_RETURN ((LM_ERROR, "rwlock test 2 failed.....\n"), 0); return 0; } int ACE_TMAIN(int, ACE_TCHAR *[]) { ACE_Thread_Manager mgr; // Run reader/writer test if (mgr.spawn_n (2, ACE_THR_FUNC (run_reader_writer), (void *) 0, THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "spawn failed"), -1); mgr.wait (); ACE_OS::sleep (2); // Run mutex test. if (mgr.spawn_n (2, ACE_THR_FUNC (run_mutex), (void *) 0, THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "spawn failed"), -1); mgr.wait (); ACE_OS::sleep (2); run_final_test (); return 0; } #else int ACE_TMAIN(int, ACE_TCHAR *[]) { ACE_ERROR_RETURN ((LM_ERROR, "threads not supported on this platform\n"), -1); } #endif /* ACE_HAS_THREADS */ ace-8.0.4+dfsg.orig/netsvcs/clients/Tokens/invariant/README0000644000175000017500000000236615027201773022442 0ustar sudipsudip invariants.cpp tests the ACE Token Invariant utilities. The ACE Token Invariant utilities allow an application to test the correctness of mutex and readers/writer locks. invariants.cpp takes no command-line arguments. invariants.cpp first tests readers/writer locks. This is done by spawning two threads which simulate reader and writer acquire/renew/release loops. However, the loops are performed without actual locks, so the competing threads quickly reach and invalid state. The test should report this violation of readers/writer lock invariants and both threads should exit. The second test is for mutexes. Similar to the readers/writer lock test, this test spawns two threads which perform acquire/renew/release loops. When to two threads reach an invalid mutex state, the error should be reported and the threads should exit. For these two previous tests, it is theoretically possible that the threads never reach an invalid token state. However, it is highly unlikely since the threads would have to execute the same code simultaneously for the duration of the test. Nevertheless, it is possible. The last test hardwires invalid token states. It runs two mutex and two readers/writer lock tests. It should report "succeeded" for the four tests. ace-8.0.4+dfsg.orig/netsvcs/clients/Tokens/collection/0000755000175000017500000000000015046037655021722 5ustar sudipsudipace-8.0.4+dfsg.orig/netsvcs/clients/Tokens/collection/rw_locks.cpp0000644000175000017500000001110115027201773024234 0ustar sudipsudip#include "ace/Get_Opt.h" #include "ace/Local_Tokens.h" #include "ace/Remote_Tokens.h" #include "ace/Thread_Manager.h" #if defined (ACE_HAS_THREADS) && defined (ACE_HAS_THREADS_LIBRARY) static ACE_Token_Proxy *global_rlock; static ACE_Token_Proxy *global_wlock; static char *server_host = ACE_DEFAULT_SERVER_HOST; static int server_port = ACE_DEFAULT_SERVER_PORT; static int ignore_deadlock = 0; static int threads = 2; static int iterations = 50; static int debug = 0; static int remote = 0; static int reads = 4; static int write_sleep = 0; static void * run_thread (void *vp) { for (int x = 0; x < iterations; x++) { int y = 0; for (; y < reads; y++) { if (global_rlock->acquire () == -1) { if (ACE_Log_Msg::instance ()->errnum () == EDEADLK) { ACE_DEBUG ((LM_DEBUG, "rlock deadlock detected\n")); goto READ_DEADLOCK; } else return 0; } ACE_DEBUG ((LM_DEBUG, "(%t) rlock acquired.\n")); } READ_DEADLOCK: for (; y > 0; y--) { if (global_rlock->release () == 0) ACE_DEBUG ((LM_DEBUG, "(%t) r-released.\n")); } if (global_wlock->acquire () == -1) { ACE_DEBUG ((LM_DEBUG, "wlock deadlock detected\n")); } else { if (write_sleep) ACE_OS::sleep (1); ACE_DEBUG ((LM_DEBUG, "\t\t(%t) wlock acquired.\n")); if (global_wlock->release () == 0) ACE_DEBUG ((LM_DEBUG, "\t\t(%t) w-released.\n")); } } ACE_DEBUG ((LM_DEBUG, "(%t) thread exiting.\n")); return 0; } static int parse_args (int argc, ACE_TCHAR *argv[]) { ACE_LOG_MSG->open (argv[0], ACE_Log_Msg::STDERR); // | ACE_Log_Msg::VERBOSE); ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("t:iun:drR:sp:h:"), 1); for (int c; (c = get_opt ()) != -1; ) { switch (c) { case 'h': // specify the host machine on which the server is running server_host = get_opt.opt_arg (); break; case 'p': // specify the port on which the server is running server_port = ACE_OS::atoi (get_opt.opt_arg ()); break; case 't': threads = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'R': reads = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'd': debug = 1; break; case 'r': remote = 1; break; case 's': write_sleep = 1; break; case 'n': iterations = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'i': ignore_deadlock = 1; break; case 'u': // usage same as unknown. ACE_FALLTHROUGH; default: ACE_ERROR_RETURN ((LM_ERROR, "%n:\n" "[-i ignore deadlock]\n" "[-n ]\n" "[-R ]\n" "[-r use remote locks]\n" "[-d debug]\n" "[-s sleep during writes]\n" "[-t \n", 1), -1); break; } } return 0; } int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { if (parse_args (argc, argv) == -1) return -1; if (remote) { ACE_Remote_Mutex::set_server_address (ACE_INET_Addr (server_port, server_host)); global_rlock = (ACE_Token_Proxy *) new ACE_Remote_RLock ("THE_TOKEN", ignore_deadlock, debug); global_wlock = (ACE_Token_Proxy *) new ACE_Remote_WLock ("THE_TOKEN", ignore_deadlock, debug); } else { global_rlock = (ACE_Token_Proxy *) new ACE_Local_RLock ("THE_TOKEN", ignore_deadlock, debug); global_wlock = (ACE_Token_Proxy *) new ACE_Local_WLock ("THE_TOKEN", ignore_deadlock, debug); } ACE_Thread_Manager mgr; if (mgr.spawn_n (threads, ACE_THR_FUNC (run_thread), (void *) 0, THR_BOUND | THR_SUSPENDED) == -1) ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "spawn failed"), -1); if (mgr.resume_all () == -1) ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "resume failed"), -1); mgr.wait (); return 0; } #else int ACE_TMAIN(int, ACE_TCHAR *[]) { ACE_ERROR_RETURN ((LM_ERROR, "threads not supported on this platform\n"), -1); } #endif /* ACE_HAS_THREADS */ ace-8.0.4+dfsg.orig/netsvcs/clients/Tokens/collection/README0000644000175000017500000000132315027201773022572 0ustar sudipsudip Shows how applications can use the ACE_Token_Collection utility. This example creates three collections and spawns a thread to operate on each. The threads use the collective acquire, renew, and release features of ACE_Token_Collection. Here are the command-line parameters for collection: ./collection: [-h ] [-p ] [-n ] [-d debug] To run the collection locally with debugging info, type % ./collection -d To run the collection remotely with debugging info, first start a token server and the type: % ./collection -d -h -p The -n option is to control how often each thread iterates on the acquire, renew, release cycle. ace-8.0.4+dfsg.orig/netsvcs/clients/Tokens/collection/collection.cpp0000644000175000017500000001365615027201773024565 0ustar sudipsudip //============================================================================= /** * @file collection.cpp * * Shows how applications can use the ACE_Token_Collection * utility. This example creates three collections and spawns a * thread to operate on each. The threads use the collective * acquire, renew, and release features of ACE_Token_Collection. * * @author Tim Harrison */ //============================================================================= #include "ace/Get_Opt.h" #include "ace/Local_Tokens.h" #include "ace/Token_Collection.h" #include "ace/Remote_Tokens.h" #include "ace/Thread_Manager.h" #include "ace/Service_Config.h" #if defined (ACE_HAS_THREADS) && defined (ACE_HAS_THREADS_LIBRARY) static const char *server_host = ACE_DEFAULT_SERVER_HOST; static int server_port = ACE_DEFAULT_SERVER_PORT; // unused: static int threads = 2; static int iterations = 50; static int debug = 0; static int remote = 0; // unused: static int tokens = 5; static void * run_thread (void *vp) { ACE_Token_Proxy *collection = (ACE_Token_Proxy *) vp; int count = iterations; while (count--) { if (collection->acquire () == -1) { if (ACE_OS::last_error () == EDEADLK) { ACE_DEBUG ((LM_DEBUG, "deadlock detected in acquire")); continue; } ACE_ERROR ((LM_ERROR, "(%t) %p acquire failed\n","run_thread")); return (void *) -1; } ACE_DEBUG ((LM_DEBUG, "(%t) %s acquired.\n", collection->name ())); if (collection->renew () == -1) { if (ACE_OS::last_error () == EDEADLK) { ACE_DEBUG ((LM_DEBUG, "deadlock detected")); goto deadlock; } ACE_ERROR ((LM_ERROR, "(%t) %p renew failed\n","run_thread")); return (void *) -1; } ACE_DEBUG ((LM_DEBUG, "(%t) %s renewed.\n", collection->name ())); deadlock: if (collection->release () == -1) { ACE_ERROR ((LM_ERROR, "(%t) %p release failed\n","run_thread")); return (void *) -1; } ACE_DEBUG ((LM_DEBUG, "(%t) %s released.\n", collection->name ())); } ACE_DEBUG ((LM_DEBUG, "(%t) thread exiting.\n")); return 0; } static int parse_args (int argc, ACE_TCHAR *argv[]) { ACE_LOG_MSG->open (argv[0], ACE_Log_Msg::STDERR); // | ACE_Log_Msg::VERBOSE); ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("un:dp:h:"), 1); for (int c; (c = get_opt ()) != -1; ) { switch (c) { case 'h': // specify the host machine on which the server is running server_host = get_opt.opt_arg (); remote = 1; break; case 'p': // specify the port on which the server is running server_port = ACE_OS::atoi (get_opt.opt_arg ()); remote = 1; break; case 'd': debug = 1; break; case 'n': iterations = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'u': // usage same as unknown. ACE_FALLTHROUGH; default: ACE_ERROR_RETURN ((LM_ERROR, "%n:\n" "[-h ]\n" "[-p ]\n" "[-n ]\n" "[-d debug]\n", 1), -1); /* NOTREACHED */ } } return 0; } int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { if (parse_args (argc, argv) == -1) return -1; ACE_Token_Proxy *A; // Mutex *A*. ACE_Token_Proxy *B; // Mutex *B*. ACE_Token_Proxy *R; // *R*eader Lock. ACE_Token_Proxy *W; // *W*riter Lock. // Depending on the command line arguments, we will create local or // remote tokens. The names of the tokens are not important as long // as they are unique. if (remote) { ACE_Remote_Mutex::set_server_address (ACE_INET_Addr (server_port, server_host)); A = new ACE_Remote_Mutex ("R Mutex A", 0, debug); B = new ACE_Remote_Mutex ("R Mutex B", 0, debug); R = new ACE_Remote_RLock ("R Reader Lock", 0, debug); W = new ACE_Remote_WLock ("R Writer Lock", 0, debug); } else { A = new ACE_Local_Mutex ("L Mutex A", 0, debug); B = new ACE_Local_Mutex ("L Mutex B", 0, debug); R = new ACE_Local_RLock ("L Reader Lock", 0, debug); W = new ACE_Local_WLock ("L Writer Lock", 0, debug); } // These collections will be treated as Tokens by the threads. ACE_Token_Collection collectionAR (debug, "A and Reader"); ACE_Token_Collection collectionAW (debug, "A and Writer"); ACE_Token_Collection collectionBR (debug, "B and Reader"); // AR and BR can run concurrently. Neither AR or BR can run when AW // is running. collectionAR.insert (*A); collectionAR.insert (*R); collectionAW.insert (*A); collectionAW.insert (*W); collectionBR.insert (*B); collectionBR.insert (*R); // Spawn off three threads. ACE_Thread_Manager *mgr = ACE_Thread_Manager::instance (); if (mgr->spawn (ACE_THR_FUNC (run_thread), (void *) &collectionAR, THR_BOUND | THR_SUSPENDED) == -1) ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "spawn 1 failed"), -1); if (mgr->spawn (ACE_THR_FUNC (run_thread), (void *) &collectionAW, THR_BOUND | THR_SUSPENDED) == -1) ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "spawn 2 failed"), -1); if (mgr->spawn (ACE_THR_FUNC (run_thread), (void *) &collectionBR, THR_BOUND | THR_SUSPENDED) == -1) ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "spawn 3 failed"), -1); #if ! defined (ACE_HAS_PTHREADS) if (mgr->resume_all () == -1) ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "resume failed"), -1); #endif // Wait for all threads to exit. mgr->wait (); return 0; } #else int ACE_TMAIN(int, ACE_TCHAR *[]) { ACE_ERROR_RETURN ((LM_ERROR, "threads not supported on this platform\n"), -1); } #endif /* ACE_HAS_THREADS && ACE_HAS_TOKENS_LIBRARY */ ace-8.0.4+dfsg.orig/netsvcs/clients/Tokens/README0000644000175000017500000000155515027201773020446 0ustar sudipsudip This directory contains a set of tests for the ACE Tokens library. . mutex Runs a few tests on ACE_Local_Mutex and ACE_Remote_Mutex. Tests recursive acquisition and global vs local proxies. . rw_locks App for testing ACE_Local_RLock, ACE_Local_WLock, ACE_Remote_RLock, and ACE_Remote_WLock. . deadlock Tests the deadlock detection algorithm of the token manager using ACE_Local_Mutex and ACE_Remote_Mutex. . collection Tests the ACE_Token_Collection utility. Uses local and remote tokens and readers/writer locks. . invariant Tests the token Invariant testing utilities. Yes, this tests a testing utility. . manual Gives users a text-based interactive interface to local or remote tokens. This is extremely useful for manually testing the token server and setting up deadlock scenarios. ace-8.0.4+dfsg.orig/netsvcs/clients/Logger/0000755000175000017500000000000015046037655017543 5ustar sudipsudipace-8.0.4+dfsg.orig/netsvcs/clients/Logger/direct_logging.cpp0000644000175000017500000000517215027201773023225 0ustar sudipsudip// This program sends logging records directly to the server, rather // than going through the client logging daemon. #include "ace/SOCK_Connector.h" #include "ace/Log_Record.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_time.h" #include "ace/OS_NS_stdlib.h" #include "ace/OS_NS_unistd.h" #include "ace/CDR_Stream.h" static u_short LOGGER_PORT = ACE_DEFAULT_SERVER_PORT; static const ACE_TCHAR *const LOGGER_HOST = ACE_DEFAULT_SERVER_HOST; static const ACE_TCHAR *const DATA = ACE_TEXT ("hello world\n"); int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { u_short logger_port = argc > 1 ? ACE_OS::atoi (argv[1]) : LOGGER_PORT; const ACE_TCHAR *logger_host = argc > 2 ? argv[2] : LOGGER_HOST; ACE_SOCK_Stream logger; ACE_SOCK_Connector connector; ACE_INET_Addr addr (logger_port, logger_host); ACE_Log_Record log_record (LM_DEBUG, ACE_OS::time ((time_t *) 0), ACE_OS::getpid ()); if (connector.connect (logger, addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1); log_record.msg_data (DATA); const size_t max_payload_size = 4 // type() + 8 // timestamp + 4 // process id + 4 // data length + ACE_Log_Record::MAXLOGMSGLEN // data + ACE_CDR::MAX_ALIGNMENT; // padding; // Insert contents of into payload stream. ACE_OutputCDR payload (max_payload_size); payload << log_record; // Get the number of bytes used by the CDR stream. ACE_CDR::ULong length = payload.total_length (); // Send a header so the receiver can determine the byte order and // size of the incoming CDR stream. ACE_OutputCDR header (ACE_CDR::MAX_ALIGNMENT + 8); header << ACE_OutputCDR::from_boolean (ACE_CDR_BYTE_ORDER); // Store the size of the payload that follows header << ACE_CDR::ULong (length); // Use an iovec to send both buffer and payload simultaneously. iovec iov[2]; iov[0].iov_base = header.begin ()->rd_ptr (); iov[0].iov_len = 8; iov[1].iov_base = payload.begin ()->rd_ptr (); iov[1].iov_len = length; if (logger.sendv_n (iov, 2) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "send"), -1); else if (logger.close () == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "close"), -1); #if defined (ACE_WIN32) // !!Important, Winsock is broken in that if you don't close // down the connection before exiting main, you'll lose data. // More over, your server might get "Access Violation" from // within Winsock functions. // Here we close down the connection to Logger by redirecting // the logging destination back to stderr. ACE_LOG_MSG->open (0, ACE_Log_Msg::STDERR, 0); #endif /* ACE_WIN32 */ return 0; } ace-8.0.4+dfsg.orig/netsvcs/clients/Logger/Logger.mpc0000644000175000017500000000056615027201773021463 0ustar sudipsudip// -*- MPC -*- project(direct logging) : aceexe { avoids += ace_for_tao exename = direct_logging libs += netsvcs after += netsvcs Source_Files { direct_logging.cpp } } project(indirect logging) : aceexe { avoids += ace_for_tao exename = indirect_logging libs += netsvcs after += netsvcs Source_Files { indirect_logging.cpp } } ace-8.0.4+dfsg.orig/netsvcs/clients/Logger/indirect_logging.cpp0000644000175000017500000000361415027201773023553 0ustar sudipsudip// This is a simple test that sends logging records to the Client // Logging Daemon running on the localhost. This daemon then forwards // them to the Server Logging Daemon. If there is no Server Logging // Daemon, the logging records will be written to stderr. #include "ace/OS_NS_time.h" #include "ace/OS_NS_stdlib.h" #include "ace/Log_Msg.h" #include "ace/Log_Record.h" int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { const ACE_TCHAR *prog_name = argv[0]; int iterations = argc < 2 ? 10 : ACE_OS::atoi (argv[1]); const ACE_TCHAR *logger_key = argc < 3 ? ACE_DEFAULT_LOGGER_KEY : argv[2]; int verbose = argc < 4 ? 0 : ACE_Log_Msg::VERBOSE; ACE_OS::srand ((u_int) ACE_OS::time (0)); if (ACE_LOG_MSG->open (prog_name, ACE_Log_Msg::LOGGER, logger_key) == -1) { ACE_ERROR ((LM_ERROR, "Cannot open logger, using STDERR\n")); if (ACE_LOG_MSG->open (prog_name, ACE_Log_Msg::STDERR | verbose) == -1) ACE_ERROR_RETURN ((LM_ERROR, "Cannot open logger\n"), -1); } ACE_DEBUG ((LM_STARTUP, "starting up the test\n")); for (int i = 0; i < iterations; i++) { size_t priority = ACE_OS::rand () % int (LM_MAX); ACE_POW (priority); ACE_Log_Priority log_priority = ACE_Log_Priority (priority); ACE_DEBUG ((log_priority, "random message %s (%d)...\n", ACE_Log_Record::priority_name (log_priority), priority)); } ACE_DEBUG ((LM_SHUTDOWN, "closing down the test\n")); #if defined (ACE_WIN32) // !!Important, Winsock is broken in that if you don't close // down the connection before exiting main, you'll lose data. // More over, your server might get "Access Violation" from // within Winsock functions. // Here we close down the connection to Logger by redirecting // the logging destination back to stderr. ACE_LOG_MSG->open (0, ACE_Log_Msg::STDERR, 0); #endif /* ACE_WIN32 */ return 0; } ace-8.0.4+dfsg.orig/netsvcs/clients/Logger/README0000644000175000017500000000117215027201773020415 0ustar sudipsudip This directory contains two sample logging applications that implement and test the ACE distributed logging service. . indirect_logging.cpp This program talks to the ACE Client Logging Daemon on the localhost, which forwards the messages to Server Logging Daemon. The Client Logging Daemon and Server Logging Daemon both must be started before you can run this test. . direct_logging.cpp This program talks directly to the Server Logging Daemon. The Server Logging Daemon must be started before you can run this test. To start these daemons, please check out the ../../servers/ directory. ace-8.0.4+dfsg.orig/netsvcs/clients/README0000644000175000017500000000052215027201773017174 0ustar sudipsudip This directory contains a number of test programs that illustrate how to write clients for the various ACE network services. . Logger -- client programs that illustrate the ACE logging service. . Naming -- client programs that illustrate the ACE name service. . Tokens -- client programs that illustrate the ACE token service. ace-8.0.4+dfsg.orig/ACE.mwc0000644000175000017500000000100415027201772014261 0ustar sudipsudipworkspace { exclude { TAO } // The associate scope does not add directories to the workspace; // it only associates a name with one or more directories. associate(examples) { examples } associate(tests) { performance-tests tests } associate(gperf) { gperf } // The '--' is a special key that indicates that the associated // projects should be of the form @NAME@ in the generated Makefile.am. associate(--) { ACEXML ASNMP protocols KOKYU TAO } } ace-8.0.4+dfsg.orig/html/0000755000175000017500000000000015046037655014142 5ustar sudipsudipace-8.0.4+dfsg.orig/html/index.html0000644000175000017500000001214415027201773016132 0ustar sudipsudip ACE+TAO Documentation

ACE+TAO Documentation

Documentation is separated by components:



ace-8.0.4+dfsg.orig/html/Stats/0000755000175000017500000000000015046037655015240 5ustar sudipsudipace-8.0.4+dfsg.orig/html/Stats/index.html0000644000175000017500000000055715027201773017235 0ustar sudipsudip Click here to continue...just in case anything else fails ace-8.0.4+dfsg.orig/html/Stats/navigation.html0000644000175000017500000000077415027201773020266 0ustar sudipsudip ace-8.0.4+dfsg.orig/html/Stats/configuration.shtml0000644000175000017500000000407115027201773021153 0ustar sudipsudip Configuration

All the experiments run the system described below. The machine is running Linux (), and we use GCC (), to compile ACE+TAO+CIAO+DAnCE, with static libraries and optimizations enabled.

ACE+TAO+CIAO+DAnCE Configurationconfig.h

ACE+TAO+CIAO+DAnCE Configurationplatform_macros.GNU

ACE+TAO+CIAO+DAnCE Configurationdefault.features

CPU Information/proc/cpuinfo

Available Memory/proc/meminfo

OS Versionuname -a

Compiler Versiongcc -v

Library Version/lib/libc.so.6

ace-8.0.4+dfsg.orig/html/Stats/index.shtml0000644000175000017500000000550315027201773017414 0ustar sudipsudip ACE+TAO+CIAO+DAnCE Metrics

Continuous Metrics for ACE+TAO+CIAO+DAnCE


These pages track footprint, and performance metrics for ACE+TAO+CIAO+DAnCE. The results are collected from our nightly regression tests. The complete source for the tests is available as part of the ACE+TAO+CIAO+DAnCE distribution. The hardware and software configuration used for these tests is described here. Notice, however, that the results contained here may be different from what you will obtain using a TAO release or micro kit, since the experiments are based on our current source tree.

More information about ACE+TAO+CIAO+DAnCE footprints, and the continuing effort to reduce the library and application's code size can be found in the ACE+TAO+CIAO subsetting page.

Additional Development Process Related Pages

In addition to the statistics described above, a number of other ACE/TAO/CIAO/DAnCE development process related web pages we use are the following:

The Scoreboard pages contain compile- and link-time build results of recent snapshots of our main development branch.

ace-8.0.4+dfsg.orig/html/Stats/simple_footprint.shtml0000644000175000017500000001735615027201773021713 0ustar sudipsudip Footprint Metrics Detailed Results

Component Name Chart Recent results Complete History
ORB_init ORB_init_size

	      
[Download]
ORB_destroy ORB_destroy_size

	      
[Download]
libACE libACE.a_size

	      
[Download]
libTAO libTAO.a_size

	      
[Download]
libTAO_PortableServer libTAO_PortableServer.a_size

	      
[Download]
libTAO_Messaging libTAO_Messaging.a_size

	      
[Download]
libTAO_Strategies libTAO_Strategies.a_size

	      
[Download]
libTAO_DynamicAny libTAO_DynamicAny.a_size

	      
[Download]
libTAO_DynamicInterface libTAO_DynamicInterface.a_size

	      
[Download]
libTAO_IFR_Client libTAO_IFR_Client.a_size

	      
[Download]
libTAO_BiDirGIOP libTAO_BiDirGIOP.a_size

	      
[Download]
libTAO_IORManip libTAO_IORManip.a_size

	      
[Download]
libTAO_IORTable libTAO_IORTable.a_size

	      
[Download]
libTAO_TypeCodeFactory libTAO_TypeCodeFactory.a_size

	      
[Download]
libTAO_PI libTAO_PI.a_size

	      
[Download]
libTAO_PI_Server libTAO_PI_Server.a_size

        
[Download]
libTAO_RTCORBA libTAO_RTCORBA.a_size

	      
[Download]
libTAO_RTPortableServer libTAO_RTPortableServer.a_size

	      
[Download]

ace-8.0.4+dfsg.orig/html/Stats/Stats.css0000644000175000017500000000005415027201773017040 0ustar sudipsudipBODY { background: white; color: black; } ace-8.0.4+dfsg.orig/html/Stats/footprint.shtml0000644000175000017500000000240615027201773020330 0ustar sudipsudip Footprint Metrics Results

ACE+TAO+CIAO+DAnCE Footprint Metrics Results


The footprint pages are organized as follows:
  • Quick Footprint, for a high-level view that shows the sizes of libraries and two executables that represent the minimum size of TAO's client and server.
  • Detailed Footprint, for a closer look at the sizes of libraries and its dependencies.


ace-8.0.4+dfsg.orig/html/Stats/detailed_footprint.shtml0000644000175000017500000000043015027201773022156 0ustar sudipsudip Footprint Metrics for ACE+TAO+CIAO+DAnCE Page
ace-8.0.4+dfsg.orig/html/Stats/performance.shtml0000644000175000017500000001110315027201773020577 0ustar sudipsudip Performance Metrics Detailed Results

Performance Metrics Detailed Results


Results for the performance experiments in $TAO_ROOT/performance-tests/Latency. The results for all the tests are combined in a single chart.

All Invocation Modes and Configurations


The tests below are all located in $TAO_ROOT/performance-tests/Latency. Each test has a driver script that runs it, these scripts run the tests over the loopback network interface. Unless indicated otherwise, the tests use the default ORB configuration.

Test Name Chart Recent results Complete History
AMI AMI

	      
[Download]
AMH_Single_Threaded AMH_Single_Threaded

	      
[Download]
DII DII

	      
[Download]
DSI DSI

	      
[Download]
Deferred Deferred

	      
[Download]
Single_Threaded
(Configuration optimized
for single-threaded apps)
Single_Threaded

	      
[Download]
Single_Threaded Default

	      
[Download]
Thread_Per_Connection Thread_Per_Connection

	      
[Download]
Thread_Pool Thread_Pool

	      
[Download]

ace-8.0.4+dfsg.orig/html/Stats/detailed_performance.shtml0000644000175000017500000001033415027201773022437 0ustar sudipsudip Performance Metrics Detailed Results

Results for the performance experiments in $TAO_ROOT/performance-tests. The results for all the tests are combined in a single chart.

All Invocation Modes and Configurations


The tests below are all located in $TAO_ROOT/performance-tests. Each test has a driver script that runs it, these scripts run the tests over the loopback network interface. Unless indicated otherwise, the tests use the default ORB configuration.

Test Name Chart Recent results Complete History
AMI_Latency AMI

	      
[Download]
DII_Latency DII

	      
[Download]
DSI_Latency DSI

	      
[Download]
Deferred_Latency Deferred

	      
[Download]
Single_Threaded_Latency
Configuration optimized
for single-threaded apps
Single_Threaded

	      
[Download]
Single_Threaded_Latency Default

	      
[Download]
Thread_Per_Connection_Latency Thread_Per_Connection

	      
[Download]
Thread_Pool_Latency Thread_Pool

	      
[Download]
AMH_Single_Threaded AMH

	      
[Download]

ace-8.0.4+dfsg.orig/html/Stats/img.html0000644000175000017500000000113315027201773016671 0ustar sudipsudip
ace-8.0.4+dfsg.orig/html/Stats/footer.html0000644000175000017500000000017515027201773017420 0ustar sudipsudip
Johnny Willemsen
ace-8.0.4+dfsg.orig/html/doxygen.css0000644000175000017500000000005415027201773016321 0ustar sudipsudipBODY { background: white; color: black; } ace-8.0.4+dfsg.orig/html/README0000644000175000017500000000054515027201773015017 0ustar sudipsudipThe following directory is a placeholder for the Doxygen generated files. The index.html file only makes sense if you download a ACE-html.tar.gz file from: https://github.com/DOCGroup/ACE_TAO or if you generate the Doxygen documentation using the configuration files in $ACE_ROOT/etc/*.doxygen and/or the perl script in $ACE_ROOT/bin/generate_doxygen.pl ace-8.0.4+dfsg.orig/bin/0000755000175000017500000000000015046037655013746 5ustar sudipsudipace-8.0.4+dfsg.orig/bin/LabVIEW_RT/0000755000175000017500000000000015046037655015544 5ustar sudipsudipace-8.0.4+dfsg.orig/bin/LabVIEW_RT/labview_test_controller/0000755000175000017500000000000015046037655022477 5ustar sudipsudipace-8.0.4+dfsg.orig/bin/LabVIEW_RT/labview_test_controller/stdafx.cpp0000644000175000017500000000045615027201773024472 0ustar sudipsudip// stdafx.cpp : source file that includes just the standard includes // labview_test_controller.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file ace-8.0.4+dfsg.orig/bin/LabVIEW_RT/labview_test_controller/ReadMe.txt0000644000175000017500000000762215027201773024375 0ustar sudipsudip ======================================================================== DYNAMIC LINK LIBRARY : labview_test_controller Project Overview ======================================================================== The labview_test_controller DLL is needed to control execution and reporting for ACE+TAO tests on a LabVIEW RT/Pharlap ETS target. The LabVIEW RT environment can not execute programs - LabVIEW RT itself is the one program that runs on the Pharlap ETS base, so no other processes can be started. This DLL is built on the host VC7.1 Windows machine and copied to the target. The target's \ni-rt.ini file must have the full path of the labview_test_controller.dll on the target added to the [STARTUP] section, EarlyStartupLibraries key. If there are already entries in that key, append labview_test_controller.dll's path with a semi-colon separator. For example, this is what mine ended up as: [STARTUP] EarlyStartupLibraries=C:\ni-rt\system\lvuste.dll;C:\ni-rt\system\tsengine.dll;C:\ni-rt\system\nisl_emb.dll;C:\ni-rt\labview_test_controller.dll; MainExe=/ni-rt/system/emblview.exe After setting up the ni-rt.ini file and the DLL, reboot the target to load the controller DLL. Keep in mind that the current working directory while tests are running will be, at least on mine, \ni-rt\system. The test logs end up in \ni-rt\system\log. The labview_test_controller spawns a thread when the DLL is loaded at system start. The child thread starts listening on TCP port 8888. For each new connection to port 8888 a new thread is spawned to run the session. The test host issues text commands to the controller via this TCP connection. The responses are text as well. Thus, it's possible to test it using plain telnet. There's also a "test" project in this VC7.1 solution. The test project is a simple console app that calls the main thread's entrypoint in labview_test_controller, facilitating its testing on the host Windows machine where there's decent debugging capability. Debugging on the LabVIEW target is by printf only. The client side of the TCP connection that drives this test controller is in the ACE_wrappers/bin/PerlACE/ProcessLVRT.pm. The TestTarget_LVRT.pm is also involved in testing on the LabVIEW RT target. The remainder of this is what Visual Studio .NET generated for this project. ======================================================================== AppWizard has created this labview_test_controller DLL for you. This file contains a summary of what you will find in each of the files that make up your labview_test_controller application. labview_test_controller.vcproj This is the main project file for VC++ projects generated using an Application Wizard. It contains information about the version of Visual C++ that generated the file, and information about the platforms, configurations, and project features selected with the Application Wizard. labview_test_controller.cpp This is the main DLL source file. When created, this DLL does not export any symbols. As a result, it will not produce a .lib file when it is built. If you wish this project to be a project dependency of some other project, you will either need to add code to export some symbols from the DLL so that an export library will be produced, or you can set the Ignore Input Library property to Yes on the General propert page of the Linker folder in the project's Property Pages dialog box. ///////////////////////////////////////////////////////////////////////////// Other standard files: StdAfx.h, StdAfx.cpp These files are used to build a precompiled header (PCH) file named labview_test_controller.pch and a precompiled types file named StdAfx.obj. ///////////////////////////////////////////////////////////////////////////// Other notes: AppWizard uses "TODO:" comments to indicate parts of the source code you should add to or customize. ///////////////////////////////////////////////////////////////////////////// ace-8.0.4+dfsg.orig/bin/LabVIEW_RT/labview_test_controller/labview_test_controller.sln0000644000175000017500000000305615027201773030145 0ustar sudipsudipMicrosoft Visual Studio Solution File, Format Version 8.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "labview_test_controller", "labview_test_controller.vcproj", "{646E6863-F3BE-403A-8B53-20C02664907B}" ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test.vcproj", "{01781FA2-36A3-49DA-A00C-2DEAE6A286FF}" ProjectSection(ProjectDependencies) = postProject {646E6863-F3BE-403A-8B53-20C02664907B} = {646E6863-F3BE-403A-8B53-20C02664907B} EndProjectSection EndProject Global GlobalSection(SolutionConfiguration) = preSolution Debug = Debug Release = Release EndGlobalSection GlobalSection(ProjectDependencies) = postSolution EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution {646E6863-F3BE-403A-8B53-20C02664907B}.Debug.ActiveCfg = Debug|Win32 {646E6863-F3BE-403A-8B53-20C02664907B}.Debug.Build.0 = Debug|Win32 {646E6863-F3BE-403A-8B53-20C02664907B}.Release.ActiveCfg = Release|Win32 {646E6863-F3BE-403A-8B53-20C02664907B}.Release.Build.0 = Release|Win32 {01781FA2-36A3-49DA-A00C-2DEAE6A286FF}.Debug.ActiveCfg = Debug|Win32 {01781FA2-36A3-49DA-A00C-2DEAE6A286FF}.Debug.Build.0 = Debug|Win32 {01781FA2-36A3-49DA-A00C-2DEAE6A286FF}.Release.ActiveCfg = Release|Win32 {01781FA2-36A3-49DA-A00C-2DEAE6A286FF}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection GlobalSection(ExtensibilityAddIns) = postSolution EndGlobalSection EndGlobal ace-8.0.4+dfsg.orig/bin/LabVIEW_RT/labview_test_controller/labview_test_controller.vcproj0000644000175000017500000001022715027201773030652 0ustar sudipsudip ace-8.0.4+dfsg.orig/bin/LabVIEW_RT/labview_test_controller/stdafx.h0000644000175000017500000000056015027201773024133 0ustar sudipsudip// stdafx.h : include file for standard system include files, or // project specific include files that are used frequently, but are // changed infrequently // #pragma once #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers // Windows Header Files: #include // TODO: reference additional headers your program requires here ace-8.0.4+dfsg.orig/bin/LabVIEW_RT/labview_test_controller/test.vcproj0000644000175000017500000000661715027201773024706 0ustar sudipsudip ace-8.0.4+dfsg.orig/bin/LabVIEW_RT/labview_test_controller/labview_test_controller.cpp0000644000175000017500000004134715027201773030140 0ustar sudipsudip// // Defines the entry point for the LabVIEW RT test controller DLL application. // This DLL is loaded at system boot by LabVIEW RT. The controller waits for // TCP connections from the ACE+TAO test scripts. The test scripts will direct // operation of the tests via commands sent over TCP. In order to be ready for // connections without intervention via VI, the initial load will spawn a // thread that sets up the listening socket. #include "stdafx.h" #include #include #include #include #include #include #include #include #include #include #include // NULL is the documented way to check DLL handles, and this is plain // Windows code, not ACE, so we stick to the Microsoft way... // FUZZ: disable check_for_NULL // This is plain Windows code, not ACE. Therefore we disable // the check for ACE_OS // FUZZ: disable check_for_lack_ACE_OS // TEST_FUNC is the prototype for the called test's main entrypoint. It's // the normal C main. typedef int (*TEST_FUNC) (int argc, char *argv[]); // Thread entrypoints static unsigned int __stdcall test_control (void *param); static unsigned int __stdcall peer_svc (void *peer_p); static unsigned int __stdcall run_test (void *test_p); static const char *format_errmsg (unsigned int errcode, const char *prefix); // Logging information static const char *LogName = "acetao.log"; static HANDLE logf = INVALID_HANDLE_VALUE; BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { if (ul_reason_for_call == DLL_PROCESS_ATTACH) { return (0 != _beginthreadex (0, // security 8 * 1024, // stack size test_control, // entrypoint 0, // param 0, // creation flags 0)); // ptr to thread id } return TRUE; } class Test { public: Test () : dll_handle_ (NULL), thr_handle_ (0), entry_ (0), running_ (false), status_ (-1) {} ~Test (); HANDLE handle () { return this->thr_handle_; } int run (); const char *start (const char *name); bool status (int *exit_status); int wait (); void kill (); // Clean up remnants of a test run. void cleanup (); private: HMODULE dll_handle_; HANDLE thr_handle_; TEST_FUNC entry_; bool running_; int status_; enum { CMDLINE_LEN = 1024, ARGV_SIZE = 100 }; char name_[CMDLINE_LEN]; char cmdline_[CMDLINE_LEN]; int argc_; char *argv_[ARGV_SIZE]; }; class Peer { public: Peer (SOCKET h) : handle_ (h) {} // Run the Peer's session; intended to be called from a new thread devoted // to this peer's session. int svc (); private: Peer () {}; // Process command input from socket. int command (); // Send a reply string to the peer. int reply (const char *msg); SOCKET handle_; Test test_; }; // Run a peer session; assume there's a thread for each session, so this // object has all it needs for context located in 'this' object, and it can // block at any point as long as one remembers that there is one or more // test threads running and some attention must be paid to the encapsulated // socket handle over which this object receives control commands from the // host test driver. int Peer::svc () { // Read commands until EOF (peer closed) or protocol error while (0 == this->command ()) ; closesocket (this->handle_); this->handle_ = INVALID_SOCKET; return 0; } int Peer::command () { // The protocol exchanges with the peer are execpted to be lock-step // request-reply command lines, so we can make assumptions about a complete // line being available to make life easier. const int MAX_RECV = 1024; char line[MAX_RECV], *p; p = &line[0]; int count = 0, len = 0; while ((count = recv (this->handle_, p, MAX_RECV - len, 0)) > 0) { p[count] = '\0'; len += count; p += count; char *nl; if ((nl = strchr (line, '\n')) == 0) continue; // At this point we have a 0-terminated string with a newline ending // the command line. Break out and process the command. break; } if (count <= 0) return -1; // Relay closed/error socket to caller char *cmd = strtok (line, "\t \n\r"); if (cmd == 0) { char err[1024]; sprintf (err, "Can't parse input: %s\n", line); this->reply (err); return -1; } // Which command is it? These commands are known: // // run [args] // Run test in the named test-dll; respond with "OK" or an error string. // status // If test still running return "RUNNING" else return exit status. // wait // Wait for test to exit; return "OK" // kill // Kill the thread with the most recent test; return "OK". // snaplog // Take a snapshot of the current stdout/stderr log to a new file // name and reset the stdout/stderr log. if (strcmp ("run", cmd) == 0) { char *test = strtok (0, "\t \n\r"); if (test == 0) { this->reply ("Malformed run command\n"); return -1; } // start() pulls apart the rest of the command line... const char *errmsg = this->test_.start (test); if (errmsg == 0) this->reply ("OK\n"); else this->reply (errmsg); } else if (strcmp ("status", cmd) == 0) { int status; if (this->test_.status (&status)) { char retvalmsg[64]; sprintf (retvalmsg, "%d\n", status); this->reply (retvalmsg); } else this->reply ("RUNNING\n"); } else if (strcmp ("wait", cmd) == 0) { int status = this->test_.wait (); char retvalmsg[64]; sprintf (retvalmsg, "%d\n", status); this->reply (retvalmsg); } else if (strcmp ("kill", cmd) == 0) { // Killing things is bad... say we can't and the host should reboot us. this->reply ("NO - please reboot me\n"); } else if (strcmp ("waitforfile", cmd) == 0) { char *name = strtok (0, "\t \n\r"); if (name == 0) { this->reply ("Malformed waitforfile command\n"); return -1; } char *secs_s = strtok (0, "\t \n\r"); int secs = 0; if (secs_s == 0 || (secs = atoi (secs_s)) <= 0) { this->reply ("Malformed waitforfile command\n"); return -1; } struct _stat info; const char *msg = 0; bool found = false; while (secs > 0) { if (_stat (name, &info) == -1) // No file yet { if (errno != ENOENT) { // Something more serious than no file yet; bail out. msg = format_errmsg (errno, name); break; } } else { if (info.st_size > 0) { found = true; break; } } // Either no file yet, or it's there but with no content yet. Sleep (1 * 1000); // arg is in msec --secs; } if (found) this->reply ("OK\n"); else if (secs == 0) this->reply ("TIMEOUT\n"); else this->reply (msg); } else if (strcmp ("snaplog", cmd) == 0) { if (logf == INVALID_HANDLE_VALUE) { this->reply ("NONE\n"); } else { CloseHandle (logf); if (0 == rename (LogName, "snapshot.txt")) { char abspath[1024]; if (_fullpath (abspath, "snapshot.txt", 1024)) { strcat (abspath, "\n"); this->reply (abspath); } else { // Last ditch effort to get a name back to the client this->reply ("\\ni-rt\\system\\snapshot.txt\n"); } } else { this->reply ("NONE\n"); } // Reset stdout/stderr to a new file logf = CreateFile (LogName, FILE_ALL_ACCESS, FILE_SHARE_READ, 0, // security CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); SetStdHandle (STD_OUTPUT_HANDLE, logf); SetStdHandle (STD_ERROR_HANDLE, logf); } } else { this->reply ("Unrecognized command\n"); return -1; } return 0; } int Peer::reply (const char *msg) { int len = (int)strlen (msg); // size_t -> int return send (this->handle_, msg, len, 0) > 0 ? 0 : -1; } Test::~Test () { this->cleanup (); } int Test::run () { this->running_ = true; try { this->status_ = (this->entry_) (this->argc_, this->argv_); } catch (...) { // Try to note this exception then save the log file before bailing out. DWORD bl; char msg[256]; sprintf (msg, "Exception in %s caught by labview_test_controller\n", this->name_); WriteFile (logf, msg, (DWORD)strlen(msg), &bl, 0); FlushFileBuffers (logf); CloseHandle (logf); throw; } this->running_ = false; // It's possible to cleanup() here; however, that would introduce a race // with start() following beginthreadex(). So do all the cleanup on user // action - either getting status, waiting, killing, or running another // test. Or, terminating the connection. return 0; } const char * Test::start (const char *name) { if (this->running_) return "Already running\n"; const char *msg = 0; // Reset test status to not inadvertantly report a previous test. this->status_ = -1; this->cleanup (); // Resets cmdline_, argc_, argv_ // The command line is part-way through being tokenized by strtok(). It // left off after the program name. Anything remaining are the command // line arguments for the program. Pick off whatever is there, copy it // to the cmdline_ array and fill in argc_/argv_ for the eventual run. strcpy (this->name_, name); this->argv_[0] = this->name_; this->argc_ = 1; size_t cmdchars = 0; for (char *token = strtok (0, "\t \n\r"); token != 0 && (cmdchars + strlen (token) + 1) < CMDLINE_LEN; token = strtok (0, "\t \n\r")) { // We have a new token and it will fit in cmdline_. Copy it to the // next spot in cmdline_, add it to argv_/argc_ then update cmdchars // to account for the copied-in token and its nul terminator. strcpy (&this->cmdline_[cmdchars], token); this->argv_[this->argc_] = &this->cmdline_[cmdchars]; ++this->argc_; cmdchars += (strlen (token) + 1); } char libspec[1024]; sprintf (libspec, "%s.dll", name); if ((this->dll_handle_ = LoadLibrary (libspec)) == NULL) return format_errmsg (GetLastError (), libspec); this->entry_ = (TEST_FUNC) GetProcAddress (this->dll_handle_, "main"); if (this->entry_ == NULL) { msg = format_errmsg (GetLastError (), "main"); this->cleanup (); return msg; } else { unsigned int thread_id; /* unused */ uintptr_t h = _beginthreadex (0, // security 1024 * 1024, // stack size run_test, // entrypoint (void *)this, // arglist 0, // initflag &thread_id); // thread ID this->thr_handle_ = (HANDLE) h; if (h == 0) // Test thread may have access to thr_handle_ { msg = format_errmsg (GetLastError (), "spawn"); this->cleanup (); return msg; } } return 0; } bool Test::status (int *exit_status) { if (this->running_) return false; // still running *exit_status = this->status_; this->cleanup (); return true; } int Test::wait () { WaitForSingleObject (this->thr_handle_, INFINITE); if (!this->running_) this->cleanup (); return this->status_; } void Test::kill () { TerminateThread (this->thr_handle_, -1); this->cleanup (); this->running_ = false; this->status_ = -1; } // Clean up remnants of a test run. void Test::cleanup () { if (this->dll_handle_ != NULL) { FreeLibrary (this->dll_handle_); this->dll_handle_ = NULL; } if (this->thr_handle_ != 0) { CloseHandle (this->thr_handle_); this->thr_handle_ = 0; } this->entry_ = 0; this->argc_ = 0; for (int i = 0; i < ARGV_SIZE; ++i) this->argv_[i] = 0; memset (this->cmdline_, 0, CMDLINE_LEN); } static unsigned int __stdcall test_control (void * /* param */) { // cd to ace dir?? (can this be an env variable?) // redirect stdout/stderr to a file logf = CreateFile (LogName, FILE_ALL_ACCESS, FILE_SHARE_READ, 0, // security OPEN_ALWAYS, // Don't crush a previous one FILE_ATTRIBUTE_NORMAL, 0); if (logf == INVALID_HANDLE_VALUE) perror (LogName); else { SetFilePointer (logf, 0, 0, FILE_END); // Append new content SetStdHandle (STD_OUTPUT_HANDLE, logf); SetStdHandle (STD_ERROR_HANDLE, logf); } WORD want; WSADATA offer; want = MAKEWORD (2, 2); if (0 != WSAStartup (want, &offer)) { perror ("WSAStartup"); CloseHandle (logf); return WSAGetLastError (); } // listen on port 8888 (can I set an env variable for this?) SOCKET acceptor = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); sockaddr_in listen_addr; memset (&listen_addr, 0, sizeof (listen_addr)); listen_addr.sin_family = AF_INET; listen_addr.sin_addr.s_addr = INADDR_ANY; listen_addr.sin_port = htons (8888); if (SOCKET_ERROR == bind (acceptor, (struct sockaddr *)&listen_addr, sizeof (listen_addr))) { perror ("bind"); } else { listen (acceptor, 10); SOCKET peer; while ((peer = accept (acceptor, 0, 0)) != INVALID_SOCKET) { Peer *p = new Peer (peer); if (p == 0) { perror ("Out of memory"); closesocket (peer); peer = INVALID_SOCKET; continue; } if (0 == _beginthreadex (0, // security 64 * 1024, // stack size peer_svc, // entrypoint (void *)p, // param 0, // creation flags 0)) // ptr to thread id { perror ("beginthreadex peer"); closesocket (peer); delete p; } p = 0; peer = INVALID_SOCKET; } perror ("accept"); } closesocket (acceptor); WSACleanup (); return 0; } // Entrypoint for thread that's spawned to run a peer's session. Direct // control to the peer class. static unsigned int __stdcall peer_svc (void *peer_p) { Peer *p = (Peer *)peer_p; DWORD status = p->svc (); delete p; return status; } // Entrypoint for the thread spawned to run a test. The thread arg is the // Test * - call back to the test's run() method; return the test exit code // as the thread's return value. static unsigned int __stdcall run_test (void *test_p) { Test *t = (Test *)test_p; return t->run (); } // Format a Windows system or Winsock error message given an error code. static const char * format_errmsg (unsigned int errcode, const char *prefix) { static const size_t errmsgsize = 1024; static char errmsg[errmsgsize]; sprintf (errmsg, "%s: ", prefix); size_t len = strlen (errmsg); char *next = &errmsg[len]; size_t max_fmt = errmsgsize - len; if (0 != FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 0, errcode, 0, // Use default language next, (DWORD)max_fmt, 0)) { strcat (errmsg, "\n"); return errmsg; } errno = errcode; char *msg = _strerror (prefix); sprintf (errmsg, "err %d: %s", errcode, msg); return errmsg; } #ifdef TEST_RUNNER_EXPORTS #define TEST_RUNNER_API __declspec(dllexport) #else #define TEST_RUNNER_API __declspec(dllimport) #endif __declspec(dllexport) int test_entry() { return 0; } ace-8.0.4+dfsg.orig/bin/LabVIEW_RT/labview_test_controller/test.cpp0000644000175000017500000000056115027201773024155 0ustar sudipsudip#include __declspec(dllimport) int test_entry(); // This is plain Windows code, not ACE. Therefore we disable // the check for ACE_OS // FUZZ: disable check_for_lack_ACE_OS // FUZZ: disable check_for_improper_main_declaration int main (int, char *[]) { char line[80]; test_entry(); puts ("Ok, go... hit return to stop."); gets (line); return 0; } ace-8.0.4+dfsg.orig/bin/LabVIEW_RT/Reboot_Target.ini0000755000175000017500000000404515027201773021004 0ustar sudipsudip[Reboot_Target] server.app.propertiesEnabled=True server.ole.enabled=True server.tcp.paranoid=True server.tcp.servic="My Computer/VI Server" server.vi.callsEnabled=True server.vi.propertiesEnabled=True WebServer.DirectoryIndex="index.htm" WebServer.MimeTypes="htm;text/html;gif;image/gif;jpg;image/jpeg;png;image/png;txt;text/plain;html;text/html;jpeg;image/jpeg;css;text/css;llb;application/x-labview-llb;vi;application/x-labview-vi;doc;application/msword;dot;application/msword;bin;application/octet-stream;exe;application/octet-stream;rtf;application/rtf;pdf;application/pdf;ai;application/postscript;eps;application/postscript;ps;application/postscript;csh;application/x-csh;gtar;application/x-gtar;gz;application/x-gz;sh;application/x-sh;tar;application/x-tar;zip;application/zip;hqx;application/mac-binhex40;ua;audio/basic;wav;audio/wav;tif;image/tiff;tiff;image/tiff;xbm;image/x-xbitmap;rtx;text/richtext;qt;video/quicktime;mov;video/quicktime;avi;video/x-msvideo;movie;video/x-sgi-movie;aif;audio/aif;aifc;audio/aif;aiff;audio/aif;aim;application/x-aim;dif;video/x-dv;div;video/x-dv;js;application/x-javascript;pntg;image/x-macpaint;xlb;application/vnd.ms-excel;xls;application/vnd.ms-excel;ppa;application/vnd.ms-powerpoint;ppt;application/vnd.ms-powerpoint;pps;application/vnd.ms-powerpoint;pot;application/vnd.ms-powerpoint;pwz;application/vnd.ms-powerpoint;mid;audio/mid;midi;audio/mid;enc;video/mpeg;m1v;video/mpeg;mp2;video/mpeg;mpa;video/mpeg;mpe;video/mpeg;mpeg;video/mpeg;mpg;video/mpeg;psd;image/x-photoshop;bmp;image/bmp;pic;image/pic;ra;audio/vnd.rn-realaudio;rf;image/vnd.rf-realflash;rm;application/vnd.rn-realmedia;rp;image/vnd.rn-realpix;ram;audio/x-pn-realaudio;rmm;audio/x-pn-realaudio;rnx;application/vnd.rn-realplayer;rt;text/vnd.rn-realtext;rv;video/vnd.rn-realvideo;smi;application/smil;ssm;application/streamingmedia;sithqx;application/mac-binhex40;sit;application/x-stuffit" WebServer.RootPath=C:\Program Files\National Instruments\LabVIEW 8.2\www WebServer.TcpAccess="c+*" WebServer.ViAccess="+*" DebugServerEnabled=False DebugServerWaitOnLaunch=False ace-8.0.4+dfsg.orig/bin/LabVIEW_RT/PXI_Reset.ini0000755000175000017500000000404115027201773020042 0ustar sudipsudip[PXI_Reset] server.app.propertiesEnabled=True server.ole.enabled=True server.tcp.paranoid=True server.tcp.servic="My Computer/VI Server" server.vi.callsEnabled=True server.vi.propertiesEnabled=True WebServer.DirectoryIndex="index.htm" WebServer.MimeTypes="htm;text/html;gif;image/gif;jpg;image/jpeg;png;image/png;txt;text/plain;html;text/html;jpeg;image/jpeg;css;text/css;llb;application/x-labview-llb;vi;application/x-labview-vi;doc;application/msword;dot;application/msword;bin;application/octet-stream;exe;application/octet-stream;rtf;application/rtf;pdf;application/pdf;ai;application/postscript;eps;application/postscript;ps;application/postscript;csh;application/x-csh;gtar;application/x-gtar;gz;application/x-gz;sh;application/x-sh;tar;application/x-tar;zip;application/zip;hqx;application/mac-binhex40;ua;audio/basic;wav;audio/wav;tif;image/tiff;tiff;image/tiff;xbm;image/x-xbitmap;rtx;text/richtext;qt;video/quicktime;mov;video/quicktime;avi;video/x-msvideo;movie;video/x-sgi-movie;aif;audio/aif;aifc;audio/aif;aiff;audio/aif;aim;application/x-aim;dif;video/x-dv;div;video/x-dv;js;application/x-javascript;pntg;image/x-macpaint;xlb;application/vnd.ms-excel;xls;application/vnd.ms-excel;ppa;application/vnd.ms-powerpoint;ppt;application/vnd.ms-powerpoint;pps;application/vnd.ms-powerpoint;pot;application/vnd.ms-powerpoint;pwz;application/vnd.ms-powerpoint;mid;audio/mid;midi;audio/mid;enc;video/mpeg;m1v;video/mpeg;mp2;video/mpeg;mpa;video/mpeg;mpe;video/mpeg;mpeg;video/mpeg;mpg;video/mpeg;psd;image/x-photoshop;bmp;image/bmp;pic;image/pic;ra;audio/vnd.rn-realaudio;rf;image/vnd.rf-realflash;rm;application/vnd.rn-realmedia;rp;image/vnd.rn-realpix;ram;audio/x-pn-realaudio;rmm;audio/x-pn-realaudio;rnx;application/vnd.rn-realplayer;rt;text/vnd.rn-realtext;rv;video/vnd.rn-realvideo;smi;application/smil;ssm;application/streamingmedia;sithqx;application/mac-binhex40;sit;application/x-stuffit" WebServer.RootPath=C:\Program Files\National Instruments\LabVIEW 8.0\www WebServer.TcpAccess="c+*" WebServer.ViAccess="+*" DebugServerEnabled=False DebugServerWaitOnLaunch=False ace-8.0.4+dfsg.orig/bin/LabVIEW_RT/README0000644000175000017500000000575415027201773016430 0ustar sudipsudip This directory contains utilities for running the ACE+TAO test suite on a LabVIEW RT 8 / Phar Lap ETS target. Although it's running Phar Lap ETS, and thus would normally be able to run programs, this environment is different than plain Phar Lap ETS in that the LabVIEW RT layer takes up the only process able to run on Phar Lap. Thus, everything executed needs to be done via LabVIEW RT facilities. Thus, we have the following restrictions: 1. There's no NFS, no SMB; there's a target filesystem but no direct access. 2. No executables can be directly executed. This yields the following: - All test "programs" are built as DLLs instead of executables. The DLL has a known "main" entrypoint. To run the test, the DLL must be copied down to the target, explicitly loaded, and its entrypoint called. MPC will automatically build these DLLs when an executable is specified in the MPC file by basing the MPC project on the labviewrt_dll.mpb base. This is done by supplying "-base labviewrt_dll" on the MPC command line. - There is a test-controlling DLL that lives on the LabVIEW RT target, and is loaded when the target boots. This DLL spawns a thread that listens on a TCP port for connections; it runs a text-based protocol by which it can be directed to load and run test DLLs and report results. This DLL is in the labview_test_controller subdirectory; see its ReadMe.txt file for more details. - The Perl test framework in PerlACE has a ProcessLVRT.pm and TestTarget_LVRT.pm that know how to run the test protocol, get the log file back from the target, etc. in order to integrate the LabVIEW RT scheme into the ACE+TAO testing framework. - If a test encounters any significant errors that would produce something akin to a crash or significant leak on a multi-process OS, it will probably render the LabVIEW RT target unuseable and unresponsive. There are two utilities in this directory that will help in this sort of situation: 1. Reboot_Target.exe: A Windows executable that runs a LabVIEW VI to reboot a local target box. If the box is alive enough to be contacted and run the LabVIEW VI that triggers the reboot, this works fine. However, if the box is unresponsive, as it usually is, this doesn't work. The advantage of this utility is that it doesn't require any additional hardware or software. 2. PXI_Reset.exe: A Windows executable that runs a LabVIEW VI to trigger a hardware reset on the target box. This utility works all the time since it does a hardware reset. However, it requires an additional piece of hardware that connects to the host PC via USB and connects to the DB9 on the back of the PXI target. This little hardware box was custom-made by Lockheed Martin, so you can't just go buy one at Radio Shack. If neither of these utilities is workable for you, you can probably use a programmable power strip that can cycle the power on the target, and write a utility that drives it. ace-8.0.4+dfsg.orig/bin/ace_ld0000755000175000017500000001251315027201773015076 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # Drop-in replacement for "ld" that supports munching. # # The first three lines above let this script run without specifying the # full path to perl, as long as it is in the user's PATH. # Taken from perlrun man page. ## ## Symbols that produce a warning due to size changing. ## This is a harmless known bug with the version of gcc that comes with ## Tornado II. Anything in this list will be suppressed unless the -w ## option is used. ## my(@symbols) = ('dequeue__t17ACE_Message_Queue1Z14ACE_NULL_SYNCHRP17ACE_Message_BlockP14ACE_Time_Value', 'activate__t17ACE_Message_Queue1Z14ACE_NULL_SYNCH', ); $usage = "usage: $0 [-? | [-w] [-o ] [[-C --] [-m ] [-n ]] [-f]]] " . "\n"; #### To avoid quoting problems on the command line, all arguments #### between -C and -- are combined into the single compile command. $compile_option = 0; $ss_change_warn = 0; #### #### process command line args #### while ( $#ARGV >= 0 && $ARGV[0] =~ /^-/ ) { if ( $ARGV[0] eq '-C' ) { $compile_option = 1; if ( $ARGV[1] !~ /^[-].+$/ ) { $compile = $ARGV[1]; shift; } else { print STDERR "$0: must provide argument for -c option\n"; die $usage; } } elsif ( $ARGV[0] eq '--' ) { $compile_option = 0; } elsif ( $ARGV[0] eq '-m' ) { if ( $ARGV[1] !~ /^[-].+$/ ) { $munch = $ARGV[1]; shift; } else { print STDERR "$0: must provide argument for -m option\n"; die $usage; } } elsif ( $ARGV[0] eq '-n' ) { if ( $ARGV[1] !~ /^[-].+$/ ) { $nm = $ARGV[1]; shift; } else { print STDERR "$0: must provide argument for -n option\n"; die $usage; } } elsif ( $ARGV[0] eq '-o' ) { if ( $ARGV[1] !~ /^[-].+$/ ) { $vdir = $ARGV[1]; shift; } else { print STDERR "$0: must provide argument for -o option\n"; die $usage; } } elsif ( $ARGV[0] eq '-w' ) { $ss_change_warn = 1; } elsif ( $ARGV[0] eq '-?' ) { print "$usage"; exit; } else { if ($compile_option) { $compile .= " $ARGV[0]"; } else { warn "$0: unknown option $ARGV[0]\n"; die $usage; } } shift; } #### #### If $vdir is empty, set default object file directory (.obj) #### if ($vdir eq ''){ $vdir = ".obj"; } #### #### Save link command, i.e., current @ARGV, for use below. #### @args = @ARGV; #### #### Find full path to each library. #### @libDirs = (); $current_dir_in_libDirs = 0; @libs = (); @objs = ''; foreach $arg (@ARGV) { if ($arg =~ /^['"]?-L([\S]+)/) { ($dir = $1) =~ s%/+$%%; #### trim any trailing slashes push (@libDirs, $dir); $current_dir_in_libDirs = 1 if $dir eq '.'; } elsif ($arg =~ /^['"]?-l([\S]+)/) { push (@libs, $1); } elsif ($arg =~ /\.o$/) { push (@objs, $arg); } } #### Add . to libDirs if it doesn't already have it. push (@libDirs, ".") unless $current_dir_in_libDirs; foreach $lib (@libs) { foreach $libDir (@libDirs) { if (-e "$libDir/lib$lib.a") { $full_path{$lib} = "$libDir/lib$lib.a"; last; } } } #### #### Set up signal handler. #### $done = 0; $SIG{'HUP'} = $SIG{'INT'} = $SIG{'QUIT'} = $SIG{'TERM'} = 'cleanup'; #### #### Munch, if $munch is non-null. #### if ($munch) { $munch_objs = join (' ', @objs); $munch_libs = join (' ', values %full_path); open (MUNCH, "$nm $munch_objs $munch_libs | $munch |") || &fail ("$0: unable to run \"$nm\" or \"$munch\"\n"); open (CTORDTOR, "> __ctordtor.c") || &fail ("$0: unable to open \"__ctordtor.c\"\n"); while () { #### Filter out munch output that contains '.cpp'. It results from #### .cpp files that have no text or data, e.g., .cpp files that #### only contain template instantiations. These lines confuse g++. print CTORDTOR unless /\.cpp/; } close CTORDTOR || &fail ("$0: unable to write \"__ctordtor.c\"\n"); close MUNCH; system ("$compile -o $vdir/__ctordtor.o __ctordtor.c") && &fail ("$0: \"$compile\" failed\n"); } #### #### Construct the link command from @args and perform the link. #### if ($munch) { #### Insert ctordtor object file before first library in link command. $arg_lib = 0; foreach $arg (@ARGV) { if ($arg =~ /^['"]?-l/) { last; } ++$arg_lib; } splice (@args, $arg_lib, 0, "$vdir/__ctordtor.o"); } $link_command = join (' ', @args); if (open(PP, "$link_command 2>&1 |")) { while() { my($line) = $_; if ($ss_change_warn) { print $line; } else { my($found) = 0; foreach my $symbol (@symbols) { if ($line =~ /Warning: size of symbol `$symbol\'/) { $found = 1; } } if (!$found) { print $line; } } } close(PP); if ($? ne 0) { fail ("$0: $link_command failed\n"); } } else { fail ("$0: $link_command failed\n"); } $done = 1; &cleanup; #### #### #### sub fail { local ($message) = @_; warn $message; &cleanup; } #### #### clean up when done or on signal #### sub cleanup { unlink "__ctordtor.c", "$vdir/__ctordtor.o"; if ($done) { exit 0; } else { exit 1; } } #### EOF ace-8.0.4+dfsg.orig/bin/auto_compile_wrapper0000755000175000017500000000312015027201773020101 0ustar sudipsudip#!/bin/sh # # Usually cron setups a really miserable environment, this script # serves two purposes: # 1. Setup a good environment for auto_compile. # 2. Invoke auto_compile with the proper arguments for each site. # # The idea is to modify this script on a per-site basis and leave # auto_compile unmodified. # # Setup a proper path, remember that cvs, GNU make, perl5 and your # compiler must be there. PATH=.:$HOME/bin:/pkg/gnu/bin:/opt/SUNWspro/bin:$PATH export PATH # Obvious enough. CVSROOT=/project/cvs-repository export CVSROOT # It could be a good idea to set CVSREAD this will make the staging # area read-only, but our staging areas are public. # CVSREAD=Y # export CVSREAD # Here we define the cvs working copy for our staging area. CHECKOUT=$HOME/head # In some sites the building directory differs from the cvs working # copy. The directory is updated running # $ACE_ROOT/bin/create_ace_build; but it must be setup manually the # first time. # TODO: Arrange for automatic creation of platform_macros.GNU & # config.h. BUILD=SUNCC # Here is where we store auto_compile output and keep a history of # each run. LOGDIR=$HOME/head/ACE_wrappers/build/$BUILD/auto_compile # Who do we send email when compilation (or anything else) fails. ADMIN=PUT_YOUR_ADDRESS_HERE ; echo "You must edit this file" ; exit 0 # You must select a mail tool that can understand the -s option such # as: # # /usr/bin/mailx Solaris # /usr/bin/mailx HP-UX # /usr/sbin/mailx IRIX # /bin/mail Linux exec /pkg/gnu/bin/perl $CHECKOUT/ACE_wrappers/bin/auto_compile \ $CHECKOUT $BUILD $LOGDIR $ADMIN /usr/bin/mailx ace-8.0.4+dfsg.orig/bin/clean_dsp.pl0000755000175000017500000000145615027201773016235 0ustar sudipsudip# DSP cleaner $if_depth = 0; @saved_lines = (); $dirty = 0; $in_dependency = 0; die "Not enough args" if ($#ARGV < 0); open (FILE, "<$ARGV[0]"); loop: while () { # Check for dependency information if (/^DEP/ || /^NODEP/) { $in_dependency = 1; } if ($in_dependency) { $in_dependency = 0 if (!/\\$/); goto loop; } # Check for empty !IF blocks if (/^\!IF/) { ++$if_depth; } push @saved_lines, $_ if ($if_depth > 0); if (/^\!ENDIF/) { --$if_depth; print @saved_lines if ($if_depth == 0 && $dirty == 1); @saved_lines = (); $dirty = 0; } elsif ($if_depth == 0) { print; } $dirty = 1 if ($if_depth > 0 && !/^\!/ && !/^\s+$/); } close (FILE); ace-8.0.4+dfsg.orig/bin/pippen.pl0000755000175000017500000003005015027201773015570 0ustar sudipsudip BEGIN { use Cwd; if (!$ENV{ACE_ROOT}) { $ACE_ROOT = getcwd ()."\\"; print STDERR "Error: ACE_ROOT not defined\n"; exit 1; } else { $ACE_ROOT = $ENV{ACE_ROOT}; } } use lib "$ACE_ROOT/bin"; use PerlACE::MSProject::DSP; use PerlACE::MSProject::VCP; use File::DosGlob 'glob'; use DirHandle; use strict; ################################################################################ my $extension; my $recurse = 0; my $list = 0; my $verbose = 0; my @arguments; my @configs; my @roots; my $auto_compile = 0; my $clean = 0; my $debug = 0; my $aceroot = 0; ################################################################################ # Parse command line arguments while ( $#ARGV >= 0) { if ($ARGV[0] =~ m/^-list/i) { $list = 1; } elsif ($ARGV[0] =~ m/^-evc3/i) { $extension = "vcp"; } elsif ($ARGV[0] =~ m/^-msvc7/i) { $extension = "vcproj"; } elsif ($ARGV[0] =~ m/^-config/i) { push @configs, $ARGV[1]; shift; } elsif ($ARGV[0] =~ m/^-r/i) { $recurse = 1; } elsif ($ARGV[0] =~ m/^-v/i) { $verbose = 1; } elsif ($ARGV[0] =~ m/^-auto_compile/i) { $auto_compile = 1; } elsif ($ARGV[0] =~ m/^-clean/i) { $clean = 1; } elsif ($ARGV[0] =~ m/^-useroot/i) { push @roots, $ARGV[1]; shift; } elsif ($ARGV[0] =~ m/^-aceroot/i) { $aceroot = 1; } elsif ($ARGV[0] =~ m/^-(\?|h)/i) { # Help information print "Options\n"; print "-list - Prints out the list of project files\n"; print "-config - Use as a configuration\n"; print "-evc3 - Looks for eMbedded Visual C++ 3.0 projects\n"; print "-msvc7 - Looks for Visual C++ 7.0 projects\n"; print "-clean - Clean instead of building\n"; print "-recurse - Recurse into directories\n"; print "-verbose - Make some noise\n"; print "-auto_compile - Print out auto_compile info during build\n"; print "-useroot - Use as a root to look for dependencies\n"; print "-aceroot - Use %ACE_ROOT% as a dependency root\n"; exit; } elsif ($ARGV[0] =~ m/^-/) { warn "$0: unknown option $ARGV[0]\n"; exit 1; } else { push @arguments, $ARGV[0]; } shift; } if ($#configs < 0) { if (defined $ENV{WINMAKE_CONFIGS}) { @configs = split /:/, $ENV{WINMAKE_CONFIGS}; } elsif (defined $ENV{PIPPEN_CONFIGS}) { @configs = split /:/, $ENV{PIPPEN_CONFIGS}; } else { print STDERR "Error: No config specified\n"; exit 1; } } if (!defined $extension) { my $compiler = ''; if (defined $ENV{WINMAKE_COMPILER}) { $compiler = $ENV{WINMAKE_COMPILER}; } elsif (defined $ENV{PIPPEN_COMPILER}) { $compiler = $ENV{PIPPEN_COMPILER}; } else { print STDERR "Error: No compiler specified\n"; exit 1; } if ($compiler eq "evc3") { $extension = "vcp"; } elsif ($compiler eq "msvc7") { $extension = "vcproj"; } } ################################################################################ # I like these variables # %projects->{$file}->{BUILD} <- Are we supposed to build this file? # ->{PROJ} <- MSProject object # ->{CONFIGS}->{$config}->{DEPS} <- List of dependencies # ->{DONE} <- Have we compiled it yet? my %projects; # %names->{$output} <- points to the $file used in the above %projects my %names; ################################################################################ # Expand all the files/directories passed in on the command line sub ProjectSearch ($@) { my $build = shift; my @targets = @_; while ($#targets >= 0) { my $target = $targets[0]; if (-d $target) { print " Reading Directory $target\n" if ($verbose); if ($recurse) { my $dh = new DirHandle ($target); if (defined $dh) { foreach my $entry ($dh->read ()) { if (-d "$target/$entry" && $entry ne "." && $entry ne "..") { $entry =~ s/^.\\//; # / <- fix for color coding in devenv push @targets, ($target . "\\". $entry); } } } else { print STDERR "Error: Cannot read $target: $!\n"; } } foreach my $t (glob ($target . "\\*." . $extension)) { print " Adding project $t\n" if ($verbose); %projects->{$t}->{BUILD} = $build; } } else { foreach my $t (glob ($target)) { print " Adding project $t\n" if ($verbose); %projects->{$t}->{BUILD} = $build; } } shift @targets; } } print "=== Expanding Command line Arguments\n" if ($verbose); if ($#arguments < 0) { print " No files specified, defaulting to \".\"\n" if ($verbose); push @arguments, ("."); } ProjectSearch (1, @arguments); print "=== Expanding Root Arguments\n" if ($verbose); ProjectSearch (0, @roots); if ($aceroot == 1) { my $oldrecurse = $recurse; $recurse = 1; my @aceroots = ($ENV{ACE_ROOT}."\\ace", $ENV{ACE_ROOT}."\\apps\\gperf\\src", $ENV{ACE_ROOT}."\\TAO\\TAO_IDL", $ENV{ACE_ROOT}."\\TAO\\tao", $ENV{ACE_ROOT}."\\TAO\\orbsvcs\\orbsvcs"); ProjectSearch (0, @aceroots); $recurse = $oldrecurse; } ################################################################################ # Read each project file to gather dependency and output information print "=== Reading Project Files\n" if ($verbose); foreach my $project (keys %projects) { my $proj; if ($project =~ m/\.dsp$/i) { $proj = new PerlACE::MSProject::DSP ($project); } elsif ($project =~ m/\.vcp$/i) { $proj = new PerlACE::MSProject::VCP ($project); } elsif ($project =~ m/\.vcproj$/i) { print STDERR "Error: MSVC7 not supported yet\n"; } else { print STDERR "Error: Unrecognized file: $project\n"; } print " Loading $project:" if ($verbose); $proj->Load (); foreach my $config (@configs) { foreach my $proj_config ($proj->Configs ()) { if ($proj_config =~ m/\Q$config\E/i) { print " \"$proj_config\"" if ($verbose); my $name = $proj->DepOutputFile ($proj_config); %names->{lc $name} = $project; my @deps = split / /, $proj->Libs ($proj_config); foreach my $dep (@deps) { # $dep =~ s/.*[\/\\]//g; push (@{%projects->{$project}->{CONFIGS}->{$proj_config}->{DEPS}}, $dep); } if ($proj->UsesTAOIDL () == 1) { push @{%projects->{$project}->{CONFIGS}->{$proj_config}->{DEPS}}, ("gperf.exe", "tao_idl.exe"); } } } } print "\n" if ($verbose); %projects->{$project}->{PROJ} = $proj; } ################################################################################ # Clean out the dependency lists, we only keep the libraries which we know # how to generate print "=== Cleaning out Dependency Lists\n" if ($verbose); foreach my $project (keys %projects) { foreach my $config (keys %{%projects->{$project}->{CONFIGS}}) { print " Cleaning Dependencies: $project ($config)\n" if ($verbose); print " Before:", join (" ", @{%projects->{$project}->{CONFIGS}->{$config}->{DEPS}}), "\n" if ($verbose); my @newdeps; foreach my $dep (@{%projects->{$project}->{CONFIGS}->{$config}->{DEPS}}) { $dep =~ s/.*[\/\\]//g; if (defined %names->{lc $dep}) { push @newdeps, $dep; } } print " After:", join (" ", @newdeps), "\n" if ($verbose); @{%projects->{$project}->{CONFIGS}->{$config}->{DEPS}} = @newdeps; } } ################################################################################ # Make sure to build any dependencies found print "=== Walking Dependency Lists\n" if ($verbose); my $finished = 0; do { $finished = 1; foreach my $project (keys %projects) { foreach my $config (keys %{%projects->{$project}->{CONFIGS}}) { if (%projects->{$project}->{BUILD} == 1) { foreach my $dep (@{%projects->{$project}->{CONFIGS}->{$config}->{DEPS}}) { if (%projects->{%names->{lc $dep}}->{BUILD} != 1) { %projects->{%names->{lc $dep}}->{BUILD} = 1; $finished = 0; } } } } } } while (!$finished); ################################################################################ # Output a list, if requested if ($debug) { print "List of Dependencies\n"; print "--------------------\n"; foreach my $project (keys %projects) { print "=== $project\n"; foreach my $config (keys %{%projects->{$project}->{CONFIGS}}) { print " Config: $config\n"; print " Depends: ", join (" ", @{%projects->{$project}->{CONFIGS}->{$config}->{DEPS}}), "\n"; } } print "\n"; print "List of Outputs\n"; print "---------------\n"; foreach my $name (keys %names) { print "$name\n"; } } ################################################################################ # Loop through and print "=== Compiling\n" if ($verbose); my $compilations; # Keep track of the number of compiles done during a pass my $unfinished; my $loop = 1; do { $compilations = 0; $unfinished = 0; foreach my $project (keys %projects) { if (%projects->{$project}->{BUILD} == 1) { foreach my $config (keys %{%projects->{$project}->{CONFIGS}}) { if (%projects->{$project}->{CONFIGS}->{$config}->{DONE} != 1) { my $depsleft = 0; foreach my $dep (@{%projects->{$project}->{CONFIGS}->{$config}->{DEPS}}) { if (%projects->{%names->{lc $dep}}->{CONFIGS}->{$config}->{DONE} != 1) { ++$depsleft; } } if ($depsleft == 0) { ++$compilations; print "Auto_compiling $project : $config\n" if ($auto_compile); if ($list == 1) { if ($clean == 1) { print "Cleaning "; } else { print "Compiling "; } print "$project : $config\n"; } elsif ($clean == 1) { %projects->{$project}->{PROJ}->Clean ($config); } else { %projects->{$project}->{PROJ}->Build ($config); } %projects->{$project}->{CONFIGS}->{$config}->{DONE} = 1; } else { ++$unfinished; } } } } } print " === Loop $loop: $compilations compiles, $unfinished left\n" if ($verbose); ++$loop; } while ($compilations != 0); # Loop through and see if anything wasn't compiled. If so, this means either there is # an error in the script or that there are circular dependencies foreach my $project (keys %projects) { if (%projects->{$project}->{BUILD} == 1) { foreach my $config (keys %{%projects->{$project}->{CONFIGS}}) { if (%projects->{$project}->{CONFIGS}->{$config}->{DONE} != 1) { print STDERR "Error: Project not compiled: $project - $config\n", } } } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/0000755000175000017500000000000015046037655017472 5ustar sudipsudipace-8.0.4+dfsg.orig/bin/MakeProjectCreator/templates/0000755000175000017500000000000015046037655021470 5ustar sudipsudipace-8.0.4+dfsg.orig/bin/MakeProjectCreator/templates/gnu.mpd0000644000175000017500000007645315027201773022773 0ustar sudipsudip# -*- Makefile -*- #---------------------------------------------------------------------------- # GNU Makefile # # @file <%project_file%> # # This file was automatically generated by MPC. Any changes made directly to # this file will be lost the next time it is generated. # #---------------------------------------------------------------------------- <%marker(top)%> MAKEFILE = <%project_file%> DEPENDENCY_FILE = .depend.<%project_name%> <%if(compares(build_dir_per_project, 1))%> VDIR_PRJ = <%project_name%>/ <%endif%> <%if(idl_files)%> <%if(contains(idlflags,-DGEN_IDL_MAKE_DEPS))%> <%foreach(idl_files)%> IDL_DEPENDENCY_FILE<%forcount%> = .depend.<%project_name%>_Idl<%forcount%> <%endfor%> IDL_DEPENDENCY_FILES += \ <%foreach(idl_files)%> .depend.<%project_name%>_Idl<%forcount%><%fornotlast(" \\")%> <%endfor%> <%endif%> <%endif%> <%if(exename)%> BIN_UNCHECKED = <%exename%> <%endif%> LIB_PREFIX ?= lib <%if(need_staticflags)%> static_libs_only ?= 1 <%endif%> <%if(staticname)%> ## LIB_CHECKED may be set to empty later on in this file LIB_UNCHECKED = $(LIB_PREFIX)<%libname_prefix%><%staticname%>.$(LIBEXT) LIB_CHECKED = $(LIB_UNCHECKED) LIB_NAME = $(LIB_PREFIX)<%libname_prefix%><%staticname%> <%if(!sharedname)%> static_libs_only = 1 <%endif%> <%endif%> <%if(sharedname)%> ## SHLIB may be set to empty later on in this file SHLIB_UNCHECKED = $(LIB_PREFIX)<%libname_prefix%><%sharedname%>.$(SOEXT) SHLIB = $(SHLIB_UNCHECKED) <%endif%> <%if(tao)%> TAO_ROOT ?= $(ACE_ROOT)/TAO <%endif%> <%if(grouped_source_files)%> <%foreach(grouped_source_files)%> <%grouped_source_file%> = \ <%foreach(uniq(grouped_source_file->files))%> <%grouped_source_file->file%><%fornotlast(" \\")%> <%endfor%> <%endfor%> FILES += \ <%foreach(grouped_source_files)%> $(<%grouped_source_file%>)<%fornotlast(" \\")%> <%endfor%> <%else%> FILES = \ <%foreach(uniq(source_files))%> <%source_file%><%fornotlast(" \\")%> <%endfor%> <%endif%> <%if(idl_files)%> <%if(contains(idlflags,-DGEN_IDL_MAKE_DEPS))%> <%foreach(idl_files)%> IDL_DEPS_FLAGS<%forcount%> = <%if(flag_overrides(idl_file, commandflags))%><%flag_overrides(idl_file, commandflags)%><%else%><%idlflags%><%endif%> IDL_DEPS<%forcount%> = <%idl_file%> <%endfor%> <%endif%> <%endif%> <%vpath%> LIBPATHS := <%libpaths%> #---------------------------------------------------------------------------- # Include macros and targets #---------------------------------------------------------------------------- <%marker(macros)%> <%if(xerceslib)%> XERCESLIB ?= <%xerceslib%> <%endif%> <%if(exename)%> LDLIBS =<%foreach(libs)%> -l<%libname_prefix%><%lib%><%endfor%><%foreach(lit_libs)%> -l<%lit_lib%><%endfor%><%foreach(pure_libs)%> <%pure_lib%><%endfor%> <%else%> <%if(sharedname)%> ACE_SHLIBS =<%foreach(libs)%> -l<%libname_prefix%><%lib%><%endfor%><%foreach(lit_libs)%> -l<%lit_lib%><%endfor%><%foreach(pure_libs)%> <%pure_lib%><%endfor%> <%endif%> <%endif%> <%if(tao_idl)%> TAO_IDL = <%tao_idl%> <%endif%> <%if(tao_idl_dep)%> TAO_IDL_DEP = <%tao_idl_dep%>$(EXEEXT) <%endif%> <%if(tao_idlflags)%> TAO_IDLFLAGS = <%tao_idlflags%><%if(!compares(vms_old_make, 1))%>$(if $(ARCH), -g $(call ADD_QUOTE,$(call ADD_ARCH,$(ACE_ROOT)/bin/ace_gperf)))<%endif%> <%endif%> <%if(exename)%> PRJ_TYPE = rtp <%else%> PRJ_TYPE = library <%endif%> <%if(exename)%> <%if(install)%> COLLAPSE_SLASHES = $(if $(findstring //,$(1)),$(call COLLAPSE_SLASHES,$(subst //,/,$(1))),$(1)) INSBIN ?= <%if(compares(vms_old_make, 1))%><%install%><%else%>$(call COLLAPSE_SLASHES,<%install%>)<%endif%> <%endif%> ifeq ($(INSBIN),.) ifeq ($(CURDIR),) ifeq ($(PWD),) PWD=$(shell pwd) endif else PWD=$(CURDIR) endif INSBIN = $(PWD)<%if(targetoutdir)%>/<%targetoutdir%><%endif%> <%if(targetoutdir)%> else ifneq ($(INSBIN),) INSBIN := $(INSBIN)/<%targetoutdir%> endif <%endif%> endif <%if(install)%> OUTPUT_DIRECTORY = $(if $(ARCH),$(if $(INSBIN),$(INSBIN)/$(ARCH)),$(INSBIN)) <%else%> OUTPUT_DIRECTORY = $(if $(ARCH),./$(ARCH)) <%endif%> <%else%> <%if(dllout || libout)%> COLLAPSE_SLASHES = $(if $(findstring //,$(1)),$(call COLLAPSE_SLASHES,$(subst //,/,$(1))),$(1)) INSLIB ?= <%if(compares(vms_old_make, 1))%><%if(dllout)%><%dllout%><%else%><%libout%><%endif%><%else%>$(call COLLAPSE_SLASHES,<%if(dllout)%><%dllout%><%else%><%libout%><%endif%>)<%endif%> <%endif%> ifeq ($(INSLIB),.) ifeq ($(CURDIR),) ifeq ($(PWD),) PWD=$(shell pwd) endif else PWD=$(CURDIR) endif INSLIB = $(PWD)<%if(targetoutdir)%>/<%targetoutdir%><%endif%> <%if(targetoutdir)%> else INSLIB := $(INSLIB)/<%targetoutdir%> <%endif%> endif OUTPUT_DIRECTORY = $(INSLIB) <%endif%> <%if(targetoutdir)%> VDIR = <%targetoutdir%>.obj/ VSHDIR = <%targetoutdir%>.shobj/ <%endif%> include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU <%marker(extension)%> <%marker(deferred-extension)%> <%if(version)%> GNUACE_PROJECT_VERSION = <%version%> <%else%> GNUACE_PROJECT_VERSION ?= $(ACE_VERSION) <%endif%> <%if(resource_files)%> ifneq (,$(RC)) RESOURCES += \ <%foreach(resource_files)%> <%resource_file%><%fornotlast(" \\")%> <%endfor%> <%if(includes)%> RC_INCLUDE_FLAG ?= --include-dir= RCFLAGS = \ <%foreach(includes)%> $(RC_INCLUDE_FLAG)<%include%><%fornotlast(" \\")%> <%endfor%> <%endif%> endif <%endif%> ifdef TEMPINCDIR TEMPINCDIR := $(TEMPINCDIR)/<%project_name%> all: $(TEMPINCDIR) endif ifneq ($(OUTPUT_DIRECTORY),) .PHONY: create_output_directory.local all: create_output_directory.local create_output_directory.local: -@$(MKDIR) "$(OUTPUT_DIRECTORY)" $(ACE_NUL_STDERR) endif <%if(sharedname || staticname || exename)%> <%if(libs && libpaths)%> # turn off libcheck if doing a dry run ifeq ($(findstring n, $(MAKEFLAGS)),n) LIBCHECK = 1 else # turn off libcheck if keep going was passed too ifeq ($(findstring k, $(MAKEFLAGS)),k) LIBCHECK = 1 else ifeq ($(LIBCHECK_PREFIX),) # If the user hasn't specified a place to look for installed libraries, let's set # a reasonable default LIBCHECK_PREFIX = /usr endif LIBCHECK ?= $(filter-out $(foreach lib,<%foreach(libs)%><%libname_prefix%><%lib%><%fornotlast(" ")%><%endfor%>,$(findstring $(lib),$(foreach libpath,<%foreach(libpaths)%><%if(targetoutdir)%><%libpath%>/<%targetoutdir%> <%endif%><%libpath%> $(if $(ARCH),<%libpath%>/$(ARCH)) <%endfor%>$(LIBCHECK_PREFIX)/lib $(LIBCHECK_PREFIX)/lib64 $(LIBCHECK_EXTRA_PATHS) $(INSLIB),$(wildcard $(libpath)/$(LIB_PREFIX)$(lib).* $(libpath)/$(lib).lib)))),<%foreach(libs)%><%libname_prefix%><%lib%><%fornotlast(" ")%><%endfor%>) ifeq ($(LIBCHECK),) LIBCHECK = 1 endif endif endif <%else%> LIBCHECK = 1 <%endif%> <%else%> LIBCHECK = 1 <%endif%> <%if(!exename)%> <%foreach(requires)%> ifeq ($(<%require%>),1) <%endfor%> <%foreach(avoids)%> ifneq ($(<%avoid%>),1) <%endfor%> ifneq ($(LIBCHECK), 1) <%if(staticname)%> LIB_CHECKED = <%endif%> <%if(sharedname)%> SHLIB = <%endif%> all: lib_warning endif <%foreach(avoids)%> else <%if(staticname)%> LIB_CHECKED = <%endif%> <%if(sharedname)%> SHLIB = <%endif%> all: avoid_warning endif <%endfor%> <%foreach(requires)%> else <%if(staticname)%> LIB_CHECKED = <%endif%> <%if(sharedname)%> SHLIB = <%endif%> all: require_warning endif <%endfor%> <%if(tagname)%> ifeq (,$(<%tagname%>)) <%endif%> <%foreach(requires)%> ifeq ($(<%require%>),1) <%endfor%> <%foreach(avoids)%> ifneq ($(<%avoid%>),1) <%endfor%> <%foreach(avoids)%> else <%if(staticname)%> LIB_CHECKED = <%endif%> <%if(sharedname)%> SHLIB = <%endif%> all: avoid_warning endif <%endfor%> <%foreach(requires)%> else <%if(staticname)%> LIB_CHECKED = <%endif%> <%if(sharedname)%> SHLIB = <%endif%> all: require_warning endif <%endfor%> <%if(tagname)%> else <%foreach(requires)%> ifeq ($(<%require%>),1) <%endfor%> <%foreach(avoids)%> ifneq ($(<%avoid%>),1) <%endfor%> <%foreach(tagchecks)%> ifeq (<%tagcheck%>, $(findstring <%tagcheck%>, $(<%tagname%>))) <%endfor%> <%foreach(tagchecks)%> else LIB_CHECKED = SHLIB = endif <%endfor%> <%foreach(avoids)%> else LIB_CHECKED = SHLIB = all: avoid_warning endif <%endfor%> <%foreach(requires)%> else LIB_CHECKED = SHLIB = all: require_warning endif <%endfor%> endif <%endif%> <%endif%> <%if(exename)%> <%foreach(requires)%> ifeq ($(<%require%>),1) <%endfor%> <%foreach(avoids)%> ifneq ($(<%avoid%>),1) <%endfor%> ifeq ($(LIBCHECK), 1) BIN = $(BIN_UNCHECKED)$(EXEEXT) ifdef ARCH ARCH_BIN = $(ARCH)/$(BIN) endif #ARCH else all: lib_warning endif <%foreach(avoids)%> else all: avoid_warning endif <%endfor%> <%foreach(requires)%> else all: require_warning endif <%endfor%> # If it contains ../ at all use notdir. OBJS = $(foreach var, $(addsuffix .$(OBJEXT), $(basename $(FILES)) $(RESOURCES)), $(if $(findstring ../,$(var)),$(notdir $(var)),$(var))) SRC = $(FILES) <%endif%> <%if(sharedname || staticname)%> LSRC = $(FILES) <%endif%> <%marker(circuit)%> include $(ACE_ROOT)/include/makeinclude/macros.GNU include $(ACE_ROOT)/include/makeinclude/rules.common.GNU include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU <%if(exename)%> ifneq ($(INSBIN),) ifneq ($(INSBIN),.) INSTALL = $(VBIN:%=$(INSBIN)/%) CLEANUP_INSTALL += $(CLEANUP_BIN:%=$(INSBIN)/$(if $(ARCH),$(ARCH)/)%$(VAR)$(EXEEXT)) endif endif <%endif%> <%if(sharedname || staticname)%> include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU <%endif%> <%if(pch_source)%> ACE_PCH_SOURCE = <%pch_source%> ACE_PCH_FILE = <%basename(pch_header)%>.gch ifeq ($(pchsupport),1) <%if(pch_defines)%> CPPFLAGS +=<%foreach(pch_defines)%> -D<%pch_define%><%endfor%> <%endif%> $(addprefix $(VDIR), $(OBJS)): $(VDIR)$(ACE_PCH_FILE) $(VSHOBJS): $(VSHDIR)$(ACE_PCH_FILE) endif <%endif%> include $(ACE_ROOT)/include/makeinclude/rules.local.GNU ifeq ($(VXWORKSLINK),1) include $(TGT_DIR)/h/make/rules.$(PRJ_TYPE) endif <%foreach(source_files)%> <%if(flag_overrides(source_file, buildflags))%> $(VDIR)<%noextension(source_file)%>.$(OBJEXT): <%source_file%> @$(MKDIR) $(VDIR)<%dirname(source_file)%> <%if(ends_with(source_file, \.c))%>$(COMPILE.c)<%else%>$(COMPILE.cc)<%endif%> <%flag_overrides(source_file, buildflags)%> $(ACE_USE_PCH_OPT) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $< ${MVCMD} ifneq ($(VSHDIR), $(VDIR)) $(VSHDIR)<%noextension(source_file)%>.$(OBJEXT): <%source_file%> @$(MKDIR) $(VSHDIR)<%dirname(source_file)%> <%if(ends_with(source_file, \.c))%>$(COMPILE.c)<%else%>$(COMPILE.cc)<%endif%> <%flag_overrides(source_file, buildflags)%> $(ACE_USE_PCH_OPT) $(PIC) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $< endif <%else%> <%if(dirname(source_file) && !contains(source_file, \.\./))%> <%if(starts_with(source_file, \$) || !ends_with(source_file, \.cpp))%> $(VDIR)<%noextension(source_file)%>.$(OBJEXT): <%source_file%> @$(MKDIR) $(VDIR)<%dirname(source_file)%> <%if(ends_with(source_file, \.c))%>$(COMPILE.c)<%else%>$(COMPILE.cc)<%endif%> <%if(flag_overrides(source_file, buildflags))%><%flag_overrides(source_file, buildflags)%> <%endif%>$(ACE_USE_PCH_OPT) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $< ${MVCMD} ifneq ($(VSHDIR), $(VDIR)) $(VSHDIR)<%noextension(source_file)%>.$(OBJEXT): <%source_file%> @$(MKDIR) $(VSHDIR)<%dirname(source_file)%> <%if(ends_with(source_file, \.c))%>$(COMPILE.c)<%else%>$(COMPILE.cc)<%endif%> <%if(flag_overrides(source_file, buildflags))%><%flag_overrides(source_file, buildflags)%> <%endif%>$(ACE_USE_PCH_OPT) $(PIC) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $< endif <%endif%> <%endif%> <%endif%> <%endfor%> <%if(libpaths)%> ifeq ($(VXWORKSLINK),1) LDLIBPATH =<%foreach(libpaths)%> <%if(targetoutdir)%>-L<%libpath%>/<%targetoutdir%> <%endif%>-L<%libpath%><%endfor%><%if(linkflags)%> <%linkflags%><%endif%> else LDFLAGS +=<%foreach(libpaths)%> <%if(targetoutdir)%>-L<%libpath%>/<%targetoutdir%> <%endif%>-L<%libpath%> $(if $(ARCH),-L<%libpath%>/$(ARCH))<%endfor%><%if(linkflags)%> <%linkflags%><%endif%> endif <%endif%> <%if(includes)%> CPPFLAGS +=<%foreach(includes)%> -I<%include%><%endfor%> <%endif%> <%if(macros)%> CPPFLAGS +=<%foreach(macros)%> -D<%macro%><%endfor%> <%endif%> <%if(compile_flags)%> CPPFLAGS += <%compile_flags%> <%endif%> <%if(dynamicflags)%> ifeq ($(shared_libs),1) ifneq ($(SHLIB),) CPPFLAGS +=<%foreach(dynamicflags)%> -D<%dynamicflag%><%endfor%> endif endif <%endif%> <%if(staticflags || exename)%> ifeq ($(static_libs),1) <%if(staticflags)%> CPPFLAGS +=<%foreach(staticflags)%> -D<%staticflag%><%endfor%> <%endif%> <%if(exename)%> ifeq ($(link_groups), 1) LDLIBS := -Wl,--start-group $(LDLIBS) -Wl,--end-group endif <%endif%> endif <%endif%> #---------------------------------------------------------------------------- # Local targets #---------------------------------------------------------------------------- <%marker(local)%> .PHONY: lib_warning lib_warning: @echo <%project_name%> will not be built due to the following missing library: $(LIBCHECK) >&2 <%if(requires)%> <%foreach(requires)%> ifneq ($(<%require%>),1) requires_disabled_macros += <%require%> endif <%endfor%> .PHONY: require_warning require_warning: @echo <%project_name%> will not be built due to the following disabled make macros: $(requires_disabled_macros)>&2 <%endif%> <%if(avoids)%> <%foreach(avoids)%> ifeq ($(<%avoid%>),1) avoids_enabled_macros += <%avoid%> endif <%endfor%> .PHONY: avoid_warning avoid_warning: @echo <%project_name%> will not be built due to the following enabled make macros: $(avoids_enabled_macros)>&2 <%endif%> <%if(custom_types)%> ## Some OS's have /bin/test others only have /usr/bin/test ifeq ($(wildcard /bin/test), /bin/test) TEST_EXE = /bin/test else ifeq ($(wildcard /usr/bin/test), /usr/bin/test) TEST_EXE = /usr/bin/test endif endif SPACE = $(should_be_unset) $(should_be_unset) <%foreach(custom_types)%> <%if(custom_type->libpath)%> export DYLD_LIBRARY_PATH := $(DYLD_LIBRARY_PATH):<%custom_type->libpath%>$(if $(ARCH),:<%custom_type->libpath%>/$(ARCH)) export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH):<%custom_type->libpath%>$(if $(ARCH),:<%custom_type->libpath%>/$(ARCH)) export SHLIB_PATH := $(SHLIB_PATH):<%custom_type->libpath%>$(if $(ARCH),:<%custom_type->libpath%>/$(ARCH)) export LIBPATH := $(LIBPATH):<%custom_type->libpath%>$(if $(ARCH),:<%custom_type->libpath%>/$(ARCH)) export PATH := $(PATH):<%custom_type->libpath%>$(if $(ARCH),:<%custom_type->libpath%>/$(ARCH)) <%endif%> <%foreach(custom_type->input_files)%> <%if(custom_type->input_file->output_files)%> GENERATED_DIRTY +=<%foreach(custom_type->input_file->output_files)%> <%custom_type->input_file->output_file%><%endfor%> <%if(precious_files)%> PRECIOUS_FILES +=<%foreach(precious_files)%><%foreach(custom_type->input_file->output_files)%><%if(contains(custom_type->input_file->output_file, precious_file))%> <%custom_type->input_file->output_file%><%endif%><%endfor%><%endfor%> <%endif%> <%if(custom_type->input_file->non_source_output_files)%> OBJS_DEPEND_ON_GENERATED = 1 <%endif%> <%foreach(custom_type->input_file->output_files)%> <%if(forlast && !forfirst)%> ## More than one file is generated by the command and therefore ## it can not be run in parallel. Unfortunately, there is no way to ## say that only this rule can't be run in parallel. However, we can ## determine if the generated files have already been generated. If that's ## the case, then we don't need this special rule. ifeq ($(wildcard $(GENERATED_DIRTY)), $(GENERATED_DIRTY)) ## If we can find /bin/test, then we will continue ifneq ($(TEST_EXE),) ## If all of the generated files are there, then we need to check ## and make sure that the generated files are up-to-date. If they are not ## then we need the special rule. ifeq ($(shell<%foreach(custom_type->input_file->output_files)%> $(TEST_EXE) "<%custom_type->input_file%>" -nt "<%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%>" 2> /dev/null ||<%endfor%> echo 0),) .NOTPARALLEL: <%if(flag_overrides(custom_type->input_file, dependent) || custom_type->dependent || flag_overrides(custom_type->input_file, dependent_libs) || custom_type->dependent_libs)%> else ## By this point, all of the generated files are here and up-to-date ## with respect to the source file. Now we need to make sure that ## they are up-to-date with respect to the generation tool. If the tool ## is newer than the generated files, then we need the special rule. ifeq ($(shell<%if(flag_overrides(custom_type->input_file, dependent))%><%foreach(dep, flag_overrides(custom_type->input_file, dependent))%><%foreach(custom_type->input_file->output_files)%> $(TEST_EXE) "<%if(compares(vms_old_make, 1))%><%dep%><%else%>$(call ADD_ARCH,<%dep%>)<%endif%>" -nt "<%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%>" 2> /dev/null ||<%endfor%><%endfor%><%else%><%if(custom_type->dependent)%><%foreach(custom_type->dependent)%><%foreach(custom_type->input_file->output_files)%> $(TEST_EXE) "<%if(compares(vms_old_make, 1))%><%custom_type->dependent%><%else%>$(call ADD_ARCH,<%custom_type->dependent%>)<%endif%>" -nt "<%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%>" 2> /dev/null ||<%endfor%><%endfor%><%endif%><%endif%><%if(flag_overrides(custom_type->input_file, dependent_libs))%><%foreach(dep_lib, flag_overrides(custom_type->input_file, dependent_libs))%><%foreach(custom_type->input_file->output_files)%> $(TEST_EXE) "<%if(compares(vms_old_make, 1))%><%dirname(dep_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(dep_lib)%>.$(SOEXT)<%else%>$(call ADD_ARCH,<%dirname(dep_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(dep_lib)%>.$(SOEXT))<%endif%>" -nt "<%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%>" 2> /dev/null ||<%endfor%><%endfor%><%else%><%if(custom_type->dependent_libs)%><%foreach(custom_type->dependent_libs)%><%foreach(custom_type->input_file->output_files)%> $(TEST_EXE) "<%if(compares(vms_old_make, 1))%><%dirname(custom_type->dependent_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(custom_type->dependent_lib)%>.$(SOEXT)<%else%>$(call ADD_ARCH,<%dirname(custom_type->dependent_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(custom_type->dependent_lib)%>.$(SOEXT))<%endif%>" -nt "<%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%>" 2> /dev/null ||<%endfor%><%endfor%><%endif%><%endif%> echo 0),) .NOTPARALLEL: endif <%endif%> endif else .NOTPARALLEL: endif else .NOTPARALLEL: endif <%endif%> <%endfor%> <%foreach(custom_type->input_file->output_files)%><%custom_type->input_file->output_file%><%fornotlast(" ")%><%endfor%>: <%custom_type->input_file%><%if(custom_type->input_file->dependencies)%><%foreach(custom_type->input_file->dependencies)%> <%if(contains(custom_type->input_file->dependencie, [\s\$]))%>$(subst $(SPACE),\$(SPACE),<%custom_type->input_file->dependencie%>)<%else%><%custom_type->input_file->dependencie%><%endif%><%endfor%><%endif%><%if(flag_overrides(custom_type->input_file, dependent))%><%foreach(dep, flag_overrides(custom_type->input_file, dependent))%> <%if(contains(dep, [\s\$]))%>$(subst $(SPACE),\$(SPACE),<%if(compares(vms_old_make, 1))%><%dep%><%else%>$(call ADD_ARCH,<%dep%>)<%endif%>)<%else%><%if(compares(vms_old_make, 1))%><%dep%><%else%>$(call ADD_ARCH,<%dep%>)<%endif%><%endif%><%endfor%><%else%><%if(custom_type->dependent)%><%foreach(custom_type->dependent)%> <%if(contains(custom_type->dependent, [\s\$]))%>$(subst $(SPACE),\$(SPACE),<%if(compares(vms_old_make, 1))%><%custom_type->dependent%><%else%>$(call ADD_ARCH,<%custom_type->dependent%>)<%endif%>)<%else%><%if(compares(vms_old_make, 1))%><%custom_type->dependent%><%else%>$(call ADD_ARCH,<%custom_type->dependent%>)<%endif%><%endif%><%endfor%><%endif%><%endif%> <%if(flag_overrides(custom_type->input_file, gendir))%> <%if(!compares(flag_overrides(custom_type->input_file, gendir),.))%> $(MKDIR) <%flag_overrides(custom_type->input_file, gendir)%> <%endif%> <%endif%> <%if(compares(vms_old_make, 1))%><%if(flag_overrides(custom_type->input_file, command))%><%flag_overrides(custom_type->input_file, command)%><%else%><%custom_type->command%><%endif%><%else%>$(if $(findstring ",<%if(flag_overrides(custom_type->input_file, command))%><%flag_overrides(custom_type->input_file, command)%><%else%><%custom_type->command%><%endif%>),<%if(flag_overrides(custom_type->input_file, command))%><%flag_overrides(custom_type->input_file, command)%><%else%><%custom_type->command%><%endif%>,$(call ADD_QUOTE,$(call ADD_ARCH,<%if(flag_overrides(custom_type->input_file, command))%><%flag_overrides(custom_type->input_file, command)%><%else%><%custom_type->command%><%endif%>)))<%endif%> <%if(flag_overrides(custom_type->input_file, commandflags))%><%flag_overrides(custom_type->input_file, commandflags)%><%else%><%custom_type->commandflags%><%endif%> <%if(custom_type->output_option)%><%custom_type->input_file%> <%custom_type->output_option%> $@<%else%><%custom_type->input_file%><%endif%> <%if(flag_overrides(custom_type->input_file, postcommand))%> <%foreach(custom_type->input_file)%> <%flag_overrides(custom_type->input_file, postcommand)%> <%endfor%> <%else%> <%if(custom_type->postcommand)%> <%foreach(custom_type->input_file)%> <%custom_type->postcommand%> <%endfor%> <%endif%> <%endif%> <%if(pch_header)%> <%if(custom_type->pch_postrule)%> <%foreach(custom_type->input_file->source_output_files)%> @echo '#include "<%pch_header%>"' > temp.$$$$ && cat <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->source_output_file)%><%else%><%custom_type->input_file->source_output_file%><%endif%> >> temp.$$$$ && mv temp.$$$$ <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->source_output_file)%><%else%><%custom_type->input_file->source_output_file%><%endif%> <%endfor%> <%endif%> <%endif%> <%if(flag_overrides(custom_type->input_file, dependent_libs) || custom_type->dependent_libs)%> ifneq ($(static_libs_only),1) ifneq ($(CROSS-COMPILE),1) <%foreach(custom_type->input_file->output_files)%><%if(flag_overrides(custom_type->input_file, gendir))%><%if(!compares(flag_overrides(custom_type->input_file, gendir),.))%><%flag_overrides(custom_type->input_file, gendir)%>/<%endif%><%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%><%fornotlast(" ")%><%endfor%>:<%if(flag_overrides(custom_type->input_file, dependent_libs))%><%foreach(dep_lib, flag_overrides(custom_type->input_file, dependent_libs))%> <%if(contains(dep_lib, [\s\$]))%>$(subst $(SPACE),\$(SPACE),<%if(compares(vms_old_make, 1))%><%dirname(dep_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(dep_lib)%>.$(SOEXT)<%else%>$(call ADD_ARCH,<%dirname(dep_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(dep_lib)%>.$(SOEXT))<%endif%>)<%else%><%if(compares(vms_old_make, 1))%><%dirname(dep_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(dep_lib)%>.$(SOEXT)<%else%>$(call ADD_ARCH,<%dirname(dep_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(dep_lib)%>.$(SOEXT))<%endif%><%endif%><%endfor%><%else%><%if(custom_type->dependent_libs)%><%foreach(custom_type->dependent_libs)%> <%if(contains(custom_type->dependent_lib, [\s\$]))%>$(subst $(SPACE),\$(SPACE),<%if(compares(vms_old_make, 1))%><%dirname(custom_type->dependent_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(custom_type->dependent_lib)%>.$(SOEXT)<%else%>$(call ADD_ARCH,<%dirname(custom_type->dependent_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(custom_type->dependent_lib)%>.$(SOEXT))<%endif%>)<%else%><%if(compares(vms_old_make, 1))%><%dirname(custom_type->dependent_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(custom_type->dependent_lib)%>.$(SOEXT)<%else%>$(call ADD_ARCH,<%dirname(custom_type->dependent_lib)%>/$(LIB_PREFIX)<%libname_prefix%><%basename(custom_type->dependent_lib)%>.$(SOEXT))<%endif%><%endif%><%endfor%><%endif%><%endif%> endif endif <%endif%> <%endif%> <%endfor%> <%endfor%> ifneq ($(GENERATED_DIRTY),) .PRECIOUS: $(GENERATED_DIRTY) <%if(source_files)%> ## If the generated files are anything but source files, we need to ## ensure that those files are generated before we attempt to build anything ## else. ifeq ($(OBJS_DEPEND_ON_GENERATED),1) $(VDIR)$(ACE_PCH_FILE) $(addprefix $(VDIR), $(OBJS)): $(GENERATED_DIRTY) $(VSHDIR)$(ACE_PCH_FILE) $(VSHOBJS): $(GENERATED_DIRTY) endif <%else%> <%foreach(requires)%> ifeq ($(<%require%>),1) <%endfor%> <%foreach(avoids)%> ifneq ($(<%avoid%>),1) <%endfor%> all: $(GENERATED_DIRTY) <%foreach(avoids)%> endif <%endfor%> <%foreach(requires)%> endif <%endfor%> <%endif%> endif <%endif%> <%if(idl_files)%> ADDITIONAL_IDL_TARGETS += $(GENERATED_DIRTY) idl_stubs: $(ADDITIONAL_IDL_TARGETS) <%if(source_files)%> # This assignment forces make to run the idl_stubs # target before building any of the source files. FORCED_IDL_STUBS = <%source_files%> <%if(pch_source)%>$(ACE_PCH_SOURCE)<%endif%> <%foreach(custom_types)%> <%foreach(custom_type->input_files)%> <%if(custom_type->input_file->source_output_files)%> <%foreach(custom_type->input_file->source_output_files)%> FORCED_IDL_STUBS := $(FORCED_IDL_STUBS:<%if(flag_overrides(custom_type->input_file, gendir))%><%if(!compares(flag_overrides(custom_type->input_file, gendir),.))%><%flag_overrides(custom_type->input_file, gendir)%>/<%endif%><%basename(custom_type->input_file->source_output_file)%><%else%><%custom_type->input_file->source_output_file%><%endif%>=) <%endfor%> <%endif%> <%endfor%> <%endfor%> ifneq ($(FORCED_IDL_STUBS),) $(FORCED_IDL_STUBS): idl_stubs endif <%endif%> <%endif%> <%if(exename)%> ifneq ($(VXWORKSLINK),1) <%if(libs && libpaths)%> ifeq ($(static_libs_only), 1) ifeq ($(use_dep_libs), 1) DEPLIBS = $(foreach lib,<%foreach(libs)%> <%libname_prefix%><%lib%><%endfor%> <%lit_libs%>, $(foreach libpath,<%foreach(libpaths)%><%if(targetoutdir)%> <%libpath%>/<%targetoutdir%><%endif%> <%libpath%><%endfor%>, $(wildcard $(libpath)/$(LIB_PREFIX)$(lib).$(LIBEXT)))) endif endif <%endif%> $(VBIN): $(addprefix $(VDIR), $(OBJS)) $(DEPLIBS) ifneq (,$(LINK.cc.override)) $(LINK.cc.override) else $(LINK.cc) $(LDFLAGS) $(CC_OUTPUT_FLAG) $@ $(filter-out %.a,$^) $(VLDLIBS) $(POSTLINK) endif endif <%endif%> <%if(idl_files)%> <%if(contains(idlflags,-DGEN_IDL_MAKE_DEPS))%> incremental_depend_idl:: <%foreach(idl_files)%> @$(RM) $(IDL_DEPENDENCY_FILE<%forcount%>)_idl.old @cp $(IDL_DEPENDENCY_FILE<%forcount%>) $(IDL_DEPENDENCY_FILE<%forcount%>)_idl.old $(DEPGEN_ENV) $(DEPGEN) -A $(DEPEND_CMD_ARGS) -f $(IDL_DEPENDENCY_FILE<%forcount%>) \ $(IDL_DEPS_FLAGS<%forcount%>) -t gnuidl -DMAKEDEPEND $(IDL_DEPS<%forcount%>) @if cmp -s $(IDL_DEPENDENCY_FILE<%forcount%>) $(IDL_DEPENDENCY_FILE<%forcount%>)_idl.old ;\ then echo "GNUmakefile idl dependencies unchanged for $(IDL_DEPS<%forcount%>)." ;\ else \ echo "GNUmakefile idl dependencies updated for $(IDL_DEPS<%forcount%>)." ;\ fi ;\ $(RM) $(IDL_DEPENDENCY_FILE<%forcount%>)_idl.old ; <%endfor%> <%endif%> <%endif%> realclean: clean ifneq ($(GENERATED_DIRTY),) -$(RM) -r $(filter-out $(PRECIOUS_FILES),$(GENERATED_DIRTY)) endif <%if(postclean)%> -<%eval(postclean)%> <%endif%> __prebuild__: <%foreach(requires)%> ifeq ($(<%require%>),1) <%endfor%> <%foreach(avoids)%> ifneq ($(<%avoid%>),1) <%endfor%> <%if(prebuild)%> @<%eval(prebuild)%> <%else%> @-: <%endif%> <%foreach(avoids requires)%> endif <%endfor%> <%if(postbuild)%> all: __postbuild__ .PHONY: __postbuild__ <%if(exename)%> __postbuild__: $(VBIN) $(INSTALL) <%else%> <%if(sharedname || staticname)%> __postbuild__: $(VLIBS) $(INSTALL) <%else%> <%foreach(requires)%> ifeq ($(<%require%>),1) <%endfor%> <%foreach(avoids)%> ifneq ($(<%avoid%>),1) <%endfor%> __postbuild__: $(GENERATED_DIRTY) <%foreach(avoids requires)%> endif <%endfor%> <%endif%> <%endif%> __postbuild__: <%foreach(requires)%> ifeq ($(<%require%>),1) <%endfor%> <%foreach(avoids)%> ifneq ($(<%avoid%>),1) <%endfor%> @<%eval(postbuild)%> <%foreach(avoids requires)%> endif <%endfor%> <%endif%> .PHONY: install install: <%if(postbuild)%>__postbuild__<%else%>all<%endif%> INSTALL_LIB ?= lib ifneq ($(INSTALL_PREFIX),) ifneq ($(install_rpath),0) LD_RPATH ?= -Wl,-rpath, LDFLAGS += $(LD_RPATH)$(INSTALL_PREFIX)/$(INSTALL_LIB) $(LD_RPATH_FLAGS) endif endif <%if(install_this_target)%> PRJINST_OPTIONS ?= INST_DIR ?= <%if(install_dir)%>/<%install_dir%><%else%>/$(notdir $(PWD))<%endif%> COMMA = , SPACE = $(should_be_unset) $(should_be_unset) INSTALLER ?= $(MPC_ROOT)/prj_install.pl CUSTOM_INST_TAGS = $(sort <%custom_install%> <%foreach(custom_types)%><%foreach(custom_type->input_files)%><%if(custom_type->input_file->output_files)%><%custom_type%> <%endif%><%endfor%><%endfor%>) <%if(staticname || sharedname)%> <%if(install_headers)%> LIB_INST_TAGS = header_files template_files inline_files$(if $(CUSTOM_INST_TAGS), $(CUSTOM_INST_TAGS)) LIB_INST_LOCATIONS = $(foreach tag,$(LIB_INST_TAGS),-b $(tag)=include$(INST_DIR)) <%else%> ifeq ($(shared_libs),1) <%endif%> INST_TAGS = lib_output$(if $(LIB_INST_TAGS), $(LIB_INST_TAGS)) INST_LOCATIONS = $(LIB_INST_LOCATIONS) -o lib_output=$(INSTALL_LIB) <%if(!install_headers)%> endif <%endif%> <%else%> <%if(exename)%> INST_TAGS = exe_output INST_LOCATIONS = -o exe_output=bin <%else%> INST_TAGS = $(CUSTOM_INST_TAGS)<%if(custom_inst_tags)%> <%custom_inst_tags%><%endif%> INST_LOCATIONS = $(foreach tag,$(INST_TAGS),-b $(tag)=include$(INST_DIR)) <%endif%> <%endif%> DATA_INST_TAGS = <%foreach(custom_types)%><%if(compares(custom_type, installdata_files))%><%if(custom_type->input_files)%>installdata_files<%endif%><%endif%><%endfor%> INST_LOCATIONS += $(if $(DATA_INST_TAGS),-x installdata_files -b installdata_files=share$(INST_DIR)) INST_TAGS := $(INST_TAGS)$(if $(DATA_INST_TAGS), $(DATA_INST_TAGS)) ifeq ($(INSTALLER),/prj_install.pl) INSTALLER = $(ACE_ROOT)/MPC/prj_install.pl endif ifeq ($(LIBCHECK),1) <%foreach(requires)%> ifeq ($(<%require%>),1) <%endfor%> <%foreach(avoids)%> ifneq ($(<%avoid%>),1) <%endfor%> install: ifeq ($(INST_TAGS),) @echo Nothing to install. else ifeq ($(INSTALL_PREFIX),) @echo The variable INSTALL_PREFIX must be set to install. @echo If binaries are already built and you want to use RPATH, @echo they must be rebuilt after changing INSTALL_PREFIX. @false else perl -ne'if (/^#END MPC-Generated Install Info/) {exit 0}' \ -e'elsif (/^#BEGIN MPC-Generated Install Info/) {$$ok=1}' \ -e'elsif ($$ok && s/^#//) {print}' $(MAKEFILE) | \ $(INSTALLER) -i -s $(subst $(SPACE),$(COMMA),$(INST_TAGS)) \ $(INST_LOCATIONS) $(if $(ARCH),-d $(ARCH)) $(PRJINST_OPTIONS) \ $(DESTDIR)$(INSTALL_PREFIX) <%foreach(custom_types)%> <%if(compares(custom_type, pkgconfig_files))%> <%if(custom_type->input_files)%> $(ACE_ROOT)/bin/ace_install_pkgconfig.pl <%custom_type->input_files%> --destdir "$(DESTDIR)" --prefix $(INSTALL_PREFIX) --libdir $(INSTALL_LIB) --libs "$(LIBS)" --version $(GNUACE_PROJECT_VERSION)<%foreach(pkgconfig_variables)%> --custom "<%pkgconfig_variable%>"<%endfor%> <%endif%> <%endif%> <%endfor%> <%marker(postinstall)%> endif endif <%foreach(requires avoids)%> endif <%endfor%> endif #BEGIN MPC-Generated Install Info <%genins%> #END MPC-Generated Install Info <%endif%> <%marker(bottom)%> ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/templates/vxtest.mpd0000644000175000017500000000043715027201773023524 0ustar sudipsudip# VxWorks script for loading libraries used by: <%if(exename)%><%exename%><%endif%><%if(sharedname)%><%sharedname%><%else%><%if(staticname)%><%staticname%><%endif%><%endif%> <%foreach(reverse(libs))%> <%libname_prefix%><%lib%><%if(use_lib_modifier)%><%lib_modifier%><%endif%> <%endfor%> ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/templates/gnudll.mpt0000644000175000017500000000007415027201773023471 0ustar sudipsudip// -*- MPC -*- conditional_include "common" targetoutdir = ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/templates/gnuexe.mpt0000644000175000017500000000005415027201773023475 0ustar sudipsudip// -*- MPC -*- conditional_include "gnudll" ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/0000755000175000017500000000000015046037655020737 5ustar sudipsudipace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/man.mpb0000644000175000017500000000015715027201773022206 0ustar sudipsudip// -*- MPC -*- project { Define_Custom(Man) { automatic = 1 inputext = .1 .2 .3 .4 .5 .6 .7 .8 } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_tkreactor.mpb0000644000175000017500000000020015027201773024226 0ustar sudipsudip// -*- MPC -*- project : acelib, ace_tk { requires += ace_tkreactor after += ACE_TkReactor libs += ACE_TkReactor } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ipv6.mpb0000644000175000017500000000007215027201773022313 0ustar sudipsudip// -*- MPC -*- feature(ipv6) { macros += ACE_HAS_IPV6 } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/acenosubsets.mpb0000644000175000017500000000011515027201773024123 0ustar sudipsudip// -*- MPC -*- feature(!ace_for_tao) { after += ACE libs += ACE } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/stl.mpb0000644000175000017500000000005515027201773022232 0ustar sudipsudip// -*- MPC -*- project { requires += stl } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/install_lib.mpb0000644000175000017500000000011015027201773023714 0ustar sudipsudip// -*- MPC -*- project { specific { install_this_target = 1 } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_qt5.mpb0000644000175000017500000000007415027201773022752 0ustar sudipsudip// -*- MPC -*- project: qt5_gui { macros += ACE_HAS_QT5 } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/vc_warnings.mpb0000644000175000017500000000333115027201773023750 0ustar sudipsudip// -*- MPC -*- // This file contains a number of optional features that disable VC // warnings regarding various items that VC turned into warnings that were // not present in earlier versions. Some people may consider these superfluous // or have already checked code to be sure it causes no trouble. So these // warnings are disabled by default. To enable them, generate your projects // with the feature set to 0. feature(vc_avoid_crt_secure_warnings) { specific(prop:microsoft) { macros += _CRT_SECURE_NO_WARNINGS _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_DEPRECATE } verbatim(cmake, macros, 1) { if(MSVC) " add_compile_definitions(_CRT_SECURE_NO_WARNINGS _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_DEPRECATE)" endif() } } feature(!vc_scl_secure_warnings) { specific(prop:microsoft) { macros += _SCL_SECURE_NO_WARNINGS } verbatim(cmake, macros, 1) { if(MSVC) " add_compile_definitions(_SCL_SECURE_NO_WARNINGS)" endif() } } feature(vc_avoid_this_in_initializer_warnings) { specific(prop:microsoft) { DisableSpecificWarnings += 4355 } verbatim(cmake, macros, 1) { if(MSVC) " add_compile_options(/wd4355)" endif() } } feature(vc_avoid_winsock_warnings) { specific(prop:microsoft) { macros += _WINSOCK_DEPRECATED_NO_WARNINGS } verbatim(cmake, macros, 1) { if(MSVC) " add_compile_definitions(_WINSOCK_DEPRECATED_NO_WARNINGS)" endif() } } feature(vc_avoid_hides_local_declaration) { specific(vc14) { DisableSpecificWarnings += 4456 } } feature(vc_avoid_hides_global_declaration) { specific(vc14) { DisableSpecificWarnings += 4459 } } feature(vc_avoid_hides_class_member) { specific(vc14) { DisableSpecificWarnings += 4458 } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/vcpartialmacros.mpt0000644000175000017500000000036415027201773024647 0ustar sudipsudip// -*- MPC -*- // ACE specific macros for nmake, vc6, and vc7 MFC Release { defines += ACE_HAS_MFC=1 ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER } MFC Debug { defines += ACE_HAS_MFC=1 ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ssl_full.mpb0000644000175000017500000000020315027201773023246 0ustar sudipsudip// -*- MPC -*- feature(!ace_for_tao) { // Includes ACE_SSL asynch stream support. after += SSL libs += ACE_SSL } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_qt.mpb0000644000175000017500000000053515027201773022667 0ustar sudipsudip// -*- MPC -*- project: qt { // Depends on configuration from include/makeinclude/platform_*.GNU verbatim(gnuace,local) { CPPFLAGS += $(PLATFORM_QT_CPPFLAGS) LIBS += $(PLATFORM_QT_LIBS) LDFLAGS += $(PLATFORM_QT_LDFLAGS) } specific(prop:microsoft) { lit_libs -= qt-mt$(QT_VERSION) pure_libs += $(PLATFORM_QT_LIBS) } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/wxwindows.mpb0000644000175000017500000000055615027201773023507 0ustar sudipsudip// -*- MPC -*- project { requires += wxWindows verbatim(gnuace,local) { # work based on the configuration of the wxWindows installation # PLATFORM_WX_* defined in includes/makeincludes/*_macros.GNU CPPFLAGS += $(PLATFORM_WX_CPPFLAGS) LDFLAGS += $(PLATFORM_WX_LDFLAGS) LDLIBS += $(PLATFORM_WX_LIBS) } // TBD - support other platforms } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/global.features0000644000175000017500000001060315027201773023730 0ustar sudipsudip// The global features file contains the default feature settings. // By default, if a feature isn't listed here then it is enabled. // If it is listed, then the value assigned to the feature is interpreted // as a boolean value. You really shouldn't have to edit this file except // to change the defaults. If you want to override these values you can do // one of two things. // // 1) Create a default.features in this directory with the features you // want enabled or disabled. // 2) Create a feature file anywhere you like with the features you want and // use the -feature_file option to specify where it is located. // // Feature definitions from this file are always overwritten by -features // command option of mwc.pl. // // This file is somewhat akin to the platform_macros.GNU file in that build // settings can be set here. // Enable these by default. acexml = 1 ace_svcconf = 1 ace_token = 1 ace_idl_dependencies = 1 // By default we disable these. ace_for_tao = 0 cross_compile = 0 ssl = 0 openssl11 = 0 qos = 0 rapi = 0 repo = 0 minimum_corba = 0 java = 0 zlib = 0 zzip = 0 bzip2 = 0 lzo1 = 0 lzo2 = 0 ipv6 = 0 mfc = 0 rpc = 0 sctp = 0 boost = 0 dummy_label = 0 wince = 0 uses_wchar = 0 // i.e. unicode gen_ostream = 0 ziparchive = 0 negotiate_codesets = 0 notify_monitor_control = 0 versioned_namespace = 0 vcl = 0 stl = 0 xsc = 0 tao_idl_fe_gen = 0 ace_svcconf_gen = 0 xerces = 0 xerces2 = 0 xerces3 = 0 ofccm = 0 ndds = 0 nddsmonitor = 0 mcpp = 0 wireshark_any = 0 wireshark = 0 wireshark_cmake = 0 old_stdstream = 0 exclude_inet = 0 inet_ssl = 0 coredx = 0 dds4ccm_opendds = 0 dds4ccm_ndds = 0 dds4ccm_splice = 0 dds4ccm_coredx = 0 openmp = 0 // Features for various GUI libraries // Some of features are switched on because they are also controlled // by higher level features eg. gl is 1 because it is necessary for fl, // but if someone turns on fl, we may assume gl is available. This way makefile // generation is simplified. Moreover all internal ACE features like ace_qtreactor // and tao_qtresource are also turn on, because we want to build every component // related with if qt is provided. It is proposed to not remove // switched on features from global.features just because features are available // by default. This file is also a kind of ACE capabilities documentation, hence // it is better to enumerate here all features recognized by ACE. // 1 - wxWindows (wxWidgets) libraries are available wxWindows = 0 // 1 - Motif (Lestif) libraries are available motif = 0 // 1 - Athena widgets libraries are available athena = 0 // 1 - X11 libraries are available x11 = 1 // 1 - X Toolkit libraries are available xt = 0 // 1 - Tk libraries are available tk = 0 // 1 - Fast Light toolkit libraries are available (assume lowercase h in header files) fl = 0 // 1 - Qt3 libraries are available qt = 0 qt3 = 0 // 1 - Qt4 core libraries are available qt4 = 0 // Qt5 qt5 = 0 // 1 - Fox libraries are available fox = 0 // 1 - OpenGL libraries are available gl = 1 // Features for ACE support for various GUI libraries // Use QtReactor ace_qtreactor = 1 // Use XtReactor ace_xtreactor = 1 // Use TkReactor ace_tkreactor = 1 // Use FlReactor ace_flreactor = 1 // Use FoxReactor ace_foxreactor = 1 // Features for TAO support for various GUI libraries // Use QtResources for TAO tao_qtresource = 1 // Use XtResources for TAO tao_xtresource = 1 // Use TkResources for TAO tao_tkresource = 1 // Use FlResources for TAO tao_flresource = 1 // Use FoxResources for TAO tao_foxresource = 1 //Use the ZIP_Wrapper feature for when using the ZIP wrapper classes ZIP_Wrapper = 0 // Feature for CORBA subsets corba_e_compact = 0 corba_e_micro = 0 // Footprint feature optimize_collocated_invocations = 1 // Option to disable iiop tao_no_iiop = 0 // Option to enable the linking of the TAO_CodecFactory library // whenever TAO is linked in link_codecfactory = 0 // Feature for LwCCM ccm_lw = 1 // Feature for CCM for disabling events. ccm_noevent = 0 // Feature for direct collocation ccm_direct_collocation = 0 valuetype_out_indirection=1 ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/crosscompile.mpb0000644000175000017500000000067015027201773024135 0ustar sudipsudip // -*- MPC -*- project { avoids += cross_compile specific(prop:microsoft) { nocross = 1 } specific(cdt6) { nocross = 1 } verbatim(gnuace, circuit) { ifneq ($(CROSS-COMPILE),) all clean realclean idl_stubs depend lib_warning require_warning avoid_warning install: " @echo This project will not build on CROSS-COMPILE platforms." else } verbatim(gnuace, bottom) { endif # CROSS-COMPILE } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_athena3d.mpb0000644000175000017500000000015515027201773023730 0ustar sudipsudip// -*- MPC -*- project: ace_xt { macros += ACE_HAS_ATHENA3D requires += athena3d lit_libs += Xaw3d } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/acemfcexe.mpb0000644000175000017500000000031015027201773023342 0ustar sudipsudip// -*- MPC -*- project: aceexe, ace_mfc { specific(vc8, vc9, vc10) { common_defines -= _CONSOLE } specific(vc8, vc9) { SubSystem = 2 } specific(vc10) { SubSystem = Windows } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_compressionlib.mpb0000644000175000017500000000014115027201773025264 0ustar sudipsudip// -*- MPC -*- project : acelib { libs += ACE_Compression after += ACE_Compression }ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/vs2019.features0000644000175000017500000000003215027201773023427 0ustar sudipsudipssl=0 qos=1 rwho=0 sctp=0 ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/vs2019nmake.mpb0000644000175000017500000000111215027201773023403 0ustar sudipsudip// -*- MPC -*- feature (nmake_avoid_Wp64) { specific(nmake) { add_compile -= /Wp64 } } feature (nmake_avoid_Gm) { specific(nmake) { compile_flags -= /Gm } } feature(vc_avoid_hides_local_declaration) { specific(nmake) { DisableSpecificWarnings += 4456 } } feature(vc_avoid_hides_global_declaration) { specific(nmake) { DisableSpecificWarnings += 4459 } } feature(vc_avoid_hides_class_member) { specific(nmake) { DisableSpecificWarnings += 4458 } } feature(ace_languagestandard2017) { specific(nmake) { compile_flags += /std:c++17 } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/versioned_namespace.mpb0000644000175000017500000000041415027201773025441 0ustar sudipsudip// -*- MPC -*- feature(versioned_namespace) { macros += ACE_HAS_VERSIONED_NAMESPACE=1 // Users, define the ACE_VERSIONED_NAMESPACE_NAME preprocessor // symbol in your ace/config.h to override the default versioned // namespace name of the form ACE_5_4_7. } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/rmcast.mpb0000644000175000017500000000023115027201773022715 0ustar sudipsudip// -*- MPC -*- project : acelib, threads { avoids += ace_for_tao after += RMCast libs += ACE_RMCast includes += $(ACE_ROOT)/protocols } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/support_ostream.mpb0000644000175000017500000000013615027201773024676 0ustar sudipsudip// -*- MPC -*- feature(gen_ostream) { requires += gen_ostream macros += GEN_OSTREAM_OPS } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_fl.mpb0000644000175000017500000000076015027201773022644 0ustar sudipsudip// -*- MPC -*- project : ace_x11, ace_gl { requires += fl // Depends on configuration from include/makeinclude/platform_*.GNU verbatim(gnuace,local) { CPPFLAGS += $(PLATFORM_FL_CPPFLAGS) CPPFLAGS += $(PLATFORM_GL_CPPFLAGS) $(PLATFORM_X11_CPPFLAGS) LIBS += $(PLATFORM_FL_LIBS) $(PLATFORM_GL_LIBS) $(PLATFORM_X11_LIBS) LDFLAGS += $(PLATFORM_FL_LDFLAGS) $(PLATFORM_GL_LDFLAGS) LDFLAGS += $(PLATFORM_X11_LDFLAGS) } specific(prop:microsoft) { libs += fltkdll } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/em3.features0000644000175000017500000000003215027201773023147 0ustar sudipsudipssl=0 qos=1 rwho=0 sctp=0 ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_tk.mpb0000644000175000017500000000050615027201773022657 0ustar sudipsudip// -*- MPC -*- project { requires += tk // Depends on configuration from include/makeinclude/platform_*.GNU verbatim(gnuace,local) { CPPFLAGS += $(PLATFORM_TCL_CPPFLAGS) $(PLATFORM_TK_CPPFLAGS) LIBS += $(PLATFORM_TCL_LIBS) $(PLATFORM_TK_LIBS) LDFLAGS += $(PLATFORM_TCL_LDFLAGS) $(PLATFORM_TK_LDFLAGS) } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/avoids_ace_for_tao.mpb0000644000175000017500000000010015027201773025225 0ustar sudipsudip// -*- MPC -*- feature(ace_for_tao) { avoids += ace_for_tao } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_qt4reactor.mpb0000644000175000017500000000020315027201773024323 0ustar sudipsudip// -*- MPC -*- project : acelib, ace_qt4 { requires += ace_qt4reactor after += ACE_Qt4Reactor libs += ACE_QtReactor } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_qt5reactor.mpb0000644000175000017500000000022015027201773024323 0ustar sudipsudip// -*- MPC -*- project : acelib, ace_qt5, qt5_widgets { requires += ace_qt5reactor after += ACE_Qt5Reactor libs += ACE_QtReactor } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/MPC.cfg0000644000175000017500000000016615027201773022033 0ustar sudipsudipdynamic_types = $ACE_ROOT/bin/MakeProjectCreator, $?DDS_ROOT/MPC, $?TAO_ROOT/MPC main_functions = cplusplus:ACE_TMAIN ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/bmake.features0000644000175000017500000000004115027201773023542 0ustar sudipsudipssl=0 qos=1 cidl=0 rwho=0 sctp=0 ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_mc.mpb0000644000175000017500000000043215027201773022636 0ustar sudipsudip// -*- MPC -*- project : ace_etcl_parser { after += Monitor_Control libs += ACE_Monitor_Control specific (prop:microsoft) { lit_libs += pdh } verbatim (gnuace, local) { "ifeq (1,$(winnt))" " ACE_SHLIBS += pdh.lib" " LDLIBS += pdh.lib" "endif" } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/test_files.mpb0000644000175000017500000000013515027201773023570 0ustar sudipsudipproject { Define_Custom(Test) { automatic=0 } Test_Files { run_test*.pl } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/acedefaults.mpb0000644000175000017500000000263515027201773023716 0ustar sudipsudip// -*- MPC -*- project: ipv6, vc_warnings, build_files, test_files, svc_conf_files, ace_unicode, ace_idl_dependencies { staticflags += ACE_AS_STATIC_LIBS includes += $(ACE_ROOT) libpaths += $(ACE_ROOT)/lib specific(prop:microsoft) { macro_for_lib_modifier=1 } specific(prop:windows) { lit_libs += iphlpapi } // Support the alternative Borland Make project type specific(bmake) { unicode_flags += -DACE_USES_WCHAR debug_macros += ACE_NO_INLINE=1 platform_libs += iphlpapi lit_libs -= iphlpapi } verbatim(cmake, top, 1) { set(ACE_ROOT $ENV{ACE_ROOT}) if(WIN32) " link_libraries(iphlpapi)" endif() } specific(cdt6) { win32::platform_libs += ws2_32 mswsock netapi32 release::macros += ACE_NDEBUG } // Link To Android Logging Library for Log_Msg_Android_Logcat specific(gnuace) { linkflags += $(if $(android_abi),-llog) } } feature(ace_inline) { specific(cdt6,cdt7) { macros += __ACE_INLINE__ } } feature(!ace_inline) { specific(cdt6,cdt7) { macros += ACE_NO_INLINE } } feature(!threads) { specific(cdt6,cdt7) { macros += ACE_MT_SAFE=0 // and without threads we must remove support for AIO. macros -= ACE_HAS_AIO_CALLS platform_libs -= rt } } feature(ace_languagestandard2017) { specific(vs2017,vs2019,vs2022) { LanguageStandard = stdcpp17 } specific(cmake) { languagestandard = 17 } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_flreactor.mpb0000644000175000017500000000020015027201773024211 0ustar sudipsudip// -*- MPC -*- project : acelib, ace_fl { requires += ace_flreactor after += ACE_FlReactor libs += ACE_FlReactor } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_rlecompressionlib.mpb0000644000175000017500000000016315027201773025773 0ustar sudipsudip// -*- MPC -*- project : ace_compressionlib { libs += ACE_RLECompression after += ACE_RLECompression }ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/tmcast.mpb0000644000175000017500000000023015027201773022716 0ustar sudipsudip// -*- MPC -*- project: acelib, threads { avoids += ace_for_tao after += TMCast libs += ACE_TMCast includes += $(ACE_ROOT)/protocols } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/aceexe.mpb0000644000175000017500000000013015027201773022654 0ustar sudipsudip// -*- MPC -*- project: acedefaults, acenosubsets, ace_for_tao, versioned_namespace { } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/install.mpb0000644000175000017500000000012515027201773023074 0ustar sudipsudip// -*- MPC -*- project : install_bin, install_lib, install_headers, install_data { } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_fox.mpb0000644000175000017500000000040415027201773023032 0ustar sudipsudip// -*- MPC -*- project { requires += fox // Depends on configuration from include/makeinclude/platform_*.GNU verbatim(gnuace,local) { CPPFLAGS += $(PLATFORM_FOX_CPPFLAGS) LIBS += $(PLATFORM_FOX_LIBS) LDFLAGS += $(PLATFORM_FOX_LDFLAGS) } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/install_headers.mpb0000644000175000017500000000010415027201773024564 0ustar sudipsudip// -*- MPC -*- project { specific { install_headers = 1 } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/acexml.mpb0000644000175000017500000000030215027201773022674 0ustar sudipsudip// -*- MPC -*- project: ace_zzip { avoids += ace_for_tao after += ACEXML_Parser ACEXML libs += ACEXML_Parser ACEXML includes += $(ACE_ROOT)/ACEXML/common requires += acexml } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_idl_dependencies.mpb0000644000175000017500000000015315027201773025515 0ustar sudipsudip// -*- MPC -*- feature(ace_idl_dependencies) { specific(gnuace) { idlflags += -DGEN_IDL_MAKE_DEPS } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_etcl_parser.mpb0000644000175000017500000000013315027201773024540 0ustar sudipsudip// -*- MPC -*- project : ace_etcl { after += ACE_ETCL_Parser libs += ACE_ETCL_Parser } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/wfmo.mpb0000644000175000017500000000006415027201773022400 0ustar sudipsudip// -*- MPC -*- feature(wfmo) { requires += wfmo } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_foxreactor.mpb0000644000175000017500000000020415027201773024410 0ustar sudipsudip// -*- MPC -*- project : acelib, ace_fox { requires += ace_foxreactor after += ACE_FoxReactor libs += ACE_FoxReactor } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/default.rel0000644000175000017500000000047415027201773023065 0ustar sudipsudip// This is the default relative definitions. Wildcards are acceptable. // // The first column is the name for which we create a relative definition. // The second (optional) column is the value to build up if it isn't defined // as an environment variable. *_ROOT TAO_ROOT, $ACE_ROOT/TAO CIAO_ROOT, $TAO_ROOT/CIAO ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/htbp.mpb0000644000175000017500000000031015027201773022357 0ustar sudipsudip// -*- MPC -*- project : acelib { avoids += ace_for_tao // Requires ACE_Configuration_Heap requires += ace_uuid after += HTBP libs += ACE_HTBP includes += $(ACE_ROOT)/protocols } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/vcfullmacros.mpt0000644000175000017500000000045115027201773024152 0ustar sudipsudip// -*- MPC -*- // ACE specific macros for nmake, vc6, and vc7 Static MFC Release { defines += ACE_HAS_MFC=1 ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER } Static MFC Debug { defines += ACE_HAS_MFC=1 ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER } conditional_include "vcpartialmacros" ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/acelib.mpb0000644000175000017500000000014415027201773022646 0ustar sudipsudip// -*- MPC -*- project: acedefaults, acenosubsets, ace_for_tao, versioned_namespace, pkgconfig { } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_xtreactor.mpb0000644000175000017500000000020015027201773024243 0ustar sudipsudip// -*- MPC -*- project : acelib, ace_xt { requires += ace_xtreactor after += ACE_XtReactor libs += ACE_XtReactor } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_unicode.mpb0000644000175000017500000000011515027201773023663 0ustar sudipsudip// -*- MPC -*- feature (uses_wchar) : unicode { macros += ACE_USES_WCHAR } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_bzip2.mpb0000644000175000017500000000003215027201773023261 0ustar sudipsudipfeature(bzip2): bzip2 { } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/inet.mpb0000644000175000017500000000034215027201773022366 0ustar sudipsudip// -*- MPC -*- project : acelib { avoids += old_stdstream avoids += exclude_inet avoids += ace_for_tao avoids += corba_e_compact after += INet libs += ACE_INet includes += $(ACE_ROOT)/protocols } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/threads.mpb0000644000175000017500000000006115027201773023057 0ustar sudipsudip// -*- MPC -*- project { requires += threads } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/inetssl.mpb0000644000175000017500000000013115027201773023104 0ustar sudipsudip// -*- MPC -*- project : inet, ssl { after += INet_SSL libs += ACE_INet_SSL } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_gtk.mpb0000644000175000017500000000041415027201773023024 0ustar sudipsudip// -*- MPC -*- project { macros += ACE_HAS_GTK // Depends on configuration from include/makeinclude/platform_*.GNU verbatim(gnuace,local) { CPPFLAGS += $(PLATFORM_GTK_CPPFLAGS) LIBS += $(PLATFORM_GTK_LIBS) LDFLAGS += $(PLATFORM_GTK_LDFLAGS) } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/install_bin.mpb0000644000175000017500000000011015027201773023716 0ustar sudipsudip// -*- MPC -*- project { specific { install_this_target = 1 } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/vs2022.features0000644000175000017500000000003215027201773023421 0ustar sudipsudipssl=0 qos=1 rwho=0 sctp=0 ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ssl.mpb0000644000175000017500000000045415027201773022234 0ustar sudipsudip// -*- MPC -*- // In the future, other ssl libraries could be supported // by creating a new xyzssl.mpb similar to openssl.mpb. // You would then derive the following project from this base. project : acelib, ssl_full, ssl_for_tao, ace_openssl { requires += ssl macros += ACE_HAS_SSL=1 } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_mfc.mpb0000644000175000017500000000007215027201773023004 0ustar sudipsudip// -*- MPC -*- project: mfc { macros += ACE_HAS_MFC=1 } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/winregistry.mpb0000644000175000017500000000013415027201773024014 0ustar sudipsudip// -*- MPC -*- feature(winregistry) { avoids += ace_for_tao requires += winregistry } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/vs2017nmake.mpb0000644000175000017500000000111215027201773023401 0ustar sudipsudip// -*- MPC -*- feature (nmake_avoid_Wp64) { specific(nmake) { add_compile -= /Wp64 } } feature (nmake_avoid_Gm) { specific(nmake) { compile_flags -= /Gm } } feature(vc_avoid_hides_local_declaration) { specific(nmake) { DisableSpecificWarnings += 4456 } } feature(vc_avoid_hides_global_declaration) { specific(nmake) { DisableSpecificWarnings += 4459 } } feature(vc_avoid_hides_class_member) { specific(nmake) { DisableSpecificWarnings += 4458 } } feature(ace_languagestandard2017) { specific(nmake) { compile_flags += /std:c++17 } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/kokyu.mpb0000644000175000017500000000015315027201773022571 0ustar sudipsudip// -*- MPC -*- project : acelib { after += Kokyu libs += Kokyu includes += $(ACE_ROOT)/Kokyu }ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ssl_for_tao.mpb0000644000175000017500000000022615027201773023742 0ustar sudipsudip// -*- MPC -*- feature(ace_for_tao) { // Does not include ACE_SSL asynch stream support. after += SSL_FOR_TAO libs += ACE_SSL_FOR_TAO } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/svc_conf_files.mpb0000644000175000017500000000011515027201773024407 0ustar sudipsudipproject { Define_Custom(Svc_Conf) { inputext = .conf, .conf.xml } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_zzip.mpb0000644000175000017500000000002715027201773023233 0ustar sudipsudipfeature(zzip): zzip { }ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/gnuace.features0000644000175000017500000000003415027201773023727 0ustar sudipsudipssl=1 fl=1 tk=1 xt=1 sctp=1 ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/core.mpb0000644000175000017500000000004515027201773022357 0ustar sudipsudip// -*- MPC -*- project : install { } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_x11.mpb0000644000175000017500000000045115027201773022651 0ustar sudipsudip// -*- MPC -*- project { specific(prop:microsoft) { } else { requires += x11 } // Depends on configuration from include/makeinclude/platform_*.GNU verbatim(gnuace,local) { CPPFLAGS += $(PLATFORM_X11_CPPFLAGS) LIBS += $(PLATFORM_X11_LIBS) LDFLAGS += $(PLATFORM_X11_LDFLAGS) } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_zlib.mpb0000644000175000017500000000003015027201773023171 0ustar sudipsudipfeature(zlib): zlib { } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/install_data.mpb0000644000175000017500000000060115027201773024064 0ustar sudipsudip// -*- MPC -*- project { // With gnuace, when install_this_target = 1 (see install_bin or install_lib) // files listed as InstallData_Files { ... } will be installed to the "data" // location for the system (such as /usr/local/share/INST_DIR). // The target sub-directory can be modified by setting MPC's "gendir" option. Define_Custom(InstallData) { automatic = 0 } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/qos.mpb0000644000175000017500000000013415027201773022230 0ustar sudipsudip// -*- MPC -*- feature(qos) { after += QoS libs += ACE_QoS macros += ACE_HAS_QOS } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/pkgconfig.mpb0000644000175000017500000000012215027201773023372 0ustar sudipsudip// -*- MPC -*- project { Define_Custom(pkgconfig) { inputext = .pc.in } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/script.mpb0000644000175000017500000000013715027201773022735 0ustar sudipsudip// -*- MPC -*- project { Define_Custom(Script) { automatic = 1 inputext = .sh } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_qtreactor.mpb0000644000175000017500000000030515027201773024242 0ustar sudipsudipfeature(qt4): ace_qt4reactor { } feature(qt5): ace_qt5reactor { } feature(!qt4, !qt5) { requires += dummy_label Define_Custom(UIC) { } Define_Custom(MOC) { } Define_Custom(QRC) { } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/labviewrt_dll.mpb0000644000175000017500000000077015027201773024266 0ustar sudipsudip// // This base project changes all projects to generate DLLs regardless of // whether it's an exe or a dll project. The DLLs still go in the place the // exe would have been generated, just as a DLL, not an EXE. // This is needed when generating projects to build LabVIEW RT "programs" // that must be loaded as DLLs. project { macros += ACE_BUILD_LABVIEW_EXE_AS_DLL specific(vc71) { configuration_type = 2 exe_ext = .dll common_defines -= _CONSOLE common_defines += _WINDOWS } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_qt4.mpb0000644000175000017500000000010615027201773022745 0ustar sudipsudip// -*- MPC -*- project: qt4_core, qt4_gui { macros += ACE_HAS_QT4 } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/vs2022nmake.mpb0000644000175000017500000000111215027201773023375 0ustar sudipsudip// -*- MPC -*- feature (nmake_avoid_Wp64) { specific(nmake) { add_compile -= /Wp64 } } feature (nmake_avoid_Gm) { specific(nmake) { compile_flags -= /Gm } } feature(vc_avoid_hides_local_declaration) { specific(nmake) { DisableSpecificWarnings += 4456 } } feature(vc_avoid_hides_global_declaration) { specific(nmake) { DisableSpecificWarnings += 4459 } } feature(vc_avoid_hides_class_member) { specific(nmake) { DisableSpecificWarnings += 4458 } } feature(ace_languagestandard2017) { specific(nmake) { compile_flags += /std:c++17 } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_xml_utils.mpb0000644000175000017500000000013515027201773024257 0ustar sudipsudip// -*- MPC -*- project : acelib, xerces { after += ACE_XML_Utils libs += ACE_XML_Utils } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/nmake.features0000644000175000017500000000003215027201773023556 0ustar sudipsudipssl=0 qos=1 rwho=0 sctp=0 ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_gl.mpb0000644000175000017500000000061115027201773022640 0ustar sudipsudip// -*- MPC -*- project : ace_x11 { requires += gl // Depends on configuration from include/makeinclude/platform_*.GNU verbatim(gnuace,local) { CPPFLAGS += $(PLATFORM_GL_CPPFLAGS) $(PLATFORM_X11_CPPFLAGS) LIBS += $(PLATFORM_GL_LIBS) $(PLATFORM_X11_LIBS) LDFLAGS += $(PLATFORM_GL_LDFLAGS) $(PLATFORM_GL_LDFLAGS) } specific(prop:microsoft) { lit_libs += OpenGL32 } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/mc_test_utils.mpb0000644000175000017500000000024315027201773024305 0ustar sudipsudipproject { includes += ../../.. //TODO: support for ^(HERE) variable expansion libpaths += .. after += MC_Test_Utilities libs += MC_Test_Utilities } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_athena.mpb0000644000175000017500000000011215027201773023472 0ustar sudipsudip// -*- MPC -*- project: ace_xt { requires += athena lit_libs += Xaw } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/wb26.features0000644000175000017500000000007415027201773023251 0ustar sudipsudip// We're always cross-compiling with wb26 cross_compile = 1 ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/vs2017.features0000644000175000017500000000003215027201773023425 0ustar sudipsudipssl=0 qos=1 rwho=0 sctp=0 ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/vcl.mpb0000644000175000017500000000040115027201773022207 0ustar sudipsudip// -*- MPC -*- project { requires += vcl macros += ACE_HAS_VCL=1 specific(bmake, bds4) { use_vcl = 1 lit_libs += rtl vcl compile_flags += -tW -tWV linkflags += -aa } verbatim(borland,macros) { VCL=1 } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_output.mpb0000644000175000017500000000006715027201773023603 0ustar sudipsudip// -*- MPC -*- project { libout = $(ACE_ROOT)/lib } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_openssl.mpb0000644000175000017500000000111715027201773023723 0ustar sudipsudip// -*- MPC -*- project : openssl { // For gnuace we want to use built-in macros instead of // the values provided by the openssl base project. specific (gnuace) { lit_libs -= ssl crypto includes -= $(SSL_INCDIR) includes -= /usr/kerberos/include libpaths -= $(SSL_LIBDIR) } // These values get set in platform_macros.GNU or defaulted // in wrapper_macros.GNU if the GNU make variable ssl is set to 1. specific (gnuace) { compile_flags += $(PLATFORM_SSL_CPPFLAGS) linkflags += $(PLATFORM_SSL_LDFLAGS) pure_libs += $(PLATFORM_SSL_LIBS) } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_etcl.mpb0000644000175000017500000000011315027201773023162 0ustar sudipsudip// -*- MPC -*- project : acelib { after += ACE_ETCL libs += ACE_ETCL } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_xt.mpb0000644000175000017500000000064215027201773022675 0ustar sudipsudip// -*- MPC -*- project: ace_x11 { // this feature by default is set to 1 as projects dependent on Xt has their own features requires += xt // Depends on configuration from include/makeinclude/platform_*.GNU verbatim(gnuace,local) { CPPFLAGS += $(PLATFORM_XT_CPPFLAGS) $(PLATFORM_X11_CPPFLAGS) LIBS += $(PLATFORM_XT_LIBS) $(PLATFORM_X11_LIBS) LDFLAGS += $(PLATFORM_XT_LDFLAGS) $(PLATFORM_X11_LDFLAGS) } } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_for_tao.mpb0000644000175000017500000000022315027201773023666 0ustar sudipsudip// -*- MPC -*- feature(ace_for_tao) { macros += ACE_LACKS_ACE_TOKEN ACE_LACKS_MSG_WFMO after += ACE_FOR_TAO libs += ACE_FOR_TAO } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/config/ace_motif.mpb0000644000175000017500000000011015027201773023346 0ustar sudipsudip// -*- MPC -*- project: ace_xt { requires += motif lit_libs += Xm } ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/docs/0000755000175000017500000000000015046037655020422 5ustar sudipsudipace-8.0.4+dfsg.orig/bin/MakeProjectCreator/docs/templates/0000755000175000017500000000000015046037655022420 5ustar sudipsudipace-8.0.4+dfsg.orig/bin/MakeProjectCreator/docs/templates/gnu.txt0000644000175000017500000000171515027201773023747 0ustar sudipsudip// This defines the role of all the template variables specific to the // 'gnuace' project type. // // Please try to keep this alphabetically sorted. // build_dir_per_project = Specifies to use per project object file output dirs (VDIR and VSHDIR) if set to '1'. idl_files = When a Define_Custom(IDL) is used, they will be accessible through this variable name. install = This is a synonym for exeout. linkflags = Platform specific flags passed during the linking of dynamic libraries and executables. tao = Indicates whether or not this project contains TAO code. tao_idl = The full path to the idl compiler. tao_idl_dep = The full path to the idl compiler as a dependency. tao_idlflags = The default flags for the idl compiler. targetoutdir = Specifies a location for all targets and intermediaries within the makefile. It should always end in a slash. vpath = The value will be used as the VPATH setting within the makefile. xerceslib = The name of the Xerces library. ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/modules/0000755000175000017500000000000015046037655021142 5ustar sudipsudipace-8.0.4+dfsg.orig/bin/MakeProjectCreator/modules/GNUACEWorkspaceCreator.pm0000644000175000017500000001507115027201773025636 0ustar sudipsudippackage GNUACEWorkspaceCreator; # ************************************************************ # Description : A GNU Workspace (GNUmakefile) creator for ACE # Author : Chad Elliott # Create Date : 5/13/2002 # ************************************************************ # ************************************************************ # Pragmas # ************************************************************ use strict; use GNUACEProjectCreator; use MakeWorkspaceBase; use WorkspaceCreator; use vars qw(@ISA); @ISA = qw(MakeWorkspaceBase WorkspaceCreator); # ************************************************************ # Data Section # ************************************************************ my($base) = 'GNUmakefile'; # ************************************************************ # Subroutine Section # ************************************************************ sub targets { return 'clean depend idl_stubs realclean'; } sub generate_implicit_project_dependencies { #my($self) = shift; return 1; } sub workspace_file_prefix { #my($self) = shift; return $base; } sub pre_workspace { my($self) = shift; my($fh) = shift; my($crlf) = $self->crlf(); print $fh '# -*- makefile -*-', $crlf; $self->workspace_preamble($fh, $crlf, 'GNU ACE Workspace', ''); print $fh 'MAKEFILE = ', $self->get_modified_workspace_name($base, '', 1), $crlf; } sub write_project_targets { my($self) = shift; my($fh) = shift; my($crlf) = shift; my($target) = shift; my($list) = shift; foreach my $project (@$list) { my($dname) = $self->mpc_dirname($project); my($chdir) = ($dname ne '.'); print $fh "\t\$(KEEP_GOING)\@", ($chdir ? "cd $dname && " : ''), "\$(MAKE) -f ", ($chdir ? $self->mpc_basename($project) : $project), " $target$crlf"; } } sub write_comps { my($self) = shift; my($fh) = shift; my($crlf) = $self->crlf(); my(%targnum) = (); my($pjs) = $self->get_project_info(); my($named) = !defined $ENV{MPC_GNUACE_DIRECTORY_DEPS}; my(@list) = $self->number_target_deps($self->get_projects(), $pjs, \%targnum, $named ? 0 : 1); ## Print out some preliminary information print $fh $crlf, "ifeq (\$(findstring k,\$(MAKEFLAGS)),k)$crlf", " KEEP_GOING = -$crlf", "endif$crlf$crlf", "include \$(ACE_ROOT)/include/makeinclude/macros.GNU$crlf"; if ($named) { $self->write_named_targets($fh, $crlf, \%targnum, \@list, 'REMAINING_TARGETS := ' . '$(filter-out all depend,$(TARGETS_NESTED:.nested=)) $(CUSTOM_TARGETS)' . "$crlf.PHONY: \$(REMAINING_TARGETS)$crlf$crlf". "\$(REMAINING_TARGETS)", '', '', $self->project_target_translation(1), 1); } else { ## Determine the ordering of the sub-directories my(@dirs) = (); my(%found) = (); foreach my $file (reverse @list) { my($dir) = $self->get_first_level_directory($file); if ($dir ne '.') { if (!defined $found{$dir}) { $found{$dir} = 1; unshift(@dirs, $dir); } } } my($need_dirs) = ($#dirs > -1); ## Store the local projects in a separate list my(@lprj) = (); my(%dirprj) = (); foreach my $project (@list) { if ($project !~ /\//) { push(@lprj, $project); if ($need_dirs && defined $targnum{$project}) { foreach my $number (@{$targnum{$project}}) { if ($list[$number] =~ /\//) { ## If any local project depends on a project that is not ## in this directory, we can not rely on the directory ## recursion to get the correct dependencies. We will do ## all projects as local targets. @lprj = (); foreach my $prj (@list) { push(@lprj, $prj); if ($prj =~ /\//) { $dirprj{$prj} = 1; } } $need_dirs = 0; last; } } if (!$need_dirs) { last; } } } } if ($#lprj >= 0) { ## Print out the all target first. This will allow multiple projects ## within the same directory to build in parallel. print $fh 'all:'; foreach my $project (@lprj) { print $fh ' ', $$pjs{$project}->[0]; } print $fh $crlf; if ($need_dirs) { foreach my $dir (@dirs) { print $fh "\t\$(KEEP_GOING)\@cd $dir && ", "\$(MAKE) -f \$(MAKEFILE) \$(\@)$crlf"; } } ## Print out each target separately. Make can decide on which ## targets can be built in parallel because we add the local ## dependencies. foreach my $project (@lprj) { print $fh $crlf, '.PHONY: ', $$pjs{$project}->[0], $crlf, $$pjs{$project}->[0], ':'; if (defined $targnum{$project}) { foreach my $number (@{$targnum{$project}}) { print $fh ' ', $$pjs{$list[$number]}->[0]; } } print $fh $crlf, "\t\$(KEEP_GOING)\@"; if (defined $dirprj{$project}) { print $fh "cd ", $self->mpc_dirname($project), " && \$(MAKE) -f ", $self->mpc_basename($project), $crlf; } else { print $fh "\$(MAKE) -f $project$crlf"; } } print $fh $crlf, 'REMAINING_TARGETS := ', '$(subst all, , $(TARGETS_NESTED:.nested=)) $(CUSTOM_TARGETS)', $crlf; } else { print $fh 'REMAINING_TARGETS := $(TARGETS_NESTED:.nested=) ', '$(CUSTOM_TARGETS)', $crlf; } ## Print out the remaing targets. ## They will be handled serially by make. print $fh "\$(REMAINING_TARGETS):$crlf"; foreach my $project (@lprj) { print $fh "\t\$(KEEP_GOING)\@"; if (defined $dirprj{$project}) { print $fh "cd ", $self->mpc_dirname($project), " && \$(MAKE) -f ", $self->mpc_basename($project), " \$(\@)", $crlf; } else { print $fh "\$(MAKE) -f $project \$(\@)$crlf"; } } if ($need_dirs) { foreach my $dir (@dirs) { print $fh "\t\$(KEEP_GOING)\@cd $dir && ", "\$(MAKE) -f \$(MAKEFILE) \$(\@)$crlf"; } } print $fh $crlf; } } 1; ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/modules/GNUACEProjectCreator.pm0000644000175000017500000000325315027201773025305 0ustar sudipsudippackage GNUACEProjectCreator; # ************************************************************ # Description : A GNU Project Creator for ACE # Author : Chad Elliott # Create Date : 3/13/2002 # ************************************************************ # ************************************************************ # Pragmas # ************************************************************ use strict; use File::Basename; use MakeProjectBase; use ProjectCreator; use vars qw(@ISA); @ISA = qw(MakeProjectBase ProjectCreator); # ************************************************************ # Subroutine Section # ************************************************************ sub expand_variables_from_template_values { #my($self) = shift; return 0; } sub convert_slashes { #my($self) = shift; return 0; } sub fill_value { my($self) = shift; my($name) = shift; if ($name eq 'vpath') { my(%vpath) = (); foreach my $item ($self->get_component_list('source_files')) { my($dname) = $self->relative($self->mpc_dirname($item)); if ($dname ne '.') { $vpath{$dname} = 1; } } my($str) = join(':', keys %vpath); if ($str ne '') { return 'VPATH = .:' . $str . $self->crlf(); } } elsif ($name eq 'genins') { my $ins = ''; $self->get_install_info(sub { $ins .= '#' . $_[0] }); return $ins; } return undef; } sub project_file_prefix { #my($self) = shift; return 'GNUmakefile.'; } sub get_dll_exe_template_input_file { #my($self) = shift; return 'gnuexe'; } sub get_dll_template_input_file { #my($self) = shift; return 'gnudll'; } sub get_template { #my($self) = shift; return 'gnu'; } 1; ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/modules/GNUAutobuildProjectCreator.pm0000644000175000017500000000122415027201773026641 0ustar sudipsudippackage GNUAutobuildProjectCreator; # ************************************************************ # Description : A Project creator for the GNUAutobuild project type # Author : Chad Elliott # Create Date : 3/13/2002 # ************************************************************ # ************************************************************ # Pragmas # ************************************************************ use strict; use File::Basename; use GNUACEProjectCreator; use MakeProjectBase; use ProjectCreator; use vars qw(@ISA); @ISA = qw(GNUACEProjectCreator MakeProjectBase ProjectCreator); sub extractType { return 'gnuace'; } 1; ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/modules/VXTestProjectCreator.pm0000644000175000017500000000325515027201773025542 0ustar sudipsudippackage VXTestProjectCreator; # ************************************************************ # Description : A Project Creator for VxWorks testing # Author : Johnny Willemsen # Create Date : 3/27/2008 # ************************************************************ # ************************************************************ # Pragmas # ************************************************************ use strict; use ProjectCreator; use vars qw(@ISA); @ISA = qw(ProjectCreator); # ************************************************************ # Subroutine Section # ************************************************************ sub project_file_name { my($self) = shift; my($name) = shift; if (!defined $name) { $name = $self->project_name(); } my($value) = $self->get_assignment('exename'); if (!defined $value) { $value = $self->get_assignment('staticname'); } if (!defined $value) { $value = $self->get_assignment('sharedname'); } return $self->get_modified_project_file_name($value, '.vxtest'); } sub get_template { #my($self) = shift; return 'vxtest'; } sub need_to_write_project { my $self = shift; ## We only want to return 1 if the project has source files and isn't a ## custom-only project. We have to check for custom_only because ## non-custom related project settings are only removed after calling ## need_to_write_project(). if (!$self->get_assignment('custom_only') && $self->SUPER::need_to_write_project() == 1) { ## We only want to return 1 if this is an executable or library project return 1 if ($self->exe_target() || $self->lib_target()); } return 0; } sub warn_useless_project { return 0; } 1; ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/modules/VXTestWorkspaceCreator.pm0000644000175000017500000000127615027201773026073 0ustar sudipsudippackage VXTestWorkspaceCreator; # ************************************************************ # Description : VxTest Workspace create # Author : Johnny Willemsen # Create Date : 28/03/2008 # ************************************************************ # ************************************************************ # Pragmas # ************************************************************ use strict; use VXTestProjectCreator; use WorkspaceCreator; use vars qw(@ISA); @ISA = qw(WorkspaceCreator); # ************************************************************ # Subroutine Section # ************************************************************ sub write_workspace { return 1; } 1; ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/modules/GNUAutobuildWorkspaceCreator.pm0000644000175000017500000000327115027201773027175 0ustar sudipsudippackage GNUAutobuildWorkspaceCreator; # ************************************************************ # Description : A GNU Workspace (GNUmakefile) creator that # collates build results for a single makefile # before outputting to stdout. # Author : Chad Elliott, minor modifications by Will Otte # Create Date : 3/22/07 # ************************************************************ # ************************************************************ # Pragmas # ************************************************************ use strict; use GNUACEWorkspaceCreator; use GNUAutobuildProjectCreator; use MakeWorkspaceBase; use WorkspaceCreator; use vars qw(@ISA); @ISA = qw(GNUACEWorkspaceCreator MakeWorkspaceBase WorkspaceCreator); # ************************************************************ # Data Section # ************************************************************ my($base) = 'GNUmakefile'; # ************************************************************ # Subroutine Section # ************************************************************ sub extractType { return 'gnuace'; } sub write_project_targets { my($self) = shift; my($fh) = shift; my($crlf) = shift; my($target) = shift; my($list) = shift; foreach my $project (@$list) { my($dname) = $self->mpc_dirname($project); my($chdir) = ($dname ne '.'); my($output_project) = ($chdir ? $self->mpc_basename($project) : $project); print $fh "\t\@", ($chdir ? "cd $dname && " : ''), "\$(MAKE) -f ", $output_project, " $target > $output_project.log 2>&1 ; cat $output_project.log ; rm $output_project.log $crlf"; } } 1; ace-8.0.4+dfsg.orig/bin/MakeProjectCreator/README0000644000175000017500000000303215027201773020341 0ustar sudipsudipThis directory contains ACE- and TAO-specific extensions of MPC. All the base projects in the config directory are ACE- and TAO-specific, along with the perl modules for the gnuace and vxtest types and the templates that go along with those implementations. GNUACE-specific aspects of project keywords ------------------------------------------- requires Specifies which features should be enabled in order to generate the project file. Under the GNUACE type, it also specifies which tao macros should be set to build the target. avoids Specifies which features should be disabled in order to generate the project file. Under the GNUACE type, it also specifies which tao macros should not be set to build the target. The following keywords are GNUACE only: tagname Specifies the make macro to check before building the target tagchecks Specifies the values for tagname to check NOTE: Within the GNUACE project type, setting sharedname to empty and setting staticname to the static library name will result in a project that will generate only static libraries. The default generation mode for the GNUACE project type is named targets. The environment variable MPC_GNUACE_DIRECTORY_DEPS can be set to get the directory based build that was used up until April of 2006. For more information about MPC, see the README and USAGE files in the MPC docs directory. MPC is available from github, see https://github.com/DOCGroup/MPC ace-8.0.4+dfsg.orig/bin/generate_export_file.pl0000755000175000017500000001101015027201773020462 0ustar sudipsudip#!/usr/bin/env perl eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # -*- perl -*- # Replacement for the old trusty GenExportH.bat # Creates the nice little *_export file which is used for # importing and exporting of symbols in DLLs. # (they are soooo cute!) use Getopt::Std; ############################################################################## # Grab the options $flags = join (" ", @ARGV); if (!getopts ('df:hsn') || $opt_h) { print STDERR "generate_export_file.pl [-d] [-f dependency] [-n] library_name\n", "\n", " -d Turn on debug mode\n", " -f Adds a dependency to another *_HAS_DLL macro\n", " -n Do not add in ACE_AS_STATIC_LIBS check\n", "\n", "generate_export_file creates the *_export files that are used\n", "in exporting of symbols for DLLs (and not exporting them when\n", "the library is static). If library_name is something like\n", "\"Foo\", then the file will contain definitions for Foo_Export\n", "and FOO_SINGLETON_DECLARE, etc. which will be controlled by\n", "FOO_HAS_DLL, etc.\n"; exit (1); } if (defined $opt_d) { print STDERR "Debugging Turned on\n"; if (defined $opt_f) { print STDERR "Dependency to $opt_f\n"; } if (defined $opt_n) { print STDERR "ACE_AS_STATIC_LIBS turned off\n"; } } if ($#ARGV < 0) { print STDERR "No library_name specified, use -h for help\n"; exit (1); } $name = shift @ARGV; $ucname = uc $name; ############################################################################## # Prologue $prologue = ' // -*- C++ -*- // Definition for Win32 Export directives. // This file is generated automatically by generate_export_file.pl '."$flags".' // ------------------------------'." #ifndef -UC-_EXPORT_H #define -UC-_EXPORT_H #include \"ace/config-all.h\" "; ############################################################################## # Static Stuff if (!defined $opt_n) { $static_stuff = " #if defined (ACE_AS_STATIC_LIBS) && !defined (-UC-_HAS_DLL) # define -UC-_HAS_DLL 0 #endif /* ACE_AS_STATIC_LIBS && -UC-_HAS_DLL */ "; } ############################################################################## # Dependencies if (defined $opt_f) { $has_dll = " #if defined ($opt_f) # if !defined (-UC-_HAS_DLL) # define -UC-_HAS_DLL 0 # endif /* ! -UC-_HAS_DLL */ #else # if !defined (-UC-_HAS_DLL) # define -UC-_HAS_DLL 1 # endif /* ! -UC-_HAS_DLL */ #endif "; } else { $has_dll = " #if !defined (-UC-_HAS_DLL) # define -UC-_HAS_DLL 1 #endif /* ! -UC-_HAS_DLL */ "; } ############################################################################## # Epilogue $epilogue = " #if defined (-UC-_HAS_DLL) && (-UC-_HAS_DLL == 1) # if defined (-UC-_BUILD_DLL) # define -NC-_Export ACE_Proper_Export_Flag # define -UC-_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) # define -UC-_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) # else /* -UC-_BUILD_DLL */ # define -NC-_Export ACE_Proper_Import_Flag # define -UC-_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) # define -UC-_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) # endif /* -UC-_BUILD_DLL */ #else /* -UC-_HAS_DLL == 1 */ # define -NC-_Export # define -UC-_SINGLETON_DECLARATION(T) # define -UC-_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) #endif /* -UC-_HAS_DLL == 1 */ // Set -UC-_NTRACE = 0 to turn on library specific tracing even if // tracing is turned off for ACE. #if !defined (-UC-_NTRACE) # if (ACE_NTRACE == 1) # define -UC-_NTRACE 1 # else /* (ACE_NTRACE == 1) */ # define -UC-_NTRACE 0 # endif /* (ACE_NTRACE == 1) */ #endif /* !-UC-_NTRACE */ #if (-UC-_NTRACE == 1) # define -UC-_TRACE(X) #else /* (-UC-_NTRACE == 1) */ # if !defined (ACE_HAS_TRACE) # define ACE_HAS_TRACE # endif /* ACE_HAS_TRACE */ # define -UC-_TRACE(X) ACE_TRACE_IMPL(X) # include \"ace/Trace.h\" #endif /* (-UC-_NTRACE == 1) */ #endif /* -UC-_EXPORT_H */ // End of auto generated file. "; ############################################################################## # Print the stuff out foreach $export ($prologue, $static_stuff, $has_dll, $epilogue) { ## -NC- stands for normal case, the name as it is ## -UC- stands for the name all upper case map { s/-NC-/$name/g; s/-UC-/$ucname/g; } $export; print $export; }; ace-8.0.4+dfsg.orig/bin/group_test_stats.sh0000755000175000017500000000032215027201773017704 0ustar sudipsudip#!/bin/sh if test -e tmp; then unlink tmp; fi if test -e tmp2; then unlink tmp2; fi cat t.txt | grep '+[a-z|A-Z]' > tmp sort tmp | uniq -c > tmp2 unlink tmp sort -n -r tmp2 > uniq.txt unlink tmp2 cat uniq.txt ace-8.0.4+dfsg.orig/bin/mpc-mode.el0000644000175000017500000001601315027201773015763 0ustar sudipsudip;;; mpc-mode.el --- Makefile Project Creator mode for Emacs ;; Author: Jules Colding ;; Maintainer: Jules Colding ;; Keywords: languages, faces, mpc ;; Copyright (C) 2008 Jules Colding ;; ;; 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 3 of the License, 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, see . ;; A major mode for editing MPC input. Please see: ;; ;; http://downloads.ociweb.com/MPC/MakeProjectCreator.pdf ;; ;; Derived from autoconf-mode.el by Martin Buchholz (martin@xemacs.org) ;; Many thanks to the follwing kind people for extensions, bugfixes and ;; other contributions: ;; ;; * William R. Otte ;; Indentation and syntax table. ;; ;; Put this file somewhere in your emacs load path and add the following ;; to your Emacs configuration file: ;; ;; (require 'mpc-mode) ;; ;; ;; You may also add something like this to the top of your MPC files ;; to force a specific indentation mode: ;; ;; // -*- Mode: MPC; tab-width: 2; indent-tabs-mode: t; -*- ;;; Code: (require 'font-lock) (defvar mpc-mode-hook nil) (defvar mpc-mode-map (let ((mpc-mode-map (make-sparse-keymap))) (define-key mpc-mode-map '[(control c) (control c)] 'comment-region) (define-key mpc-mode-map '[(control j)] 'newline-and-indent) mpc-mode-map) "Keymap for MPC major mode") (defvar mpc-font-lock-keywords `( ("\\(project\\)" 1 font-lock-warning-face t) ("\\(workspace\\)" 1 font-lock-warning-face t) ("(\\([^()]*\\))" 1 font-lock-constant-face t) ("\\(IDL_Files\\)" 1 font-lock-keyword-face t) ("\\(Source_Files\\)" 1 font-lock-keyword-face t) ("\\(Header_Files\\)" 1 font-lock-keyword-face t) ("\\(Inline_Files\\)" 1 font-lock-keyword-face t) ("\\(Template_Files\\)" 1 font-lock-keyword-face t) ("\\(Resource_Files\\)" 1 font-lock-keyword-face t) ("\\(Pkgconfig_Files\\)" 1 font-lock-keyword-face t) ("\\(exclude\\)" 1 font-lock-type-face t) ("\\(custom_only\\)" 1 font-lock-type-face t) ("\\(cmdline\\)" 1 font-lock-type-face t) ("\\(avoids\\)" 1 font-lock-type-face t) ("\\(exename\\)" 1 font-lock-type-face t) ("\\(install =\\)" 1 font-lock-type-face t) ("\\(install +=\\)" 1 font-lock-type-face t) ("\\(install -=\\)" 1 font-lock-type-face t) ("\\(libs\\)" 1 font-lock-type-face t) ("\\(lit_libs\\)" 1 font-lock-type-face t) ("\\(linkflags\\)" 1 font-lock-type-face t) ("\\(specific\\)" 1 font-lock-type-face t) ("\\(macros\\)" 1 font-lock-type-face t) ("\\(after\\)" 1 font-lock-type-face t) ("\\(libout\\)" 1 font-lock-type-face t) ("\\(libpaths\\)" 1 font-lock-type-face t) ("\\(includes\\)" 1 font-lock-type-face t) ("\\(automatic\\)" 1 font-lock-type-face t) ("\\(command\\)" 1 font-lock-type-face t) ("\\(output_option\\)" 1 font-lock-type-face t) ("\\(header_pre_extension\\)" 1 font-lock-type-face t) ("\\(header_outputext\\)" 1 font-lock-type-face t) ("\\(sharedname\\)" 1 font-lock-type-face t) ("\\(dynamicflags\\)" 1 font-lock-type-face t) ("\\(idlflags\\)" 1 font-lock-type-face t) ("\\(:\\)" 1 font-lock-builtin-face t) ("\\( = \\)" 1 font-lock-builtin-face t) ("\\(+=\\)" 1 font-lock-builtin-face t) ("\\(-=\\)" 1 font-lock-builtin-face t) ("\\(//\\)" 1 font-lock-comment-face t) ("\\//\\(.*\\)" 1 font-lock-comment-face t) "default font-lock-keywords") ) ;; Indenting logic (defun mpc-indent-line () "Indent current line as MPC directives" (interactive) (beginning-of-line) (if (bobp) (indent-line-to 0) ; if we are at start of file, zero indent (let ((not-found-hint t) cur-indent (close-brace nil)) (save-excursion ; otherwise, we are not looking at a }, so we need to go back to find the (if (looking-at ".*}") (setq close-brace t)) (while not-found-hint ; nearest indentation hint (forward-line -1) (if (looking-at ".*{") (progn (setq cur-indent (+ (current-indentation) tab-width)) (setq not-found-hint nil)) (if (looking-at ".*}") (progn (setq cur-indent (current-indentation)) (if (< cur-indent 0) (setq cur-indent 0)) (setq not-found-hint nil)) (if (bobp) (setq not-found-hint nil)))))) (if close-brace (setq cur-indent (- cur-indent tab-width))) (if cur-indent (indent-line-to cur-indent) (indent-line-to 0)))) ) ;; Create a syntax table. Derived from fundamental mode, it will automatically ;; highlight strings, and behave correctly on most words. (defvar mpc-mode-syntax-table nil "syntax table used in mpc mode") (setq mpc-mode-syntax-table (make-syntax-table)) (modify-syntax-entry ?_ "w" mpc-mode-syntax-table) ; underscore is a valid part of a word (modify-syntax-entry ?- "w" mpc-mode-syntax-table) ; hyphen is a valid part of a word (modify-syntax-entry ?/ ". 12b" mpc-mode-syntax-table) ; c++-style comments (modify-syntax-entry ?\n "> b" mpc-mode-syntax-table) ; c++-style comments ;;;###autoload (defun mpc-mode () "A major-mode to edit MPC files. \\{mpc-mode-map} " (interactive) (kill-all-local-variables) (use-local-map mpc-mode-map) (make-local-variable 'comment-start) (setq comment-start "//") (make-local-variable 'parse-sexp-ignore-comments) (setq parse-sexp-ignore-comments t) (make-local-variable 'tab-width) (make-local-variable 'font-lock-defaults) (make-local-variable 'indent-line-function) (setq major-mode 'mpc-mode) (setq mode-name "MPC") (setq font-lock-defaults `(mpc-font-lock-keywords nil t)) (setq indent-line-function 'mpc-indent-line) (set-syntax-table mpc-mode-syntax-table) (run-hooks 'mpc-mode-hook) ) (add-to-list 'auto-mode-alist '("\\.mwb\\'" . mpc-mode)) (add-to-list 'auto-mode-alist '("\\.mwc\\'" . mpc-mode)) (add-to-list 'auto-mode-alist '("\\.mpb\\'" . mpc-mode)) (add-to-list 'auto-mode-alist '("\\.mpc\\'" . mpc-mode)) (provide 'mpc-mode) ;;; mpc-mode.el ends here ace-8.0.4+dfsg.orig/bin/clean_sems.sh0000755000175000017500000000074215027201773016412 0ustar sudipsudip#!/bin/sh SYSTEM=`uname -s` IPCS="ipcs" IPCRM="ipcrm -s" if [ "$SYSTEM" = "Darwin" ]; then USER=`id | sed 's/(.*//; s/uid=//'` IPCS="ngvipc -s" IPCRM="ngvipc -s -R" elif [ -z "$USER" ]; then USER=`id | sed 's/).*//; s/.*(//'` fi case "$SYSTEM" in "Linux" ) ipcs -a | grep $USER | awk '{ print ($2) }' | xargs -r ipcrm sem; ;; * ) semids=`$IPCS | grep "^s" | grep $USER | awk '{ print ($2) }'` for p in $semids do $IPCRM $p done ;; esac ace-8.0.4+dfsg.orig/bin/msvc_static_compile.pl0000755000175000017500000002701315027201773020331 0ustar sudipsudip# Win32 auto_compile script. if (!$ENV{ACE_ROOT}) { $ACE_ROOT = getcwd ()."\\"; warn "ACE_ROOT not defined, defaulting to ACE_ROOT=$ACE_ROOT"; } else { $ACE_ROOT = $ENV{ACE_ROOT}; } use lib "$ENV{ACE_ROOT}/bin"; use File::Find; use PerlACE::Run_Test; use Cwd; @directories = (); @ace_dirs = ("$ACE_ROOT\\ace", "$ACE_ROOT\\ACEXML\\common", "$ACE_ROOT\\ACEXML\\parser", "$ACE_ROOT\\ACEXML\\apps", "$ACE_ROOT\\ACEXML\\tests", "$ACE_ROOT\\ACEXML\\examples", "$ACE_ROOT\\apps", "$ACE_ROOT\\ASNMP", "$ACE_ROOT\\examples", "$ACE_ROOT\\netsvcs", "$ACE_ROOT\\performance-tests", "$ACE_ROOT\\protocols", "$ACE_ROOT\\tests", "$ACE_ROOT\\websvcs"); $debug = 0; $verbose = 0; $print_status = 0; $Ignore_errors = 0; # By default, bail out if an error occurs. $Build_LIB = 0; $Build_Debug = 0; $Build_Release = 0; $Build_All = 1; $build_core_only = 0; $Build_Cmd = "/BUILD"; $use_custom_dir = 0; $useenv = ''; $vc7 = 0; $name_mod = ''; $mod_name = 0; $proj_ext = '.dsp'; # Build sub Build ($$) { my ($project, $config) = @_; if ($debug == 1) { print "$project\n"; return 0; } else { print "Auto_compiling $project : $config\n"; print "Building $project $config\n" if $verbose; return system ("msdev.com $project /MAKE \"$config\" $Build_Cmd $useenv"); } } # Build sub Build_VC7 ($$) { my ($project, $config) = @_; if ($debug == 1) { print "$project\n"; return 0; } else { print "Auto_compiling $project : $config\n"; print "Building $project $config\n" if $verbose; return system ("devenv.com $project $Build_Cmd $config $useenv"); } } sub Find_Dsw (@) { my (@dir) = @_; @array = (); sub wanted_dsw { $array[++$#array] = $File::Find::name if ($File::Find::name =~ /\.dsw$/i); } find (\&wanted_dsw, @dir); print "List of dsw's \n" if ($verbose == 1); return @array; } sub Find_Sln (@) { my (@dir) = @_; @array = (); sub wanted_sln { $array[++$#array] = $File::Find::name if ($File::Find::name =~ /\.sln$/i); } find (\&wanted_sln, @dir); print "List of sln's \n" if ($verbose == 1); return @array; } sub Rename_Files ($$) { my ($target) = shift; my ($newext) = shift; my (@array) = (); sub wanted_file { my ($text) = shift; my ($next) = shift; if ($File::Find::name =~ /^(.*)$text$/i) { my ($newname) = $1 . $next; rename ($File::Find::name, $newname); } } find (sub { wanted_file ($target, $newext) }, $ACE_ROOT); } # Only builds the core libraries. sub Build_Core () { print STDERR "Building Core of ACE/TAO\n" if ($print_status == 1); print "\nmsvc_static_compile: Building Core of ACE/TAO\n"; print "Build \n" if ($verbose); print "Debug " if ($verbose) && ($Build_Debug); print "Release " if ($verbose) && ($Build_Release); print "LIB " if ($verbose) && ($Build_LIB); print "\n" if ($verbose); my @core_list = (); if ($Build_LIB) { push (@file_list, "/bin/msvc_static_order.lst"); foreach my$test_lst (@file_list) { my $config_list = new PerlACE::ConfigList; $config_list->load ($ACE_ROOT.$test_lst); foreach $test ($config_list->valid_entries ()) { if ($mod_name) { @plist = split (/\//, $test); $fname = pop @plist; $fname_mod = $name_mod; $fname_mod =~ s/\*/$fname/; push @plist,($fname_mod); push (@core_list, join('/', @plist) . $proj_ext); } else { push (@core_list, $test . $proj_ext); } } } if ( $vc7 ) { foreach $c (@core_list) { if ($Build_Debug) { $Status = Build_VC7 ($c, "debug"); return if $Status != 0 && !$Ignore_errors; } if ($Build_Release) { $Status = Build_VC7 ($c, "release"); return if $Status != 0 && !$Ignore_errors; } } } else { foreach $c (@core_list) { if ($Build_Debug) { $Status = Build ($c, "ALL - Win32 Debug"); return if $Status != 0 && !$Ignore_errors; } if ($Build_Release) { $Status = Build ($c, "ALL - Win32 Release"); return if $Status != 0 && !$Ignore_errors; } } } } } sub Build_All () { my @configurations = Find_Dsw (@directories); print STDERR "Building selected projects\n" if ($print_status == 1); print "\nmsvc_static_compile: Building selected projects\n"; $count = 0; foreach $c (@configurations) { print STDERR "Configuration ".$count++." of ".$#configurations."\n" if ($print_status == 1); if ($Build_Debug) { $Status = Build ($c, "ALL - Win32 Debug"); return if $Status != 0 && !$Ignore_errors; } if ($Build_Release) { $Status = Build ($c, "ALL - Win32 Release"); return if $Status != 0 && !$Ignore_errors; } } } sub Build_All_VC7 () { my @configurations = Find_Sln (@directories); print STDERR "Building selected projects\n" if ($print_status == 1); print "\nmsvc_static_compile: Building selected projects\n"; $count = 0; foreach $c (@configurations) { print STDERR "Configuration ".$count++." of ".$#configurations."\n" if ($print_status == 1); if ($Build_Debug) { $Status = Build_VC7 ($c, "debug"); return if $Status != 0 && !$Ignore_errors; } if ($Build_Release) { $Status = Build_VC7 ($c, "release"); return if $Status != 0 && !$Ignore_errors; } } } ## Parse command line argument while ( $#ARGV >= 0 && $ARGV[0] =~ /^(-|\/)/ ) { if ($ARGV[0] =~ '-k') { # Ignore errors print "Ignore errors\n" if ( $verbose ); $Ignore_errors = 1; } elsif ($ARGV[0] =~ /^-d$/i) { # debug $debug = 1; } elsif ($ARGV[0] =~ '-vc7') { # Use VC7 project and solution files. print "Using VC7 files\n" if ( $verbose ); $vc7 = 1; $proj_ext = '.vcproj'; } elsif ($ARGV[0] =~ '-vc8') { # Use VC8 project and solution files. print "Using VC8 files\n" if ( $verbose ); $vc7 = 1; # VC8 is like VC7 $proj_ext = '.vcproj'; } elsif ($ARGV[0] =~ '-vc9') { # Use VC9 project and solution files. print "Using VC9 files\n" if ( $verbose ); $vc7 = 1; # VC9 is like VC7 $proj_ext = '.vcproj'; } elsif ($ARGV[0] =~ '-v') { # verbose mode $verbose = 1; } elsif ($ARGV[0] =~ '-name_modifier') { # use MPC name_modifier for project shift; print "Setting name_modifier $ARGV[0]\n" if ( $verbose ); $name_mod = $ARGV[0]; $mod_name = 1; } elsif ($ARGV[0] =~ '-s') { # status messages $print_status = 1; } elsif ($ARGV[0] =~ '-u') { # USEENV print "Using Environment\n" if ($verbose); $useenv = '/USEENV'; } elsif ($ARGV[0] =~ '-CORE') { # Build the core of ace/tao print "Building only Core\n" if ( $verbose ); $build_core_only = 1; } elsif ($ARGV[0] =~ '-ACE') { # Build ACE and its programs print "Building ACE\n" if ( $verbose ); $use_custom_dir = 1; push @directories, @ace_dirs; } elsif ($ARGV[0] =~ '-TAO') { # Build TAO and its programs print "Building TAO\n" if ( $verbose ); $use_custom_dir = 1; # Other tests depend on the lib in this dir so we need to force it # to the front of the build list. This is pretty ugly. push @directories, ("$ACE_ROOT\\TAO\\orbsvcs\\tests\\Notify\\lib"); push @directories, ("$ACE_ROOT\\TAO"); } elsif ($ARGV[0] =~ '-dir') { # Compile only a specific directory shift; print "Adding directory $ARGV[0]\n" if ( $verbose ); $use_custom_dir = 1; push @directories, $ARGV[0]; } elsif ($ARGV[0] =~ '-rebuild') { # Rebuild all print "Rebuild all\n" if ( $verbose ); $Build_Cmd = "/REBUILD"; } elsif ($ARGV[0] =~ '-clean') { # Clean print "Cleaning all\n" if ( $verbose ); $Build_Cmd = "/CLEAN"; } elsif ($ARGV[0] =~ '-Debug') { # Debug versions print "Building Debug Version\n" if ( $verbose ); $Build_Debug = 1; $Build_All = 0; } elsif ($ARGV[0] =~ '-Release') { # Release versions print "Building Release Version\n" if ( $verbose ); $Build_Release = 1; $Build_All = 0; } elsif ($ARGV[0] =~ '-LIB') { # Build LIB only print "Build LIB only\n" if ( $verbose ); $Build_LIB = 1; $Build_All = 0; } elsif ($ARGV[0] =~ '-(\?|h)') { # Help information print "Options\n"; print "-d = Debug (only print out projects)\n"; print "-k = Ignore Errors\n"; print "-v = Script verbose Mode\n"; print "-s = Print status messages to STDERR\n"; print "-u = Tell MSVC to use the environment\n"; print "-vc7 = Use MSVC 7 toolset\n"; print "-vc8 = Use MSVC 8 toolset\n"; print "-name_modifier = Use MPC name_modifier to match projects\n"; print "\n"; print "-CORE = Build the Core libraries\n"; print "-ACE = Build ACE and its programs\n"; print "-TAO = Build TAO and its programs\n"; print "-dir = Compile custom directories\n"; print "\n"; print "-rebuild = Rebuild All\n"; print "-clean = Clean\n"; print "-Debug = Compile Debug versions\n"; print "-Release = Compile Release versions\n"; print "-LIB = Comple LIB Configurations\n"; exit; } else { warn "$0: error unknown option $ARGV[0]\n"; die -1; } shift; } if (!$Build_DLL && !$Build_LIB) { $Build_DLL = 1; $Build_LIB = 1; } if (!$Build_Debug && !$Build_Release) { $Build_Debug = 1; $Build_Release = 1; } if ($#directories < 0) { @directories = ($ACE_ROOT); } print "msvc_static_compile: Begin\n"; print STDERR "Beginning Core Build\n" if ($print_status == 1); if (!$use_custom_dir || $build_core_only) { if ($vc7) { ## devenv is too smart for it's own good. When a .vcproj is specified, ## as is done when building the CORE, it will find the solution to which ## the .vcproj belongs and begin to build additional portions of the ## solution. This is not what we want as dependencies are not set up ## between library projects. my($sln) = '.sln'; my($core_sln) = $sln . '.build_core'; Rename_Files ($sln, $core_sln); foreach my $sig ('INT', 'TERM') { $SIG{$sig} = sub { print STDERR "Renaming solution files, please be patient...\n"; Rename_Files ($core_sln, $sln); exit(1); }; } Build_Core (); Rename_Files ($core_sln, $sln); foreach my $sig ('INT', 'TERM') { $SIG{$sig} = 'DEFAULT'; } } else { Build_Core (); } } print STDERR "Beginning Full Build\n" if ($print_status == 1); if ( $vc7 ) { Build_All_VC7 if !$build_core_only; } else { Build_All if !$build_core_only; } print "msvc_static_compile: End\n"; print STDERR "End\n" if ($print_status == 1); ace-8.0.4+dfsg.orig/bin/diff-builds-and-group-fixed-tests-only.sh0000755000175000017500000000173615027201773023603 0ustar sudipsudip#!/bin/sh if test -z $1; then newdate=`date -u +%Y_%m_%d`; else newdate=$1; fi if test -z $2; then prefix=`date -u +%Y%m%d%a`; else prefix=$2; fi if test -z $3; then olddate=2025_05_04; else olddate=$3; fi if test -z $ACE_ROOT; then ACE_ROOT=..; fi if test -z $TAO_ROOT; then TAO_ROOT=${ACE_ROOT}/TAO; fi # grep -h \!FIXED_BUGS_ONLY ${ACE_ROOT}/tests/*.lst ${ACE_ROOT}/bin/*.lst ${TAO_ROOT}/bin/*.lst | sed -e "s/^\([^\:]*\).*/\1/" | sed -e "s/\(\/run_test.pl\)\?\s*$//" > ${prefix}-Ignore.txt # perl ${ACE_ROOT}/bin/diff-builds.pl -r -D $olddate -D $newdate | perl -ne 'print unless /^(\@\@|[ \-][a-zA-Z])/' | grep -v -f ${prefix}-Ignore.txt | tee ${prefix}-Builds.txt | grep '+[a-zA-Z]' | sort | uniq -c | sort -n -r -s | sort -k3 -r -s > ${prefix}-Tests.txt perl ${ACE_ROOT}/bin/diff-builds.pl -D $olddate -D $newdate | perl -ne 'print unless /^(\@\@|[ \-][a-zA-Z])/' | grep -v -f ${prefix}-Ignore.txt | grep '+[a-zA-Z]' | sort | uniq -c | sort -n -r -s > ${prefix}-Tests-NoTestRev.txt ace-8.0.4+dfsg.orig/bin/count_lines0000755000175000017500000001531415027201773016213 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # -*- perl -*- use File::Basename; $cmd= basename($0); if ($#ARGV < 0) { die "Usage: $cmd module...\n"; } @match_order = (); %typeRE = (); &initfiletypes; foreach $module (@ARGV) { if ( ! -d $module ) { warn "$cmd: no such directory $module\n"; next; } open(DIRS, "find $module -type d|"); @dirs = grep {if(!/CVS/) {chop;}} ; close(DIRS); open(FIND, "find $module -type f|"); @files = grep {if (!/build/ && !/CVS/ && !/rpc\+\+/ && !/\.bpr$/ && !/\.mdp$/ && !/\.MDP$/ && !/\.dsp$/ && !/\.DSP$/ && !/\.dsw$/ && !/\.DSW$/ && !/\.mak$/ && !/\.MAK$/ && !/\.o$/ && !/\.sl$/ && !/\.a$/) {chop;}} ; close(FIND); $totdirs = $#dirs; $totfiles = $#files; $totlines = 0; %lines = (); foreach $file (@files) { $n = 0; if (!open(IN, $file)) { warn "$cmd: cannot open '$file' for reading\n"; next; } while() { $n++; } close(IN); $lines{$file} = $n; $totlines += $n; } # Define two associative arrays to keep the results for each kind # of file. %linespertype = (); %filespertype = (); foreach $type (keys %typeRE) { $linespertype{$type} = 0; $filespertype{$type} = 0; } # The file is classified and added to the corresponding variable. FILE: while (($file, $l) = each %lines) { foreach $type (@match_order) { $re = $typeRE{$type}; if($file =~ m/$re/) { $linespertype{$type} += $l; $filespertype{$type}++; next FILE; } } print STDERR "Unmatched file: $file\n"; } format STDOUT_TOP= @||| $% Lines of code in module @<<<<<<<<<<<<<<<<<<<< $module Files: @>>>>>>>> $totfiles Directories: @>>>>>>>> $totdirs Lines: @>>>>>>>> $totlines File type lines files ---------------------------- ------------------ ----------------- . format STDOUT= @<<<<<<<<<<<<<<<<<<<<<<<<<<< @>>>>>>>>>>>>>>>>> @>>>>>>>>>>>>>>>> $type, $typelines, $typefiles . foreach $type (@match_order) { $typelines = $linespertype{$type}; $typefiles = $filespertype{$type}; if ($typefiles != 0) { write; } } # Forzamos un newpage para cada modulo. $- = 0; } sub updateRE { local $desc = shift; local $re = shift; if (exists $typeRE{$desc}) { local $mix = $typeRE{$desc} . '|(' . $re . ')'; $typeRE{$desc} = $mix; } else { $typeRE{$desc} = '(' . $re . ')'; push @match_order, $desc; } } sub initfiletypes { # Here we define the regular expressions for each kind of file. # This RE must be mutually exclusive, a file will not be counted # twice, but it could be unproperly classified. local %filenames = ('GNUmakefile' => 'Makefile', 'Makefile.*' => 'Makefile', 'README' => 'README files', 'COPYING' => 'Licenses', 'LICENSE.*' => 'Licenses', 'ChangeLog.*' => 'ChangeLog', 'ChangeLog-.*' => 'ChangeLog', '.cvsignore' => 'Control CVS', 'run_test.pl' => 'Test driver', 'run_test' => 'Test driver', 'run_tests' => 'Test driver', 'run_test.sh' => 'Test driver'); local %fileexts = ('cc' => 'C++ sources', 'cpp' => 'C++ sources', 'inl' => 'C++ sources', 'i' => 'C++ sources', 'h' => 'Headers', 'hh' => 'Headers', 'c' => 'C/C++ sources', 'idl' => 'IDL sources', 'IDL' => 'IDL sources', 'pidl' => 'IDL sources', 'y' => 'yacc source', 'yy' => 'yacc source', 'l' => 'lex source', 'll' => 'lex source', 'php' => 'php script', 'pm' => 'perl script', 'pl' => 'perl script', 'perl' => 'perl script', 'py' => 'python script', 'GNU' => 'GNU make config', 'tex' => '(La)TeX', 'txt' => 'Text files', '1' => 'man pages', '3' => 'man pages', 'html' => 'HTML', 'bib' => 'BibTeX', 'sty' => 'TeX styles', 'bld' => 'VxWorks build file', 'am' => 'Automake file', 'icc' => 'VisualAge project files', 'icp' => 'VisualAge project files', 'vac' => 'VisualAge project files', 'vcp' => 'Microsof eMbedded Visual Tools project files', 'vcw' => 'Microsof eMbedded Visual Tools project files', 'bpr' => 'Borland project files', 'bor' => 'Borland project files', 'dsp' => 'DevStudio project files', 'DSP' => 'DevStudio project files', 'mdp' => 'MSVC project files', 'MDP' => 'MSVC project files', 'dsw' => 'MSVC workspaces', 'DSW' => 'MSVC workspaces', 'mak' => 'MSVC MAK files', 'MAK' => 'MSVC MAK files', 'java' => 'JAVA source', 'class' => 'JAVA class', 'cccc' => 'codecount output', 'gif' => 'GIF images', 'conf' => 'Svc_Config files', 'diff' => 'patches', 'zip' => 'Compressed files', 'gz' => 'Compressed files', 'EXE' => 'Win32 executable', 'shar' => 'Shar archive', 'mib' => 'MIB definition files', 'gperf' => 'GPERF input', 'phil.*'=> 'Test driver' ); local %paths = (); local ($desc, $reseed); while (($reseed, $desc) = each %filenames) { local $re = '/' . $reseed . '$'; updateRE($desc, $re); } while (($reseed, $desc) = each %fileexts) { local $re = '/[^/]*\.' . $reseed . '$'; updateRE($desc, $re); } while (($reseed, $desc) = each %paths) { local $re = $reseed; updateRE($desc, $re); } updateRE('Others', '.*'); # while (($desc, $reseed) = each %typeRE) { # print STDERR $desc, " ==> ", $reseed, "\n"; # } } ace-8.0.4+dfsg.orig/bin/aix_shr0000755000175000017500000000167615027201773015334 0ustar sudipsudip#!/bin/sh # Filter out the duplicate symbol warnings from Visual Age C++ # output=`basename $0`.$$.`/bin/date +%Y%m%d%H%M%S` usrtmp="/tmp" for possible in "$TMPDIR" "$TEMP" "$TMP"; do if [ "$possible" != "" ]; then if [ -w "$possible" ]; then usrtmp="$possible" break fi fi done ## Send the output to a temporary file and save the return code. ## This macro is being passed during the to avoid #include errors ## while instantiating templates. $@ -DACE_VACPP_INSTANTIATING_TEMPLATES > "$usrtmp/$output" 2>&1 status=$? ## Print the output to stdout, but filter duplicate symbol warnings from ## Visual Age C++-using builds. The first pattern ends up coming from the ## linker in Visual Age C++ 5 builds; the second is from Visual Age C++ 6. /bin/egrep -v '0711-(224|345)|1540-0(424|425|436)' "$usrtmp/$output" ## Clean up the temporary file /bin/rm -f "$usrtmp/$output" ## Exit with the return code from the compiler exit $status ace-8.0.4+dfsg.orig/bin/reverse_clean0000755000175000017500000000076015027201773016505 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # -*- perl -*- # This script does a realclean of the list in the reverse order that # is passed to this. This is just a utility script @ARGS = (); if ($ARGV[0] eq ''){ print STDERR "$0: No directories provided\n"; die "provide list of directories"; } my $make = $ARGV[0]; shift; @BUILD_LIST = @ARGV; foreach $i (reverse (@BUILD_LIST)) { system ("$make -k -C $i realclean"); } ace-8.0.4+dfsg.orig/bin/indent_macros.pl0000755000175000017500000000225015027201773017123 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -i -S $0 ${1+"$@"}' & eval 'exec perl -i -S $0 $argv:q' if 0; # This perl script re-arrange the macro indentation so it's easier to # see the layering relationship. $lineno = 0; $indent = 0; sub inc_indent { $indent += 2; } sub dec_indent { $indent -= 2; } sub get_indent { $retv = 0; print STDERR "$0 (", $lineno, "): Unbalanced macro pairs\n" if ($indent < 0); $retv = $indent - 1 if ($indent > 0); $retv; } while (<>) { $lineno++; if (/^[ \t]*\#[ \t]*((if|el|en|).*)/) { $cont = $1; $temp = $2; if ($temp =~ /if/) { print "#", " " x &get_indent (), $cont,"\n"; inc_indent (); } elsif ($temp =~ /el/) { dec_indent (); print "#", " " x &get_indent (), $cont,"\n"; inc_indent (); } elsif ($temp =~ /en/) { dec_indent (); print "#", " " x &get_indent (), $cont,"\n"; } else { print "#", " " x &get_indent (), $cont,"\n"; } } else { print $_; } } die ("$0 (EOF): Unbalanced macro pairs\n") if ($indent != 0); ace-8.0.4+dfsg.orig/bin/doxygen-convert-h.pl0000755000175000017500000003406515027201773017667 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # doxygen-convert-h.pl is a script that would be used to convert old # documented style ACE/TAO header files to doxygen style. # TODO List: # (Search for @todo in this script) use File::Copy; use FileHandle; use Getopt::Std; ############################################################################## # Parse the options if (!getopts ('dDhsu') || $opt_h) { print "doxygen-convert-h.pl [-dDhsu] filenames or directories\n"; print "\n"; print " -d debug script\n"; print " -D really verbose debug\n"; print " -h display this help\n"; print " -s print result to stdout\n"; print " -u turn off file verification\n"; exit (1); } ## if verbose debug, also regular debug $opt_d = 1 if (defined $opt_D); ############################################################################## # Find the files @files = (); sub recursive_find { my($file) = shift; my(@rfiles) = (); my($fh) = new FileHandle(); if (opendir($fh, $file)) { foreach my $f (grep(!/^\.\.?$/, readdir($fh))) { my($full) = "$file/$f"; if (-d $full) { push(@rfiles, recursive_find($full)); } else { push(@rfiles, $full) if ($f =~ /\.(h|hxx|hpp|hh|inl|idl|cpp|cxx|cc|c|C)$/) ; } } closedir($fh); } return @rfiles; } foreach $arg (@ARGV) { my @results = glob $arg; if ($#results < 0) { print STDERR "File not Found: $arg\n" } else { foreach my $result (@results) { if (-d $result) { push(@files, recursive_find($result)); } else { push(@files, $result); } } } } ############################################################################## # Subroutines used to change the file. $fail = 0; sub verify (@) { my (@contents) = @_; print "Verification\n" if (defined $opt_d); my $found_id = 0; my $found_filename = 0; foreach $line (@contents) { $found_id = 1 if ($line =~ /\$Id\:/); $found_filename = 1 if ($line =~ /\= FILENAME/); } return 0 if ($found_id == 1 && $found_filename == 1); # failed return 1; } sub format_description (@) { my (@description) = @_; my @after = (); my $line; if ($#description < 1) { foreach $line (@description) { $line =~ s/\/\// \* \@brief /; push @after, $line; } } else { foreach $line (@description) { $line =~ s/\/\// \*/; $line =~ s/\* /\* /; push @after, $line; } } return @after; } sub fix_file_header (@) { my (@before) = @_; my @after = (); my @description = (); my $id = "\$Id\$\n"; my $authors = ""; my $state = 'before'; ## state = before, filename, description, author, after, done print "Fixing File Header\n" if (defined $opt_d); LOOP: foreach $line (@before) { printf ("%10s %s", $state, $line) if (defined $opt_D); if ($state eq 'done') { push @after, $line; next LOOP; } if ($state eq 'before') { if ($line =~ /\-\*\- C\+\+ \-\*\-/) { push @after, $line; } elsif ($line =~ /\$Id\:(.*)\n/) { $id = "\$Id\:$1"; } elsif ($line =~ /===================/) { push @after, "//========================================". "=====================================\n"; push @after, "/**\n"; } elsif ($line =~ /\= FILENAME/) { $state = 'filename'; next LOOP; } elsif ($line !~ /^\s*\/\//) { push @after, $line; } } if ($state eq 'filename') { if ($line =~ /\/\/ (.+)/) { push @after, " * \@file $1\n"; push @after, " *\n"; push @after, " * $id\n"; push @after, " *\n"; } elsif ($line =~ /\= DESCRIPTION/) { $state = 'description'; next LOOP; } elsif ($line =~ /\= AUTHOR/) { $state = 'author'; next LOOP; } elsif ($line =~ /===================/) { $state = 'after'; ### Fall through so the after can put the ending in } } if ($state eq 'description') { if ($line =~ /\= AUTHOR/) { push @after, format_description (@description); @description = (); push @after, " *\n"; $state = 'author'; next LOOP; } elsif ($line =~ /===================/) { push @after, format_description (@description); @description = (); push @after, " *\n"; $state = 'after'; ### Fall through } push @description, $line; } if ($state eq 'author') { if ($line =~ /\/\/ (.+)\n/) { $authors .= $1; } elsif ($line =~ /===================/ || $line =~ /\= DESCRIPTION/) { ## print the authors if ($authors ne "") { @authors = split /\,/, $authors; foreach $author (@authors) { if ($author =~ /^ (.*)/) { $author = $1; } push @after, " * \@author $author\n"; } } if ($line =~ /\= DESCRIPTION/) { push @after, " *\n"; $state = 'description'; next LOOP; } else { $state = 'after'; ## Fall through } } } if ($state eq 'after') { if ($line =~ /===================/) { ## print the rest push @after, " */\n"; push @after, "//========================================". "=====================================\n"; push @after, "\n"; $state = 'done'; } next LOOP; } } return @after; } sub fix_class_headers (@) { my (@before) = @_; my @after = (); my @store = (); my $classname = ""; my $state = 'outside'; ## state = ## outside = not in class ## template = stored template line ## class = started collecting lines, in case of a class ## header = after a class foo, but before any methods print "Fixing class headers\n" if (defined $opt_d); LOOP: foreach $line (@before) { printf ("%10s %s", $state, $line) if (defined $opt_D); if ($state eq 'outside') { if ($line =~ /^\s*template/) { push @store, $line; $state = 'template'; next LOOP; } elsif ($line =~ /^\s*class/) { $state = 'class'; ## Fall through } else { push @after, $line; } } if ($state eq 'template') { if ($line =~ /^\s*class/) { $state = 'class'; ## Fall through } else { push @after, @store; @store = (); push @after, $line; $state = 'outside'; next LOOP; } } if ($state eq 'class') { if ($line =~ /^\s*class(.*)\n/) { push @store, $line; my @s = split / /, $1; if ($s[1] =~ /export$/i) { $classname = $s[2]; } else { $classname = $s[1]; } } elsif ($line =~ /^\s*\{/) { push @store, $line; } elsif ($line =~ /^\s*\/\//) { $state = 'header'; ### Fall through } else { push @after, @store; @store = (); push @after, $line; $state = 'outside'; next LOOP; } } if ($state eq 'header') { if ($line =~ /^\s*\/\//) { push @headers, $line; } else { my $prefix = ''; $line =~ /^(\s*)[\w\/]/; ### used to get indent my $indent = $1; push @after, "$indent/**\n"; push @after, "$indent * \@class $classname\n"; foreach $header (@headers) { if ($header =~ /\= TITLE/) { push @after, "$indent *\n"; $prefix = "$indent * \@brief"; } elsif ($header =~ /\= DESCRIPTION/) { push @after, "$indent *\n"; $prefix = "$indent *"; } elsif ($header !~ /\/\/\s*\n/) { my $myline = $header; $myline =~ s/\s*\/\/\s*/$prefix /; push @after, $myline; $prefix = "$indent *"; } } push @after, "$indent */\n"; @headers = (); push @after, @store; push @after, $line; @store = (); $state = 'outside'; next LOOP; } } } return @after; } sub format_comment (@) { my (@comments) = @_; my @after = (); my $line; if ($#comments < 2) { foreach $line (@comments) { $line =~ s/\/\//\/\/\//; push @after, $line; } } else { my $line = $comments[0]; $line =~ /^(\s*)\//; my $indent = $1; push @after, "$indent/**\n"; foreach $line (@comments) { $line =~ s/\/\// */; push @after, $line; } push @after, "$indent */\n"; } return @after; } sub fix_class_members (@) { my (@before) = @_; my @after = (); my @method = (); my @comment = (); my $classfound = 0; my $classlevel = 0; my $level = 0; print "Fixing class methods\n" if (defined $opt_d); LOOP: foreach $line (@before) { if ($line =~ /\{/ && $line !~ /^\s*\/\//) { $level++; } if ($line =~ /^\s*class/ && $line !~ /\;/ && $level == $classlevel) { $classlevel++; } if ($line =~ /\}/ && $line !~ /^\s*\/\//) { if ($classlevel == $level) { $classlevel--; } $level--; } printf ("%2d%2d", $level, $classlevel) if (defined $opt_D); if ($level == $classlevel && $level > 0) { if ($line =~ /^\s*public/ || $line =~ /^\s*private/ || $line =~ /\s*protected/ || $line =~ /^\s*\n$/ || $line =~ /^\s*\{/ || $line =~ /^\s*\}/ || $line =~ /^\s*\#/) { push @after, format_comment (@comment); push @after, @method; @comment = (); @method = (); print " $line" if (defined $opt_D); push @after, $line; } elsif ($line =~ /^\s*\/\//) { print "C $line" if (defined $opt_D); if ($#method >= 0) { push @comment, $line; } else { push @after, $line; } } else { print "M $line" if (defined $opt_D); push @method, $line; } } else { push @after, format_comment (@comment); push @after, @method; @comment = (); @method = (); print " $line" if (defined $opt_D); push @after, $line; } } if ($level > 0 || $classlevel > 0) { $fail = 1; $failmessage = "Brace level recognition failed" } return @after; } ############################################################################## # Read in the files. FILELOOP: foreach $file (@files) { print "\n" if (defined $opt_d); print "$file\n"; print "\n" if (defined $opt_d); $fail = 0; my @contents = (); ### Read file into @contents print "Reading\n" if (defined $opt_d); unless (open (FILE, "<$file")) { print STDERR "$file: $!\n"; next FILELOOP; } @contents = ; close (FILE); ### Verify file print "Verifying file\n" if (defined $opt_d); if (!defined $opt_u) { if (verify (@contents) == 1) { print "$file did not pass verification\n"; next FILELOOP; } elsif (defined $opt_d) { print "Passed verification\n"; } } ### Fix up parts of it print "Fixing file\n" if (defined $opt_d); @contents = fix_file_header (@contents); @contents = fix_class_headers (@contents); @contents = fix_class_members (@contents); if ($fail != 0) { print "$file: $failmessage\n"; } else { if (defined $opt_s) { print @contents; } elsif (!defined $opt_D) { ### Save @contents back to the file print "Saving\n" if (defined $opt_d); unless (open (FILE, ">$file")) { print STDERR "$file: $!\n"; next FILELOOP; } foreach $line (@contents) { print FILE $line; } close (FILE); } } } ace-8.0.4+dfsg.orig/bin/clone.csh0000644000175000017500000000072015027201773015535 0ustar sudipsudip#!/bin/csh set src_root=`pwd` set dst_root=`abspath $1` set subdirs=`find * -type d -print` mkdir $dst_root set files=`find * \( -type d -prune \) -o -type f -print` if ($#files) then ln $files $dst_root endif if ($#subdirs) then foreach subdir ($subdirs) cd $src_root mkdir $dst_root/$subdir cd $src_root/$subdir set files=`find * \( -type d -prune \) -o -type f -print` if ($#files) then ln $files $dst_root/$subdir endif end endif exit 0 ace-8.0.4+dfsg.orig/bin/install_proj.mk0000644000175000017500000000065315027201773016774 0ustar sudipsudipinclude $(PROJECT_MAKEFILE) POTENTIAL_FILES = $(BIN_UNCHECKED) $(SHLIB_UNCHECKED) $(LIB_UNCHECKED) ACTUAL_FILES := $(wildcard $(POTENTIAL_FILES)) .PHONY: checked-install ifeq ($(ACTUAL_FILES),) checked-install: @echo Skipping $(PROJECT_MAKEFILE:GNUmakefile.%=%), not built else .PHONY: checked-install-message checked-install-message: @echo Installing $(ACTUAL_FILES) checked-install: checked-install-message install endif ace-8.0.4+dfsg.orig/bin/generate_footprint_chart.sh0000755000175000017500000000045415027201773021360 0ustar sudipsudip#!/bin/sh # gnuplot <<_EOF_ >/dev/null 2>&1 set xdata time set xtics rotate set timefmt '%Y/%m/%d-%H:%M' set xlabel 'Date (MM/DD)' 0,-3 set ylabel 'Size (KBytes)' set terminal png small size 1024,768 color set output "$2" plot '$1' using 1:(\$2/1024.0) title '$3' w l exit _EOF_ ace-8.0.4+dfsg.orig/bin/libsize.pl0000755000175000017500000001166415027201773015750 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # # Provides size breakdown of ACE, TAO, or orbsvcs libs. # # Assumes (or builds) the lib with debug=0. Allows other make args, # such as -j 4, to be passed on the command line. $usage = "$0 [-h, for html output] [-s, for shared libs] [-v] [make arguments]\n"; #### #### Configuration parameters. #### $build_args = 'debug=0 optimize=1 static_libs_only=1'; $ACE_COMPONENTS = 'OS Utils Logging Threads Demux Connection Sockets IPC Svcconf ' . 'Streams Memory Token Other'; $TAO_COMPONENTS = 'POA Pluggable_Protocols Default_Resources Interpretive_Marshaling ' . 'IDL_Compiler ORB_Core Dynamic_Any'; $ORBSVCS_COMPONENTS = 'Naming ImplRepo Time Concurrency Property Trader LifeCycle Sched ' . 'Event CosEvent Event2 AV'; #### The following are only used for VxWorks libraries, and #### only if the corresponding environment variable isn't set. $default_toolenv = '386'; $default_wind_base = '/project/doc/pkg/wind'; $default_host_type = 'sun4-solaris2'; #### Use gmake if it's on the user's PATH, otherwise use make. Use #### sh -c to avoid warning if gmake isn't found. $make = system ("sh -c \"gmake --version\" > /dev/null 2>&1") ? 'make' : 'gmake'; $ACE_ROOT = $ENV{'ACE_ROOT'} || die "$0: ACE_ROOT was not set!\n"; $html = $verbose = 0; $lib_extension = 'a'; #### #### Process command line args. #### while ($#ARGV >= $[ && $ARGV[0] =~ /^-/) { if ($ARGV[0] eq '-h') { $html = 1; chop ($sysname = `uname -s`); chop ($sysrev = `uname -r`); shift; } elsif ($ARGV[0] eq '-s') { $lib_extension = 'so'; $build_args =~ s/ static_libs_only=1//; shift; } elsif ($ARGV[0] eq '-v') { $verbose = 1; shift; } elsif ($ARGV[0] eq '-?') { print "$usage"; exit; } else { #### Pass remaining args to make. } } $make_args = join (' ', @ARGV) . $build_args; chop ($pwd = `pwd`); if ($pwd =~ m%/ace$%) { #### libACE $COMPONENTS = "$ACE_COMPONENTS"; $LIB_COMPONENTS = 'ACE_COMPONENTS'; $libname = 'ACE'; } elsif ($pwd =~ m%/tao$%) { $COMPONENTS = "$TAO_COMPONENTS"; $LIB_COMPONENTS = 'TAO_COMPONENTS'; $libname = 'TAO'; } elsif ($pwd =~ m%/orbsvcs/orbsvcs$%) { $COMPONENTS = "$ORBSVCS_COMPONENTS"; $LIB_COMPONENTS = 'TAO_ORBSVCS'; $libname = 'orbsvcs'; } else { die "$0: unsupported directory; $pwd\n"; } $lib = "lib${libname}.$lib_extension"; #### #### Select the size command based on ACE_ROOT setting. #### if ($ACE_ROOT =~ /vxworks/) { $TOOLENV = $ENV{'TOOLENV'} || $default_toolenv; $WIND_BASE = $ENV{'WIND_BASE'} || $default_wind_base; $WIND_HOST_TYPE = $ENV{'WIND_HOST_TYPE'} || $default_host_type; $size = "$WIND_BASE/host/$WIND_HOST_TYPE/bin/size$TOOLENV"; } elsif ($ACE_ROOT =~ /lynx-ppc/) { $size = '/usr/lynx/3.0.0/ppc/cdk/sunos-xcoff-ppc/bin/size'; } elsif ($ACE_ROOT =~ /lynx/) { $size = '/usr/lynx/3.0.0/x86/cdk/sunos-coff-x86/bin/size'; } else { $size = 'size'; } #### #### Measure the size of the entire library. #### $sizeTotal = build_lib ("$LIB_COMPONENTS=\"$COMPONENTS\""); $components = " Platform\n Component\n Total"; $componentSize = " Size, bytes\n $sizeTotal"; $componentPercentage = " Percentage of
total size\n 100"; print "Total $sizeTotal (100)\n" unless $html; #### #### Measure the size of each library component. #### foreach my $i (split (' ', $COMPONENTS)) { $sizeLib = build_lib ("$LIB_COMPONENTS=\"$i\""); $components .= "\n $i"; $componentSize .= "\n $sizeLib"; $thisPercentage = percentage ($sizeLib, $sizeTotal); $componentPercentage .= "\n $thisPercentage"; print "$i $sizeLib ($thisPercentage)\n" unless $html; } #### #### Produce HTML output, if requested. #### if ($html) { print '
' . "\n"; print ' ' . "\n"; print "$echoArgs $components\n"; print ' ' . "\n"; print " ' . "\n"; print "$echoArgs $componentPercentage\n"; print '
$sysname $sysrev $ACE_ROOT\n"; print "$echoArgs $componentSize\n"; print '

' . "\n"; } #### #### Build library with components specified in argument. #### sub build_lib () { my ($lib_components) = @_; unlink "$lib"; print "$make $make_args $lib_components\n" if $verbose; system ("$make $make_args $lib_components >> make.log 2>&1") && die "$0: command failed; $make $make_args $lib_components\n"; my $libSize = 0; open (SIZE, "$size $lib |") || die "$0: unable to open $size\n"; while () { my (@field) = split; $libSize += $field[3] if $field[3] =~ /\d/; #### Skip size header line. } close (SIZE); $libSize; } #### #### Return percentage of first argument as fraction of second. #### Returns a string with two-decimal place precision. #### sub percentage () { my ($size, $total) = @_; sprintf ("%.2f", $size * 100 / $total); } ace-8.0.4+dfsg.orig/bin/ace-install0000755000175000017500000003564615027201773016077 0ustar sudipsudip#!/bin/sh ##################################################################### # install_ace: distill the minimal stuff out of the ACE+TAO distribution # alias cpio 'xargs -i echo {}'; # just for testing the script # # according to David Levine on 1999/01/09: # # An even better way would be to only build what you need. # These directories are probably a good start: # # ace # apps/gperf/src # TAO/tao # TAO/TAO_IDL # TAO/orbsvcs # # netsvcs ? - not built in here, probably useful # ##################################################################### # actions unpack=0 config=0 compile=0 install=0 force=0 # can we do it? die=0 # this script name without path this_script=$(basename $0) ##################################################################### # check for install_ace options ##################################################################### while [ $# -gt 0 ]; do case $1 in ########################################## # help output -h | --help*) echo " " echo "$this_script [options]" echo " " echo "options:" echo " -h, --help show brief help" echo " " echo "required options:" echo " -r, --aceroot=ACE_ROOT use ACE_ROOT directory for build/install" echo " " echo "extracting and configuring options:" echo " -z, --archive=FILE unpack specified source archive" echo " -p, --platform=HEADER,MAKE use HEADER,MAKE as config.h, platform_macros" echo " " echo "compiling options:" echo " -c, --compile=ACE_OPTS compile with make options (e.g. debug=0)" echo " " echo "installing options:" echo " -i, --install=ACE_DEST install into ACE_DEST directory" echo " -a, --arch=ACE_ARCH use ACE_ARCH subdirs for arch-dependent files" echo " " echo "miscellaneous options:" echo " -f, --force don't ask for confirmation before proceeding" echo " " exit 0 ;; ########################################## # required options -r) shift if [ $# -gt 0 ]; then ACE_ROOT=$1; export ACE_ROOT else echo "no ACE_ROOT specified" exit 1 fi shift ;; --aceroot*) ACE_ROOT=$(echo $1 | sed -e 's/^[^=]*=//g'); export ACE_ROOT shift ;; ########################################## # extracting and configuring options -z) shift if [ $# -gt 0 ]; then ACE_ARCHIVE=$1; export ACE_ARCHIVE unpack=1 else echo "no archive specified" exit 1 fi shift ;; --archive*) ACE_ARCHIVE=$(echo $1 | sed -e 's/^[^=]*=//g'); export ACE_ARCHIVE unpack=1 shift ;; -p) shift if [ $# -gt 0 ]; then ACE_HEADER=$(echo $1 | cut -f 1 -d ,); export ACE_HEADER ACE_MAKE=$(echo $1 | cut -f 2 -d ,); export ACE_MAKE else echo "no header,make files specified" exit 1 fi config=1 shift ;; --platform*) stuff=$(echo $1 | sed -e 's/^[^=]*=//g') ACE_HEADER=$(echo $stuff | cut -f 1 -d ,); export ACE_HEADER ACE_MAKE=$(echo $stuff | cut -f 2 -d ,); export ACE_MAKE config=1 shift ;; ########################################## # compiling options -c) shift if [ $# -gt 0 ]; then ACE_OPTS="$1"; export ACE_OPTS compile=1 else echo "no compilation options specified (e.g. debug=0)" exit 1 fi shift ;; --compile*) ACE_OPTS=$(echo $1 | sed -e 's/^[^=]*=//g'); export ACE_OPTS compile=1 shift ;; ########################################## # installing options -i) shift if [ $# -gt 0 ]; then ACE_DEST=$1; export ACE_DEST install=1 else echo "no installation target directory specified (e.g. /tools/ace)" exit 1 fi shift ;; --install*) ACE_DEST=$(echo $1 | sed -e 's/^[^=]*=//g'); export ACE_DEST install=1 shift ;; -a) shift if [ $# -gt 0 ]; then ACE_ARCH=$1; export ACE_ARCH else echo "no installation target architecture specified" exit 1 fi shift ;; --arch*) ACE_ARCH=$(echo $1 | sed -e 's/^[^=]*=//g'); export ACE_ARCH shift ;; ########################################## # miscellaneous options -f) shift force=1 ;; *) # no more options, get on with life if [ $# -gt 0 ]; then echo "unrecognized option: $1" exit 1 fi ;; esac done ##################################################################### # sanity checks for required variables ##################################################################### if [ $install -ne 0 ] && [ $compile -ne 0 ] && [ $unpack -eq 0 ]; then echo "- No actions specified." die=1 fi if [ $unpack -ne 0 ] && [ $compile -ne 0 ] && [ $config -eq 0 ] \ || [ $unpack -ne 0 ] && [ $install -ne 0 ] && [ $config -eq 0 ]; then echo "- Must set platform config options with --platform option" echo " ($this_script -h for help) to unpack and compile/install" die=1 fi if [ -z "$ACE_ROOT" ]; then echo "- Must set ACE_ROOT directory before proceeding..." echo " The directory may be set with the ACE_ROOT environment" echo " variable or the --aceroot option ($this_script -h for help)" die=1 fi if [ $install -eq 1 ] && [ -z "$ACE_ARCH" ]; then # just set it to blank if we want to flatten this level of subdirectory ACE_ARCH="" fi if [ $die -ne 0 ]; then echo "- terminating $this_script script" exit 2 fi ##################################################################### # announce intentions ##################################################################### echo "This script will perform the following actions:" echo "using ACE_ROOT directory: $ACE_ROOT" if [ $unpack -ne 0 ]; then echo " " echo "Extracting:" echo "- unpack source archive: $ACE_ARCHIVE" fi if [ $config -ne 0 ]; then echo " " echo "Configuring:" echo "- platform config.h header: $ACE_HEADER" echo "- platform makefile macros: $ACE_MAKE" fi if [ $compile -ne 0 ]; then echo " " echo "Compiling:" echo "- ACE/TAO compile options: $ACE_OPTS" fi if [ $install -ne 0 ]; then echo " " echo "Installing:" echo "- install target directory: $ACE_DEST" echo "- install target arch: $ACE_ARCH" fi echo "" ##################################################################### # confirm desire to proceed ##################################################################### if [ $force -eq 0 ]; then echo " " echo "Type 'yes' to proceed, anything else to exit" read -r ready if [ "$ready" != "yes" ]; then echo "Terminating install script. Thank you for playing." echo "We have some lovely parting gifts for you. =)" exit 1 fi fi ##################################################################### # extract ACE and TAO ##################################################################### if [ $unpack -ne 0 ]; then echo "Unpacking $ACE_ARCHIVE..." cd $(dirname $ACE_ROOT) gzip -dc $ACE_ARCHIVE | tar xvf - fi ##################################################################### # configure ACE and TAO ##################################################################### if [ $config -ne 0 ]; then echo "Configuring: $ACE_HEADER,$ACE_MAKE..." # copy the files if they exist test -f $ACE_ROOT/ace/$ACE_HEADER \ && cp $ACE_ROOT/ace/$ACE_HEADER $ACE_ROOT/ace/config.h test -f $ACE_ROOT/include/makeinclude/$ACE_MAKE \ && cp $ACE_ROOT/include/makeinclude/$ACE_MAKE \ $ACE_ROOT/include/makeinclude/platform_macros.GNU # print error message and die if they don't if [ ! -f $ACE_ROOT/ace/$ACE_HEADER ]; then echo "error: $ACE_HEADER doesn't exist" die=1 fi if [ ! -f $ACE_ROOT/include/makeinclude/$ACE_MAKE ]; then echo "error: $ACE_MAKE doesn't exist" die=1 fi if [ $die -ne 0 ]; then exit $die fi fi ##################################################################### # compile ACE and TAO ##################################################################### if [ $compile -ne 0 ]; then echo "Compiling: $ACE_OPTS..." ########################################## # add ACE_ROOT/ace to LD_LIBRARY_PATH so tao_idl can find libACE.so if [ "$(uname -s)" = "HP-UX" ]; then if [ ! -z "$SHLIB_PATH" ]; then SHLIB_PATH=$ACE_ROOT/ace:$SHLIB_PATH else SHLIB_PATH=$ACE_ROOT/ace; export SHLIB_PATH fi else if [ ! -z "$LD_LIBRARY_PATH" ]; then LD_LIBRARY_PATH=$ACE_ROOT/ace:$LD_LIBRARY_PATH else LD_LIBRARY_PATH=$ACE_ROOT/ace; export LD_LIBRARY_PATH fi fi ########################################## # compile a few select directories for d in ace apps/gperf/src TAO/tao TAO/TAO_IDL TAO/orbsvcs TAO/utils; do echo --- Building in $d. cd "$ACE_ROOT/$d" make $ACE_OPTS if [ $? -ne 0 ]; then echo --- Error during build: $? exit $? fi done fi ##################################################################### # install ACE and TAO ##################################################################### if [ $install -ne 0 ]; then echo "Installing: $ACE_DEST..." ########################################## # determine final target directories ACE_VER=$(head -n 1 $ACE_ROOT/VERSION.txt | sed -e 's/^[^0-9]*//' -e 's/[, ].*//') ACE_DIR="$ACE_DEST/ACE-$ACE_VER"; export ACE_DIR TAO_VER=$(head -n 1 $ACE_ROOT/TAO/VERSION.txt | sed -e 's/^[^0-9]*//' -e 's/[, ].*//') TAO_DIR="$ACE_DEST/TAO-$TAO_VER"; export ACE_DIR ########################################## # create target directories as needed echo "creating target directories..." ace_dirs="$ACE_DIR $ACE_DIR/include $ACE_DIR/man" ace_arch_dirs="$ACE_DIR/$ACE_ARCH/include/ace \ $ACE_DIR/$ACE_ARCH/bin $ACE_DIR/$ACE_ARCH/lib" tao_dirs="$TAO_DIR $TAO_DIR/include $TAO_DIR/include/orbsvcs" tao_arch_dirs="$TAO_DIR/$ACE_ARCH/include \ $TAO_DIR/$ACE_ARCH/bin $TAO_DIR/$ACE_ARCH/lib" for dir in $ace_dirs $ace_arch_dirs $tao_dirs $tao_arch_dirs; do if [ ! -d $dir ]; then echo $dir mkdir -p $dir fi done ########################################## # copy TAO stuff cd $ACE_ROOT/TAO cp VERSION.txt $TAO_DIR/$ACE_ARCH/TAO-VERSION # copy TAO includes echo "Copying include files..." find tao -type f -name "*.idl" -print | cpio -p -d -V $TAO_DIR/include find tao -type f -name "*.pidl" -print | cpio -p -d -V $TAO_DIR/include find tao -type f -name "*.h" -print | grep -v "^config\.h" | cpio -p -d -V $TAO_DIR/include find tao -type f \( -name "*.i" -o -name "*.inl" \) -print | cpio -p -d -V $TAO_DIR/include find tao -type f -name "*.cpp" -print | cpio -p -d -V $TAO_DIR/include # NOTE: may need all .h, .i and .cpp under TAO/orbsvcs, instead of just TAO/orbsvcs/orbsvcs cd orbsvcs find orbsvcs -type f -name "*.idl" -print | cpio -p -d -V $TAO_DIR/include find orbsvcs -type f -name "*.pidl" -print | cpio -p -d -V $TAO_DIR/include find orbsvcs -type f -name "*.h" -print | grep -v "^config\.h" | cpio -p -d -V $TAO_DIR/include find orbsvcs -type f \( -name "*.i" -o -name "*.inl" \) -print | cpio -p -d -V $TAO_DIR/include find orbsvcs -type f -name "*.cpp" -print | cpio -p -d -V $TAO_DIR/include cd .. # copy TAO libs echo "Copying libraries..." for f in $(find . -type f \( -name "lib?*.so*" -o -name "lib?*.a" -o -name "lib?*.dll" -o -name "*.dylib" \) -print); do echo $f cp $f $TAO_DIR/$ACE_ARCH/lib done # copy TAO executables echo "Copying executables..." ALL_PROGS=$(find orbsvcs -type f -perm /a+x -print | grep -v ".*lib.*" | grep -v ".\.pl" | grep -v test | grep -v example) ALL_PROGS="$(find utils -type f -perm /a+x -print) $ALL_PROGS" PROGS=$(echo $ALL_PROGS | tr " " "\n" | grep -v test | grep -v default.bld | grep -v README | grep -v GNUmakefile) for f in TAO_IDL/tao_idl $PROGS; do echo $f cp $f $TAO_DIR/$ACE_ARCH/bin done ########################################## # copy ACE stuff cd $ACE_ROOT cp VERSION.txt $ACE_DIR/$ACE_ARCH/ACE-VERSION # copy ACE includes echo "Copying include files..." find ace -type f -name "*.h" -print | grep -v "^config\.h" | cpio -p -d -V $ACE_DIR/include find ace -type f \( -name "*.i" -o -name "*.inl" \) -print | cpio -p -d -V $ACE_DIR/include find ace -type f -name "*.cpp" -print | cpio -p -d -V $ACE_DIR/include cp ace/config.h $ACE_DIR/$ACE_ARCH/include/ace/config.h chmod -R a+r $ACE_DIR/$ACE_ARCH/include # copy ACE libs echo "Copying libraries..." for f in $(find . -type f \( -name "lib?*.so*" -o -name "lib?*.a" -o -name "lib?*.dll" -o -name "*.dylib" \) -print); do # only copy libs if they're not already in $TAO_DIR/$ACE_ARCH/lib maybe_tao_lib=$TAO_DIR/$ACE_ARCH/lib/$(basename $f) if [ ! -f $maybe_tao_lib ]; then echo $f cp $f $ACE_DIR/$ACE_ARCH/lib fi test -f $maybe_tao_lib && echo "library $f already installed with TAO" done # copy ACE executables echo "Copying executables..." ACE_PROGS=apps/gperf/src/ace_gperf for f in $ACE_PROGS; do echo $f cp $f $ACE_DIR/$ACE_ARCH/bin done # copy ACE man pages echo "Copying man pages..." find man -type f -print | cpio -p -d -V $ACE_DIR # PERMISSIONS chmod -R a+r $ACE_DEST find $ACE_DEST -type d -exec chmod a+x {} \; find $ACE_DEST -type f -perm /a+x -exec chmod a+x {} \; fi # if [ $install -ne 0 ] ##################################################################### # that's all, folks ##################################################################### echo "$this_script: done." ace-8.0.4+dfsg.orig/bin/bin.mpc0000644000175000017500000000025015027201773015205 0ustar sudipsudip// -*- MPC -*- project(bin) : aceexe, script { exename = envinfo Source_Files { envinfo.cpp } Script_Files { auto_run_tests.pl ace_tests.lst } } ace-8.0.4+dfsg.orig/bin/fuzz.pl0000755000175000017500000026253015027201773015305 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # Fuzz is a script whose purpose is to check through ACE/TAO files for # easy to spot (by a perl script, at least) problems. use lib "$ENV{ACE_ROOT}/bin"; if (defined $ENV{srcdir}) { use lib "$ENV{srcdir}/bin"; } use Cwd; use File::Find; use File::Basename; use Getopt::Std; use PerlACE::Run_Test; ###### TODO # # Add tests for these: # # - Guards in .h files # - no global functions # - other commit_check checks # # And others in ACE_Guidelines and Design Rules # # Also add a -g flag to ignore tao_idl generated files # ###### END TODO # Lists of all the files @files_cdp = (); @files_cpp = (); @files_inl = (); @files_h = (); @files_html = (); @files_dsp = (); @files_dsw = (); @files_gnu = (); @files_idl = (); @files_pl = (); @files_py = (); @files_changelog = (); @files_makefile = (); @files_mpc = (); @files_bor = (); @files_noncvs = (); @files_sln = (); @files_vcproj = (); @files_run_pl = (); @files_generic = (); @files_doxygen = (); @files_conf = (); @files_rb = (); @files_features = (); # To keep track of errors and warnings $errors = 0; $warnings = 0; # to register suppressed tests %suppressed_tests = (); # to register excluded directories @excluded_dirs = (); ############################################################################## # Use 'git status -s' to get a list of locally modified # files to look through sub find_mod_git_files () { unless (open (GIT, "git status -s |")) { print STDERR "Error: Could not run git\n"; return 0; } while () { if (/^ [MA] +(.*)$/) { store_file ($1); } } close (GIT); return 1; } sub find_mod_files () { if (!find_mod_git_files()) { print "Could use git to find modified files\n"; exit (1); } } sub is_excluded ($) { # exclude will contain the full file name my $exclude = shift; foreach (@excluded_dirs) { if ($exclude =~ /$_/) { return 1; } } return 0; } # Find_Files will search for files with certain extensions in the # directory tree sub find_files () { # wanted is only used for the File::Find sub wanted { store_file ($File::Find::name); } find (\&wanted, '.'); } # sub store_file ($) { my $name = shift; return if is_excluded ($name); if ($name =~ /\.(c|cc|cpp|cxx|tpp)$/i) { push @files_cpp, ($name); } elsif ($name =~ /\.(inl|i)$/i) { push @files_inl, ($name); } elsif ($name =~ /\.(h|hh|hpp|hxx)$/i) { push @files_h, ($name); } elsif ($name =~ /\.(htm|html)$/i) { push @files_html, ($name); } elsif ($name =~ /\.(bor)$/i) { push @files_bor, ($name); } elsif ($name =~ /\.(GNU)$/i) { push @files_gnu, ($name); } elsif ($name =~ /\.(dsp|vcp)$/i) { push @files_dsp, ($name); } elsif ($name =~ /\.(dsw|vcp)$/i) { push @files_dsw, ($name); } elsif ($name =~ /\.(pidl|idl|idl3|idl3p)$/i) { push @files_idl, ($name); } elsif ($name =~ /\.pl$/i) { if ($name =~ /fuzz.pl/) { return; } push @files_pl, ($name); if ($name =~ /^run.*\.pl$/i) { push @files_run_pl, ($name); } } elsif ($name =~ /\.py$/i) { push @files_py, ($name); } elsif ($name =~ /\.(rb|erb)$/i) { push @files_rb, ($name); } elsif ($name =~ /\.features$/i) { push @files_features, ($name); } elsif ($name =~ /\.vcproj$/i) { push @files_vcproj, ($name); } elsif ($name =~ /\.sln$/i) { push @files_sln, ($name); } elsif ($name =~ /ChangeLog/i && -f $name) { push @files_changelog, ($name); } elsif ($name =~ /\/GNUmakefile.*.[^~]$/) { push @files_makefile, ($name); } elsif ($name =~ /\.(mpc|mwc|mpb|mpt)$/i) { push @files_mpc, ($name); } elsif ($name =~ /\.(icc|ncb|zip)$/i) { push @files_noncvs, ($name); } elsif ($name =~ /\.(cdp)$/i) { push @files_cdp, ($name); } elsif ($name =~ /\.(doxygen)$/i) { push @files_doxygen, ($name); } elsif ($name =~ /\.(conf)$/i) { if ($name =~ /\.(WCHAR_T.conf|UTF-16.conf)$/i) { return; } push @files_conf, ($name); } elsif ($name =~ /\.(conf.xml)$/i) { if ($name =~ /\.(WCHAR_T.conf.xml|UTF-16.conf.xml)$/i) { return; } push @files_conf, ($name); } elsif ($name =~ /\.(pm|cmd|java|sh|txt|xml)$/i) { push @files_generic, ($name); } elsif ($name =~ /README$/i) { push @files_generic, ($name); } } ############################################################################## ## Just messages sub print_error ($) { my $msg = shift; print "Error: $msg\n"; ++$errors; } sub print_warning ($) { my $msg = shift; print "Warning: $msg\n"; ++$warnings; } ############################################################################## ## Check if test is suppressed sub is_suppressed () { my $method = (split (/::/, (caller(1))[3]))[-1]; return (defined $suppressed_tests{$method} ? 1 : 0); } ############################################################################## ## Tests # The point of this test is to check for the existence of ACE_INLINE # or ASYS_INLINE in a .cpp file. This is most commonly caused by # copy/pasted code from a .inl/.i file sub check_for_inline_in_cpp () { return if is_suppressed (); print "Running ACE_INLINE/ASYS_INLINE check\n"; foreach $file (@files_cpp) { if (open (FILE, $file)) { print "Looking at file $file\n" if $opt_d; while () { if (/^ACE_INLINE/) { print_error ("$file:$.: ACE_INLINE found"); } if (/^ASYS_INLINE/) { print_error ("$file:$.: ASYS_INLINE found"); } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # This test checks to make sure we have no files with $Id string in them. sub check_for_id_string () { return if is_suppressed (); print "Running \$Id\$ string check\n"; foreach $file (@files_cpp, @files_inl, @files_h, @files_mpc, @files_bor, @files_gnu, @files_html, @files_idl, @files_pl, @files_cdp, @files_py, @files_conf, @files_generic, @files_features) { my $found = 0; if (open (FILE, $file)) { print "Looking at file $file\n" if $opt_d; while () { if (/\$id\$/) { print_error ("$file:$.: Incorrect \$id\$ found (correct casing)"); } if (/\$Id:\$/) { print_error ("$file:$.: Incorrect \$Id:\$ found (remove colon)"); } if (/\$Id\$/ || /\$Id: /) { $found = 1; } } close (FILE); if ($found == 1) { print_error ("$file: \$Id\$ string found, not used anymore."); } } else { print STDERR "Error: Could not open $file\n"; } } } # check for _MSC_VER sub check_for_msc_ver_string () { return if is_suppressed (); print "Running _MSC_VER check\n"; foreach $file (@files_cpp, @files_inl, @files_h) { my $found = 0; if (open (FILE, $file)) { my $disable = 0; my $mscline = 0; print "Looking at file $file\n" if $opt_d; while () { if (/FUZZ\: disable check_for_msc_ver/) { $disable = 1; } if (/FUZZ\: enable check_for_msc_ver/) { $disable = 0; } if ($disable == 0 and /\_MSC_VER \<= 1200/) { $found = 1; $mscline = $.; } if ($disable == 0 and /\_MSC_VER \>= 1200/) { $found = 1; $mscline = $.; } if ($disable == 0 and /\_MSC_VER \> 1200/) { $found = 1; $mscline = $.; } if ($disable == 0 and /\_MSC_VER \< 1300/) { $found = 1; $mscline = $.; } if ($disable == 0 and /\_MSC_VER \<= 1300/) { $found = 1; $mscline = $.; } if ($disable == 0 and /\_MSC_VER \>= 1300/) { $found = 1; $mscline = $.; } if ($disable == 0 and /\_MSC_VER \< 1310/) { $found = 1; $mscline = $.; } if ($disable == 0 and /\_MSC_VER \>= 1310/) { $found = 1; $mscline = $.; } } close (FILE); if ($found == 1) { print_error ("$file:$mscline: Incorrect _MSC_VER check found"); } } else { print STDERR "Error: Could not open $file\n"; } } } # This test checks for the newline at the end of a file sub check_for_newline () { return if is_suppressed (); print "Running newline check\n"; foreach $file (@files_cpp, @files_inl, @files_h, @files_html, @files_idl, @files_pl) { if (open (FILE, $file)) { my $line; print "Looking at file $file\n" if $opt_d; while () { $line = $_ } close (FILE); if ($line !~ /\n$/) { print_error ("$file:$.: No ending newline found in $file"); } } else { print STDERR "Error: Could not open $file\n"; } } } # This test checks for files that are not allowed to be in version control sub check_for_noncvs_files () { return if is_suppressed (); print "Running non versioned controlled files check\n"; foreach $file (@files_noncvs, @files_dsp, @files_dsw, @files_makefile, @files_bor) { print_error ("File $file should not be in version control!"); } } # This test checks for the use of ACE_SYNCH_MUTEX in TAO, # TAO_SYNCH_MUTEX should used instead. sub check_for_ACE_SYNCH_MUTEX () { return if is_suppressed (); print "Running ACE_SYNCH_MUTEX check\n"; ITERATION: foreach $file (@files_cpp, @files_inl, @files_h) { if (open (FILE, $file)) { my $disable = 0; print "Looking at file $file\n" if $opt_d; while () { if (/FUZZ\: disable check_for_ACE_SYNCH_MUTEX/) { $disable = 1; } if (/FUZZ\: enable check_for_ACE_SYNCH_MUTEX/) { $disable = 0; next; } if ($disable == 0 and /ACE_SYNCH_MUTEX/) { # It is okay to use ACE_SYNCH_MUTEX in ACE # so don't check the ACE directory. The below # will check it for TAO if (($file !~ /.*TAO.*/)) { next ITERATION; } # Disable the check in the ESF directory for the # time being until we fix the issues there. if(($file =~ /.*TAO\/orbsvcs\/orbsvcs\/ESF.*/)) { next ITERATION; } print_error ("$file:$.: found ACE_SYNCH_MUTEX, use TAO_SYNCH_MUTEX instead"); } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # This test checks for the use of ACE_Thread_Mutex in TAO, # TAO_SYNCH_MUTEX should used instead to make the code build # in single-threaded builds. sub check_for_ACE_Thread_Mutex () { return if is_suppressed (); print "Running ACE_Thread_Mutex check\n"; ITERATION: foreach $file (@files_cpp, @files_inl, @files_h) { if (open (FILE, $file)) { my $disable = 0; print "Looking at file $file\n" if $opt_d; while () { if (/FUZZ\: disable check_for_ACE_Thread_Mutex/) { $disable = 1; } if (/FUZZ\: enable check_for_ACE_Thread_Mutex/) { $disable = 0; next; } if ($disable == 0 and /ACE_Thread_Mutex/) { # It is okay to use ACE_Thread_Mutex in ACE # so don't check the ACE directory. The below # will check it for TAO if (($file !~ /.*TAO.*/)) { next ITERATION; } print_error ("$file:$.: found ACE_Thread_Mutex, use TAO_SYNCH_MUTEX instead to allow the code to work in single-threaded builds"); } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # This test checks for the use of ACE_Guard # ACE_GUARD should used because it checks if we really got a lock # in single-threaded builds. sub check_for_ACE_Guard () { return if is_suppressed (); print "Running ACE_Guard check\n"; ITERATION: foreach $file (@files_cpp, @files_inl, @files_h) { if (open (FILE, $file)) { my $disable = 0; print "Looking at file $file\n" if $opt_d; while () { if (/FUZZ\: disable check_for_ACE_Guard/) { $disable = 1; } if (/FUZZ\: enable check_for_ACE_Guard/) { $disable = 0; next; } if ($disable == 0 and /ACE_Guard/) { print_error ("$file:$.: found ACE_Guard, use ACE_GUARD"); } if ($disable == 0 and /ACE_Read_Guard/) { print_error ("$file:$.: found ACE_Read_Guard, use ACE_READ_GUARD"); } if ($disable == 0 and /ACE_Write_Guard/) { print_error ("$file:$.: found ACE_Write_Guard, use ACE_WRITE_GUARD"); } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # This test checks for the use of tabs, spaces should be used instead of tabs sub check_for_tab () { return if is_suppressed (); print "Running tabs check\n"; ITERATION: foreach $file (@files_cpp, @files_inl, @files_h, @files_idl, @files_cdp, @files_doxygen, @files_changelog) { if (open (FILE, $file)) { my $disable = 0; print "Looking at file $file\n" if $opt_d; while () { if (/FUZZ\: disable check_for_tab/) { $disable = 1; } if (/FUZZ\: enable check_for_tab/) { $disable = 0; } if ($disable == 0 and /.*\t.*/) { print_error ("$file:$.: found tab"); } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } sub check_for_trailing_whitespace () { return if is_suppressed (); print "Running trailing_whitespaces check\n"; ITERATION: foreach $file (@files_cpp, @files_inl, @files_h, @files_idl, @files_cdp, @files_pl, @files_py, @files_generic) { if (open (FILE, $file)) { my $disable = 0; print "Looking at file $file\n" if $opt_d; while () { if (/FUZZ\: disable check_for_trailing_whitespace/) { $disable = 1; } if (/FUZZ\: enable check_for_trailing_whitespace/) { $disable = 0; } if ($disable == 0 and /\s\n$/) { print_error ("$file:$.: found trailing whitespace"); } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # This test checks for the lack of ACE_OS sub check_for_lack_ACE_OS () { return if is_suppressed (); $OS_NS_arpa_inet_symbols = "inet_addr|inet_aton|inet_ntoa|inet_ntop|inet_pton"; $OS_NS_ctype_symbols = "isalnum|isalpha|iscntrl|isdigit|isgraph|islower|isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper|isblank|isascii|isctype|iswctype"; $OS_NS_dirent_symbols = "closedir|opendir|readdir|readdir_r|rewinddir|scandir|alphasort|seekdir|telldir|opendir_emulation|scandir_emulation|closedir_emulation|readdir_emulation"; $OS_NS_dlfcn_symbols = "dlclose|dlerror|dlopen|dlsym"; $OS_NS_errno_symbols = "last_error|set_errno_to_last_error|set_errno_to_wsa_last_error"; $OS_NS_fcntl_symbols = "fcntl|open"; $OS_NS_math_symbols = "floor|ceil|log2"; $OS_NS_netdb_symbols = "gethostbyaddr|gethostbyaddr_r|gethostbyname|gethostbyname_r|getipnodebyaddr|getipnodebyname|getmacaddress|getprotobyname|getprotobyname_r|getprotobynumber|getprotobynumber_r|getservbyname|getservbyname_r|netdb_acquire|netdb_release"; $OS_NS_poll_symbols = "poll"; $OS_NS_pwd_symbols = "endpwent|getpwent|getpwnam|getpwnam_r|setpwent"; $OS_NS_regex_symbols = "compile|step"; $OS_NS_signal_symbols = "kill|pthread_sigmask|sigaction|sigaddset|sigdelset|sigemptyset|sigfillset|sigismember|signal|sigprocmask|sigsuspend|raise"; $OS_NS_stdio_symbols = "fileno|checkUnicodeFormat|clearerr|cuserid|fclose|fdopen|fflush|fgetc|getc|fgetpos|fgets|flock_adjust_params|flock_init|flock_destroy|flock_rdlock|flock_tryrdlock|flock_trywrlock|flock_unlock|flock_wrlock|fopen|default_win32_security_attributes|default_win32_security_attributes_r|get_win32_versioninfo|get_win32_resource_module|set_win32_resource_module|fprintf|ungetc|fputc|putc|fputs|fread|freopen|fseek|fsetpos|ftell|fwrite|perror|printf|puts|rename|rewind|snprintf|sprintf|tempnam|vsprintf|vsnprintf|asprintf|aswprintf|vasprintf|vaswprintf"; $OS_NS_stdlib_symbols = "_exit|abort|atexit|atof|atol|atoi|atop|bsearch|calloc|exit|free|getenv|getenvstrings|itoa|itoa_emulation|itow_emulation|malloc|mkstemp|mkstemp_emulation|mktemp|setenv|unsetenv|putenv|qsort|rand|rand_r|realloc|realpath|set_exit_hook|srand|strenvdup|strtod|strtol|strtol_emulation|strtoul|strtoul_emulation|strtoll|strtoll_emulation|strtoull|strtoull_emulation|system|getprogname|setprogname"; $OS_NS_string_symbols = "memchr|memchr_emulation|memcmp|memcpy|fast_memcpy|memmove|memset|strcat|strchr|strcmp|strcpy|strcspn|strdup|strdup_emulation|strecpy|strerror|strerror_emulation|strsignal|strlen|strncat|strnchr|strncmp|strncpy|strnlen|strnstr|strpbrk|strrchr|strrchr_emulation|strsncpy|strspn|strstr|strtok|strtok_r|strtok_r_emulation"; $OS_NS_strings_symbols = "strcasecmp|strncasecmp|strcasecmp_emulation"; $OS_NS_stropts_symbols = "getmsg|getpmsg|fattach|fdetach|ioctl|isastream|putmsg|putpmsg"; $OS_NS_sys_mman_symbols = "madvise|mmap|mprotect|msync|munmap|shm_open|shm_unlink"; $OS_NS_sys_msg_symbols = "msgctl|msgget|msgrcv|msgsnd"; $OS_NS_sys_resource_symbols = "getrlimit|getrusage|setrlimit"; $OS_NS_sys_select_symbols = "select"; $OS_NS_sys_sendfile_symbols = "sendfile|sendfile_emulation"; $OS_NS_sys_shm_symbols = "shmat|shmctl|shmdt|shmget"; $OS_NS_sys_socket_symbols = "accept|bind|closesocket|connect|enum_protocols|getpeername|getsockname|getsockopt|join_leaf|listen|recv|recvfrom|recvmsg|recvv|send|sendmsg|sendto|sendv|setsockopt|shutdown|if_nametoindex|if_indextoname|if_nameindex|socket_init|socket_fini|socket|socketpair"; $OS_NS_sys_stat_symbols = "creat|filesize|fstat|lstat|mkdir|mkfifo|stat|umask"; $OS_NS_sys_time_symbols = "gettimeofday"; $OS_NS_sys_uio_symbols = "readv|readv_emulation|writev|writev_emulation"; $OS_NS_sys_utsname_symbols = "uname"; $OS_NS_sys_wait_symbols = "wait|waitpid"; $OS_NS_Thread_symbols = "cleanup_tss|condattr_init|condattr_destroy|cond_broadcast|cond_destroy|cond_init|cond_signal|cond_timedwait|cond_wait|event_destroy|event_init|event_pulse|event_reset|event_signal|event_timedwait|event_wait|lwp_getparams|lwp_setparams|mutex_destroy|mutex_init|mutex_lock|mutex_lock_cleanup|mutex_trylock|mutex_unlock|priority_control|recursive_mutex_cond_unlock|recursive_mutex_cond_relock|recursive_mutex_destroy|recursive_mutex_init|recursive_mutex_lock|recursive_mutex_trylock|recursive_mutex_unlock|rw_rdlock|rw_tryrdlock|rw_trywrlock|rw_trywrlock_upgrade|rw_unlock|rw_wrlock|rwlock_destroy|rwlock_init|sched_params|scheduling_class|sema_destroy|sema_init|sema_post|sema_trywait|sema_wait|semctl|semget|semop|set_scheduling_params|sigtimedwait|sigwait|sigwaitinfo|thr_cancel|thr_cmp|thr_continue|thr_create|thr_equal|thr_exit|thr_getconcurrency|thr_getprio|thr_getspecific_native|thr_getspecific|thr_join|thr_get_affinity|thr_set_affinity|thr_key_detach|thr_key_used|thr_keycreate_native|thr_keycreate|thr_keyfree|thr_kill|thr_min_stack|thr_self|thr_setcancelstate|thr_setcanceltype|thr_setconcurrency|thr_setprio|thr_setspecific_native|thr_setspecific|thr_sigsetmask|thr_suspend|thr_testcancel|thr_yield|thread_mutex_destroy|thread_mutex_init|thread_mutex_lock|thread_mutex_trylock|thread_mutex_unlock|unique_name"; $OS_NS_time_symbols = "asctime|asctime_r|clock_gettime|clock_settime|ctime|ctime_r|difftime|gmtime|gmtime_r|localtime|localtime_r|mktime|nanosleep|readPPCTimeBase|strftime|strptime|strptime_emulation|strptime_getnum|time|timezone|tzset"; $OS_NS_unistd_symbols = "access|alarm|allocation_granularity|argv_to_string|chdir|rmdir|close|dup|dup2|execl|execle|execlp|execv|execve|execvp|fork|fork_exec|fsync|ftruncate|getcwd|getgid|getegid|getopt|getpagesize|getpgid|getpid|getppid|getuid|geteuid|hostname|isatty|lseek|llseek|num_processors|num_processors_online|pipe|pread|pwrite|read|read_n|readlink|sbrk|setgid|setegid|setpgid|setregid|setreuid|setsid|setuid|seteuid|sleep|string_to_argv|swab|sysconf|sysinfo|truncate|ualarm|unlink|write|write_n"; $OS_NS_wchar_symbols = "fgetwc|wcscat_emulation|wcschr_emulation|wcscmp_emulation|wcscpy_emulation|wcscspn_emulation|wcsicmp_emulation|wcslen_emulation|wcsncat_emulation|wcsncmp_emulation|wcsncpy_emulation|wcsnicmp_emulation|wcspbrk_emulation|wcsrchr_emulation|wcsrchr_emulation|wcsspn_emulation|wcsstr_emulation|wslen|wscpy|wscmp|wsncmp|ungetwc"; print "Running ACE_OS check\n"; foreach $file (@files_cpp, @files_inl) { if (open (FILE, $file)) { my $disable = 0; print "Looking at file $file\n" if $opt_d; while () { if (/FUZZ\: disable check_for_lack_ACE_OS/) { $disable = 1; } if (/FUZZ\: enable check_for_lack_ACE_OS/) { $disable = 0; } if ($disable == 0) { if($file !~ /.c$/ && $file !~ /S.cpp$/ && $file !~ /S.inl$/ && $file !~ /C.cpp$/ && $file !~ /C.inl$/) { if($file !~ /OS_NS_arpa_inet/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_arpa_inet_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_arpa_inet.h"); } } if($file !~ /OS_NS_ctype/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_ctype_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_ctype.h"); } } if($file !~ /OS_NS_dirent/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_dirent_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_dirent.h"); } } if($file !~ /OS_NS_dlfcn/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_dlfcn_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_dlfcn.h"); } } if($file !~ /OS_NS_errno/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_errno_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_errno.h"); } } if($file !~ /OS_NS_fcntl/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_fcntl_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_fcntl.h"); } } if($file !~ /OS_NS_math/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_math_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_math."); } } if($file !~ /OS_NS_netdb/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_netdb_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_netdb.h"); } } if($file !~ /OS_NS_poll/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_netdb_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_poll.h"); } } if($file !~ /OS_NS_pwd/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_pwd_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_pwd.h"); } } if($file !~ /OS_NS_regex/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_regex_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_regex.h"); } } if($file !~ /OS_NS_signal/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_signal_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_signal.h"); } } if($file !~ /OS_NS_stdlib/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_stdlib_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_stdlib.h"); } } if($file !~ /OS_NS_stdio/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_stdio_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_stdio.h"); } } if($file !~ /OS_NS_string/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_string_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_string.h"); } } if($file !~ /OS_NS_strings/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_strings_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_strings.h"); } } if($file !~ /OS_NS_stropts/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_stropts_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_stropts.h"); } } if($file !~ /OS_NS_sys_mman/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_mman_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_sys_mman.h"); } } if($file !~ /OS_NS_sys_msg/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_msg_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_sys_msg.h"); } } if($file !~ /OS_NS_sys_resource/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_resource_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_sys_resource.h"); } } if($file !~ /OS_NS_sys_select/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_select_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_sys_select.h"); } } if($file !~ /OS_NS_sys_sendfile/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_sendfile_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_sys_sendfile.h"); } } if($file !~ /OS_NS_sys_shm/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_shm_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_sys_shm.h"); } } if($file !~ /OS_NS_sys_socket/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_socket_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_sys_socket.h"); } } if($file !~ /OS_NS_sys_stat/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_stat_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_sys_stat.h"); } } if($file !~ /OS_NS_sys_time/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_time_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_sys_time.h"); } } if($file !~ /OS_NS_sys_uio/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_uio_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_sys_uio.h"); } } if($file !~ /OS_NS_sys_utsname/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_utsname_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_sys_utsname.h"); } } if($file !~ /OS_NS_sys_wait/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_sys_wait_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_sys_wait.h"); } } if($file !~ /OS_NS_Thread/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_Thread_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_Thread.h"); } } if($file !~ /OS_NS_time/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_time_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_time.h"); } } if($file !~ /OS_NS_unistd/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_unistd_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_unistd.h"); } } if($file !~ /OS_NS_wchar/) { if(/(\s+:{0,2}|\(:{0,2}|\s*!:{0,2}|^|\):{0,2})($OS_NS_wchar_symbols)\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: missing ACE_OS use ace/OS_NS_wchar.h"); } } } } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # This test checks for the use of exception specification, # exception specification has fallen out of favor, and generally # should not be used. sub check_for_exception_spec () { return if is_suppressed (); print "Running exception specification check\n"; foreach $file (@files_cpp, @files_inl, @files_h) { if (open (FILE, $file)) { my $disable = 0; print "Looking at file $file\n" if $opt_d; while () { if (/FUZZ\: disable check_for_exception_sepc/) { $disable = 1; } if (/FUZZ\: enable check_for_exception_sepc/) { $disable = 0; } if ($disable == 0) { if(/throw\s*\(\s*\)/) { #next; } elsif(/(^|\s+)throw\s*\(/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: exception specification found"); } } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # This test checks for the use of NULL, # NULL shouldn't be used, use 0 instead sub check_for_NULL () { return if is_suppressed (); print "Running NULL usage check\n"; foreach $file (@files_cpp, @files_inl, @files_h) { if (open (FILE, $file)) { my $disable = 0; print "Looking at file $file\n" if $opt_d; while () { if (/FUZZ\: disable check_for_NULL/) { $disable = 1; } if (/FUZZ\: enable check_for_NULL/) { $disable = 0; } if ($disable == 0) { if(/(\(|\)|\s+|=)NULL(\)|\s+|\;|\,)/ and $` !~ /\/\// and $` !~ /\/\*/ and $` !~ /\*\*+/ and $` !~ /\s+\*+\s+/) { print_error ("$file:$.: NULL found, use nullptr"); } } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # This test checks for improper main declaration, # the proper form should look like: # int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) sub check_for_improper_main_declaration () { return if is_suppressed (); print "Running Improper main() declaration check\n"; foreach $file (@files_cpp) { if (open (FILE, $file)) { my $disable = 0; my $type_of_main; my $multi_line; my $not_found_end_line_count= 0; print "Looking at file $file\n" if $opt_d; while () { if (!defined $multi_line) { if (/FUZZ\: disable check_for_improper_main_declaration/) { $disable = 1; next; } elsif (/FUZZ\: enable check_for_improper_main_declaration/) { $disable = 0; next; } elsif ($disable == 0) { s/^\s+//; ## Remove leading space s/\s*(\/\/.*)?$//; ## Remove trailing space and line comments if (s/^(?:.*\s)?(main|ACE_TMAIN)\s*//) { $type_of_main = $1; ## main or ACE_TMAIN $multi_line = $_; ## Rest of the line } else { next; } } } else { $_ =~ s/^\s+//; ## Remove leading space $_ =~ s/\s*(\/\/.*)?$//; ## Remove trailling space and line comments if ($multi_line eq "") { ## Append this line to existing statement. $multi_line = $_; } else { $multi_line .= ' ' . $_; } } $multi_line =~ s!^(/+\*.*?\*/\s*)*!!; ## Remove leading /* ... */ comments next if ($multi_line eq ""); ## Must have something after main if ($multi_line !~ m/^\(/) { ## Not a function opening bracket, we will ignore this one ## it is not a main function. undef $multi_line; $not_found_end_line_count = 0; } elsif ($multi_line =~ s/^\(\s*([^\)]*?)\s*\)[^;\{]*?\{//) { $multi_line = $1; ## What was between the main's ( and ) $multi_line =~ s/\s{2,}/ /g; ## Compress white space my $was = $multi_line; $multi_line =~ s!([^/])\*\s([^/])!$1\*$2!g; ## Remove space after * (except around comment) $multi_line =~ s!([^/])\s\[!$1\[!g; ## Remove space before [ (except following comment) $multi_line =~ s!\s?\*/\s?/\*\s?! !g; ## Connect seporate adjacent /* ... */ comments if ($multi_line =~ s!^([^,]*?)\s?,\s?(/+\*.*?\*/\s?)*!!) { # Fails if only 1 parameter (ignore this main) my $arg1 = $1; if ($multi_line =~ s/^(\w[\w\d]*)\s?//) { # Fails if no type for 2nd parameter (ignore this main) my $arg2_type = $1; $multi_line =~ s!^(?:/+\*.*?\*/\s?)?(\**)(\w[\w\d]*|\s?/\*.*?\*/\s?)?!!; my $prefix = $1; ## should be * or ** my $name = $2; ## is now arg2's variable name $multi_line =~ s!\s?\*/\s?/\*\s?! !g; ## Connect seporate adjacent /* ... */ comments ## remove any comment after postfix if ($multi_line =~ s!\s?(/+\*.*?\*/)$!! && $name eq '') { $name = "$1 "; ## Some name argv in comment after [] } ## multi_line now postfix, should be [] if ($type_of_main ne 'ACE_TMAIN' || $arg2_type ne 'ACE_TCHAR' || !(($prefix eq '*' && $multi_line eq '[]') || ($prefix eq '**' && $multi_line eq '' )) ) { print_error ("$file:$.: $type_of_main ($was) should be ACE_TMAIN ($arg1, ACE_TCHAR \*$name\[])"); } } } undef $multi_line; $not_found_end_line_count = 0; } elsif ($not_found_end_line_count < 10) { # Limit the search for ( ... ) following main to ten lines ++$not_found_end_line_count; } else { undef $multi_line; $not_found_end_line_count = 0; } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # This test checks for the use of "inline" instead of ACE_INLINE sub check_for_inline () { return if is_suppressed (); print "Running inline check\n"; foreach $file (@files_inl) { if (open (FILE, $file)) { my $disable = 0; print "Looking at file $file\n" if $opt_d; while () { if (/FUZZ\: disable check_for_inline/) { $disable = 1; } if (/FUZZ\: enable check_for_inline/) { $disable = 0; } if ($disable == 0 and m/^\s*inline/) { print_error ("$file:$.: 'inline' keyword found"); } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # This test checks for the inclusion of math.h. math.h should be avoided # since on some platforms, "exceptions" is defined as a struct, which will # cause problems with exception handling sub check_for_math_include () { return if is_suppressed (); print "Running math.h test\n"; foreach $file (@files_h, @files_cpp, @files_inl) { if (open (FILE, $file)) { my $disable = 0; print "Looking at file $file\n" if $opt_d; while () { if (/FUZZ\: disable check_for_math_include/) { $disable = 1; } if (/FUZZ\: enable check_for_math_include/) { $disable = 0; } if ($disable == 0 and /^\s*#\s*include\s*(\/\*\*\/){0,1}\s*\/) { print_error ("$file:$.: included"); } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # This test checks for the inclusion of streams.h. # // FUZZ: disable check_for_streams_include sub check_for_streams_include () { return if is_suppressed (); print "Running ace/streams.h test\n"; foreach $file (@files_h, @files_cpp, @files_inl) { if (open (FILE, $file)) { my $disable = 0; print "Looking at file $file\n" if $opt_d; while () { if (/FUZZ\: disable check_for_streams_include/) { $disable = 1; } if (/FUZZ\: enable check_for_streams_include/) { $disable = 0; } if ($disable == 0 and /^\s*#\s*include\s*\"ace\/streams\.h\"/) { print_error ("$file:$.: expensive ace/streams.h included; consider ace/iosfwd.h"); print " ace/streams.h is very expensive in both "; print "compile-time and footprint. \n"; print " Please consider including ace/iosfwd.h instead.\n\n"; } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # This test checks for the inclusion of Synch*.h. sub check_for_synch_include () { return if is_suppressed (); print "Running ace/Synch*.h test\n"; foreach $file (@files_h, @files_cpp, @files_inl) { if (open (FILE, $file)) { my $disable = 0; print "Looking at file $file\n" if $opt_d; while () { if (/FUZZ\: disable check_for_synch_include/) { $disable = 1; } if (/FUZZ\: enable check_for_synch_include/) { $disable = 0; } if ($disable == 0 and (/^\s*#\s*include\s*\"(ace\/Synch\.h)\"/ or /^\s*#\s*include\s*\"(ace\/Synch_T\.h)\"/)) { my $synch = $1; print_error ("$file:$.: expensive $synch included; consider individual synch file"); print " $synch is very expensive in both "; print "compile-time and footprint. \n"; print " Please consider including one of the "; print "individual synch files instead.\n\n"; } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # For general readability, lines should not contain more than 80 characters sub check_for_line_length () { return if is_suppressed (); print "Running line length test\n"; foreach $file (@files_h, @files_cpp, @files_inl) { if (open (FILE, $file)) { print "Looking at file $file\n" if $opt_d; while () { # Make sure to ignore ACE_RCSID lines, since they # are difficult to get under 80 chars. if (/.{80,}/ and !/^ACE_RCSID/) { print_error ("$file:$.: line longer than 80 chars"); } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # For preprocessor directives, only the old C style comments (/* */) # should be used, not the newer // style. sub check_for_preprocessor_comments () { return if is_suppressed (); print "Running preprocessor comment test\n"; foreach $file (@files_h, @files_cpp, @files_inl) { if (open (FILE, $file)) { print "Looking at file $file\n" if $opt_d; while () { if (/^\#.*\/\//) { print_error ("$file:$.: C++ comment in directive"); } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # We should not have empty files in the repo sub check_for_empty_files () { return if is_suppressed (); print "Running empty file test\n"; foreach $file (@files_inl, @files_cpp, @files_rb) { my $found_non_empty_line = 0; if (open (FILE, $file)) { print "Looking at file $file\n" if $opt_d; while () { next if /^[[:blank:]]*$/; # skip empty lines next if /^[[:blank:]]*\/\//; # skip C++ comments next if /^[[:blank:]]*\/\*/; # skip C++ comments $found_non_empty_line = 1; last; } close (FILE); if ($found_non_empty_line == 0) { print_error ("$file:1: empty file should not be in the repository"); } } else { print STDERR "Error: Could not open $file\n"; } } } # This test checks for the use of the Win32 Unicode string defines # or outdated ASYS_* macros # We should only be using the ACE_TCHAR, ACE_TEXT macros instead. sub check_for_tchar { return if is_suppressed (); print "Running TCHAR test\n"; foreach $file (@files_h, @files_cpp, @files_inl) { if (open (FILE, $file)) { my $disable = 0; print "Looking at file $file\n" if $opt_d; while () { if (/FUZZ\: disable check_for_tchar/) { $disable = 1; } if (/FUZZ\: enable check_for_tchar/) { $disable = 0; } if ($disable == 0) { if (/LPTSTR/) { print_error ("$file:$.: LPTSTR found"); } if (/LPCTSTR/) { print_error ("$file:$.: LPCTSTR found"); } if (/ASYS_TCHAR/) { print_error ("$file:$.: ASYS_TCHAR found"); } elsif (/TCHAR/ and !/ACE_TCHAR/) { ### Do a double check, since some macros do have TCHAR ### (like DEFAULTCHARS) if (/^TCHAR[^\w_]/ or /[^\w_]TCHAR[^\w_]/) { print_error ("$file:$.: TCHAR found"); } } if (/ASYS_TEXT/) { print_error ("$file:$.: ASYS_TEXT found"); } elsif (/TEXT/ and !/ACE_TEXT/) { ### Do a double check, since there are several macros ### that end with TEXT if (/^TEXT\s*\(/ or /[^\w_]TEXT\s*\(/) { print_error ("$file:$.: TEXT found"); } } } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # This checks to see if Makefiles define a DEPENDENCY_FILE, and if they do # whether or not it's in the cvs repo. sub check_for_dependency_file () { return if is_suppressed (); print "Running DEPENDENCY_FILE test\n"; foreach $file (@files_makefile) { if (open (FILE, $file)) { print "Looking at file $file\n" if $opt_d; while () { if (/^DEPENDENCY_FILE\s* =\s*(.*)/) { my $depend = $1; my $path = $file; $path =~ s/\/GNUmakefile.*/\//; $depend = $path . $depend; unless (open (DFILE, $depend)) { print_error ("DEPENDENCY_FILE \"$depend\" not found"); print " Either add \"$depend\" to git "; print "or remove DEPENDENCY_FILE variable\n"; print " from $file\n\n"; } close (DFILE); } } close (FILE); } else { print_error ("cannot open $file"); } } } # This checks to see if GNUmakefiles define a MAKEFILE, and if it matches the # name of the GNUmakefile sub check_for_makefile_variable () { return if is_suppressed (); print "Running MAKEFILE variable test\n"; foreach $file (@files_makefile) { if (!(substr($file,-4) eq ".bor") and !(substr($file,-3) eq ".am") and !(substr($file,-4) eq ".vac") and !(substr($file,-4) eq ".alt")) { if (open (FILE, $file)) { print "Looking at file $file\n" if $opt_d; my $makevarfound = 0; my $filename = basename($file,""); while () { if (/^MAKEFILE\s*=\s*(.*)/) { $makevarfound = 1; $makevar = $1; if (!($makevar eq $filename)) { print_error ("$file:$.: MAKEFILE variable $makevar != $filename"); print " Change MAKEFILE = $filename in $file.\n\n"; } } } if ($makevarfound == 0 and !($filename eq "GNUmakefile")) { print_error ("$file:$.: MAKEFILE variable missing in $file"); print " Add MAKEFILE = $filename to the top of $file.\n\n"; } close (FILE); } else { print_error ("cannot open $file"); } } } } # This checks to make sure files include ace/post.h if ace/pre.h is included # and vice versa. sub check_for_pre_and_post () { return if is_suppressed (); print "Running pre.h/post.h test\n"; foreach $file (@files_h) { my $pre = 0; my $post = 0; if (open (FILE, $file)) { my $disable = 0; print "Looking at file $file\n" if $opt_d; while () { if (/FUZZ\: disable check_for_pre_and_post/) { $disable = 1; } if (/FUZZ\: enable check_for_pre_and_post/) { $disable = 0; } if ($disable == 0) { if (/^\s*#\s*include\s*\"ace\/pre\.h\"/) { print_error ("$file:$.: pre.h missing \"/**/\""); ++$pre; } if (/^\s*#\s*include\s*\s*\"ace\/post\.h\"/) { print_error ("$file:$.: post.h missing \"/**/\""); ++$post; } if (/^\s*#\s*include\s*\/\*\*\/\s*\"ace\/pre\.h\"/) { ++$pre; } if (/^\s*#\s*include\s*\/\*\*\/\s*\"ace\/post\.h\"/) { ++$post; } } } close (FILE); if ($disable == 0 && $pre != $post) { print_error ("$file:1: pre.h/post.h mismatch"); } } else { print STDERR "Error: Could not open $file\n"; } } } # This test verifies that the same number of "#pragma warning(push)" and # "#pragma warning(pop)" pragmas are used in a given header. sub check_for_push_and_pop () { return if is_suppressed (); print "Running #pragma (push)/(pop) test\n"; foreach $file (@files_h) { my $push_count = 0; my $pop_count = 0; if (open (FILE, $file)) { my $disable = 0; print "Looking at file $file\n" if $opt_d; while () { if (/FUZZ\: disable check_for_push_and_pop/) { $disable = 1; } if (/FUZZ\: enable check_for_push_and_pop/) { $disable = 0; } if ($disable == 0) { if (/^\s*#\s*pragma\s*warning\s*\(\s*push[,1-4]*\s*\)/) { ++$push_count; } if (/^\s*#\s*pragma\s*warning\s*\(\s*pop\s*\)/) { ++$pop_count; } } } close (FILE); if ($disable == 0 && $push_count != $pop_count) { print_error ("$file: #pragma warning(push)/(pop) mismatch"); } } else { print STDERR "Error: Could not open $file\n"; } } } # This test verifies that the same number of # "ACE_VERSIONED_NAMESPACE_BEGIN_DECL" and # "ACE_END_VERSIONED_NAMESPACE_DECL" macros are used in a given # source file. sub check_for_versioned_namespace_begin_end () { return if is_suppressed (); print "Running versioned namespace begin/end test\n"; foreach $file (@files_cpp, @files_inl, @files_h) { my $begin_count = 0; my $end_count = 0; if (open (FILE, $file)) { print "Looking at file $file\n" if $opt_d; while () { if (/^\s*\w+_BEGIN_VERSIONED_NAMESPACE_DECL/) { ++$begin_count; } if (/^\s*\w+_END_VERSIONED_NAMESPACE_DECL/) { ++$end_count; } if ($begin_count > $end_count and /^\s*#\s*include(\s*\/\*\*\/)?\s*"/) { print_error ("$file:$.: #include directive within Versioned namespace block"); } } close (FILE); if ($begin_count != $end_count) { print_error ("$file: Versioned namespace begin($begin_count)/end($end_count) mismatch"); } } else { print STDERR "Error: Could not open $file\n"; } } } # Check doxygen @file comments sub check_for_mismatched_filename () { return if is_suppressed (); print "Running doxygen \@file test\n"; foreach $file (@files_h, @files_cpp, @files_inl, @files_idl) { if (open (FILE, $file)) { my $disable = 0; print "Looking at file $file\n" if $opt_d; while () { if (m/\@file\s*([^\s]+)/){ # $file includes complete path, $1 is the name after # @file. We must check whether the last part of $file # is equal to $1 if ($file !~ /$1$/) { print_error ("$file:$.: \@file mismatch in $file, found $1"); } } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # check for bad run_test sub check_for_bad_run_test () { return if is_suppressed (); print "Running run_test.pl test\n"; foreach $file (@files_run_pl) { if (open (FILE, $file)) { my $is_run_test = 0; my $sub = 0; if (($file =~ /.*TAO\/examples\/Advanced.*/)) { next ITERATION; } if (($file =~ /.*TAO\/orbsvcs\/examples\/Security\/Send_File.*/)) { next ITERATION; } print "Looking at file $file\n" if $opt_d; while () { if (m/PerlACE/ || m/ACEutils/) { $is_run_test = 1; } if ($is_run_test == 1) { if (m/ACEutils/) { print_error ("$file:$.: ACEutils.pm still in use"); } if (m/unshift \@INC/) { print_error ("$file:$.: unshifting \@INC; use \"use lib\""); } if (m/\$EXEPREFIX/) { print_error ("$file:$.: using \$EXEPREFIX"); } if (m/\$EXE_EXT/) { print_error ("$file:$.: using \$EXE_EXT"); } if (m/Sys::Hostname/) { print_error ("$file:$.: using Sys::Hostname"); } if (m/PerlACE::wait_interval_for_process_creation/) { print_error ("$file:$.: using PerlACE::wait_interval_for_process_creation"); } if (m/PerlACE::waitforfile_timed/) { print_error ("$file:$.: using PerlACE::waitforfile_timed"); } if (m/PerlACE::is_vxworks_test/) { print_error ("$file:$.: using PerlACE::is_vxworks_test"); } if (m/PerlACE::add_lib_path/) { print_error ("$file:$.: using PerlACE::add_lib_path, use AddLibPath on the target"); } if (m/PerlACE::Run_Test/) { print_error ("$file:$.: using PerlACE::Run_Test, use PerlACE::TestTarget"); } if (m/PerlACE::random_port/) { print_error ("$file:$.: using PerlACE::random_port, use TestTarget::random_port"); } if (m/PerlACE::Process/) { print_error ("$file:$.: using PerlACE::Process"); } if (m/PerlACE::TestConfig/) { print_error ("$file:$.: using PerlACE::TestConfig"); } if (m/ACE_RUN_VX_TGTHOST/) { print_error ("$file:$.: using ACE_RUN_VX_TGTHOST, use TestTarget::HostName"); } if (m/Spawn(Wait(Kill)?)?\s*\(.+\->ProcessStop.*\)/) { print_error ("$file:$.: uses Stop together with Spawn"); } if (m/Spawn(Wait(Kill)?)?\s*\(\d+\)/) { print_error ("$file:$.: uses hardcoded timeout for Spawn"); } if (m/Kill\s*\(\d+\)/) { print_error ("$file:$.: uses hardcoded timeout for Kill"); } if (m/unlink/) { print_error ("$file:$.: using unlink"); } if (m/PerlACE::LocalFile/) { print_error ("$file:$.: using PerlACE::LocalFile"); } if (m/\$DIR_SEPARATOR/) { print_error ("$file:$.: using \$DIR_SEPARATOR"); } if (m/ACE\:\:/ && !m/PerlACE\:\:/) { print_error ("$file:$.: using ACE::*"); } if (m/Process\:\:/ && !m/PerlACE\:\:Process\:\:/) { print_error ("$file:$.: using Process::*"); } if (m/Process\:\:Create/) { print_error ("$file:$.: using Process::Create"); } if (m/^ [^ ]/) { print_warning ("$file:$.: using two-space indentation"); } if (m/^\s*\t/) { print_error ("$file:$.: Indenting using tabs"); } if (m/^\s*\{/ && $sub != 1) { print_warning ("$file:$.: Using Curly Brace alone"); } if (m/timedout/i && !m/\#/) { print_error ("$file:$.: timedout message found"); } if (m/^\s*sub/) { $sub = 1; } else { $sub = 0; } } } close (FILE); if ($is_run_test) { my @output = `perl -wc $file 2>&1`; foreach $output (@output) { chomp $output; if ($output =~ m/error/i) { print_error ($output); } elsif ($output !~ m/syntax OK/) { print_warning ($output); } } } } } } # Check for links to ~schmidt/ACE_wrappers/, which should not be in the # documentation sub check_for_absolute_ace_wrappers() { return if is_suppressed (); print "Running absolute ACE_wrappers test\n"; foreach $file (@files_html) { if (open (FILE, $file)) { print "Looking at file $file\n" if $opt_d; while () { if (m/\~schmidt\/ACE_wrappers\//) { chomp; print_error ("$file:$.: ~schmidt/ACE_wrappers found"); print_error ($_); } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # Check for generated headers in the code documentation sub check_for_generated_headers() { return if is_suppressed (); print "Running generated headers test\n"; foreach $file (@files_cpp, @files_inl, @files_h) { if (open (FILE, $file)) { print "Looking at file $file\n" if $opt_d; while () { if (m/Code generated by the The ACE ORB \(TAO\) IDL Compiler/) { chomp; print_error ("$file:$.: header found"); print_error ($_); } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # Make sure ACE_[OS_]TRACE matches the function/method sub check_for_bad_ace_trace() { return if is_suppressed (); print "Running TRACE test\n"; foreach $file (@files_inl, @files_cpp) { if (open (FILE, $file)) { my $class; my $function; print "Looking at file $file\n" if $opt_d; while () { # look for methods or functions if (m/(^[^\s][^\(]*)\:\:([^\:^\(]*[^\s^\(])\s*/) { $class = $1; $function = $2; } elsif (m/^([^\s^\(^\#]*) \(/i) { $class = ""; $function = $1; } elsif (m/^(operator.*) \(/i) { $class = ""; $function = $1; } elsif (m/^class (.*)\s*:/) { $class = $1; $function = ""; } elsif (m/^class (.*)\s*$/) { $class = $1; $function = ""; } # print "TRACE_CHECK. Class = $class\n"; # Look for TRACE statements if (m/ACE_OS_TRACE\s*\(\s*\"(.*)\"/ || m/ACE_TRACE\s*\(\s*\"(.*)\"/) { my $trace = $1; # reduce the classname if ($class =~ m/([^\s][^\<^\s]*)\s*\) { if (/ACE_THROW_SPEC/) { ## Do not use ACE_THROW_SPEC in TAO. if ($file =~ /TAO/i || $cwd =~ /TAO/i) { print_error ("$file:$.: ACE_THROW_SPEC found."); } } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # This test checks for ptr_arith_t usage in source code. ptr_arith_t # is non-portable. Use ptrdiff_t instead. sub check_for_ptr_arith_t () { return if is_suppressed (); print "Running ptr_arith_t check\n"; foreach $file (@files_cpp, @files_inl, @files_h) { if (open (FILE, $file)) { print "Looking at file $file\n" if $opt_d; while () { next if m/^\s*\/\//; # Ignore C++ comments. next if m/^\s*$/; # Skip lines only containing # whitespace. # Check for ptr_arith_t usage. This test should # ignore typedefs, and should only catch variable # declarations and parameter types. if (m/ptr_arith_t / || m/ptr_arith_t,/) { print_error ("$file:$.: ptr_arith_t; use ptrdiff_t instead."); } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # This test checks for the #include # This check is suggested by Don Hinton to force user to use # " " instead of <> to avoid confict with Doxygen. sub check_for_include () { return if is_suppressed (); print "Running the include check\n"; foreach $file (@files_h, @files_cpp, @files_inl, @files_idl) { my $bad_occurance = 0; if (open (FILE, $file)) { my $disable = 0; print "Looking at file $file\n" if $opt_d; while () { if (/FUZZ\: disable check_for_include/) { $disable = 1; } if (/FUZZ\: enable check_for_include/) { $disable = 0; } if ($disable == 0) { if (/^\s*#\s*include\s*<[(ace)|(TAO)]\/.*>/) { print_error ("$file:$.: include used"); ++$bad_occurance; } if (/^\s*#\s*include\s*/) { print_error ("$file:$.: include used"); ++$bad_occurance; } } } close (FILE); if ($disable == 0 && $bad_occurance > 0 ) { print_error ("$file:1: found $bad_occurance usage(s) of #include <> of ace\/tao."); } } else { print STDERR "Error: Could not open $file\n"; } } } # This test verifies that all equality, relational and logical # operators return bool, as is the norm for modern C++. # # NOTE: This test isn't fool proof yet. sub check_for_non_bool_operators () { return if is_suppressed (); print "Running non-bool equality, relational and logical operator check\n"; foreach $file (@files_h, @files_inl, @files_cpp) { if (open (FILE, $file)) { print "Looking at file $file\n" if $opt_d; my $found_bool = 0; my $found_return_type = 0; while () { if ($found_bool == 0 && (/[^\w]bool\s*$/ || /^bool\s*$/ || /\sbool\s+\w/ || /^bool\s+\w/ || /[^\w]return\s*$/)) { $found_bool = 1; $found_return_type = 0; next; } if ($found_bool == 0 && $found_return_type == 0 && /^(?:\w+|\s+\w+)\s*$/ && !/[^\w]return\s*$/) { $found_return_type = 1; $found_bool = 0; next; } if ($found_bool == 0 && /(?\s*::)operator\s*(?:!|<|<=|>|>=|==|!=|&&|\|\|)\s*\(/ && !/\(.*operator\s*(?:!|<|<=|>|>=|==|!=|&&|\|\|)\s*\(/ && !/^\s*return\s+/) { print_error ("$file:$.: non-bool return type for operator"); } $found_return_type = 0; $found_bool = 0; } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # This test verifies that all filenames are short enough sub check_for_long_file_names () { return if is_suppressed (); my $max_filename = 50; my $max_mpc_projectname = $max_filename - 12; ## GNUmakefile.[project_name] print "Running file names check\n"; foreach $file (@files_cpp, @files_inl, @files_h, @files_html, @files_dsp, @files_dsw, @files_gnu, @files_idl, @files_pl, @files_changelog, @files_makefile, @files_bor, @files_mpc, @files_generic) { if ( length( basename($file) ) >= $max_filename ) { print_error ("File name $file meets or exceeds $max_filename chars."); } } foreach $file (grep(/\.mpc$/, @files_mpc)) { if (open(FH, $file)) { my($blen) = length(basename($file)) - 4; ## .mpc while() { if (/project\s*(:.*)\s*{/) { if ($blen >= $max_mpc_projectname) { print_warning ("File name $file meets or exceeds $max_mpc_projectname chars."); } } elsif (/project\s*\(([^\)]+)\)/) { my($name) = $1; if ($name =~ /\*/) { my($length) = length($name) + (($name =~ tr/*//) * $blen); if ($length >= $max_mpc_projectname) { print_warning ("Project name ($name) from $file will meet or exceed $max_mpc_projectname chars when expanded by MPC."); } } else { if (length($name) >= $max_mpc_projectname) { print_warning ("Project name ($name) from $file meets or exceeds $max_mpc_projectname chars."); } } } } close(FH); } } } sub check_for_refcountservantbase () { return if is_suppressed (); print "Running PortableServer::RefCountServantBase derivation check\n"; foreach $file (@files_h, @files_cpp, @files_inl) { if (open (FILE, $file)) { print "Looking at file $file\n" if $opt_d; while () { if (/PortableServer::RefCountServantBase/) { print_error ("$file:$.: reference to deprecated PortableServer::RefCountServantBase"); } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } sub check_for_old_documentation_style () { return if is_suppressed (); print "Running documentation style check\n"; foreach $file (@files_h, @files_cpp, @files_inl) { if (open (FILE, $file)) { print "Looking at file $file\n" if $opt_d; while () { if (/\/\/\s*\= TITLE/) { print_error ("$file:$.: found old documentation style // = TITLE"); } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } sub check_for_TAO_Local_RefCounted_Object () { return if is_suppressed (); print "Running TAO_Local_RefCounted_Object check\n"; ITERATION: foreach $file (@files_h, @files_cpp, @files_inl) { if (open (FILE, $file)) { my $disable = 0; print "Looking at file $file\n" if $opt_d; while () { if (/FUZZ\: disable check_for_TAO_Local_RefCounted_Object/) { $disable = 1; } if (/FUZZ\: enable check_for_TAO_Local_RefCounted_Object/) { $disable = 0; } if ($disable == 0 and /TAO_Local_RefCounted_Object/) { print_error ("$file:$.: TAO_Local_RefCounted_Object is deprecated, use CORBA::LocalObject instead"); } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # This test checks for the correct use of ORB_init() so as # to be compatible with wide character builds. sub check_for_ORB_init () { return if is_suppressed (); print "Running the ORB_init() wide character incompatibility check\n"; foreach $file (@files_cpp, @files_inl) { if (open (FILE, $file)) { my $disable = 0; my $multi_line; my $not_found_end_line_count= 0; print "Looking at file $file\n" if $opt_d; while () { if (!defined $multi_line) { if (/FUZZ\: disable check_for_ORB_init/) { $disable = 1; next; } elsif (/FUZZ\: enable check_for_ORB_init/) { $disable = 0; next; } elsif ($disable == 0) { s/^\s+//; ## Remove leading space s/\s*(\/\/.*)?$//; ## Remove trailling space and line comments if (s/^([^=]*=)?\s*(CORBA\s*::\s*)?ORB_init\s*//) { $multi_line = $_; ## Rest of the line } else { next; } } } else { $_ =~ s/^\s+//; ## Remove leading space $_ =~ s/\s*(\/\/.*)?$//; ## Remove trailling space and line comments if ($multi_line eq "") { ## Append this line to existing statement. $multi_line = $_; } else { $multi_line .= ' ' . $_; } } my $testing = $multi_line; if ($testing =~ s/^\(([^\"\/\)]*(\"([^\"\\]*(\\.)*)\")?(\/+\*.*?\*\/\s*)*)*\)//) { # $testing has thrown away what we actually want, i.e. # we want to ignore what's left in $testing. $multi_line = substr ($multi_line, 0, -length ($testing)); $multi_line =~ s!/\*.*?\*/! !g; ## Remove any internal /* ... */ comments $multi_line =~ s!\s{2,}! !g; ## collapse multi spaces $multi_line =~ s/^\(\s*//; ## Trim leading ( and space $multi_line =~ s/\s*\)$//; ## Trim trailing space and ) if ($multi_line =~ s/^[^,]*,\s*//) { # If this fails there is only 1 parameter (which we will ignore) # 1st parameter has been removed by the above, split up remaining 2 & 3 $multi_line =~ s/^([^,]*),?\s*//; my $param2 = $1; $param2 =~ s/\s+$//; # Trim trailing spaces print_error ("$file:$.: ORB_init() 2nd parameter requires static_cast(0)") if ($param2 eq '0'); print_error ("$file:$.: ORB_init() 3rd parameter is redundant (default orbID or give as string)") if ($multi_line eq '0'); print_error ("$file:$.: ORB_init() 3rd parameter is redundant (default orbID already \"\")") if ($multi_line eq '""'); } undef $multi_line; $not_found_end_line_count = 0; } elsif ($not_found_end_line_count < 10) { # Limit the search for ( ... ) following ORB_init to ten lines ++$not_found_end_line_count; } else { undef $multi_line; $not_found_end_line_count = 0; } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } # This test checks for the presence of an include for ace/OS.h # which should never occur. Only user code is allowed to include OS.h. sub check_for_include_OS_h () { return if is_suppressed (); print "Running the OS.h inclusion check\n"; foreach $file (@files_h, @files_cpp, @files_inl) { if (open (FILE, $file)) { my $disable = 0; print "Looking at file $file\n" if $opt_d; while () { if (/FUZZ\: disable check_for_include_OS_h/) { $disable = 1; next; } elsif (/FUZZ\: enable check_for_include_OS_h/) { $disable = 0; next; } elsif ($disable == 0 and /^\s*#\s*include\s*<[(ace)|(TAO)]\/.*>/) { print_error ("$file:$.: include used"); } else { if ($disable == 0 and /^\s*#\s*include\s*"ace\/OS.h"/) { print_error ("$file:$.: include ace/OS.h used"); } } } close (FILE); } else { print STDERR "Error: Could not open $file\n"; } } } sub check_for_ace_log_categories () { return if is_suppressed (); print "Running the ACE log categories check\n"; my @macros = qw/HEX_DUMP ERROR ERROR_RETURN ERROR_BREAK DEBUG/; my $macros = join ('|', @macros); for my $f (@files_h, @files_cpp, @files_inl) { my $cat = 'ACE'; $f =~ s!\\!/!g; if ($f =~ /\bace\/(\w+)/) { next if $1 eq 'Log_Msg' || $` =~ /\/protocols\/$/; $cat = 'ACELIB'; } elsif ($f =~ /tao\// && $f !~ /interop-tests\//) { $cat = 'TAOLIB'; } elsif ($f =~ /\/orbsvcs\// && $f !~ /tests|examples/i) { $cat = 'ORBSVCS'; } elsif ($f =~ /tests\/Log_Msg_Test\.cpp/) { next; } if (open (IN, $f)) { print "Looking at file $f for category $cat\n" if $opt_d; my $disable = 0; while () { if (/FUZZ: disable check_for_ace_log_categories/) { $disable = 1; next; } elsif (/FUZZ: enable check_for_ace_log_categories/) { $disable = 0; next; } elsif ($disable == 0 && /\b(ACE|ACELIB|TAOLIB|ORBSVCS)_($macros)\b/g && $1 ne $cat) { print_error ("$f:$.: found log macro $1_$2, " . "expecting ${cat}_$2"); } } close IN; } else { print STDERR "Error: Could not open $f\n"; } } } ############################################################################## use vars qw/$opt_c $opt_d $opt_x $opt_h $opt_l $opt_t $opt_s $opt_m/; if (!getopts ('cdx:hl:t:s:mv') || $opt_h) { print "fuzz.pl [-cdhm] [-l level] [-t test_names] [file1, file2, ...]\n"; print "\n"; print " -c only look at the files passed in\n"; print " -d turn on debugging\n"; print " -x specify comma-separated list of path masks\n"; " (regex) to exclude\n"; print " -h display this help\n"; print " -l level set detection level (default = 5)\n"; print " -t test_names specify comma-separated list of tests to run\n". " this will disable the run level setting\n"; print " -s test_names specify comma-separated list of tests to suppress\n". " this will supplement the run level setting\n"; print " -m only check locally modified files (uses git)\n"; print "======================================================\n"; print "list of the tests that could be run or suppressed:\n"; print < 0) ? 1 : 0; } if ($opt_s) { my @tests = split '\s*,\s*', $opt_s; for my $test (@tests) { $suppressed_tests{$test} = 1; } } print "--------------------Configuration: Fuzz - Level ",$opt_l, "--------------------\n"; check_for_trailing_whitespace () if ($opt_l >= 4); check_for_lack_ACE_OS () if ($opt_l >= 6); check_for_ACE_Guard () if ($opt_l >= 1); check_for_generated_headers () if ($opt_l >= 6); check_for_bad_run_test () if ($opt_l >= 5); check_for_deprecated_macros () if ($opt_l >= 1); check_for_refcountservantbase () if ($opt_l >= 1); check_for_msc_ver_string () if ($opt_l >= 3); check_for_empty_files () if ($opt_l >= 1); check_for_noncvs_files () if ($opt_l >= 1); check_for_streams_include () if ($opt_l >= 6); check_for_dependency_file () if ($opt_l >= 1); check_for_makefile_variable () if ($opt_l >= 1); check_for_inline_in_cpp () if ($opt_l >= 2); check_for_id_string () if ($opt_l >= 1); check_for_newline () if ($opt_l >= 1); check_for_ACE_Thread_Mutex () if ($opt_l >= 1); check_for_ACE_SYNCH_MUTEX () if ($opt_l >= 1); check_for_tab () if ($opt_l >= 1); check_for_exception_spec () if ($opt_l >= 1); check_for_NULL () if ($opt_l >= 1); check_for_inline () if ($opt_l >= 2); check_for_math_include () if ($opt_l >= 3); check_for_synch_include () if ($opt_l >= 6); check_for_line_length () if ($opt_l >= 8); check_for_preprocessor_comments () if ($opt_l >= 7); check_for_tchar () if ($opt_l >= 4); check_for_pre_and_post () if ($opt_l >= 4); check_for_push_and_pop () if ($opt_l >= 4); check_for_versioned_namespace_begin_end () if ($opt_l >= 4); check_for_mismatched_filename () if ($opt_l >= 2); check_for_absolute_ace_wrappers () if ($opt_l >= 3); check_for_bad_ace_trace () if ($opt_l >= 4); check_for_ptr_arith_t () if ($opt_l >= 4); check_for_non_bool_operators () if ($opt_l > 2); check_for_long_file_names () if ($opt_l >= 1); check_for_improper_main_declaration () if ($opt_l >= 1); check_for_TAO_Local_RefCounted_Object () if ($opt_l >= 1); check_for_include_OS_h () if ($opt_l >= 1); check_for_ORB_init () if ($opt_l >= 1); check_for_old_documentation_style () if ($opt_l >= 6); check_for_ace_log_categories () if ($opt_l >= 5); print "\nfuzz.pl - $errors error(s), $warnings warning(s)\n"; exit (1) if $errors > 0; ace-8.0.4+dfsg.orig/bin/split-cpp.pl0000755000175000017500000003075315027201773016222 0ustar sudipsudip#!/usr/bin/env perl eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}' & eval 'exec perl -w -S $0 $argv:q' if 0; # # Splits C++ source files into one file per function or data item. # # Author: David L. Levine, with much help and encouragment from # Umar Syyid and Gonzalo A. Diethelm. # Completed by Andrew Gilpin, July 2000 # Date: 10 November 1998 # # For each C++ source file: # 1) Extracts the "intro" code, i.e., #includes and declarations. # 2) Identifies function definitions, relying on {, and } at the # beginning of a line, to delineate the function begin and # end. # # Assumptions: (applies only to the files being split, i.e. .cpp files) # * Function definition bodies are terminated with } appearing at # the beginning of a line. # * Free-standing (outside of functions) macro invocations must be # followed by a blank line, or terminated with a semicolon. # * A function must not have a blank line between its header # (signature) and its body. # * There aren't multiple C-style comments on one line, with code # between them. # * typedefs are on a single line # * A #endif doesn't have a multi-line C comment starting on that line. # The first three lines above let this script run without specifying the # full path to perl, as long as it is in the user's PATH. # Taken from perlrun man page. # Changes made by Andrew Gilpin (June - July 2000) # * Added option -c to use .c extension instead of .cpp extension # * Prints message when no filenames are specified on the command line # * Changed -? option to -h so that it works properly in most shells # * Added option -s to skip certain files, but copy them to $split_dir, # renaming them. (filename.cpp -> $split_dir/filename_S1.cpp). This is # here so that ACE can selectively not split certain files (namely those # that this script doesn't work with :) # * Added support for classes declared in the .cpp file. $usage="usage: $0 [-h] [-d] [-v] [-c] [-s filename] filenames\n"; #### Configuration parameters. $verbose = 0; $debug = 0; $split_dir = 'SPLIT'; $extension = 'cpp'; @files_to_skip = (); #### Constants. $DIR_SEPARATOR = $^O eq "MSWin32" ? '\\' : '/'; #### #### Process command line args. #### while ( $#ARGV >= $[ && $ARGV[0] =~ /^-/ ) { if ( $ARGV[0] eq '-d' ) { $debug = 1; } elsif ( $ARGV[0] eq '-v' ) { $verbose = 1; } elsif ( $ARGV[0] eq '-c' ) { $extension = 'c'; } elsif ( $ARGV[0] eq '-s' ) { push @files_to_skip, $ARGV[1]; shift; } elsif ( $ARGV[0] eq '-h' ) { print "$usage"; exit; } else { print STDERR "$0: unknown option $ARGV[0]\n"; die $usage; } shift; } &main (); #### #### Reset state, to process a new file starting with a clean slate. #### sub reset { #### Working data buffers. @intro = (); @current_comments = (); @current_code = (); @if = (); @save_if = (); @endif = (); @unknown = (); ####@unknown_s = (); #### State variables. $current_file_number = 0; $top_of_file = 1; $in_braces = 0; $in_nonfunction_code = 0; $in_C_comment = 0; $intro_length = 0; $preprocessor_continuation = 0; $preserved_ifs = 0; } sub main { #### Print error message if no files are specified. #### We need to do this before we modify anything on disk. die "No files specified!\n$usage" if (@ARGV == 0); #### Remove the destination subdirectory, if it exists. #### Attempts to clean it out using unlink may fail because #### it can have many files. if (-d "$split_dir") { system ("/bin/rm -r $split_dir") << 256 && die "$0: unable to rm \"$split_dir\"\n"; } #### Create the destination subdirectory. mkdir "$split_dir", 0755 || die "$0: unable to create $split_dir directory: $!\n"; MAIN_LOOP: foreach $file (@ARGV) { #### Strip off filename extension. ($basename = $file) =~ s/\.[^\.]+$//; foreach $skip_file (@files_to_skip) { if ($skip_file eq $file) { system ("/bin/cp $file $split_dir/" . $basename. "_S1\.$extension"); next MAIN_LOOP; } } &reset (); print "FILE: $file\n" if $verbose; open INPUT, "$file" || die "$0: unable to open \"$file\"\n"; while () { #### Strip comments from $line and use that for processing. #### But, use $_ for output, so that comments will be preserved. my $line = $_; #### If we're in the midst of a multiline C comment, see #### if it's finished on this line. if ($in_C_comment) { if ($line =~ s%^.*\*/%%) { #### End C-style comment. $in_C_comment = 0; if ($line =~ /^\s*$/ && ! $in_braces) { #### No code on the line. #&save_comment ($_); next; } } else { unless ($in_braces) { #&save_comment ($_); next; } } } #### Strip C++-style comments. if ($line =~ s%\s*//.*$%%) { if ($line =~ /^\s*$/ && ! $in_braces) { #### C++-style comment, without any code on the line. #&save_comment ($_); next; } } #### And C-style comments. if ($line =~ m%/\*%) { #### Begin C-style comment. Strip any complete comment(s), #### then see what's left. $line =~ s%\s*/\*.*\*/\s*%%g; #### check to see if a preprocessor is on this line if (! $in_braces) { if ($line eq '') { #### The line just had comment(s). Save it. #&save_comment ($_); next; } else { #### There's other text on the line. See if it's just the #### start of a comment. if ($line =~ m%/\*% && $line !~ m%\*/%) { #### The C-style comment isn't terminated on this line. $in_C_comment = 1; #&save_comment ($_); next; } } } } #### For now, skip ACE_RCSID's. Eventually, we might want to #### consider putting them in _every_ file, if they're enabled. next if $line =~ /^ACE_RCSID/; if ($in_braces) { push @unknown, $_; if ($line =~ /{/) { ++$in_braces; } elsif ($line =~ /^};/) { #### }; at beginning of line could signify end of class --$in_braces; if ($in_braces == 0) { push @intro, @unknown; @unknown = (); } } elsif ($line =~ /^}/) { #### } at beginning of line signifies end of function. --$in_braces; push @current_code, @unknown; @unknown = (); &finish_current ($basename, ++$current_file_number); } elsif ($line =~ /};/) { #### end of multi-line data delcaration --$in_braces; if ($in_braces == 0) { push @current_code, @unknown; @unknown = (); &finish_current ($basename, ++$current_file_number); } } } else { #### Not in braces. if (($line =~ m%[^/]*{%) && (! $preprocessor_continuation)) { #### { signifies beginning of braces (obviously :). if ($line =~ /};/) { #### braces end on this line push @unknown, $_; push @current_code, @unknown; @unknown = (); &finish_current ($basename, ++$current_file_number); } else { push @unknown, $_; $in_braces = 1; $in_nonfunction_code = $top_of_file = 0; } } elsif ($line =~ /^}/) { warn "$0: skipping unexpected } on line $. of \"$file\"\n"; next; } elsif ($line =~ /^typedef/) { push @intro, $_; } elsif ($line =~ /^\s*#/ || $preprocessor_continuation) { #### Preprocessor directive. if ($in_nonfunction_code) { push @unknown, $_; } else { push @intro, $_; } $top_of_file = 0; $preprocessor_continuation = /\\$/ ? 1 : 0; if ($line =~ m%^\s*#\s*if\s*(.*)(/.*)*$%) { push @save_if, $_; unshift @endif, "#endif /* $1 [Added by split-cpp.] */\n"; } elsif ($line =~ /^\s*#\s*endif/) { #### End an #if/#else block. unless (defined pop @save_if) { pop @if; if ($preserved_ifs > 0) { --$preserved_ifs; } } shift @endif; #### } elsif ($line =~ /^\s*#/) { #### Any other preprocessor directive. } } elsif ($line =~ /^\s*$/) { #### Whitespace only, or empty line.. push @current_code, "\n"; if ($in_nonfunction_code) { #### In the midst of non-function code, we reached a #### blank line. Assume that we're done with it. &finish_current ($basename, ++$current_file_number); } else { #### Not in a function, so add to intro. Just in case data or #### a function follow it, flush now. $preserved_ifs += $#save_if + 1; &flush_current (\@intro); } } elsif ($line =~ /;/) { #### Data definition or semicolon-terminated macro invocation. push @unknown, $_; $top_of_file = 0; #### Is it file-static? Squash newlines out of @current_code. my $statement = join (' ', @current_code); if ($statement =~ /([^=[(]+)[=[(](.*)/) { if ($1 =~ /static/) { #### Move code to the intro. push @intro, @current_comments; @current_comments = (); &flush_current (\@intro); #### Not separate code. $in_nonfunction_code = 0; #### ???? Extract name from the left side and save for #### later matching. } else { if ($statement =~ /^USEUNIT\s*\(/) { #### Special-case those Borland USEUNIT things. &flush_current (\@intro); } else { #### Non-static entity, with semicolon. Wrap it up. push @current_code, @unknown; @unknown = (); &finish_current ($basename, ++$current_file_number); } } } else { #### Dunno. Wrap it up, anyways. push @current_code, @unknown; @unknown = (); &finish_current ($basename, ++$current_file_number); } } else { #### Beginning of data definition or function or class. push @unknown, $_; $in_nonfunction_code = 1; $top_of_file = 0; } } if (eof) { close (ARGV); #### To reset line number counter. if ($#intro > $intro_length) { #### Leftover prepreprocessor statement(s), such as #pragma #### instantiate. &finish_current ($basename, ++$current_file_number); } } } close INPUT; } }; #### #### Save a comment in the appropriate array. #### #sub save_comment { # my ($comment) = @_; # # if ($top_of_file) { # push @intro, $comment; # } else { # push @current_comments, $comment; # } #} #### #### Flush the contents of the @current_code array to the destination #### argument array. It is passed by reference. #### sub flush_current { my ($destination) = @_; push @$destination, @current_code; @current_code = (); } #### #### Flush what we've got now to an output (split) file. #### sub finish_current { my ($basename, $current_file_number) = @_; my $current_file_name = sprintf "$split_dir$DIR_SEPARATOR${basename}_S%d.$extension", $current_file_number++; if ($verbose) { print "CURRENT OUTPUT FILE: $current_file_name\n"; print "INTRO:\n"; print @intro; print @if; print @current_comments; print "CURRENT CODE:\n"; print @current_code; print @endif; } open OUTPUT, "> $current_file_name" || die "unable to open $current_file_name\n"; print OUTPUT "// Automatically generated by ACE's split-cpp.\n" . "// DO NOT EDIT!\n\n"; if ($debug) { print OUTPUT "INTRO:\n", @intro, "IF:\n", @if, "COMMENTS:\n", @current_comments, "CURRENT:\n", @current_code, "ENDIF:\n", @endif; } else { print OUTPUT @intro, @if, @current_comments, @current_code, @endif; } close OUTPUT; #### For detection of leftover preprocessor statements and #### comments at end of file. $intro_length = $#intro; @current_comments = @current_code = @save_if = (); $in_braces = $in_nonfunction_code = 0; } ace-8.0.4+dfsg.orig/bin/copy-script.sh0000755000175000017500000000027115027201773016552 0ustar sudipsudip#!/bin/sh for i in *.gz *.bz2 *.zip *.md5; do d=`echo $i | sed 's/\.[tz][ai][rp]/-6.5.9&/'` echo "Copying $i to $d" cp -ip $i /export/www/download.dre/previous_versions/$d done ace-8.0.4+dfsg.orig/bin/generate_performance_chart.sh0000755000175000017500000000055715027201773021641 0ustar sudipsudip#!/bin/sh # gnuplot <<_EOF_ >/dev/null 2>&1 set xdata time set xtics rotate set format x "%Y/%m/%d" set timefmt '%Y/%m/%d-%H:%M' set xlabel 'Date (YYYY/MM/DD)' 0,-3 set ylabel 'Throughput (Requests/Second)' set terminal png small size $4 color set yrange [0:] set output "$2" plot '$1' using 1:2 title '$3' w l exit _EOF_ ace-8.0.4+dfsg.orig/bin/cltime.pl0000755000175000017500000000030615027201773015553 0ustar sudipsudipuse strict; my($name) = shift; my($email) = shift; my($entry) = scalar(gmtime()); my($tz) = 'UTC'; $entry =~ s/(:\d\d\s+)(.*)(\d\d\d\d)$/$1$tz $3/; $entry .= " $name <$email>"; print $entry; ace-8.0.4+dfsg.orig/bin/main2TMAIN.pl0000755000175000017500000000104715027201773016100 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -pi -S $0 ${1+"$@"}' & eval 'exec perl -pi -S $0 $argv:q' if 0; # # You may want to run the "find" command with this script, which maybe # something like this: # # find . -type f \( -name "*.C" -o -name "*.cc" -o -name "*.c" -o -name "*.cpp" \) -print | xargs $ACE_ROOT/bin/main2TMAIN.pl # The first three lines above let this script run without specifying the # full path to perl, as long as it is in the user's PATH. # Taken from perlrun man page. s/main( *\(int[ A-Za-z]*, *ACE_TCHAR)/ACE_TMAIN$1/g; ace-8.0.4+dfsg.orig/bin/ACE+TAO+CIAO+DAnCE.json0000644000175000017500000000712415027201773017222 0ustar sudipsudip// Policy used in Coverity tests. // // Generates UNCALLED defects for functions which are not called by any test. // Generates INSUFFICIENT_COVERAGE defects for functions which do not have // 100% line coverage. // Generates INSUFFICIENT_FILE_COVERAGE defects for files which do not // have 100% line coverage. // // The line immediately following a coverity[TA.COVERAGE] annotation // (i.e. in source code comments) is ignored for coverage purposes. // Lines with xnocover annotations are ignored for coverage purposes. { type: "Coverity test policy definition", format_version: 1, recent_date_cutoff: "2012-03-07", // 6.1.0 old_date_cutoff: "2010-12-14", // 6.0.0 rules: [ { violation_name: "INSUFFICIENT_COVERAGE", aggregation_granularity: "function", minimum_line_coverage_pct: 100, use_filters: [ "exclude_annotated_lines", "executed_code", "focus_on_my_source", "exclude_logging_code", "exclude_throw_statements", "exclude_error_handlers" ] }, ], define_filters: [ { filter_name: "executed_code", function_filters: [ { is_executed: true, exclusion_reason: "unexecuted code", } ] }, { filter_name: "exclude_annotated_lines", line_filters: [ { not: { or: [ { line_regex: "coverity\\[TA\\.COVERAGE\\]", line_offset: -1 }, { line_regex: "xnocover" }, ] }, exclusion_reason: "coverage annotation", } ] }, { filter_name: "exclude_logging_code", line_filters: [ { not: { or: [ { line_regex: "ACE_DEBUG" }, { line_regex: "ACE_ERROR" }, { line_regex: "ACE_ERROR_RETURN" }, { line_regex: "ACELIB_DEBUG" }, { line_regex: "ACELIB_ERROR" }, { line_regex: "ACELIB_ERROR_RETURN" }, { line_regex: "TAOLIB_DEBUG" }, { line_regex: "TAOLIB_ERROR" }, { line_regex: "TAOLIB_ERROR_RETURN" }, { line_regex: "TAO_debug_level" }, { line_regex: "ORBSVCS_DEBUG" }, { line_regex: "ORBSVCS_ERROR" }, { line_regex: "ORBSVCS_ERROR_RETURN" }, { line_regex: "VDBG" }, { line_regex: "VDBG_LVL" }, { line_regex: "Transport_debug_level" }, { line_regex: "_tao_print_exception" }, ] }, exclusion_reason: "policy indicates no need to test logging code", } ] }, { filter_name: "exclude_throw_statements", line_filters: [ { exclusion_reason: "on throw path", not: { contains_astnode: { dominated_by_astnode: { expression_kind: "throw" , } } } } ] }, { filter_name: "exclude_error_handlers", line_filters: [ { not: { line_regex: "return\\s+-1" }, exclusion_reason: "policy indicates no need to test error handlers", } ] }, { filter_name: "focus_on_my_source", file_filters: [ { exclusion_reason: "outside interesting source locations", and: [ { or: [ { file_name_regex: ".*/ACE/ace/.*" }, { file_name_regex: ".*/DDS/dds/DCPS/.*" }, { file_name_regex: ".*/TAO/tao/.*" }, { file_name_regex: ".*/TAO/orbsvcs/orbsvcs/Naming/.*" }, { file_name_regex: ".*/TAO/orbsvcs/orbsvcs/Notify/.*" }, { file_name_regex: ".*/TAO/orbsvcs/orbsvcs/Event/.*" } ] } ] } ] }, ] } ace-8.0.4+dfsg.orig/bin/ACETAOCIAO.style0000644000175000017500000003134115027201773016413 0ustar sudipsudip ace-8.0.4+dfsg.orig/bin/msvc_mpc_auto_compile.pl0000755000175000017500000002475715027201773020665 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # Win32 auto_compile script. use File::Find; use Cwd; if (!$ENV{ACE_ROOT}) { $ACE_ROOT = getcwd ()."\\"; warn "ACE_ROOT not defined, defaulting to ACE_ROOT=$ACE_ROOT"; } else { $ACE_ROOT = $ENV{ACE_ROOT}; $TAO_ROOT = $ENV{TAO_ROOT}; } @directories = (); @ace_core_dirs = ("$ACE_ROOT\\ace", "$ACE_ROOT\\Kokyu", "$ACE_ROOT\\ACEXML", "$ACE_ROOT\\examples", "$ACE_ROOT\\tests", "$ACE_ROOT\\protocols"); @tao_core_dirs = ("$ACE_ROOT\\apps\\gperf\\src", "$TAO_ROOT\\TAO_IDL", "$TAO_ROOT\\tao", "$TAO_ROOT\\tests"); @orbsvcs_core_dirs = ("$TAO_ROOT\\orbsvcs\\orbsvcs"); $debug = 0; $verbose = 0; $print_status = 0; $Ignore_errors = 0; # By default, bail out if an error occurs. $Build_Debug = 0; $Build_Release = 0; $build_all = 0; $Build_Cmd = "/BUILD"; $use_custom_dir = 0; $useenv = ''; $vc7 = 0; $project_root = "$ACE_ROOT"; # Build_Config takes in a string of the type "project--configuration" and # runs msdev to build it. # sub Build_Config ($) #{ # my ($arg) = @_; # my ($project, $config) = split /--/, $arg; # # return Build ($project, $config); #} # Build sub Build ($$) { my ($project, $config) = @_; if ($debug == 1) { print "$project\n"; return 0; } else { print "Auto_compiling $project : $config\n"; print "Building $project $config\n" if $verbose; return system ("msdev.com $project /MAKE \"$config\" $Build_Cmd $useenv"); } } # Build sub Build_VC7 ($$) { my ($project, $config) = @_; if ($debug == 1) { print "$project\n"; return 0; } else { print "Auto_compiling $project : $config\n"; print "Building $project $config\n" if $verbose; return system ("devenv.com $project $Build_Cmd $config $useenv"); } } sub Find_Dsw (@) { my (@dir) = @_; @array = (); sub wanted_dsw { $array[++$#array] = $File::Find::name if ($File::Find::name =~ /\.dsw$/i); } find (\&wanted_dsw, @dir); print "List of dsw's\n" if ($verbose == 1); return @array; } sub Find_Sln (@) { my (@dir) = @_; @array = (); print "Searching for list of sln's\n" if ($verbose == 1); sub wanted_sln { $array[++$#array] = $File::Find::name if ($File::Find::name =~ /\.sln$/i); } find (\&wanted_sln, @dir); print "List of sln's\n" if ($verbose == 1); return @array; } # Only builds the core libraries. sub Build_Custom () { print STDERR "Building Custom\n"; print "Building Custom directories specified\n";# if ($verbose == 1); print "Build " if ($verbose); print "Debug " if ($verbose) && ($Build_Debug); print "Release " if ($verbose) && ($Build_Release); print "\n" if ($verbose); my @custom_list = Find_Dsw (@directories); print "List now is @custom_list \n"; foreach $c (@custom_list) { print "List now is $c \n"; if ($Build_Debug) { $Status = Build ($c, "ALL - Win32 Debug"); return if $Status != 0 && !$Ignore_errors; } if ($Build_Release) { $Status = Build ($c, "ALL - Win32 Release"); return if $Status != 0 && !$Ignore_errors; } } } # Build all examples and directories sub Build_All () { push @directories, @ace_core_dirs; push @directories, @tao_core_dirs; push @directories, @orbsvcs_core_dirs; print STDERR "First pass (libraries)\n" if ($print_status == 1); print "\nmsvc_mpc_auto_compile: First Pass CORE (libraries)\n"; Build_Custom (); my @new_directory_search = "$project_root"; my @configurations = Find_Dsw (@new_directory_search); print STDERR "Second pass (for other things)\n" if ($print_status == 1); print "\nmsvc_mpc_auto_compile: Second Pass (rest of the stuff)\n"; foreach $c (@configurations) { print "\nUsing $c for compilation\n"; if ($Build_Debug) { $Status = Build ($c, "ALL - Win32 Debug"); return if $Status != 0 && !$Ignore_errors; } if ($Build_Release) { $Status = Build ($c, "ALL - Win32 Release"); return if $Status != 0 && !$Ignore_errors; } } } # Only builds the core libraries. sub Build_Custom_VC7 () { print STDERR "Building Custom\n"; print "Building Custom directories specified\n";# if ($verbose == 1); print "Build " if ($verbose); print "Debug " if ($verbose) && ($Build_Debug); print "Release " if ($verbose) && ($Build_Release); print "\n" if ($verbose); my @custom_list = Find_Sln (@directories); print "List now is @custom_list \n"; foreach $c (@custom_list) { print "List now is $c \n"; if ($Build_Debug) { $Status = Build_VC7 ($c, "debug"); return if $Status != 0 && !$Ignore_errors; } if ($Build_Release) { $Status = Build_VC7 ($c, "release"); return if $Status != 0 && !$Ignore_errors; } } } # Build all examples and directories sub Build_All_VC7 () { push @directories, @ace_core_dirs; push @directories, @tao_core_dirs; push @directories, @orbsvcs_core_dirs; print STDERR "First pass (libraries)\n" if ($print_status == 1); print "\nmsvc_mpc_auto_compile: First Pass CORE (libraries)\n"; Build_Custom_VC7 (); my @new_directory_search = "$project_root"; my @configurations = Find_Sln (@new_directory_search); print STDERR "Second pass (for other things)\n" if ($print_status == 1); print "\nmsvc_mpc_auto_compile: Second Pass (rest of the stuff)\n"; foreach $c (@configurations) { print "\nUsing $c for compilation\n"; if ($Build_Debug) { $Status = Build_VC7 ($c, "debug"); return if $Status != 0 && !$Ignore_errors; } if ($Build_Release) { $Status = Build_VC7 ($c, "release"); return if $Status != 0 && !$Ignore_errors; } } } ## Parse command line argument while ( $#ARGV >= 0 && $ARGV[0] =~ /^(-|\/)/ ) { if ($ARGV[0] =~ '-k') { # Ignore errors print "Ignore errors\n" if ( $verbose ); $Ignore_errors = 1; } elsif ($ARGV[0] =~ /^-d$/i) { # debug $debug = 1; } elsif ($ARGV[0] =~ '-vc7') { # Use VC7 project and solution files. print "Using VC7 files\n" if ( $verbose ); $vc7 = 1; } elsif ($ARGV[0] =~ '-vc8') { # Use VC8 project and solution files. print "Using VC8 files\n" if ( $verbose ); $vc7 = 1; # vc8 is like vc7 } elsif ($ARGV[0] =~ '-vc9') { # Use VC9 project and solution files. print "Using VC9 files\n" if ( $verbose ); $vc7 = 1; # vc9 is like vc7 } elsif ($ARGV[0] =~ '-v') { # verbose mode $verbose = 1; } elsif ($ARGV[0] =~ '-s') { # status messages $print_status = 1; } elsif ($ARGV[0] =~ '-u') { # USEENV print "Using Environment\n" if ($verbose); $useenv = '/USEENV'; } elsif ($ARGV[0] =~ '-ACE') {# Build ACE and its tests print "Building ACE\n" if ( $verbose ); $use_custom_dir = 1; push @directories, @ace_core_dirs; } elsif ($ARGV[0] =~ '-TAO') {# Build TAO and its tests print "Building TAO\n" if ( $verbose ); $use_custom_dir = 1; push @directories, @ace_core_dirs; push @directories, @tao_core_dirs; } elsif ($ARGV[0] =~ '-ORBSVCS') {# Build TAO/ORBSVCS and its tests print "Building ACE+TAO+orbsvcs\n" if ( $verbose ); $use_custom_dir = 1; push @directories, @ace_core_dirs; push @directories, @tao_core_dirs; push @directories, @orbsvcs_core_dirs; } elsif ($ARGV[0] =~ '-ALL') {# Build all print "Building ALL \n" if ( $verbose ); $build_all = 1; } elsif ($ARGV[0] =~ '-dir') { # Compile only a specific directory shift; print "Adding directory $ARGV[0]\n" if ( $verbose ); $use_custom_dir = 1; push @directories, $ARGV[0]; } elsif ($ARGV[0] =~ '-project_root') { # use different root than ACE_ROOT shift; print "Using project root $ARGV[0]\n" if ( $verbose ); $project_root = $ARGV[0]; } elsif ($ARGV[0] =~ '-rebuild') { # Rebuild all print "Rebuild all\n" if ( $verbose ); $Build_Cmd = "/REBUILD"; } elsif ($ARGV[0] =~ '-clean') { # Clean print "Cleaning all\n" if ( $verbose ); $Build_Cmd = "/CLEAN"; } elsif ($ARGV[0] =~ '-Debug') { # Debug versions print "Building Debug Version\n" if ( $verbose ); $Build_Debug = 1; } elsif ($ARGV[0] =~ '-Release') { # Release versions print "Building Release Version\n" if ( $verbose ); $Build_Release = 1; } elsif ($ARGV[0] =~ '-(\?|h)') { # Help information print "Options\n"; print "-d = Debug (only print out projects)\n"; print "-k = Ignore Errors\n"; print "-v = Script verbose Mode\n"; print "-s = Print status messages to STDERR\n"; print "-u = Tell MSVC to use the environment\n"; print "-vc7 = Use MSVC 7 toolset\n"; print "-vc8 = Use MSVC 8 toolset\n"; print "-vc9 = Use MSVC 9 toolset\n"; print "\n"; print "-ACE = Build ACE and its tests\n"; print "-TAO = Build ACE+TAO and its tests\n"; print "-ORBSVCS = Build ACE+TAO+ORBSVCS and its tests\n"; print "-dir

= Compile custom directories\n"; print "-project_root = Use different root directory than ACE_ROOT\n"; print "\n"; print "-rebuild = Rebuild All\n"; print "-clean = Clean\n"; print "-Debug = Compile Debug versions\n"; print "-Release = Compile Release versions\n"; exit; } else { warn "$0: error unknown option $ARGV[0]\n"; die -1; } shift; } if (!$Build_Debug && !$Build_Release) { $Build_Debug = 1; $Build_Release = 1; } print "MPC version of msvc_mpc_auto_compile: Begin\n"; if ($vc7) { Build_All_VC7 if ($build_all && !$use_custom_dir); Build_Custom_VC7 if $use_custom_dir; } else { Build_All if ($build_all && !$use_custom_dir); Build_Custom if $use_custom_dir; } print "msvc_mpc_auto_compile: End\n"; print STDERR "End\n" if ($print_status == 1); ace-8.0.4+dfsg.orig/bin/topinfo_simple_stats.sh0000755000175000017500000000370115027201773020544 0ustar sudipsudip#!/bin/sh # if [ $# -lt 2 ]; then echo "Usage: $0 [DEST] [USER]" exit 0 fi DEST=$1 US=$2 DATE=`date +%Y/%m/%d-%H:%M` cd $ACE_ROOT LD_LIBRARY_PATH=$ACE_ROOT/ace export LD_LIBRARY_PATH PATH=/usr/bin:/bin:$PATH export PATH cd $TAO_ROOT/performance-tests/Memory/Single_Threaded # start the server ./server & s_id=$!; # Just sleep for 2 seconds. sleep 2; # Check whether the server has started file="test.ior" if test -f $file then # Just get the size as soon the server is started, ie. the vanilla # server. s_up=`cat /proc/$s_id/status | grep VmRSS | awk '{print $2}'`; # Write it a file echo $DATE $s_up >> $DEST/source/st_start_size.txt # start the client ./client & c_id=$!; # Wait till all the invocations are done sleep 10; # Get the size once the client has made sufficient invocations. s_invocations=`cat /proc/$s_id/status | grep VmRSS| awk '{print $2}'`; echo $DATE $s_invocations >> $DEST/source/st_after_invoke_size.txt # Get teh size of the client after all the invocations c_invocations=`cat /proc/$c_id/status | grep VmRSS | awk '{print $2}'`; echo $DATE $c_invocations >> $DEST/source/st_client_size.txt # Kill the server and client. We will look at better ways of doing # this later. kill -9 $c_id; # Just sleep for the server to release memory etc. sleep 5; # Get the size once the client is killed or crashed s_client_death=`cat /proc/$s_id/status | grep VmRSS | awk '{print $2}'`; echo $DATE $s_client_death >> $DEST/source/st_after_peer_death_size.txt kill -9 $s_id; rm -f $file else echo $file doesnt exist fi cd $DEST/source FILES="start after_invoke client after_peer_death" for i in $FILES ; do /usr/bin/tac st_${i}_size.txt > $DEST/data/st_${i}_size.txt /usr/bin/tail -5 st_${i}_size.txt > $DEST/data/LAST_st_${i}_size.txt $ACE_ROOT/bin/generate_topinfo_charts.sh st_${i}_size.txt $DEST/images/st_${i}_size.png st_${i}_size.txt done ace-8.0.4+dfsg.orig/bin/cleanbuilds.sh0000755000175000017500000000065515027201773016571 0ustar sudipsudip#!/bin/sh if test -z $1; then CURRENTDATE=YYYY_MM_DD; else CURRENTDATE=$1; fi wget http://teststat.remedy.nl/teststat/cleanbuild_testfails-$CURRENTDATE.txt -O cleanbuild.txt # grep -h \!FIXED_BUGS_ONLY ${ACE_ROOT}/tests/*.lst ${ACE_ROOT}/bin/*.lst ${TAO_ROOT}/bin/*.lst | sed -e "s/^\([^\:]*\).*/\1/" | sed -e "s/\(\/run_test.pl\)\?\s*$//" > Ignore.txt # cat cleanbuild.txt | grep -v -f Ignore.txt | tee cleanbuildresults.txt ace-8.0.4+dfsg.orig/bin/ACE-casts-convert0000755000175000017500000000523415027201773017052 0ustar sudipsudip#! /bin/sh # ============================================================================= # # @file ACE-casts-convert # # Script to convert all ACE cast macro calls (e.g. # ACE_static_cast (foo, bar)) to their standard C++ counterparts (e.g. # static_cast (bar)). # # Use this script at your own risk. It appears to work correctly for # most cases, but verify the results "just in case". # # @note Wildcards may be supplied as the "FILE" arguments to this # script since the shell should expand the wildcards before # executing the script. # # @bug The sed program used in this script may loop indefinitely on # ACE casts with arguments split across multiple lines # containing patterns it doesn't recognize. # # @author Ossama Othman # # ============================================================================= if test "$#" -eq 0; then echo "Usage: $0 FILE [FILE2] ..." echo "" exit 1 fi echo "" echo "Converting ACE cast macro calls to standard C++ syntax in:" while test "$#" -gt 0 do arg="$1" shift if grep "ACE_\(static\|dynamic\|const\|reinterpret\)_cast" $arg > /dev/null 2>&1; then echo " $arg" sed -e :a -e 's/ACE_\(const\|static\|reinterpret\|dynamic\)_cast[ \t]*([ \t]*\([^,]*\)[ \t]*,[ \t]*\([^ \t].*\)/\1_cast<\2> (\3/g; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast[ \t]*([ \t]*\([^,]*\)[ \t]*,[ \t]*$/{N;s/\n//;ba;}; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast[ \t]*([ \t]*$/{N;s/\n//;ba;}; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast[ \t]*$/{N;s/\n//;ba;}; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast[ \t]*(/ba' \ -e :aa -e 's/ACE_\(const\|static\|reinterpret\|dynamic\)_cast_[1-5]_ref[ \t]*([ \t]*\([^,]*\)[ \t]*,\(.*\),[ \t]*\([^,]*\)/\1_cast<\2<\3> \&> (\4/g; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast_[1-5]_ref[ \t]*([ \t]*\([^,]*\)[ \t]*,[ \t]*$/{N;s/\n//;baa;}; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast_[1-5]_ref[ \t]*([ \t]*$/{N;s/\n//;baa;}; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast_[1-5]_ref[ \t]*$/{N;s/\n//;baa;}; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast_[1-5]_ref[ \t]*(/baa' \ -e :aaa -e 's/ACE_\(const\|static\|reinterpret\|dynamic\)_cast_[1-5]_ptr[ \t]*([ \t]*\([^,]*\)[ \t]*,\(.*\),[ \t]*\([^,]*\)/\1_cast<\2<\3> \*> (\4/g; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast_[1-5]_ptr[ \t]*([ \t]*\([^,]*\)[ \t]*,[ \t]*$/{N;s/\n//;baaa;}; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast_[1-5]_ptr[ \t]*([ \t]*$/{N;s/\n//;baaa;}; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast_[1-5]_ptr[ \t]*$/{N;s/\n//;baaa;}; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast_[1-5]_ptr[ \t]*(/baaa' $arg > ${arg}.new mv ${arg}.new $arg fi done ace-8.0.4+dfsg.orig/bin/generate_topinfo_charts.sh0000755000175000017500000000043315027201773021172 0ustar sudipsudip#!/bin/sh gnuplot <<_EOF_ >/dev/null 2>&1 set xdata time set xtics rotate set timefmt '%Y/%m/%d-%H:%M' set xlabel 'Date (MM/DD)' set ylabel 'Size (KBytes) $4' set terminal png small size 800,600 color set output "$2" plot '$1' using 1:2 title '$3' w l exit _EOF_ ace-8.0.4+dfsg.orig/bin/topinfo_stats.sh0000755000175000017500000000335715027201773017202 0ustar sudipsudip#!/bin/sh # if [ $# -lt 2 ]; then echo "Usage: $0 [DEST] [USER]" exit 0 fi DEST=$1 US=$2 DATE=`date +%Y/%m/%d-%H:%M` cd $ACE_ROOT LD_LIBRARY_PATH=$ACE_ROOT/ace export LD_LIBRARY_PATH PATH=/usr/bin:$PATH export PATH cd $TAO_ROOT/performance-tests/Memory/Single_Threaded # start the server ./server & s_id=$!; # Just sleep for 2 seconds. sleep 2; # Check whether the server has started file="test.ior" if test -f $file then # Just get the size as soon the server is started, ie. the vanilla # server. s_up=`top -p $s_id -n 1 -b | grep $US| awk '{print $5}'`; # Write it a file echo $DATE $s_up >> $DEST/source/st_start_size.txt # start the client ./client & c_id=$!; # Wait till all the invocations are done sleep 10; # Get the size once the client has made sufficient invocations. s_invocations=`top -p $s_id -n 1 -b | grep $US| awk '{print $5}'`; echo $DATE $s_invocations >> $DEST/source/st_after_invoke_size.txt # Kill the server and client. We will look at better ways of doing # this later. kill -9 $c_id; # Just sleep for the server to release memory etc. sleep 5; # Get the size once the client is killed or crashed s_client_death=`top -p $s_id -n 1 -b | grep $US| awk '{print $5}'`; echo $DATE $s_client_death >> $DEST/source/st_after_peer_death_size.txt kill -9 $s_id; rm -f $file else echo $file doesnt exist fi cd $DEST/source STRING="" FILES="start after_invoke after_peer_death" for i in $FILES ; do /usr/bin/tac st_${i}_size.txt > $DEST/data/st_${i}_size.txt /usr/bin/tail -5 st_${i}_size.txt > $DEST/data/LAST_st_${i}_size.txt $ACE_ROOT/bin/generate_topinfo_charts.sh st_${i}_size.txt $DEST/images/st_${i}_size.png st_${i}_size.txt $STRING done ace-8.0.4+dfsg.orig/bin/depgen.pl0000755000175000017500000000341215027201773015541 0ustar sudipsudip#!/usr/bin/env perl eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}' & eval 'exec perl -w -S $0 $argv:q' if 0; # ************************************************************ # Description : Generate dependencies for GNU Make and NMake. # Author : Chad Elliott # Create Date : 5/06/2002 # # ************************************************************ # ************************************************************ # Pragma Section # ************************************************************ use strict; use FindBin; use File::Spec; use File::Basename; my($basePath) = $FindBin::RealBin; if ($^O eq 'VMS') { $basePath = File::Spec->rel2abs(dirname($0)) if ($basePath eq ''); $basePath = VMS::Filespec::unixify($basePath); } unshift(@INC, $basePath . '/DependencyGenerator'); my($mpcroot) = $ENV{MPC_ROOT}; my($mpcpath) = (defined $mpcroot ? $mpcroot : dirname($basePath) . '/MPC'); unshift(@INC, $mpcpath . '/modules/Depgen', $mpcpath . '/modules'); if (! -d "$mpcpath/modules/Depgen") { print STDERR "ERROR: Unable to find the MPC DependencyGenerator ", "modules in $mpcpath.\n"; if (defined $mpcroot) { print STDERR "Your MPC_ROOT environment variable does not point to a ", "valid MPC location.\n"; } else { print STDERR "You can set the MPC_ROOT environment variable to the ", "location of MPC.\n"; } exit(255); } require Driver; # ************************************************************ # Main Section # ************************************************************ my($driver) = new Driver('UNIX=gnu', 'automatic=ACE_ROOT,TAO_ROOT,' . 'DDS_ROOT,ACE_PLATFORM_CONFIG'); exit($driver->run(\@ARGV)); ace-8.0.4+dfsg.orig/bin/ace_install_pkgconfig.pl0000755000175000017500000000271315027201773020607 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}' & eval 'exec perl -w -S $0 $argv:q' if 0; # ******************************************************************** # ace_install_pkgconfig.pl - Creates *.pc files for pkg-config in the # installed location, based on the *.pc.in # files from the source tree, with @foo@ # variables replaced with their values. # Called from the MPC-generated makefiles. # ******************************************************************** use strict; use Getopt::Long; my ($prefix, $libdir, $libs, $destdir, $version, %custom); GetOptions('prefix=s' => \$prefix, 'libdir=s' => \$libdir, 'libs=s' => \$libs, 'destdir=s' => \$destdir, 'version=s' => \$version, 'custom=s' => \%custom); my %subs = ('LIBS' => $libs, 'VERSION' => $version, 'exec_prefix' => $prefix, 'prefix' => $prefix, 'includedir' => "$prefix/include", 'libdir' => "$prefix/$libdir"); for my $k (keys %custom) { $subs{$k} = $custom{$k}; } my $pcdir = "${destdir}$prefix/$libdir/pkgconfig"; if (scalar @ARGV && ! -d $pcdir) { mkdir($pcdir, 0755); } for my $file (@ARGV) { open IN, $file or die $file . ": $!"; my $pcfile = $file; $pcfile =~ s/\.in$//; open OUT, ">$pcdir/$pcfile"; while () { s/@(\w+)@/exists $subs{$1} ? $subs{$1} : $&/ge; print OUT $_; } close OUT; close IN; } ace-8.0.4+dfsg.orig/bin/g++dep0000755000175000017500000001117715027201773014741 0ustar sudipsudip#! /bin/sh # This utility is a lightly edited version of the freed Berkeley # script `mkdep'. The current script is intended to work for GNU G++. # Here is the original BSD header: # @(#)mkdep.sh 1.7 (Berkeley) 10/13/87 # if [ $# = 0 ] ; then echo 'usage: g++dep [-p] [-f makefile] [flags] file ...' exit 1 fi DO_ACE_MAKE_DEPEND=0 MAKE=GNUmakefile STOPNOW=0 REL="" while [ $STOPNOW -eq 0 ] do case $1 in # -e for compatibility with depgen.pl -e) shift; shift ;; # -f allows you to select a makefile name -f) MAKE=$2 shift; shift ;; # the -p flag produces "program: program.c" style dependencies # so .o's don't get produced -p) SED='s;\.o;;' shift ;; # -A implies -r and fixes the .obj line, hate -A) REL="ACE_ROOT TAO_ROOT "$REL DO_ACE_MAKE_DEPEND=1 shift ;; # -r allows the use of relative pathnames... -r) REL="ACE_ROOT TAO_ROOT "$REL shift ;; # -R VARNAME allows you to specify a variable which should be used # to generate relative paths if it's defined. You can use multiple # -R options, but be careful if one of the values is a proper # subset of a subsequent value, because I suspect that sed will # substitute for the first value properly, but not for the # second. You might be able to get around this by reordering and # having the more specific values lead the less specific values. -R) REL=$2" "$REL shift; shift;; *) STOPNOW=1 esac done if [ ! -w $MAKE ]; then echo "g++dep: no writeable file \"$MAKE\"" exit 1 fi TMP=/tmp/g++dep$$ SCRIPT=${TMP}_script trap 'rm -f $TMP $SCRIPT; exit 1' 1 2 3 13 15 cp $MAKE ${MAKE}.bak sed -e '/DO NOT DELETE THIS LINE/,$d' < $MAKE > $TMP cat << _EOF_ >> $TMP # DO NOT DELETE THIS LINE -- g++dep uses it. # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. _EOF_ # Local files may appear as './foo' change that to 'foo' echo 's; \./; ;g' >$SCRIPT # If the -p flag is set we want to change 'foo.o' to simply 'foo' echo $SED >>$SCRIPT # Dependencies on local files are better expressed like that, instead # of using $(TAO_ROOT) or $(ACE_ROOT). This is specially important # for IDL generated files. echo "s;`pwd`/;;g" >>$SCRIPT if [ -z "$TAO_ROOT" ]; then TAO_ROOT=${ACE_ROOT}/TAO fi # This is a long series of commands to change the actual value of # $ACE_ROOT to '$(ACE_ROOT)', similar changes are done for TAO_ROOT # and any number of "variables" defined via the -R option. for varname in $REL; do varvalue=$(eval echo \$${varname}) echo "s;"$varvalue";$""("$varname");g" >>$SCRIPT done if [ $DO_ACE_MAKE_DEPEND -eq 1 ]; then # Append a series of commands to the sed script that help with the # ACE build style (.obj subdirectories, plaform indenpendent # dependencies, etc.) # To avoid interpolation we build this string in pieces, the idea is # to generate a rule that will convert # foo.o: # into # .obj/foo.o .shobj/foo.o .obj/foo.so .shobj/foo.so: # # will be foo.o foo. LONG_TARGET="$""(sort " for i in VDIR VSHDIR; do for j in OBJEXT SOEXT; do LONG_TARGET=${LONG_TARGET}"$""("${i}")\1.$""("${j}") " done done LONG_TARGET=${LONG_TARGET}")" cat >>$SCRIPT <>$TMP /bin/rm -f $SCRIPT cat << _EOF_ >> $TMP # IF YOU PUT ANYTHING HERE IT WILL GO AWAY _EOF_ # copy to preserve permissions cp $TMP $MAKE rm -f ${MAKE}.bak $TMP exit 0 ace-8.0.4+dfsg.orig/bin/create_ace_build.pl0000755000175000017500000003011115027201773017525 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # # Creates an ACE build tree in directory "build/" below the $ACE_ROOT # directory. The build tree directory structure mirrors that of the ACE # top level directory structure, except that instead of containing any plain # files, it contains only links to the files in the ACE top level structure. # Symbolic links will be used instead of hard links if available. # # Makefiles, projects, and other build files are not linked. This allows # use of MPC to generate the correct project types as needed. Use the # -nompc option to disable this. # # This program has a similar purpose to "clone", but in addition to # only creating symlinks (clone creates hard links, by default), this # script: # 1) uses relative rather than absolute symlinks, # 2) tries not to put junk files into the build tree, # 3) only creates a new tree in a build/ directory below the current, # top level ACE directory (it's a feature :-), but it does enforce # consistency). # # This program can be re-run on a build tree at any time in order to # update it. It will add links for newly added files, and remove # any that are no longer valid. # Specifying no command line options will cause all current builds # to be updated. # # If the starts with "build/", that part will be removed # from it. use File::Find (); use File::Basename; use FileHandle; use File::stat; use File::Copy; use File::Path; print "You should consider using clone_build_tree.pl found with MPC\n"; $usage = "usage: $0 -? | [-a] [-d ] [-v] [-nompc] \n"; $directory_mode = 0777; #### Will be modified by umask, also. $verbose = 0; $mpc = 1; #### When using mpc, we don't want links created for mpc-generated files. $update_all = 1; $source='.'; $absolute = 0; #### #### Check that we're in an ACE "top level" directory. #### unless (-d 'ace' && -d 'include') { die "Must be in an ACE top level (ACE_ROOT) directory!\n"; } if (-e 'create_ace_build.links') { die "Must be in an ACE top level (ACE_ROOT) directory!\n"; } $perl_version = $] + 0; if ($perl_version >= 5) { #### Use an eval so that this script will compile with perl4. eval <<'PERL5_CWD' require Cwd; sub cwd { Cwd::getcwd (); } PERL5_CWD } else { sub cwd { local ($pwd); chop ($pwd = `pwd`); $pwd; } } my($starting_dir) = cwd (); my(@nlinks) = (); my(@build_re) = (); print "Creating or updating builds in $starting_dir\n"; #### If the $linked file is newer than the real file then #### backup the real file, and replace it with the linked #### version. sub backup_and_copy_changed { my($real, $linked) = @_; my($status_real) = stat($real); if (! $status_real) { die "ERROR: cannot access $real.\n"; } my($status_linked) = stat($linked); if ($status_linked->mtime > $status_real->mtime) { rename($real, $real . '.bak'); rename($linked, $real); return 1; } if ($status_real->mtime != $status_linked->mtime) { unlink($linked); return 1; } if ($status_real->size != $status_linked->size) { unlink($linked); return 1; } return 0; } sub cab_link { my($real,$linked,$build_regex) = @_; my($status) = 0; if ($^O eq 'MSWin32') { my($fixed) = $linked; $fixed =~ s/$build_regex//; push(@nlinks, $fixed); my($curdir) = "$starting_dir/" . dirname($linked); if (! -d $curdir) { die "ERROR: Dir not found: $curdir\n"; } $status = chdir($curdir); if (! $status) { die "ERROR: cab_link() chdir " . $curdir . " failed.\n"; } my($base_linked) = basename($linked); if (! -e $real) { ## If the real file "doesn't exist", then we need to change back to ## the starting directory and look up the short file name. chdir($starting_dir); my($short) = Win32::GetShortPathName($fixed); ## If we were able to find the short file name, then we need to ## modyfy $real. Note, we don't need to change back to $curdir ## unless the short name lookup was successful. if (defined $short) { ## Replace a section of $real (the part that isn't a relative ## path) with the short file name. The hard link will still have ## the right name, it's just pointing to the short name. substr($real, length($real) - length($fixed)) = $short; ## Get back to the right directory for when we make the hard link chdir($curdir); } else { ## This should never happen, but there appears to be a bug ## with the underlying win32 apis on Windows Server 2003. ## Long paths will cause an error which perl will ignore. ## Unicode versions of the apis seem to work fine. ## To experiment try Win32 _fullpath() and CreateHardLink with ## long paths. print "ERROR : Skipping $real.\n"; return; } } if (-e $base_linked) { if (! backup_and_copy_changed($real, $base_linked)) { return; } } print "link $real $linked\n" if $verbose; $status = link ($real, $base_linked); if (! $status) { ## Once again, this happens for long paths on Win2003 print "ERROR: Can't link $real\n"; return; } chdir($starting_dir); } else { print "$symlink $real $linked\n" if $verbose; $status = symlink ($real, $linked); } if (!$status) { die "$0: $real -> $linked failed\n"; } } #### #### Process command line args. #### while ($#ARGV >= 0 && $ARGV[0] =~ /^-/) { if ($ARGV[0] eq '-v') { $verbose = 1; } elsif ($ARGV[0] eq '-d') { if ($ARGV[1] =~ /^\d+$/) { $directory_mode = eval ($ARGV[1]); shift; } else { warn "$0: must provide argument for -d option\n"; die $usage; } } elsif ($ARGV[0] eq '-a' && ! ($^O eq 'MSWin32')) { $source = &cwd (); $absolute = 1; } elsif ($ARGV[0] =~ /-[?hH]$/) { die "$usage"; } elsif ($ARGV[0] eq '-nompc') { $mpc = 0; } else { warn "$0: unknown option $ARGV[0]\n"; die $usage; } shift; } @builds = (); if ($#ARGV == 0) { $update_all = 0; $builds[0] = $ARGV[0]; $builds[0] =~ s%^build[/\\]%%; #### remove leading "build/", if any $builds[0] = "build/$builds[0]"; } else { @builds = glob "build/*"; } sub create_build_regex { if ($^O eq 'MSWin32') { for ($idx = 0; $idx <= $#builds; $idx++) { ## Get the original build name $build_re[$idx] = $builds[idx]; ## Remove any trailing slashes $build_re[$idx] =~ s/[\\\/]+$//; ## Add a single trailing slash $build_re[$idx] .= '/'; ## Escape any special characters $build_re[$idx] =~ s/([\\\$\[\]\(\)\.])/\\$1/g; } } } create_build_regex(); # all builds go in ACE_wrappers\build unless (-d "$starting_dir/build") { print "Creating $starting_dir/build\n"; mkdir ("$starting_dir/build", $directory_mode); } foreach $build (@builds) { unless (-d "$starting_dir/$build") { print "Creating $starting_dir/$build\n"; mkpath ("$starting_dir/$build", 0, $directory_mode); } } #### #### Get all ACE plain file and directory names. #### @files = (); sub wanted { my ($dev,$ino,$mode,$nlink,$uid,$gid); $matches = ! ( /^CVS\z/s && ($File::Find::prune = 1) || /^build\z/s && ($File::Find::prune = 1) || /^\..*obj\z/s && ($File::Find::prune = 1) || /^Templates\.DB\z/s && ($File::Find::prune = 1) || /^Debug\z/s && ($File::Find::prune = 1) || /^Release\z/s && ($File::Find::prune = 1) || /^Static_Debug\z/s && ($File::Find::prune = 1) || /^Static_Release\z/s && ($File::Find::prune = 1) || /^\.svn\z/s && ($File::Find::prune = 1) ); $matches = $matches && ( ($nlink || (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_))) && ! -l $_ && ! /^core\z/s && ! /^.*\.state\z/s && ! /^.*\.so\z/s && ! /^.*\.[oa]\z/s && ! /^.*\.dll\z/s && ! /^.*\.lib\z/s && ! /^.*\.obj\z/s && ! /^.*~\z/s && ! /^\.\z/s && ! /^\.#.*\z/s && ! /^.*\.log\z/s ); if ($mpc && $matches) { $matches = ($File::Find::dir =~ /include\/makeinclude*/) || ( ! /^.*\.dsp\z/s && ! /^.*\.vcproj\z/s && ! /^.*\.bor\z/s && ! /^.*\.dsw\z/s && ! /^.*\.sln\z/s && ! /^.*\.vcp\z/s && ! /^.*\.nmake\z/s && ! /^.*\.am\z/s && ! /^.*\.vcw\z/s && ! /^.*\.mak\z/s && ! /^.*\.bld\z/s && ! /^.*\.icc\z/s && ! /^.*\.icp\z/s && ! /^.*\.ncb\z/s && ! /^.*\.opt\z/s && ! /^.*\.bak\z/s && ! /^.*\.ilk\z/s && ! /^.*\.pdb\z/s && ! /^\.cvsignore\z/s && ! /^\.disable\z/s && ! /^GNUmakefile.*\z/s ); } if ($matches) { push(@files, $File::Find::name); } } File::Find::find({wanted => \&wanted}, '.'); print "Found $#files files and directories.\n"; #### #### Create directories and symlinks to files. #### foreach $file (@files) { $file =~ s%^./%%g; #### excise leading ./ directory component my($fullname) = "$starting_dir/$file"; for ($idx = 0; $idx <= $#builds; $idx++) { my($build) = $builds[$idx]; if (-d $fullname) { unless (-d "$starting_dir/$build/$file") { print "Creating $build/$file\n" if $verbose; mkdir ("$starting_dir/$build/$file", $directory_mode); } } else { unless (($^O ne 'MSWin32') && (-e "$build/$file")) { if (!$absolute) { $up = '..'; while ($build =~ m%/%g) { $up .= '/..'; } while ($file =~ m%/%g) { $up .= '/..'; } cab_link("$up/$file", "$build/$file", $build_re[$idx]); } else { $path = $source . '/' . $file; cab_link("$path", "$build/$file", $build_re[$idx]); } } } } } print "Finished creating and updating links.\n"; foreach $build (@builds) { #### #### Find all the symlinks in the build directory, and remove ones #### that are no longer actually linked to a file. #### if ($^O eq 'MSWin32') { my($lfh) = new FileHandle(); my($links_file) = "$starting_dir/$build/create_ace_build.links"; if (-e $links_file) { if (open($lfh, $links_file)) { while(<$lfh>) { my($line) = $_; $line =~ s/\s+$//; if (-e "$starting_dir/$line") { ## The links were already added in cab_link when they ## were checked for changes. } else { print "Removing $build/$line \n" if $verbose; unlink("$starting_dir/$build/$line") || warn "$0: unlink of $build/$line failed\n"; } } close($lfh); } unless (unlink($links_file)) { die "Couldn't delete links file.\n"; } } print "Writing $#nlinks links to link file.\n"; if (open($lfh, ">$links_file")) { foreach my $lnk (@nlinks) { print $lfh "$lnk\n"; } close($lfh); } else { die "Couldn't open links file.\n"; } } else { @lfiles = (); sub lcheck { ## There's no way to know if we have hard linked back to a now ## non-existent file. So, just do the normal -l on the file ## which will cause no files to be pushed on Windows. if (-l $_) { push(@lfiles, $File::Find::name); } } File::Find::find({wanted => \&lcheck}, $build); foreach (@lfiles) { local @s = stat $_; if ($#s == -1) { print "Removing $_ \n" if $verbose; unlink $_ || warn "$0: unlink of $_ failed\n"; } } } #### #### Done: print message. #### print "\nCompleted creation of $build/.\n"; foreach $build (@builds) { unless (-d "$starting_dir/$build") { print "Creating $starting_dir/$build\n"; mkdir ("$starting_dir/$build", $directory_mode); } if (! -e "$starting_dir/$build/ace/config.h") { print "Be sure to setup $build/ace/config.h"; } if ($^O ne 'MSWin32' && ! -e "$starting_dir/$build/include/makeinclude/platform_macros.GNU") { print " and\n$build/include/makeinclude/platform_macros.GNU"; } print ".\n"; } } #### EOF ace-8.0.4+dfsg.orig/bin/auto_ptr.perl0000755000175000017500000000110515027201773016460 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -pi -S $0 ${1+"$@"}' & eval 'exec perl -pi -S $0 $argv:q' if 0; # You may want to run the "find" command with this script, which maybe # something like this: # # find . -type f \( -name "*.i" -o -name "*.h" -o -name "*.C" -o -name "*.cc" -o -name "*.c" -o -name "*.cpp" -o -name "*.hpp" -o -name "*.ipp" \) -print | xargs $ACE_ROOT/bin/auto_ptr.perl # The first three lines above let this script run without specifying the # full path to perl, as long as it is in the user's PATH. # Taken from perlrun man page. s/__TEXT/ACE_TEXT/g; ace-8.0.4+dfsg.orig/bin/performance_stats.sh0000755000175000017500000001403415027201773020017 0ustar sudipsudip#!/bin/sh # if [ $# -lt 1 ]; then echo "Usage: $0 " exit 0 fi DEST=$1 DATE=`date +%Y/%m/%d-%H:%M` mkdir -p $DEST/images mkdir -p $DEST/data mkdir -p $DEST/source COMPILER="gcc" COMMON_TESTS="AMI DII DSI Deferred Single_Threaded Thread_Per_Connection Thread_Pool AMH_Single_Threaded" SEQUENCE_TESTS="AMI DII DSI Deferred Single_Threaded Thread_Per_Connection Thread_Pool AMH_Single_Threaded" SEQ_TEST_TYPE="octet long short char double longlong" cd $DEST/source /bin/sync sleep 10 ( cd $ACE_ROOT/performance-tests/TCP; ./run_test.pl ) >tcp_test.log 2>&1 if grep -q 'Client throughput: ' tcp_test.log; then ( echo -n $DATE " "; awk '/^Client throughput:/ {print $3}' tcp_test.log ) >> TCP.txt; fi /bin/sync sleep 10 ( cd $TAO_ROOT/performance-tests/Latency/Single_Threaded; ./default_configuration.pl > $DEST/source/Default.log 2>&1 ) if grep -q 'Total throughput: ' Default.log; then ( echo -n $DATE " "; awk '/^Total throughput:/ {print $3}' Default.log ) >> Default.txt fi /bin/sync sleep 2 ( cd $TAO_ROOT/performance-tests/Sequence_Latency/Single_Threaded; for i in $SEQ_TEST_TYPE; do ( ./default_configuration.pl -t $i > $DEST/source/Sequence_Default_${i}.log 2>&1 if grep -q 'Total throughput: ' $DEST/source/Sequence_Default_${i}.log; then ( echo -n $DATE " "; awk '/^Total throughput:/ {print $3}' $DEST/source/Sequence_Default_${i}.log ) >> $DEST/source/Sequence_Default_${i}.txt fi ) done ) for i in $COMMON_TESTS; do /bin/sync sleep 10 ( cd $TAO_ROOT/performance-tests/Latency/${i}; ./run_test.pl > $DEST/source/${i}.log 2>&1 ) if grep -q 'Total throughput: ' ${i}.log; then ( echo -n $DATE " "; awk '/^Total throughput:/ {print $3}' $DEST/source/${i}.log ) >> ${i}.txt fi done for i in $SEQUENCE_TESTS; do /bin/sync sleep 10 ( cd $TAO_ROOT/performance-tests/Sequence_Latency/${i}; for j in $SEQ_TEST_TYPE; do ( ./run_test.pl -t $j > $DEST/source/Sequence_${i}_${j}.log 2>&1 if grep -q 'Total throughput: ' $DEST/source/Sequence_${i}_${j}.log; then ( echo -n $DATE " "; awk '/^Total throughput:/ {print $3}' $DEST/source/Sequence_${i}_${j}.log ) >> $DEST/source/Sequence_${i}_${j}.txt fi ) done ) done for i in $COMMON_TESTS TCP Default; do $ACE_ROOT/bin/generate_performance_chart.sh ${i}.txt ${i}.png "$i" 1024,768 /bin/cp ${i}.png $DEST/images/${i}.png /usr/bin/tac ${i}.txt > $DEST/data/${i}.txt /usr/bin/tail -5 ${i}.txt > $DEST/data/LAST_${i}.txt done for i in $SEQ_TEST_TYPE ; do $ACE_ROOT/bin/generate_performance_chart.sh Sequence_Default_${i}.txt Sequence_Default_${i}.png "Default Configuration for $i sequences" 1024,768 /bin/cp Sequence_Default_${i}.png $DEST/images/Sequence_Default_${i}.png /usr/bin/tac $DEST/source/Sequence_Default_${i}.txt > $DEST/data/Sequence_Default_${i}.txt /usr/bin/tail -5 $DEST/source/Sequence_Default_${i}.txt > $DEST/data/LAST_Sequence_Default_${i}.txt done for i in $SEQUENCE_TESTS; do for j in $SEQ_TEST_TYPE; do $ACE_ROOT/bin/generate_performance_chart.sh Sequence_${i}_${j}.txt Sequence_${i}_${j}.png "Sequence_$i_$j" 1024,768 /bin/cp Sequence_${i}_${j}.png $DEST/images/Sequence_${i}_${j}.png /usr/bin/tac Sequence_${i}_${j}.txt > $DEST/data/Sequence_${i}_${j}.txt /usr/bin/tail -5 Sequence_${i}_${j}.txt > $DEST/data/LAST_Sequence_${i}_${j}.txt done done gnuplot <<_EOF_ >/dev/null 2>&1 set xdata time set timefmt '%Y/%m/%d-%H:%M' set xlabel 'Date (YYYYMMDD)' set xtics rotate set ylabel 'Throughput (Requests/Second)' set yrange [0:] set terminal png small size 1024,768 color set output "/dev/null" plot 'AMI.txt' using 1:2 title 'AMI' w l replot 'DII.txt' using 1:2 title 'DII' w l replot 'DSI.txt' using 1:2 title 'DSI' w l replot 'Deferred.txt' using 1:2 title 'Deferred' w l replot 'Single_Threaded.txt' using 1:2 title 'Single_Threaded' w l replot 'Default.txt' using 1:2 title 'Single_Threaded (Defaults)' w l replot 'Thread_Per_Connection.txt' using 1:2 title 'Thread_Per_Connection' w l replot 'Thread_Pool.txt' using 1:2 title 'Thread_Pool' w l replot 'AMH_Single_Threaded.txt' using 1:2 title 'AMH' w l replot 'TCP.txt' using 1:2 title 'TCP/IP' w l set output "All.png" replot exit _EOF_ gnuplot <<_EOF_ >/dev/null 2>&1 set xdata time set timefmt '%Y/%m/%d-%H:%M' set xlabel 'Date (YYYYMMDD)' set xtics rotate set ylabel 'Throughput (Requests/Second)' set yrange [0:] set terminal png small size 1024,768 color set output "/dev/null" plot 'AMI.txt' using 1:2 title 'AMI' w l replot 'DII.txt' using 1:2 title 'DII' w l replot 'DSI.txt' using 1:2 title 'DSI' w l replot 'Deferred.txt' using 1:2 title 'Deferred' w l replot 'Single_Threaded.txt' using 1:2 title 'Single_Threaded' w l replot 'Default.txt' using 1:2 title 'Single_Threaded (Defaults)' w l replot 'Thread_Per_Connection.txt' using 1:2 title 'Thread_Per_Connection' w l replot 'Thread_Pool.txt' using 1:2 title 'Thread_Pool' w l replot 'AMH_Single_Threaded.txt' using 1:2 title 'AMH' w l set output "CORBA.png" replot exit _EOF_ /bin/cp CORBA.png All.png $DEST/images/ cd $DEST/data /bin/uname -a > uname.txt $COMPILER -v > gcc.txt 2>&1 $COMPILER -dumpversion > gccversion.txt 2>&1 /lib/libc.so.6 | sed -e 's//\>/g' > libc.txt cat /proc/cpuinfo > cpuinfo.txt cat /proc/meminfo > meminfo.txt if [ -e "/etc/SuSE-release" ]; then cat /etc/SuSE-release > linuxversion.txt fi if [ -e "/etc/redhat-release" ]; then cat /etc/redhat-release > linuxversion.txt fi if [ -e "/etc/fedora-release" ]; then cat /etc/fedora-release > linuxversion.txt fi cat $ACE_ROOT/ace/config.h > config.h.txt cat $ACE_ROOT/include/makeinclude/platform_macros.GNU > platform_macros.GNU.txt cat $ACE_ROOT/bin/MakeProjectCreator/config/default.features > default.features.txt cp $ACE_ROOT/html/Stats/* $DEST ace-8.0.4+dfsg.orig/bin/show_unused_macros.pl0000755000175000017500000001171115027201773020207 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}' & eval 'exec perl -w -S $0 $argv:q' if 0; # ************************************************************ # Description : Find macros in specified config files that # are not referenced in other config files, # but are referenced in the rest of the source # files. # Author : Chad Elliott # Create Date : 12/22/2004 # ************************************************************ # ************************************************************ # Pragmas # ************************************************************ use strict; use Cwd; use FileHandle; use File::Basename; # ************************************************************ # Data Section # ************************************************************ my($in_comment) = undef; # ************************************************************ # Subroutine Section # ************************************************************ sub getline { my($fh) = shift; my($line) = $fh->getline(); if (defined $line) { ## Remove the line feed $line =~ s/\n//; ## Remove one line c comments $line =~ s/\/\*.*\*\///; ## Check for multi lined c comments if ($line =~ s/\/\*.*//) { $in_comment = 1; } elsif ($line =~ s/.*\*\///) { $in_comment = 0; } elsif ($in_comment) { $line = ''; } else { ## Remove c++ comments $line =~ s/\/\/.*//; ## Concatenate lines if ($line =~ s/\\\s*$//) { $line .= getline($fh); } } } return $line; } sub findMacros { my($defines) = shift; my($macros) = shift; my(@files) = @_; foreach my $file (@files) { my($fh) = new FileHandle(); if (open($fh, $file)) { $in_comment = undef; while(defined($_ = getline($fh))) { if (($defines & 1) == 1 && /^\s*#\s*define\s*([^\s]+)/) { my($word) = $1; $word =~ s/\(.*//; if (!defined $$macros{$word}) { $$macros{$word} = $file; } } elsif (($defines & 2) == 2 && /^\s*#\s*if/) { foreach my $word (split(/[^\w]/, $_)) { if ($word =~ /^[^\d]\w+$/ && $word !~ /^if([n]?def)?$/ && $word !~ /^define[d]?/ && $word !~ /^els(e|if)$/ && !defined $$macros{$word}) { $$macros{$word} = $file; } } } } close($fh); } else { print STDERR "Unable to open $file\n"; exit(2); } } } sub usageAndExit { my($msg) = shift; if (defined $msg) { print STDERR "ERROR: $msg\n"; } print STDERR 'Usage: ', basename($0), " [-I ] \n\n", "This script will provide a set of macros that may possibly\n", "be removed from ACE.\n\n", "It should be run under ACE_wrappers/ace and the input should\n", "be the config header file or files planned for removal.\n"; exit(1); } # ************************************************************ # Main Section # ************************************************************ my(@files) = (); my(@dirs) = ('.', 'os_include', 'os_include/sys', 'os_include/netinet', 'os_include/net', 'os_include/arpa', ); for(my $i = 0; $i <= $#ARGV; ++$i) { my($arg) = $ARGV[$i]; if ($arg =~ /^-/) { if ($arg eq '-h') { usageAndExit(); } elsif ($arg eq '-I') { ++$i; if (defined $ARGV[$i]) { push(@dirs, $ARGV[$i]); } else { usageAndExit('-I requires a directory parameter'); } } else { usageAndExit("$arg is an unknown option"); } } else { push(@files, $arg); } } if (!defined $files[0]) { usageAndExit(); } ## First find all of the control macros my(%control) = (); findMacros(3, \%control, @files); ## Now find all of the macros from the other config files my(@other) = grep(!/config-all\.h|config-lite\.h/, ); for(my $i = 0; $i <= $#other; ++$i) { foreach my $file (@files) { if ($other[$i] eq $file) { splice(@other, $i, 1); --$i; last; } } } my(%other) = (); findMacros(3, \%other, @other); my(%notreferenced) = (); foreach my $macro (keys %control) { if (!defined $other{$macro}) { $notreferenced{$macro} = $control{$macro}; } } ## Find all other macros my(@all) = (); foreach my $dir (@dirs) { my($orig) = getcwd(); if (chdir($dir)) { my(@more) = <*.h *.i* *.cpp>; if ($dir ne '.') { foreach my $file (@more) { $file = "$dir/$file"; } } push(@all, @more); chdir($orig); } } for(my $i = 0; $i <= $#all; ++$i) { foreach my $file (@files, @other) { if ($all[$i] eq $file) { splice(@all, $i, 1); --$i; last; } } } my(%all) = (); findMacros(2, \%all, @all); foreach my $macro (sort keys %notreferenced) { if (defined $all{$macro}) { print "$macro\n"; } } ace-8.0.4+dfsg.orig/bin/generate_doxygen.pl0000755000175000017500000002056215027201773017633 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # -*- perl -*- # require POSIX; require File::Path; use Cwd; use File::Spec; use File::Temp qw/ tempfile tempdir /; use Env qw(ACE_ROOT TAO_ROOT DDS_ROOT); # Configuration and default values if (!defined $TAO_ROOT) { $TAO_ROOT = "$ACE_ROOT/TAO"; } $is_release = 0; $exclude_ace = 0; $exclude_tao = !-r "$TAO_ROOT/VERSION.txt"; $verbose = 0; $perl_path = '/usr/bin/perl'; $html_output_dir = '.'; $footer = ''; $dds = 0; if (defined $DDS_ROOT && -r "$DDS_ROOT/VERSION.txt") { $dds_path = Cwd::abs_path($DDS_ROOT); $cwd_path = Cwd::abs_path(getcwd()); if ($dds_path eq $cwd_path) { $dds = $exclude_ace = $exclude_tao = 1; } } @ACE_DOCS = ('ace', 'ace_rmcast', 'ace_ssl', 'ace_qos', 'ace_inet', 'acexml'); @TAO_DOCS = ('tao' ,'tao_anytypecode' ,'tao_portableserver' ,'tao_pi' ,'tao_pi_server' ,'tao_rtportableserver' ,'tao_compression' ,'tao_transportcurrent' ,'tao_rtcorba' ,'tao_dynamicany' ,'tao_dynamicinterface' ,'tao_iormanip' ,'tao_iortable' ,'tao_ziop' ,'tao_esf' ,'tao_rtevent' ,'tao_cosevent' ,'tao_cosnotification' ,'tao_implrepo' ,'tao_strategies' ,'tao_smartproxies' ,'tao_av' ,'tao_security' ,'tao_ssliop' ,'tao_cosnaming' ,'tao_costime' ,'tao_costrader' ,'tao_portablegroup' ,'tao_ifr'); @DDS_DOCS = ('dds'); # Modify defaults using the command line arguments &parse_args (); $wrote_configh = 0; if (!-r "$ACE_ROOT/ace/config.h") { open(CONFIG_H, ">$ACE_ROOT/ace/config.h") || die "Cannot create config file\n"; print CONFIG_H "#include \"ace/config-doxygen.h\"\n"; close(CONFIG_H); $wrote_configh = 1; } &generate_doxy_files ('ACE', " $ACE_ROOT", " $ACE_ROOT/VERSION.txt", @ACE_DOCS) if (!$exclude_ace); &generate_doxy_files ('TAO', " $TAO_ROOT", " $TAO_ROOT/VERSION.txt", @TAO_DOCS) if (!$exclude_tao); &generate_doxy_files ('DDS', "$DDS_ROOT", " $DDS_ROOT/VERSION.txt", @DDS_DOCS) if $dds; unlink "$ACE_ROOT/ace/config.h" if $wrote_configh; exit 0; sub parse_args { my @ARGS = (); while ($#ARGV >= 0) { if (!($ARGV[0] =~ m/^-/)) { push @ARGS, $ARGV[0]; } elsif ($ARGV[0] eq "-is_release") { $is_release = 1; } elsif ($ARGV[0] eq "-exclude_ace") { $exclude_ace = 1; } elsif ($ARGV[0] eq "-exclude_tao") { $exclude_tao = 1; } elsif ($ARGV[0] eq "-include_dds") { $dds = 1; } elsif ($ARGV[0] eq "-verbose") { $verbose = 1; } elsif ($ARGV[0] eq "-perl_path" && $#ARGV >= 1) { $perl_path = $ARGV[1]; shift; } elsif ($ARGV[0] eq "-footer" && $#ARGV >= 1) { $footer = $ARGV[1]; shift; } elsif ($ARGV[0] eq "-html_output" && $#ARGV >= 1) { $html_output_dir = $ARGV[1]; shift; } else { print "Ignoring option $ARGV[0]\n"; } shift @ARGV; } @ARGV = @ARGS; } #is $arg1 the same path as "$arg2/$arg3"? sub same_dir { my $lhs = shift; my $rhs_base = shift; my $rhs_dir = shift; my $rhs = File::Spec->catdir($rhs_base, $rhs_dir); return File::Spec->canonpath($lhs) eq File::Spec->canonpath($rhs); } sub generate_doxy_files { my $KIT = shift; my $ROOT_DIR = shift; my $VERSION_FILE= shift; my @DOCS = @_; my $VERSION = 'Snapshot ('. POSIX::strftime("%Y/%m/%d-%H:%M", localtime) .')'; my $KIT_path = $KIT; my $translate_paths = ($KIT eq 'TAO' && !same_dir($TAO_ROOT, $ACE_ROOT, 'TAO')); foreach my $i (@DOCS) { if ($is_release) { my ($major, $minor, $beta) = &get_versions ($KIT, $VERSION_FILE); $VERSION = $major.'.'.$minor.'.'.$beta; } my $input = "$ROOT_DIR/etc/".$i.".doxygen"; ($fh, $output) = tempfile(TEMPLATE => 'XXXXXXXX', SUFFIX => '.doxygen', TMPDIR => 1, DESTROY => 1); open(DOXYINPUT, $input) || die "Cannot open doxygen input file $input\n"; open(DOXYOUTPUT, ">$output") || die "Cannot open doxygen output file $output\n"; my $generate_man = 0; my $generate_html = 0; my @output_dirs = (); while () { chomp; if (/^PROJECT_NUMBER/) { print DOXYOUTPUT "PROJECT_NUMBER = ", $VERSION, "\n"; next; } elsif (/^PERL_PATH /) { print DOXYOUTPUT "PERL_PATH = $perl_path\n"; next; } elsif (/^QUIET / && $verbose) { print DOXYOUTPUT "QUIET = NO\n"; next; } elsif (/^INLINE_SOURCES/ && $is_release) { print DOXYOUTPUT "INLINE_SOURCES = NO\n"; next; } elsif (/^SOURCE_BROWSER/ && $is_release) { print DOXYOUTPUT "SOURCE_BROWSER = NO\n"; next; } elsif (/^VERBATIM_HEADERS/ && $is_release) { print DOXYOUTPUT "VERBATIM_HEADERS = NO\n"; next; } elsif (/^GENERATE_MAN/ && /= YES/) { $generate_man = 1; } elsif (/^GENERATE_HTML/ && /= YES/) { $generate_html = 1; } elsif ($generate_html && /^HTML_OUTPUT/) { my @field = split(' = '); if ($#field >= 1) { my $html_out_dir = "$html_output_dir/$field[1]"; push @output_dirs, $html_out_dir; print DOXYOUTPUT "HTML_OUTPUT = $html_out_dir\n"; next; } } elsif ($generate_html && /^GENERATE_TAGFILE/) { my @field = split(' = '); if ($#field >= 1) { my $html_out_dir = "$html_output_dir/$field[1]"; print DOXYOUTPUT "GENERATE_TAGFILE = $html_out_dir\n"; next; } } elsif ($generate_html && /^TAGFILES\s*=\s*(.*)$/) { my $value = $1; while ($value =~ /\\$/) { chop $value; #removes trailing \ my $line = ; chomp $line; $value .= ' ' . $line; } my @values = split(' ', $value); print DOXYOUTPUT "HTML_FOOTER = $footer\n"; map {$_ = $html_output_dir . '/' . $_; } @values; print DOXYOUTPUT 'TAGFILES = ' . join(' ', @values) . "\n"; next; } elsif ($generate_man && /^MAN_OUTPUT/) { my @field = split(' = '); if ($#field >= 1) { push @output_dirs, $field[1]; } } elsif ($translate_paths && /^(INPUT|INCLUDE_PATH)\s*=\s*(.*)$/) { my $keyword = $1; my $value = $2; while ($value =~ /\\$/) { chop $value; #removes trailing \ my $line = ; chomp $line; $value .= ' ' . $line; } $value =~ s/$KIT_path/${"${KIT}_ROOT"}/g; print DOXYOUTPUT "$keyword = $value\n"; next; } print DOXYOUTPUT $_, "\n"; } close (DOXYOUTPUT); close (DOXYINPUT); foreach my $i (@output_dirs) { File::Path::mkpath($i, 0, 0755); } &run_doxy ($output); unlink $output; } if ($generate_man) { open(FIND, "find man -type f -print |") or die "Can't run find\n"; while () { chomp; my $name_with_whitespace = $_; next unless ($name_with_whitespace =~ /\s/); my $name_without_whitespace = $name_with_whitespace; $name_without_whitespace =~ s/\s+//g; rename $name_with_whitespace, $name_without_whitespace; } close FIND; } } sub run_doxy { my $config = shift; open(DOX,"doxygen $config 2>&1 |") || die "cannot start ACE doxygen process\n"; while () { print $_; } close (DOX) || die "error while running doxygen on $config\n"; } ######## ######## Retrieve version information from VERSION file(s). ######## sub get_versions () { my $KIT = shift; my $VERSION_FILE = shift; my ($major_version, $minor_version, $micro_version); open (VERSION, '<'.$VERSION_FILE) || die "$0: unable to open $VERSION_FILE\n"; while () { chomp; if (/$KIT version (\d+)\.(\d+)\.(\d+)/) { $major_version = $1; $minor_version = $2; $micro_version = $3; last; } elsif (/$KIT version (\d+)\.(\d+)[^\.]/) { #### Previous release was a minor. $major_version = $1; $minor_version = $2; $micro_version = '0'; last; } elsif (/$KIT version (\d+)[^\.]/) { #### Previous release was a major. $major_version = $1; $minor_version = '0'; $micro_version = '0'; last; } } close VERSION; return ($major_version, $minor_version, $micro_version); } ace-8.0.4+dfsg.orig/bin/footprint_stats.sh0000755000175000017500000000412315027201773017540 0ustar sudipsudip#!/bin/sh # if [ $# -lt 1 ]; then echo "Usage: $0 [DEST]" exit 0 fi DEST=$1 DATE=`date +%Y/%m/%d-%H:%M` BINS="$TAO_ROOT/tests/ORB_init/ORB_init $TAO_ROOT/tests/ORB_destroy/ORB_destroy" LIBS="$ACE_ROOT/ace/libACE.a \ $TAO_ROOT/tao/libTAO.a \ $TAO_ROOT/tao/PortableServer/libTAO_PortableServer.a \ $TAO_ROOT/tao/Strategies/libTAO_Strategies.a \ $TAO_ROOT/tao/SmartProxies/libTAO_SmartProxies.a \ $TAO_ROOT/tao/DynamicAny/libTAO_DynamicAny.a \ $TAO_ROOT/tao/DynamicInterface/libTAO_DynamicInterface.a \ $TAO_ROOT/tao/IFR_Client/libTAO_IFR_Client.a \ $TAO_ROOT/tao/BiDir_GIOP/libTAO_BiDirGIOP.a \ $TAO_ROOT/tao/IORManipulation/libTAO_IORManip.a \ $TAO_ROOT/tao/IORTable/libTAO_IORTable.a \ $TAO_ROOT/tao/TypeCodeFactory/libTAO_TypeCodeFactory.a \ $TAO_ROOT/tao/RTCORBA/libTAO_RTCORBA.a \ $TAO_ROOT/tao/IORInterceptor/libTAO_IORInterceptor.a \ $TAO_ROOT/tao/Messaging/libTAO_Messaging.a \ $TAO_ROOT/tao/ObjRefTemplate/libTAO_ObjRefTemplate.a \ $TAO_ROOT/tao/Valuetype/libTAO_Valuetype.a \ $TAO_ROOT/tao/RTScheduling/libTAO_RTScheduler.a \ $TAO_ROOT/tao/AnyTypeCode/libTAO_AnyTypeCode.a \ $TAO_ROOT/tao/PI/libTAO_PI.a \ $TAO_ROOT/tao/PI_Server/libTAO_PI_Server.a \ $TAO_ROOT/tao/Codeset/libTAO_Codeset.a \ $TAO_ROOT/tao/CodecFactory/libTAO_CodecFactory.a \ $TAO_ROOT/tao/RTPortableServer/libTAO_RTPortableServer.a" mkdir -p $DEST/source mkdir -p $DEST/data mkdir -p $DEST/images for i in $BINS; do b=`basename $i` if [ -x $i ]; then ( echo -n $DATE " "; size $i | grep -v text | awk '{print $4}' ) >> $DEST/source/${b}_size.txt fi done for i in $LIBS; do b=`basename $i`; if [ -f $i ]; then ( echo -n $DATE " "; size $i | awk '{s += $4} END {print s}' ) >> $DEST/source/${b}_size.txt fi done cd $DEST/source for i in $LIBS $BINS; do b=`basename $i` /usr/bin/tac ${b}_size.txt > $DEST/data/${b}_size.txt /usr/bin/tail -5 ${b}_size.txt > $DEST/data/LAST_${b}_size.txt $ACE_ROOT/bin/generate_footprint_chart.sh ${b}_size.txt $DEST/images/${b}_size.png $b done ace-8.0.4+dfsg.orig/bin/valgrind.supp0000644000175000017500000001175615027201773016470 0ustar sudipsudip { Memcheck:Leak fun:* obj:*cc1plus } { Memcheck:Leak fun:* obj:*g++* } { Memcheck:Leak ... obj:*/bin/perl } { Memcheck:Leak ... obj:*/bin/bash } { Memcheck:Leak ... obj:*/bin/grep } { Memcheck:Cond ... obj:*/bin/grep } { Memcheck:Leak ... obj:*/bin/ps } { Memcheck:Leak ... obj:*/bin/ls } # { # # Memcheck:Param # fun:* # fun:NDDS_Transport_UDPv4_send # fun:RTINetioSender_send # } { Memcheck:Addr8 fun:__memcpy_ssse3_back } { Memcheck:Addr8 fun:__strspn_sse42 } { Memcheck:Leak fun:* fun:*ACE_Log_Msg_Manager*get_lock* } { Memcheck:Leak ... fun:*ACE_Log_Msg*close* } { Memcheck:Leak fun:* fun:*ACE_Log_Msg_Manager*init_backend* } { Memcheck:Leak fun:calloc fun:_dlerror_run } { Memcheck:Leak fun:malloc fun:add_to_global fun:dl_open_worker fun:_dl_catch_error fun:_dl_open fun:dlopen_doit fun:_dl_catch_error fun:_dlerror_run } { Memcheck:Leak fun:calloc fun:_dl_new_object fun:_dl_map_object_from_fd fun:_dl_map_object fun:openaux fun:_dl_catch_error fun:_dl_map_object_deps fun:dl_open_worker fun:_dl_catch_error fun:_dl_open fun:dlopen_doit fun:_dl_catch_error fun:_dlerror_run } { Memcheck:Leak fun:malloc fun:_dl_map_object_deps fun:dl_open_worker fun:_dl_catch_error fun:_dl_open fun:dlopen_doit fun:_dl_catch_error fun:_dlerror_run } { Memcheck:Leak fun:calloc fun:_dl_check_map_versions fun:dl_open_worker fun:_dl_catch_error fun:_dl_open fun:dlopen_doit fun:_dl_catch_error fun:_dlerror_run } { Memcheck:Leak fun:malloc fun:_dl_new_object fun:_dl_map_object_from_fd fun:_dl_map_object fun:openaux fun:_dl_catch_error fun:_dl_map_object_deps fun:dl_open_worker fun:_dl_catch_error fun:_dl_open fun:dlopen_doit fun:_dl_catch_error fun:_dlerror_run } { Memcheck:Leak fun:calloc fun:do_lookup_x fun:_dl_lookup_symbol_x } { Memcheck:Leak fun:malloc fun:open_path fun:_dl_map_object fun:openaux fun:_dl_catch_error fun:_dl_map_object_deps fun:dl_open_worker fun:_dl_catch_error fun:_dl_open fun:dlopen_doit fun:_dl_catch_error fun:_dlerror_run } { Memcheck:Leak fun:malloc fun:_dl_close_worker fun:_dl_close fun:_dl_catch_error fun:_dlerror_run fun:dlclose } { Memcheck:Leak fun:malloc ... fun:dl_open_worker fun:_dl_catch_error fun:_dl_open fun:dlopen_doit fun:_dl_catch_error fun:_dlerror_run } { Memcheck:Leak fun:malloc obj:/usr/lib64/libicuuc.so.42.0 } { Memcheck:Leak fun:calloc fun:_dl_new_object } { Memcheck:Leak fun:malloc fun:_dl_scope_free } { Memcheck:Leak fun:malloc fun:_dl_lookup_symbol_x } { Memcheck:Leak fun:malloc fun:_dl_new_object } { Memcheck:Leak fun:malloc fun:open_path fun:_dl_map_object } { Memcheck:Leak fun:malloc fun:realloc fun:_dl_new_object } { Memcheck:Leak fun:* fun:*_dl_scope_free* } { Memcheck:Leak fun:* fun:*_dl_new_object* } { Memcheck:Leak fun:* fun:*NDDSConfigLogger*get_instance* } { Memcheck:Leak fun:* fun:*register_or_unregister_typeI* } { Memcheck:Leak fun:malloc fun:dl_open_worker } { Memcheck:Addr8 fun:wcscmp } { Memcheck:Leak ... fun:PRESPsReaderQueue_initializeQueryConditionInventory } { Memcheck:Param writev(vector[...]) fun:writev fun:*ACE*sendv* fun:*TAO_IIOP_Transport*send* fun:*TAO_Transport*drain_queue_helper* fun:*TAO_Transport*drain_queue_i* fun:*TAO_Transport*send_synch_message_helper* ... fun:*TAO_IIOP_Transport*send_message* } { Memcheck:Value8 fun:*nibble2hex* fun:*ORB*object_to_string* } { Memcheck:Cond obj:/usr/lib/libz.so.1.2.3 obj:/usr/lib/libz.so.1.2.3 fun:deflate fun:compress2 } ace-8.0.4+dfsg.orig/bin/auto_compile0000755000175000017500000004017515027201773016354 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # -*- perl -*- # This script checkouts ACE from CVS, updates the "clone" directory, # compiles $ACE_ROOT/ace and $ACE_ROOT/tests and finally runs # $ACE_ROOT/tests/run_tests.sh. # # If it detects any problem it send email. # # DO NOT invoke this script from your crontab, use # auto_compile_wrapper for that. # # This script requires Perl5. # # TODO: Modify the script or split it in such a way that the main copy # can be obtained either using cvs or downloading the latest beta # from the WWW. # # The first three lines above let this script run without specifying the # full path to perl, as long as it is in the user's PATH. # Taken from perlrun man page. use File::Basename; use File::Copy; use FileHandle; require POSIX; # This are the sub-directories (in the module) we really compile. # Find out the command name. $CMD = basename($0); $dont_update = 0; # $copy_logs = 1; # $LOG_DESTINATION = $ENV{'HOME'}.'/.www-docs/auto_compile'; $copy_logs = 0; $LOG_DESTINATION='bugzilla'.'@cs.wustl.edu'; $dont_build_tao = 0; $dont_run = 0; $makefile_suffix = ""; $pre_realclean = 0; $post_realclean = 0; $report_success = 0; $debug = 0; $sandbox = ''; $sandbox_timeout = 600; $sendreport = 0; @BUILD_LIST= (); @CONFIGURATION_OPTIONS = (); @ARGS = (); while ($#ARGV >= 0) { if (!($ARGV[0] =~ m/^-/)) { push @ARGS, $ARGV[0]; } elsif ($ARGV[0] eq "-single_threaded") { print STDERR "$CMD: obsolete option $ARGV[0], " ."please use -config instead\n"; push @CONFIGURATION_OPTIONS, 'ST'; } elsif ($ARGV[0] eq "-minimum_corba") { print STDERR "$CMD: obsolete option $ARGV[0], " ."please use -config instead\n"; push @CONFIGURATION_OPTIONS, 'MINIMUM'; } elsif ($ARGV[0] eq "-ami") { print STDERR "$CMD: obsolete option $ARGV[0], " ."please use -config instead\n"; push @CONFIGURATION_OPTIONS, 'AMI'; } elsif ($ARGV[0] eq "-smart_proxies") { print STDERR "$CMD: obsolete option $ARGV[0], " ."please use -config instead\n"; push @CONFIGURATION_OPTIONS, 'SMART_PROXIES'; } elsif ($ARGV[0] eq "-static") { print STDERR "$CMD: obsolete option $ARGV[0], " ."please use -config instead\n"; push @CONFIGURATION_OPTIONS, 'STATIC'; } elsif ($ARGV[0] eq "-config") { shift; push @CONFIGURATION_OPTIONS, $ARGV[0]; } elsif ($ARGV[0] eq "-build_list") { shift; @BUILD_LIST = split (/,/, $ARGV[0]); } elsif ($ARGV[0] eq "-dont_update") { $dont_update = 1; } elsif ($ARGV[0] eq "-copy_logs") { shift; $copy_logs = 1; $LOG_DESTINATION = $ARGV[0]; } elsif ($ARGV[0] eq "-sandbox") { shift; $sandbox = $ARGV[0]; } elsif ($ARGV[0] eq "-sandbox_timeout") { shift; $sandbox_timeout = $ARGV[0]; } elsif ($ARGV[0] eq "-dont_run") { $dont_run = 1; } elsif ($ARGV[0] eq "-pre_realclean") { $pre_realclean = 1; } elsif ($ARGV[0] eq "-post_realclean") { $post_realclean = 1; } elsif ($ARGV[0] eq "-report_success") { $report_success = 1; } elsif ($ARGV[0] eq "-debug") { $debug = 1; } elsif ($ARGV[0] eq "-sendreport") { $sendreport = 1; } elsif ($ARGV[0] eq "-notao") { $dont_build_tao = 1; } elsif ($ARGV[0] eq "-make_type") { shift; $makefile_suffix = $ARGV[0]; } else { print "Ignoring option $ARGV[0]\n"; } shift; } # Extract configuration information from command line. # TODO: Some validation and checking should be done here. $CHECKOUT = $ARGS[0]; $BUILD = $ARGS[1]; $LOGDIR = $ARGS[2]; $ADMIN = $ARGS[3]; $MAIL = "mail"; if ($#ARGS >= 4) { $MAIL = $ARGS[4]; } $LOG_URL = "http://ace.cs.wustl.edu/~bugzilla/auto_compile_logs/"; if ($#ARGS >= 5) { $LOG_URL = $ARGS[5]; } # This is the module we will checkout unless a different one is on the # command line. $MODULE='ACE_wrappers'; if ($#ARGS >= 6) { $MODULE = $ARGS[6]; } $ENV{'ACE_ROOT'} = $CHECKOUT . '/' . $MODULE . '/build/' . $BUILD; $ENV{'TAO_ROOT'} = $CHECKOUT . '/' . $MODULE . '/build/' . $BUILD . '/TAO'; # We obtain our revision to report errors. $REVISION='$Revision$ '; # When an error is found we try to die gracefully and send some email # to ADMIN. $disable_file = $LOGDIR . '/.disable'; $histfile = $LOGDIR . '/history'; $LOGBASE = POSIX::strftime("%Y_%m_%d_%H_%M", localtime); $LOGFILE = $LOGDIR . '/' . $LOGBASE . '.txt'; $HOST = `hostname`; chop $HOST; $LOG_NAME = $HOST . '_' . $BUILD . '/' . $LOGBASE . '.txt'; $STATUS = "OK"; if ($debug) { print "CHECKOUT = $CHECKOUT\n"; print "BUILD = $BUILD\n"; print "LOGDIR = $LOGDIR\n"; print "ADMIN = $ADMIN\n"; print "MAIL = $MAIL\n"; print "ACE_ROOT = $ENV{ACE_ROOT}\n"; print "TAO_ROOT = $ENV{TAO_ROOT}\n"; print "CONFIGURATION_OPTIONS = ", @CONFIGURATION_OPTIONS, "\n"; } push @INC, $CHECKOUT . '/' . $MODULE . '/bin'; require PerlACE::ConfigList; $config_list = new PerlACE::ConfigList; $config_list->my_config_list (@CONFIGURATION_OPTIONS); if ($#BUILD_LIST == -1) { if ($dont_build_tao) { @BUILD_LIST=('ace', 'netsvcs', 'tests'); } else { @BUILD_LIST=('.', 'TAO'); } } sub mydie { my $DEST_DIR = $LOG_DESTINATION.'/'.$HOST.'_'.$BUILD; mkdir $DEST_DIR,0755 if (!-d $DEST_DIR); if (open(STATUS, '>'.$DEST_DIR.'/status.txt')) { print STATUS "SCOREBOARD_STATUS: Inactive\n"; close STATUS; } unlink $disable_file; die $_ . "\n"; } @RUN_LIST = (); if ($debug) { @BUILD_LIST = ('ace'); @RUN_LIST = ('TAO/tests/OctetSeq/run_test.pl'); $ADMIN = $ENV{'LOGNAME'}; } else { $config_list->load ($CHECKOUT . '/' . $MODULE . '/' . 'build/' . $BUILD . '/bin/auto_run_tests.lst'); @RUN_LIST = $config_list->valid_entries (); } sub mail_logs { open (MAIL, "|".$MAIL.' -s AUTO_COMPILE_LOG='.$LOG_NAME.' '.$LOG_DESTINATION) || mydie "Cannot open mail pipe for: $LOG_NAME\n"; print MAIL 'This is the log for: ', "\n"; print MAIL $CMD, ' [', $REVISION, "] for $HOST/$BUILD\n"; print MAIL "\n================================================================\n"; if (open (THELOG, "$LOGFILE")) { while () { print MAIL $_; } close (THELOG); } close (MAIL); # Ignore errors.... } sub copy_logs { local $DEST_DIR = $LOG_DESTINATION.'/'.$HOST.'_'.$BUILD; mkdir $DEST_DIR,0755 if (!-d $DEST_DIR); copy($LOGFILE, $DEST_DIR.'/'.$LOGBASE.'.txt'); local $MAKE_PRETTY="$CHECKOUT/$MODULE/bin/make_pretty.pl"; system ("perl $MAKE_PRETTY -b -i $LOGFILE >$DEST_DIR/$LOGBASE"."_brief.html"); system ("perl $MAKE_PRETTY -i $LOGFILE >$DEST_DIR/$LOGBASE".".html"); chmod 0644, $DEST_DIR.'/'.$LOGBASE.'.txt' , $DEST_DIR.'/'.$LOGBASE.'_brief.html' , $DEST_DIR.'/'.$LOGBASE.'.html' ; } sub report_errors { # First clear the lock, so the next execution works... unlink $disable_file; # Ignore errors! if ($sendreport) { # Now send a summary of the errors to the ADMIN account, if there are any. if ($#_ >= 0) { local $to = $ADMIN; open (MAIL, "|".$MAIL.' -s "[AUTO_COMPILE] '.$HOST.' '.$BUILD.'" '.$to) || mydie "Cannot open mail pipe for: $_\n"; print MAIL 'The following message is brought to you by: ', "\n"; print MAIL $CMD, ' [', $REVISION, "] for $BUILD on $HOST\n\n"; print MAIL "\nPlease check the following log for more info:\n\n"; print MAIL $LOG_URL, '?', $HOST, '_', $BUILD, "\n\n"; local $m; foreach $m (@_) { print MAIL $m, "\n"; } close (MAIL); # Ignore errors.... } } # Now send the complete log to bugzilla... if ($copy_logs) { copy_logs (); } else { mail_logs (); } } ### MAIN FUNCTION if (-f $disable_file) { print 'The following message is brought to you by: ', "\n"; print $CMD, ' [', $REVISION, "] for $BUILD on $CHECKOUT\n"; print "DISABLED\n"; exit 0; } open (DISABLE, '>' . $disable_file) || die "cannot open disable file <$disable_file>\n"; print DISABLE "auto_compile <$date> is running\n"; close (DISABLE) || die "cannot close disable file"; open(HIST, '>>' . $histfile) # Do not use 'mydie' to report the problem, it tries to remove the # disable file || mydie "cannot open history file \"$histfile\"\n"; $date = localtime; print HIST $CMD, ': running at ', $date, ' '; open(LOG, '>' . $LOGFILE) || mydie "cannot open log file"; LOG->autoflush (); # The following lines are useful when debugging the script or wrapper. # print LOG $CHECKOUT, " ", $BUILD, " ", $LOGDIR, " ", $ADMIN, "\n"; #while (($key,$value) = each %ENV) { # print LOG $key, " = ", $value, "\n"; #} print LOG "#################### CVS\n"; my $DEST_DIR = $LOG_DESTINATION.'/'.$HOST.'_'.$BUILD; mkdir $DEST_DIR,0755 if !-d $DEST_DIR; if (open(STATUS, '>'.$DEST_DIR.'/status.txt')) { print STATUS "SCOREBOARD_STATUS: CVS\n"; close STATUS; } chdir($CHECKOUT) || mydie "Cannot chdir to $CHECKOUT"; if ($dont_update == 0) { $date = localtime; print LOG "$CMD: starting checkout at ", $date, "\n"; open(CVS, "cvs -q checkout -P $MODULE 2>&1 |") || mydie "cannot start checkout of $MODULE"; $conflicts = 0; while () { if (m/^C /) { ($unused, $entry) = split('/'); if (($entry ne "ChangeLog\n") && ($entry ne "THANKS\n")) { $conflicts = 1; } } print LOG $_; } close(CVS); # || mydie "error while checking out $MODULE"; $date = localtime; print LOG "$CMD: checkout finished at ", $date, "\n"; if ($conflicts != 0) { mydie "conflicts on checkout"; } } chdir($MODULE) || mydie "cannot chdir to $MODULE"; $date = localtime; print LOG "$CMD: starting clone at ", $date, "\n"; open(CLONE, "perl bin/create_ace_build -a -v $BUILD 2>&1 |") || mydie "cannot clone directory"; while() { print LOG $_; } close(CLONE) || mydie "error while cloning ACE_ROOT"; $date = localtime; print LOG "$CMD: clone finished at ", $date, "\n"; chdir('build/' . $BUILD) || mydie "cannot chdir to $BUILD"; @failures = (); if ($makefile_suffix ne "") { $MAKEFLAGS = "-f Makefile.$makefile_suffix"; } print LOG "#################### Compiler\n"; if (open(STATUS, '>'.$DEST_DIR.'/status.txt')) { print STATUS "SCOREBOARD_STATUS: Compile\n"; close STATUS; } if ($pre_realclean) { foreach $i (reverse(@BUILD_LIST)) { $date = localtime; print LOG "$CMD: =============================================\n"; print LOG "$CMD: make realclean in $i started at ", $date, "\n"; open(MAKE, "make -k $MAKEFLAGS -C $i realclean 2>&1 |") || mydie "cannot start make in $i"; while () { # Ignore errors.... } if (close(MAKE) == 0) { push @failures, "errors while cleaning $i"; } $date = localtime; print LOG "$CMD: make realclean in $i finished at ", $date, "\n"; print LOG "$CMD: =============================================\n\n"; } } $MAKEFLAGS .= ""; foreach $i (@BUILD_LIST) { $date = localtime; print LOG "$CMD: =============================================\n"; print LOG "$CMD: make for $i started at ", $date, "\n"; open(MAKE, "make -k $MAKEFLAGS -C $i 2>&1 |") || mydie "cannot start make for $i"; local $current_dir = $i; local $last_error = ""; local $this_error = 0; local $this_warning = 0; while () { chop; $this_error = $this_warning = 0; if ($^O eq 'hpux' && m/^Warning:[ \t]+[0-9]+ future errors were detected/) { next; } print LOG $_, "\n"; if (m/^make(\[[0-9]+\])?: Entering directory /) { s/^make(\[[0-9]+\])?: Entering directory //; s%^$ENV{'ACE_ROOT'}/%%; $current_dir = $_; } if (m/error:/i || m/error /i || m/^make(\[[0-9]+\])?: \*\*\*/) { $this_error = 1; } if ($^O eq 'aix' && m/\d+-\d+ \([SI]\)/) { $this_error = 1; } if ($this_error) { if ($last_error ne $current_dir || STATUS eq "COMPILATION WARNING") { $STATUS = "COMPILATION ERROR"; push @failures, "Error while compiling in $current_dir \n"; $last_error = $current_dir; } } if (m/warning:/i || m/warning /i || m/Info: /i) { $this_warning = 1; if ($^O eq 'aix' && m/^ld: \d+-\d+ WARNING: Duplicate symbol: .*ACE.*/) { $this_warning = 0; } } if ($^O eq 'aix' && m/\d+-\d+ \(W\)/) { $this_warning = 1; } if ($this_warning) { if ($last_error ne $current_dir) { if ($STATUS eq "OK") { $STATUS = "COMPILATION WARNING"; } push @failures, "Warning while compiling in $current_dir\n"; $last_error = $current_dir; } } } if (close(MAKE) == 0) { push @failures, "errors while running make in $i"; } $date = localtime; print LOG "$CMD: make for $i finished at ", $date, "\n"; print LOG "$CMD: =============================================\n\n"; } print LOG "#################### Tests\n"; if (open(STATUS, '>'.$DEST_DIR.'/status.txt')) { print STATUS "SCOREBOARD_STATUS: Tests\n"; close STATUS; } if ($dont_run == 0) { my $config_params; if ($#CONFIGURATION_OPTIONS != -1) { $config_params = ' -Config '; } $config_params .= join ' -Config ', @CONFIGURATION_OPTIONS; foreach my $i (@RUN_LIST) { local $directory = '.'; local $program = $i; if ($i =~ /(.*)\/([^\/]*)$/) { $directory = $1; $program = $2; } $date = localtime; print LOG "\n\n$CMD: ================ $date ================\n"; print LOG "auto_run_tests: $i\n"; local $subdir = $CHECKOUT .'/'. $MODULE .'/build/'. $BUILD .'/'. $directory; chdir ($subdir) || mydie "cannot chdir to $subdir"; $run_error = 0; my $prefix = ''; if ($sandbox ne "") { $prefix = $sandbox.' '.$sandbox_timeout.' '; } if (open(RUN, $prefix."perl $program $config_params 2>&1 |") == 0) { push @failures, "cannot run $program in $directory"; next; } while () { print LOG $_; if (m/Error/ || m/ERROR/ || m/FAILED/ || m/EXCEPTION/ || m/pure virtual /i) { if ($STATUS eq "OK") { $STATUS = "RUNTIME ERROR"; } $run_error = 1; } } if (close(RUN) == 0) { if ($STATUS eq "OK") { $STATUS = "RUNTIME ERROR"; } print LOG "ERROR, non-zero status returned by test script\n"; push @failures, "Error when closing pipe for $program in $directory"; next; } $date = localtime; print LOG "$CMD: $program finished ", $date, "\n"; if ($run_error != 0) { push @failures, "errors detected while running $program in $directory"; } } } if ($post_realclean) { foreach $i (reverse(@BUILD_LIST)) { $date = localtime; print LOG "$CMD: =============================================\n"; print LOG "$CMD: make realclean in $i started at ", $date, "\n"; open(MAKE, "make -k $MAKEFLAGS -C $i realclean 2>&1 |"); while () { # Ignore errors.... } if (close(MAKE) == 0) { push @failures, "errors while cleaning $i"; } $date = localtime; print LOG "$CMD: make realclean in $i finished at ", $date, "\n"; print LOG "$CMD: =============================================\n\n"; } } print LOG "#################### Config\n"; chdir($CHECKOUT . "/" . $MODULE . "/build/" . $BUILD) || mydie "Cannot chdir to $CHECKOUT/$MODULE/build/$BUILD"; open (CONFIG, "perl bin/nightlybuilds/print_config.pl $CHECKOUT/$MODULE/build/$BUILD 2>&1 |") || mydie "Cannot run print_config.pl script"; while () { print LOG $_; } close (CONFIG) || mydie "Error while running print_config.pl script"; report_errors @failures; print LOG "#################### End\n"; if (open(STATUS, '>'.$DEST_DIR.'/status.txt')) { print STATUS "SCOREBOARD_STATUS: Inactive\n"; close STATUS; } close(LOG) || mydie "cannot close LOGFILE"; print HIST "$STATUS\n"; close(HIST) || mydie "cannot close history file"; unlink $disable_file || die "cannot unlink disable file"; if ($report_success && $STATUS eq "OK") { report_errors "Congratulations: No errors or warnings detected\n"; } exit 0; ace-8.0.4+dfsg.orig/bin/DependencyGenerator/0000755000175000017500000000000015046037655017673 5ustar sudipsudipace-8.0.4+dfsg.orig/bin/DependencyGenerator/GNUIDLDependencyWriter.pm0000644000175000017500000000164315027201773024404 0ustar sudipsudippackage GNUIDLDependencyWriter; # ************************************************************ # Description : Generates GNU IDL Makefile dependencies. # Author : Chip Jones # Create Date : 11/01/2011 # ************************************************************ # ************************************************************ # Pragmas # ************************************************************ use strict; use DependencyWriter; use vars qw(@ISA); @ISA = qw(DependencyWriter); # ************************************************************ # Subroutine Section # ************************************************************ sub process { my($objects) = $_[1]; my($files) = $_[2]; ## Sort the dependencies to make them reproducible if (scalar @$files > 0) { return '$(sort ' . join(' ', @$objects) . "): \\\n " . join(" \\\n ", sort @$files) . "\n"; } else { return; } } 1; ace-8.0.4+dfsg.orig/bin/DependencyGenerator/GNUIDLObjectGenerator.pm0000644000175000017500000000244015027201773024202 0ustar sudipsudippackage GNUIDLObjectGenerator; # ************************************************************ # Description : Generates object files for GNU IDL Makefiles. # Author : Chip Jones # Create Date : 11/01/2011 # ************************************************************ # ************************************************************ # Pragmas # ************************************************************ use strict; use File::Spec; use ObjectGenerator; use vars qw(@ISA); @ISA = qw(ObjectGenerator); # ************************************************************ # Constants # ************************************************************ my $prefix = '$(IDL_GEN_FILES_DIR)/'; my @suffixes = qw/ $(IDL_CLIENT_HDR_EXT) $(IDL_CLIENT_INL_EXT) $(IDL_CLIENT_SRC_EXT) $(IDL_SERVER_HDR_EXT) $(IDL_SERVER_SRC_EXT) $(IDL_SERVER_THDR_EXT) $(IDL_SERVER_TINL_EXT) $(IDL_SERVER_TSRC_EXT) /; # ************************************************************ # Subroutine Section # ************************************************************ sub process { my($noext) = $_[1]; $noext =~ s/\.[^\.]+$//o; $noext =~ s/.+\/// if $noext =~ /\.\.\//; my($vol, $dir, $file) = File::Spec->splitpath($noext); my @list = map "$prefix$file$_", @suffixes; return \@list; } 1; ace-8.0.4+dfsg.orig/bin/DependencyGenerator/GNUDependencyWriter.pm0000644000175000017500000000153615027201773024054 0ustar sudipsudippackage GNUDependencyWriter; # ************************************************************ # Description : Generates GNU Makefile dependencies. # Author : Chad Elliott # Create Date : 2/10/2002 # ************************************************************ # ************************************************************ # Pragmas # ************************************************************ use strict; use DependencyWriter; use vars qw(@ISA); @ISA = qw(DependencyWriter); # ************************************************************ # Subroutine Section # ************************************************************ sub process { my($objects) = $_[1]; my($files) = $_[2]; ## Sort the dependencies to make them reproducible return '$(sort ' . join(' ', @$objects). "): \\\n " . join(" \\\n ", sort @$files) . "\n"; } 1; ace-8.0.4+dfsg.orig/bin/DependencyGenerator/GNUObjectGenerator.pm0000644000175000017500000000163715027201773023660 0ustar sudipsudippackage GNUObjectGenerator; # ************************************************************ # Description : Generates object files for GNU Makefiles. # Author : Chad Elliott # Create Date : 5/23/2003 # ************************************************************ # ************************************************************ # Pragmas # ************************************************************ use strict; use ObjectGenerator; use vars qw(@ISA); @ISA = qw(ObjectGenerator); # ************************************************************ # Subroutine Section # ************************************************************ sub process { my($noext) = $_[1]; $noext =~ s/\.[^\.]+$//o; $noext =~ s/.+\/// if $noext =~ /\.\.\//; return ["\$(VDIR)$noext.\$(SOEXT)", "\$(VDIR)$noext.\$(OBJEXT)", "\$(VSHDIR)$noext.\$(SOEXT)", "\$(VSHDIR)$noext.\$(OBJEXT)", ]; } 1; ace-8.0.4+dfsg.orig/bin/msvc_static_order.lst0000644000175000017500000001223715027201773020202 0ustar sudipsudip# This file lists the project files that must be build first in a static # build using msvc_static_compile.pl ace/ace ace/ACE_ETCL ace/ACE_ETCL_Parser ace/MonitorControl/MonitorControl Kokyu/Kokyu ACEXML/parser/parser/ACEXML_Parser ACEXML/common/ACEXML apps/gperf/src/gperf TAO/TAO_IDL/TAO_IDL_BE TAO/TAO_IDL/TAO_IDL_FE TAO/TAO_IDL/TAO_IDL_EXE TAO/tao/TAO TAO/tao/AnyTypeCode TAO/tao/CodecFactory TAO/tao/Codeset TAO/tao/PI TAO/tao/PortableServer TAO/tao/PI_Server TAO/tao/Valuetype TAO/tao/ObjRefTemplate TAO/tao/IORInterceptor TAO/tao/DynamicAny TAO/tao/IORManipulation TAO/tao/IORTable TAO/tao/Messaging TAO/tao/DynamicInterface TAO/tao/Strategies TAO/tao/RTCORBA TAO/tao/RTPortableServer TAO/tao/Utils TAO/tao/TAO_Utils TAO/tao/RTScheduler TAO/tao/IFR_Client TAO/tao/TypeCodeFactory TAO/tao/ImR_Client TAO/tao/CSD_Framework TAO/tao/CSD_ThreadPool TAO/tao/TC TAO/tao/DiffServPolicy TAO/tao/Monitor TAO/orbsvcs/orbsvcs/Svc_Utils TAO/orbsvcs/orbsvcs/CosNaming_IDL TAO/orbsvcs/orbsvcs/CosNaming TAO/orbsvcs/orbsvcs/CosNaming_Skel TAO/orbsvcs/orbsvcs/CosNaming_Serv TAO/orbsvcs/orbsvcs/CosProperty_IDL TAO/orbsvcs/orbsvcs/CosProperty TAO/orbsvcs/orbsvcs/CosProperty_Skel TAO/orbsvcs/orbsvcs/CosProperty_Serv TAO/orbsvcs/orbsvcs/CosTrading_IDL TAO/orbsvcs/orbsvcs/CosTrading TAO/orbsvcs/orbsvcs/CosTrading_Skel TAO/orbsvcs/orbsvcs/CosTrading_Serv TAO/orbsvcs/orbsvcs/HTIOP TAO/orbsvcs/orbsvcs/AV TAO/orbsvcs/orbsvcs/ETCL TAO/orbsvcs/orbsvcs/RTCosScheduling TAO/orbsvcs/orbsvcs/RTEvent TAO/orbsvcs/orbsvcs/RTEvent_Skel TAO/orbsvcs/orbsvcs/RTEvent_Serv TAO/orbsvcs/orbsvcs/RTSched TAO/orbsvcs/orbsvcs/RTSchedEvent TAO/orbsvcs/orbsvcs/CosEvent_IDL TAO/orbsvcs/orbsvcs/CosEvent TAO/orbsvcs/orbsvcs/CosEvent_Skel TAO/orbsvcs/orbsvcs/CosEvent_Serv TAO/orbsvcs/orbsvcs/RTKokyuEvent TAO/orbsvcs/orbsvcs/CosConcurrency_IDL TAO/orbsvcs/orbsvcs/CosConcurrency TAO/orbsvcs/orbsvcs/CosConcurrency_Skel TAO/orbsvcs/orbsvcs/CosConcurrency_Serv TAO/orbsvcs/orbsvcs/CosLifeCycle TAO/orbsvcs/orbsvcs/CosTime TAO/orbsvcs/orbsvcs/CosNotification_IDL TAO/orbsvcs/orbsvcs/CosNotification TAO/orbsvcs/orbsvcs/CosNotification_Skel TAO/orbsvcs/orbsvcs/CosNotification_Serv TAO/orbsvcs/orbsvcs/CosNotification_Persist TAO/orbsvcs/orbsvcs/DsLogAdmin_IDL TAO/orbsvcs/orbsvcs/DsLogAdmin TAO/orbsvcs/orbsvcs/DsLogAdmin_Skel TAO/orbsvcs/orbsvcs/DsLogAdmin_Serv TAO/orbsvcs/orbsvcs/DsEventLogAdmin_IDL TAO/orbsvcs/orbsvcs/DsEventLogAdmin TAO/orbsvcs/orbsvcs/DsEventLogAdmin_Skel TAO/orbsvcs/orbsvcs/DsEventLogAdmin_Serv TAO/orbsvcs/orbsvcs/DsNotifyLogAdmin_IDL TAO/orbsvcs/orbsvcs/DsNotifyLogAdmin TAO/orbsvcs/orbsvcs/DsNotifyLogAdmin_Skel TAO/orbsvcs/orbsvcs/DsNotifyLogAdmin_Serv TAO/orbsvcs/orbsvcs/PortableGroup TAO/orbsvcs/orbsvcs/FTORB_Utils TAO/orbsvcs/orbsvcs/FT_ClientORB TAO/orbsvcs/orbsvcs/FT_ServerORB TAO/orbsvcs/orbsvcs/FtRtEvent TAO/orbsvcs/orbsvcs/FaultTolerance TAO/orbsvcs/orbsvcs/CosLoadBalancing TAO/orbsvcs/orbsvcs/IFRService TAO/orbsvcs/orbsvcs/RTCORBAEvent TAO/orbsvcs/orbsvcs/RT_Notification TAO/orbsvcs/orbsvcs/RTEventLogAdmin_IDL TAO/orbsvcs/orbsvcs/RTEventLogAdmin TAO/orbsvcs/orbsvcs/RTEventLogAdmin_Skel TAO/orbsvcs/orbsvcs/RTEventLogAdmin_Serv TAO/orbsvcs/orbsvcs/Security TAO/orbsvcs/Naming_Service/Naming_Service TAO/orbsvcs/ImplRepo_Service/ImR_Activator_IDL TAO/orbsvcs/ImplRepo_Service/ImR_Locator_IDL TAO/orbsvcs/ImplRepo_Service/ImR_Activator TAO/orbsvcs/ImplRepo_Service/ImR_Activator_Service TAO/orbsvcs/ImplRepo_Service/ImR_Locator TAO/orbsvcs/ImplRepo_Service/ImR_Locator_Service TAO/orbsvcs/ImplRepo_Service/tao_imr TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager_Lib TAO/orbsvcs/orbsvcs/FTRT_ClientORB TAO/orbsvcs/tests/Concurrency/CC_client TAO/orbsvcs/tests/Event/lib/Event_Test_Lib TAO/orbsvcs/tests/Event/Mcast/Common/ECMcastTests_lib TAO/orbsvcs/tests/Trading/Trading_Test_Lib TAO/orbsvcs/examples/CosEC/RtEC_Based/lib/CosEC_RtEC_Based_lib TAO/orbsvcs/performance-tests/RTEvent/lib/RTEC_Perf TAO/tests/CSD_Strategy_Tests/TP_Common/CSD_TP_Test_Lib TAO/tests/Smart_Proxies/Collocation/SP_Collocation_Idl TAO/tests/Smart_Proxies/Collocation/SP_Collocation_TestStubsLib TAO/tests/Collocation/Collocation_Idl TAO/tests/Collocation/Collocation_Test_Stub TAO/tests/Collocation/Collocation_Diamond TAO/tests/ORB_Local_Config/Two_DLL_ORB/Two_DLL_ORB_Idl TAO/tests/TransportCurrent/lib/Current_Test_Lib_Idl TAO/tests/TransportCurrent/lib/Current_Test_Lib_Client TAO/tests/TransportCurrent/lib/Current_Test_Lib_Server TAO/examples/POA/Generic_Servant/POA_Generic_Servant_Lib TAO/examples/Simple/time-date/Simple_Time_Date_Lib TAO/docs/tutorials/Quoter/idl/Quoter_Idl_Lib TAO/performance-tests/RTCorba/Multiple_Endpoints/Common/RTCORBA_Common TAO/examples/RTScheduling/Job TAO/examples/RTScheduling/RTSchedSynch TAO/examples/RTScheduling/RTSchedTestLib tests/Test_Output tests/DLL_Test_Parent TAO/tests/CSD_Strategy_Tests/TP_Common/CSD_TP_Test_Lib performance-tests/Synch-Benchmarks/Synch_Lib/Synch_Lib examples/Service_Configurator/Misc/Service_Configurator_Misc_Timer examples/Timer_Queue/Timer_Queue_Library ASNMP/asnmp/asnmp_lib netsvcs/lib/netsvcs netsvcs/clients/Naming/Client/Netsvsc_Client_Test_Lib netsvcs/clients/Naming/Dump_Restore/Netsvcs_Dump_Restore_Lib websvcs/lib/websvcs protocols/ace/HTBP/HTBP protocols/ace/RMCast/RMCast protocols/ace/TMCast/TMCast ace-8.0.4+dfsg.orig/bin/topinfo_iorsize_stats.sh0000755000175000017500000000353515027201773020744 0ustar sudipsudip#!/bin/sh # if [ $# -lt 3 ]; then echo "Usage: $0 [DEST] [USER] [OPTIMIZED]" exit 0 fi DEST=$1 US=$2 OPT=$3 DATE=`date +%Y/%m/%d-%H:%M` cd $ACE_ROOT LD_LIBRARY_PATH=$ACE_ROOT/ace export LD_LIBRARY_PATH PATH=/usr/bin:/bin:$PATH export PATH cd $TAO_ROOT/performance-tests/Memory/IORsize # start the server. If OPT == 1 then start the optimized version, else # the non-optimized version if test $OPT == 1 then ./server -ORBSvcConf server.conf & else ./server & fi s_id=$!; server_start_size=`cat /proc/$s_id/status | grep VmRSS | awk '{print $2}'`; # Just sleep for 2 seconds. sleep 2; # Check whether the server has started file="test.ior" if test -f $file then # start the client ./client & c_id=$!; # Wait till all the invocations are done sleep 30; # Get the size once the client has made sufficient invocations. s_invocations=`cat /proc/$s_id/status | grep VmRSS | awk '{print $2}'`; let "actual_server_growth=${s_invocations}-${server_start_size}"; if test $OPT == 1 then echo $DATE $s_invocations >> $DEST/source/server_opt_ior_size.txt echo $DATE $actual_server_growth >> $DEST/source/opt_ior_size.txt else echo $DATE $s_invocations >> $DEST/source/server_ior_size.txt echo $DATE $actual_server_growth >> $DEST/source/actual_ior_size.txt fi # Kill the server and client. We will look at better ways of doing # this later. kill -9 $c_id; kill -9 $s_id; rm -f $file else echo $file doesnt exist fi cd $DEST/source STRING="for 50000 IORs" FILES="server_opt opt server actual" for i in $FILES ; do /usr/bin/tac ${i}_ior_size.txt > $DEST/data/${i}_ior_size.txt /usr/bin/tail -5 ${i}_ior_size.txt > $DEST/data/LAST_${i}_ior_size.txt $ACE_ROOT/bin/generate_topinfo_charts.sh ${i}_ior_size.txt $DEST/images/${i}_ior_size.png ${i}_ior_size.txt done ace-8.0.4+dfsg.orig/bin/create_ace_build0000755000175000017500000001607315027201773017126 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # Creates an ACE build tree in directory "build/" below the current # directory, which must be an ACE "top level" directory (such as # $ACE_ROOT). The build tree directory structure mirrors that of the ACE # top level directory structure, except that instead of containing any plain # files, it contains only symlinks to the files in the ACE top level structure. # # This program has a similar purpose to "clone", but in addition to # only creating symlinks (clone creates hard links, by default), this # script: # 1) uses relative rather than absolute symlinks, # 2) tries not to put junk files into the build tree, # 3) only creates a new tree in a build/ directory below the current, # top level ACE directory (it's a feature :-), but it does enforce # consistency). # # This program can be re-run on a build tree at any time in order to # update it. It will add symlinks for newly added files, and remove # any that are no longer valid. # # If the starts with "build/", that part will be removed # from it. # # The first three lines above let this script run without specifying the # full path to perl, as long as it is in the user's PATH. # Taken from perlrun man page. use File::Find (); use File::Basename; use FileHandle; print "You should consider using clone_build_tree.pl found with MPC\n"; $usage = "usage: $0 -? | [-a] [-d ] [-v] \n"; $directory_mode = 0777; #### Will be modified by umask, also. $verbose = 0; $source='.'; $absolute= 0; $perl_version = $] + 0; if ($perl_version >= 5) { #### Use an eval so that this script will compile with perl4. eval <<'PERL5_CWD' require Cwd; sub cwd { Cwd::getcwd (); } PERL5_CWD } else { sub cwd { local ($pwd); chop ($pwd = `pwd`); $pwd; } } my($starting_dir) = cwd (); my(@nlinks) = (); my($build_re) = undef; sub cab_link { my($real) = shift; my($fake) = shift; my($uif) = ($^O eq 'MSWin32' ? 'link' : 'symlink'); print "$uif $real $fake\n" if $verbose; my($status) = 0; if ($^O eq 'MSWin32') { my($fixed) = $fake; $fixed =~ s/$build_re//; push(@nlinks, $fixed); chdir(dirname($fake)); $status = link ($real, basename($fake)); chdir($starting_dir); } else { $status = symlink ($real, $fake); } if (!$status) { warn "$0: $uif to $fake failed\n"; } } #### #### Process command line args. #### while ($#ARGV >= 0 && $ARGV[0] =~ /^-/) { if ($ARGV[0] eq '-v') { $verbose = 1; } elsif ($ARGV[0] eq '-d') { if ($ARGV[1] =~ /^\d+$/) { $directory_mode = eval ($ARGV[1]); shift; } else { warn "$0: must provide argument for -d option\n"; die $usage; } } elsif ($ARGV[0] eq '-a') { $source = &cwd (); $absolute = 1; } elsif ($ARGV[0] eq '-?') { print "$usage"; exit; } else { warn "$0: unknown option $ARGV[0]\n"; die $usage; } shift; } die $usage unless $#ARGV == 0; $build = $ARGV[0]; $build =~ s%^build[/\\]%%; #### remove leading "build/", if any $build = "build/$build"; ## Set up the build regular expression use under MSWin32 if ($^O eq 'MSWin32') { ## Get the original build name $build_re = $build; ## Remove any trailing slashes $build_re =~ s/[\\\/]+$//; ## Add a single trailing slash $build_re .= '/'; ## Escape any special characters $build_re =~ s/([\\\$\[\]\(\)\.])/\\$1/g; } #### #### Check that we're in an ACE "top level" directory. #### (-d 'ace' && -d 'include') || die "$0: must be in an ACE top level (ACE_ROOT) directory!\n"; #### #### Create build directories, if needed. #### -d 'build' || mkdir ('build', $directory_mode); -d "$build" || mkdir ("$build", $directory_mode); #### #### Get all ACE plain file and directory names. #### @files = (); sub wanted { my ($dev,$ino,$mode,$nlink,$uid,$gid); /^CVS\z/s && ($File::Find::prune = 1) || /^build\z/s && ($File::Find::prune = 1) || /^\..*obj\z/s && ($File::Find::prune = 1) || /^Templates\.DB\z/s && ($File::Find::prune = 1) || /^Debug\z/s && ($File::Find::prune = 1) || /^Release\z/s && ($File::Find::prune = 1) || /^Static_Debug\z/s && ($File::Find::prune = 1) || /^Static_Release\z/s && ($File::Find::prune = 1) || ( ($nlink || (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_))) && ! -l $_ && ! /^core\z/s && ! /^.*\.state\z/s && ! /^.*\.so\z/s && ! /^.*\.[oa]\z/s && ! /^.*\.dll\z/s && ! /^.*\.lib\z/s && ! /^.*\.obj\z/s && ! /^.*~\z/s && ! /^\.\z/s && ! /^\.#.*\z/s && ! /^.*\.log\z/s ) && push(@files, $File::Find::name); } File::Find::find({wanted => \&wanted}, '.'); #### #### Create directories and symlinks to files. #### foreach $file (@files) { $file =~ s%^./%%g; #### excise leading ./ directory component if (-d $file) { unless (-d "$build/$file") { print "mkdir $build/$file, $directory_mode\n" if $verbose; mkdir ("$build/$file", $directory_mode); } } else { unless (-e "$build/$file") { if (!$absolute) { $up = '../..'; while ($file =~ m%/%g) { $up .= '/..'; } cab_link("$up/$file", "$build/$file"); } else { $path = $source . '/' . $file; cab_link("$path", "$build/$file"); } } } } #### #### Find all the symlinks in the build directory, and remove ones #### that are no longer actually linked to a file. #### if ($^O eq 'MSWin32') { my($lfh) = new FileHandle(); my($txt) = "$build/create_ace_build.links"; if (open($lfh, "$txt")) { while(<$lfh>) { my($line) = $_; $line =~ s/\s+$//; if (-e $line) { push(@nlinks, $line); } else { print "Removing $build/$line \n" if $verbose; unlink("$build/$line") || warn "$0: unlink of $build/$line failed\n"; } } close($lfh); } ## Rewrite the link file. unlink($txt); if (open($lfh, ">$txt")) { foreach my $file (@nlinks) { print $lfh "$file\n"; } close($lfh); } } else { @lfiles = (); sub lcheck { ## There's no way to know if we have hard linked back to a now ## non-existent file. So, just do the normal -l on the file ## which will cause no files to be pushed on Windows. if (-l $_) { push(@lfiles, $File::Find::name); } } File::Find::find({wanted => \&lcheck}, $build); foreach (@lfiles) { local @s = stat $_; if ($#s == -1) { print "Removing $_ \n" if $verbose; unlink $_ || warn "$0: unlink of $_ failed\n"; } } } #### #### Done: print message. #### print "\nCompleted creation of $build/.\n"; my($msg) = ''; if (! -e "$build/ace/config.h") { $msg .= "$build/ace/config.h"; } if ($^O ne 'MSWin32' && ! -e "$build/include/makeinclude/platform_macros.GNU") { if ($msg ne '') { $msg .= " and\n"; } $msg .= "$build/include/makeinclude/platform_macros.GNU"; } if ($msg ne '') { print "Be sure to setup $msg.\n"; } #### EOF ace-8.0.4+dfsg.orig/bin/diff-builds.pl0000755000175000017500000002211415027201773016467 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # -*- perl -*- use File::Spec qw/ tmpdir /; use File::Temp qw/ tempfile tempdir /; use POSIX qw/ strftime /; my $debugging = 0; # Print additional info my $verbose = '-q'; # WGET verbosity my $new_errors_only = 0; # Show new errors only my $clean_builds_only = 1; # Only diff todays clean builds my $append_revision_to_new_test_fails = 0; # Default to not doing this. # The root of the test statistics my $teststaturl = "http://teststat.remedy.nl/teststat/builds/"; my $allbuildsurl = "http://teststat.remedy.nl/teststat/buildscore"; my $cleanbuildsurl = "http://teststat.remedy.nl/teststat/cleanbuildtests"; # Determine the available timestamps for a build on a date, # by scanning the index page (build.html) sub find_timestamps ($$) { my ($file,$date) = @_; # print "\nSearching for $file, $date\n"; open (INDEX, "wget " . $verbose . " \'" . $teststaturl . $file . ".html\' -O - |") || die "***Could not read the index page for $file\n"; # Split at all HTML tags, except my @suffixes = split ( /[<][b-zB-Z\/]+[>]/, ); close (INDEX); # Select only those of the "href=..." that match our file and date my $rx = quotemeta ( $file . '_' . $date); my @temp = map { (/${rx}_([0-9][0-9]_[0-9][0-9])/) ? $1 : "" } @suffixes; return grep /^[0-9]/, @temp; } # Determine the timestamp by scanning the index sub find_closest_earlier { my ($file,$date) = @_; open (INDEX, "wget " . $verbose . " \'" . $teststaturl . $file . ".html\' -O - |") || die "***Could not read the index page for $file\n"; # Split at all HTML tags, except my @suffixes = split ( /[<][b-zB-Z\/]+[>]/, ); close (INDEX); # Select only those of the "href=..." that match our file my $rx = quotemeta ( $file); my @temp = map { (/${rx}_([0-9][0-9][0-9][0-9]_[0-9][0-9]_[0-9][0-9])/ && $1 le $date) ? $1 : undef } @suffixes; my @temp2 = grep /^[0-9]/, @temp; if ($#temp2 == -1) { return undef; } return $temp2[0]; } sub select_builds ($$$) { my ($rdates, $rbuilds, $rfiles) = @_; my @dates = @{$rdates}; my @builds = @{$rbuilds}; if ($#dates eq 1) { $rfiles->[0] = $rbuilds->[0]; $rfiles->[1] = $rbuilds->[0]; } elsif ($#builds eq 1) { $rfiles->[0] = $rbuilds->[0]; $rfiles->[1] = $rbuilds->[1]; $rdates->[1] = $rdates->[0]; } else { die "Dates: $#dates, Builds: $#builds\n"; } return 0; } sub load_failed_tests_list ($$) { my ($file, $original_date) = @_; my $date = $original_date; my $last_tried_date = $original_date; my @timestamps = (); while ($#timestamps < 0) { @timestamps = find_timestamps ($file, $date); if ($#timestamps == -1) { $date = find_closest_earlier ($file, $date); if (!$date) { print "***Found no builds for $file on, or before $original_date\n"; return File::Spec->devnull(); } print "***No builds for $file on $last_tried_date. The closest earlier is " . $date . "\n"; $last_tried_date = $date; next; } print "Build times for $file on $date are " . join (', ', @timestamps) . "\n" unless !$debugging; } my $tmpdir = File::Spec->tmpdir(); my $fullfile = $file .'_' . $date . '_' . $timestamps[0]; my ($fh, $tmpfile) = tempfile ($fullfile . ".XXXXXX", UNLINK => 1, DIR => $tmpdir); print "wget " . $verbose . " \'" .$teststaturl . $fullfile . ".txt\' -O - | sort >\'" . $tmpfile . '\'' . "\n" unless !$debugging; system ("wget " . $verbose . " \'" .$teststaturl . $fullfile . ".txt\' -O - | sort >\'" . $tmpfile . '\''); close ($fh); return $tmpfile; } sub differentiate ($$$) { my ($rfiles, $rdates, $revision) = @_; print "Difference for dates " . join (', ', @$rdates) . "\n" unless !$debugging; my $first_file = load_failed_tests_list ($rfiles->[0], $rdates->[0]); my $second_file = load_failed_tests_list ($rfiles->[1], $rdates->[1]); open (DIFF, "diff -u \'" . $first_file . "\' \'" . $second_file . "\' 2>&1 |") || die "***Failed to diff \'" . $first_file . "\' \'" . $second_file . "\'\n"; while () { # Don't filter out the build details when printing the new errors only if (/^---/) { # Previous Build Date print; } elsif (/^\+\+\+/) { # Current Build date if ($revision) { chomp; print "$_ ($revision)\n"; } else { print; } } elsif (/^[^\+]/) { # Anything except a new error print unless ($new_errors_only == 1); } elsif ($append_revision_to_new_test_fails && $revision) { chomp; print "$_ ($revision)\n"; } else { print; } } close (DIFF); print "\n"; } sub find_builds ($$$$$) { my ($rbuilds, $buildscoreurl, $selectcolumn_name, $revision_hash, $selectcolumn_revision) = @_; print "Reading from $buildscoreurl\n" unless !$debugging; open (CLEANS, "wget " . $verbose . " \'" . $buildscoreurl . "\' -O - |") || die "Could not read builds score page $buildscoreurl\n"; # Split at all spaces for(my $begin=0; ;) { chomp; my @columns = split (/ +/); if (/=+/) { $begin++; next; } if ($begin) { my $temp = %{$revision_hash}; $temp->{$columns[$selectcolumn_name]} = $columns[$selectcolumn_revision]; push (@{$rbuilds}, $columns[$selectcolumn_name]); } } close (CLEANS); sort @{$rbuilds}; print "Using builds @{$rbuilds}\n" unless !$debugging; } my @dates = (); my @builds = (); my @files = (); while ($arg = shift(@ARGV)) { if ($arg eq "-h" || $arg eq "-?") { print "Prints a diff for the list of test failures, for two builds on a certain date\n\n"; print "diff-builds [-n] [-d] [-D date] [-A] [build ...]\n"; print "\n"; print " -n -- Show only new test failing (default=no)\n"; print " -d -- Show debug info\n"; print " -h -- Prints this information\n"; print " -D date -- Specify a date. Either YYYY_MM_DD or YYYY-MM-DD works\n"; print " Use two date parameters to specify an interval\n"; print " -A -- Use all builds, not just the clean (successful) ones\n"; print " -r -- Append SVN revision numbers to NEW test names\n"; print " build -- Specify the build name. As it appears on the scoreboard\n"; print " Works with two builds and one date to show the differences\n"; print " between them. One build and two dates works, too.\n"; print " Just a single date (no builds) implies comparing all of \n"; print " today's builds with the builds on the supplied date.\n"; exit 0; } if ($arg eq '-D') { my $date = shift(@ARGV); $date =~ s/-/_/g; push (@dates, $date); print "Date=$date\n" unless !$debugging; } elsif ($arg eq '-v') { $verbose = undef; } elsif ($arg eq '-d') { $debugging = 1; } elsif ($arg eq '-n') { $new_errors_only = 1; } elsif ($arg eq '-A') { $clean_builds_only = 0; } elsif ($arg eq '-r') { $append_revision_to_new_test_fails = 1; } else { push (@builds, $arg); print "Build=$arg\n" unless !$debugging; } } # Diff the todays clean builds with the ones from a specific date if ($#builds == -1 && $#dates >= 0) { my %revisions = {}; # only the start date given - implies we should # use the today's date if ($#dates == 0) { $dates[1] = strftime ("%Y_%m_%d", gmtime); } if ($clean_builds_only) { find_builds (\@builds, $cleanbuildsurl . "-" . $dates[1] . ".txt" , 8, \%revisions, 7); } else { find_builds (\@builds, $allbuildsurl . "-" . $dates[1] . ".txt" , 4, \%revisions, 3); } foreach $build (sort @builds) { $files[0] = $files[1] = $build; differentiate (\@files, \@dates, $revisions{$build} ); } } else { die "More than one date or build name are required" unless ($#dates + $#builds ge 1); print "dates=@dates ($#dates)\n" unless !$debugging; print "builds=@builds ($#builds)\n" unless !$debugging; select_builds (\@dates, \@builds, \@files); differentiate (\@files, \@dates, 0); } __END__ =head1 diff-builds.pl Diff the lists of failing tests =item DESCRIPTION Prints a diff for the list of test failures, for two builds on a certain date. Or, for two dates and a certain build. =item EXAMPLE diff-builds.pl WinXP_VC71_NET_Static_Debug -D 2006_04_17 -D 2006_05_12 =item AUTHOR Iliyan Jeliazkov ace-8.0.4+dfsg.orig/bin/envinfo.cpp0000644000175000017500000000132315027201773016106 0ustar sudipsudip#include "ace/ACE.h" #include "ace/Log_Msg.h" #include "ace/OS_main.h" #include "ace/OS_NS_sys_utsname.h" int ACE_TMAIN (int, ACE_TCHAR *[]) { ACE_DEBUG ((LM_INFO, ACE_TEXT ("ACE: %u.%u.%u\n"), ACE::major_version(), ACE::minor_version(), ACE::micro_version())); ACE_utsname uname; ACE_OS::uname(&uname); ACE_DEBUG ((LM_INFO, ACE_TEXT ("OS: %C %C\n"), uname.sysname, uname.release)); ACE_DEBUG ((LM_INFO, ACE_TEXT ("Compiler: %s %u.%u\n"), ACE::compiler_name(), ACE::compiler_major_version(), ACE::compiler_minor_version(), ACE::compiler_beta_version())); return 0; } ace-8.0.4+dfsg.orig/bin/generate_compile_stats.sh0000755000175000017500000007407415027201773021032 0ustar sudipsudip#! /bin/sh # # This script generate metrics html pages for either compile times or # footprint. # # Compile times: # Parse the build.txt file from an autobuild that was generated with the # g++_metric.sh script, e.g., with CXX=g++_metric.sh which outputs # compile times on a per object basis, and use the data to generate time # series graphs with gnuplot. # # Footprint: # Parse the build.txt file and and the *.map files, generated with LDFLAGS # set to =-Xlinker -M -Xlinker -Map -Xlinker \$@.map and static_libs_only=1. # # For use with an autobuild, place a line something like this in the xml file, # after the log file is closed, but before it's moved. # # # ############################################################################### # # usage # ############################################################################### usage () { echo "Usage: `basename $0` [--base=] [--name=] [--compiler=compiler]" echo " [target_file]" echo " [Footprint|Compilation] [] []" echo "" echo "--base This option can be used to set the base root directory to" echo " something other than the default \$ACE_ROOT." echo "--name This option can be used to set the software title to something" echo " other than the default ACE+TAO." echo "--compiler This option can be used to set the compiler to something" echo " other than the default gcc." echo "input_file This is the compilation log file." echo "destination_directory This designates the location of the generated html." echo "target_file This is similar to input_file, but should contain no errors." echo "date Set the date used in all generated html pages." echo "fudge_factor Add the specified number of seconds to the compilation time" echo " for each target." echo "" echo "Options must be specified in the order shown above." exit } ############################################################################### # # parse_time # # this only works for english # assumes the date is formatted like this: Sat Apr 12 18:19:31 UTC 2003 # and outputs this: 2003/04/12-18:19 # ############################################################################### parse_time () { # todo: add a format parameter local INDEX=0 local PT_MONTH="" local PT_DAY="" local PT_YEAR="" local PT_HOUR="" local PT_MINUTE="" local PT_SECOND="" local PT_TIMEZONE="" read -a line for token in "${line[@]}"; do #echo "$INDEX = $token" case $INDEX in 1 ) case $token in Jan ) PT_MONTH="01" ;; Feb ) PT_MONTH="02" ;; Mar ) PT_MONTH="03" ;; Apr ) PT_MONTH="04" ;; May ) PT_MONTH="05" ;; Jun ) PT_MONTH="06" ;; Jul ) PT_MONTH="07" ;; Aug ) PT_MONTH="08" ;; Sep ) PT_MONTH="09" ;; Oct ) PT_MONTH="10" ;; Nov ) PT_MONTH="11" ;; Dec ) PT_MONTH="12" ;; esac ;; 2 ) PT_DAY="$token" ;; 3 ) PT_HOUR="${token%%:*}" PT_MINUTE="${token%:*}" PT_MINUTE="${PT_MINUTE#*:}" PT_SECOND="${token##*:}" ;; 4 ) PT_TIMEZONE="$token" ;; 5 ) PT_YEAR="$token" ;; esac let INDEX=$INDEX+1 done if [ "$1" = "debug" ]; then echo "month = $PT_MONTH" echo "day = $PT_DAY" echo "year = $PT_YEAR" echo "hour = $PT_HOUR" echo "min = $PT_MINUTE" echo "sec = $PT_SECOND" echo "tz = $PT_TIMEZONE" fi echo "$PT_YEAR/$PT_MONTH/$PT_DAY-$PT_HOUR:$PT_MINUTE" } ############################################################################### # # strip_date # # grab date from line with following format: # ################### End [Fri Apr 11 00:18:31 2003 UTC] # and return it in this format: Fri Apr 11 00:18:31 UTC 2003 which is # what parse_time() expects # ############################################################################### strip_date () { local INDEX=0 local TEMP_DATE="" local DATE="" read -a line for token in "${line[@]}"; do #echo "$INDEX = $token" case $INDEX in 2 ) DATE=${token#[} ;; 7 ) DATE="$DATE ${token%]} $TEMP_DATE" ;; # this is a hack since the autobuild scripts don't format the date # correctly... :-( 6 ) TEMP_DATE=$token ;; * ) DATE="$DATE $token" ;; esac let INDEX=$INDEX+1 done echo $DATE } ############################################################################### # # parse # # Parse the commandline and validate the inputs # ############################################################################### parse () { echo "parse()" while [ $# -gt 1 ]; do if [ -n "`echo $1 | grep '^--base=.*'`" ]; then BASE_ROOT=`echo $1 | sed 's/^--base=//'` shift elif [ -n "`echo $1 | grep '^--name=.*'`" ]; then BASE_TITLE=`echo $1 | sed 's/^--name=//'` shift elif [ -n "`echo $1 | grep '^--compiler.*'`" ]; then COMPILER=`echo $1 | sed 's/^--compiler=//'` shift else break fi done # set input file and destination (required) if [ $# -gt 1 ]; then INFILE=$1 DEST=$2 if ! [ -e "$INFILE" ]; then echo "input_file $INFILE does not exist." usage fi else usage fi # set the target file from command line if [ $# -gt 2 ]; then TARGETS=$3 else TARGETS=$INFILE fi # set type of metric from command line if [ $# -gt 3 ]; then METRIC=$4 else METRIC="Compilation" fi echo "metric = ($METRIC)" # set the date from command line if [ $# -gt 4 ]; then DATE=$5 else DATE=`tail -n 1 $INFILE | strip_date | parse_time` fi echo "date = ($DATE)" # set fudge factor from commandline (for testing) if [ $# -gt 5 ]; then FUDGE_FACTOR=$6 else FUDGE_FACTOR=0 fi } ############################################################################### # # gen_chart # # Generate the actual charts and move them to ${DEST} # ############################################################################### gen_chart () { local object=$1 local DEST=$2 local TYPE=$3 local EXT="txt" local YLABEL="Compile Time (Seconds)" local FACTOR=1 local low=$4 local high=$5 if [ "$TYPE" = "Footprint" ]; then EXT="size" if [ ${high} -gt 1024 ]; then YLABEL="Footprint (KBytes)" FACTOR=1024 else YLABEL="Footprint (Bytes)" FACTOR=1 fi fi let low="${low}/${FACTOR}" let high="${high}/${FACTOR}" sort -t'/' -k1n -k2n -k3n ${DEST}/data/${object}.${EXT} | grep -E ^2 > tmp.txt gnuplot <' echo '
' echo '

All the experiments run on the system described below. ' echo 'The machine is running Linux (' if [ -e "/etc/SuSE-release" ]; then cat /etc/SuSE-release fi if [ -e "/etc/redhat-release" ]; then cat /etc/redhat-release fi echo "), and we use " $COMPILER " version " $COMPILER -dumpversion > ${DEST}/compilerversion.txt 2>&1 cat ${DEST}/compilerversion.txt echo ' to compile '$BASE_TITLE'.

' if [ -z "$MPC_ROOT" ]; then MPC_ROOT=$ACE_ROOT/MPC fi CFG_FILES=$ACE_ROOT/ace/config.h if [ -r $ACE_ROOT/bin/MakeProjectCreator/config/default.features ]; then CFG_FILES="$CFG_FILES $ACE_ROOT/bin/MakeProjectCreator/config/default.features" elif [ -r $MPC_ROOT/config/default.features ]; then CFG_FILES="$CFG_FILES $MPC_ROOT/config/default.features" fi CFG_FILES="$CFG_FILES $ACE_ROOT/include/makeinclude/platform_macros.GNU" echo '' for cfg_file in $CFG_FILES; do if [ -r $cfg_file ]; then echo "" echo '' fi done echo '' echo '' echo '' echo '' echo '' echo '
ACE+TAO Configuration`basename $cfg_file`
'
      cat $cfg_file
      echo '
CPU Information/proc/cpuinfo
'

  cat /proc/cpuinfo

  echo '
Available Memory/proc/meminfo
'

  cat /proc/meminfo

  echo '
OS Versionuname -a
'

  /bin/uname -a

  echo '
Compiler Version'$COMPILER' -v
' $COMPILER -v > ${DEST}/compiler.txt 2>&1 cat ${DEST}/compiler.txt if [ -e "/lib/libc.so.6" ]; then echo '
Library Version/lib/libc.so.6
'

    /lib/libc.so.6 | sed -e 's//\>/g'
  fi

  echo '
' echo '' } ############################################################################### # # create_page # ############################################################################### create_page () { # always strip off "ACE___" / "TAO___" local BASE=$1 local TYPE=$2 local EXT="" local BASE_NAME=${BASE#ACE___} local BASE_NAME=${BASE#TAO___} local TITLE="${TYPE} metrics for ${BASE_NAME//___//}" if [ "$TYPE" = "Compilation" ]; then EXT="txt" UNITS="100th's of seconds" else EXT="size" UNITS="Bytes" fi # header echo "" echo "$TITLE" echo '' echo '' echo "

$TITLE


" if [ -e "${DEST}/images/${BASE}_${TYPE}.png" ]; then echo '

' echo "\"$BASE\"

' fi echo "


" echo "

Detail (${DATE})

" echo '' echo '' echo "" echo '' while read i; do if [ -e "${DEST}/data/${i}.${EXT}" ]; then LAST=0 PRE=0 VAL_TMP=0 VAL_INT=0 VAL_SIGN="+" echo '" let PRE=`sort -t'/' -k1n -k2n -k3n ${DEST}/data/${i}.${EXT} | grep -E ^2 | tail -n2 | head -n1 | cut -d" " -f2` let VAL_TMP="((($LAST+1)-($PRE+1))*1000)/($PRE+1)" if [ $VAL_TMP -lt 0 ]; then VAL_SIGN="-" let VAL_TMP="-1*$VAL_TMP" elif [ $VAL_TMP -eq 0 ]; then VAL_SIGN= fi let VAL_INT="$VAL_TMP/10" let VAL_TENTH="$VAL_TMP-($VAL_INT*10)" echo "" echo "" echo "" else echo '" echo "" fi done # for echo '
ObjectLast Compile
Date$UNITS%chgData
' if [ -e "${DEST}/${i}_${TYPE}.html" ]; then # strip off "ACE___" if it exists NAME=${i#ACE___} # strip off "TAO___" if it exists NAME=${i#TAO___} echo "${NAME//___//}" elif [ -e "${DEST}/images/${i}_${TYPE}.png" ]; then # since you'll only have images if it's a composite, strip off the # path for the name if [ "$TYPE" = "Footprint" ]; then # if we are doing footprint, add library llib=`grep -e "lib.*\.a" ${DEST}/size_composites.txt | grep ${i} | awk '{print $1}'` #echo "lib $llib" #llib="${llib% :}" llib="${llib//___//}" NAME="${llib}(${i##*___})" else NAME="${i##*___}" fi echo "${NAME}" else echo "${i##*___}" fi echo '' echo `sort -t'/' -k1n -k2n -k3n ${DEST}/data/${i}.${EXT} | grep -E ^2 | tail -n1 | cut -d" " -f1` let LAST=`sort -t'/' -k1n -k2n -k3n ${DEST}/data/${i}.${EXT} | grep -E ^2 | tail -n1 | cut -d" " -f2` echo "$LAST${VAL_SIGN}${VAL_INT}.${VAL_TENTH}Data
' echo "${i}" echo '' echo '?' echo "???
' # footer echo '' } ############################################################################### # # sort_list # ############################################################################### sort_list () { # sort the dependency files if [ -e ${DEST}/tmp_list ]; then rm ${DEST}/tmp_list fi touch ${DEST}/tmp_list for i in $@; do echo "$i" >> ${DEST}/tmp_list #echo $i done sort -f ${DEST}/tmp_list } ############################################################################### # # create_html # ############################################################################### create_html () { echo "create_html()" local DEST=$1 local TYPE=$2 local ALL_OBJS="" local ACE_OBJS="" local TAO_OBJS="" while read base colon files; do # create individual page for app/lib sort_list ${files} | create_page ${base} ${TYPE} \ > ${DEST}/${base}_${TYPE}.html if [ "${base}" != "${base#TAO}" ]; then TAO_OBJS="${TAO_OBJS} ${base}" elif [ "${base}" != "${base#ACE}" ]; then ACE_OBJS="${ACE_OBJS} ${base}" fi ALL_OBJS="${ALL_OBJS} ${base}" done # create main page create_index_page ${TYPE} > ${DEST}/index.html if [ "${TYPE}" = "Compilation" ] || [ "${TYPE}" = "Footprint" ]; then if [ $BASE_TITLE = $DEFAULT_TITLE ]; then name="ace_${TYPE}.html" sort_list ${ACE_OBJS} | create_page "ACE" ${TYPE} > ${DEST}/${name} name="tao_${TYPE}.html" sort_list ${TAO_OBJS} | create_page "TAO" ${TYPE} > ${DEST}/${name} else name="all_${TYPE}.html" sort_list ${ALL_OBJS} | create_page $BASE_TITLE ${TYPE} > ${DEST}/${name} fi fi } ############################################################################### # # main program # ############################################################################### INFILE="" DEST="" TARGETS="" DATE="" METRIC="Compilation" FUDGE_FACTOR=0 BASE_ROOT=$ACE_ROOT DEFAULT_TITLE=ACE+TAO BASE_TITLE=$DEFAULT_TITLE COMPILER="gcc" parse $@ create_dirs "${DEST}/" create_dirs "${DEST}/" if [ "$METRIC" = "Compilation" ]; then ######################################################## # compile times # grab the compile time metrics for objects only and process them grep "compile time(0):" $INFILE | grep "\.o" | cut -d' ' -f3,4,5 | process_file # Create ${DEST}/composites.txt with entries like this: # tests___OS_Test : tests___OS_Test.o tests___Main.o create_composite_list $TARGETS # compile times cat ${DEST}/composites.txt | rollup_compile_times find ${DEST}/data/ -name "*.txt" | create_images ${DEST} "Compilation" cat ${DEST}/composites.txt | create_html ${DEST} "Compilation" elif [ "$METRIC" = "Footprint" ]; then ######################################################## # footprint # Create ${DEST}/libraries.txt with entries like this: # ace___libACE.a create_library_list $TARGETS # Create ${DEST}/composites.txt with entries like this: # tests___OS_Test : tests___OS_Test.o tests___Main.o create_composite_list $TARGETS # Run size on the executables and append results to *.size file. cat ${DEST}/composites.txt | footprint # Run size on the libraries and append results to *.size for the # library and each contained object. # It also creates ${DEST}/size_composites.txt based on size output for # libraries with entries like this: # ace___libACE.a : ace___ACE.o ace___Addr.o cat ${DEST}/libraries.txt | footprint LIB # Add executables to ${DEST}/size_composites.txt based on output # from the map files (created with LDFLAGS=-Xlinker -M -Xlinker # -Map -Xlinker $(@).map). Find the map files of we want based on # entries in ${DEST}/composites.txt. cat ${DEST}/composites.txt | create_size_composites find ${DEST}/data/ -name "*.size" | create_images ${DEST} "Footprint" cat ${DEST}/size_composites.txt | create_html ${DEST} "Footprint" else echo "metric type ($METRIC) not recognized" usage fi ace-8.0.4+dfsg.orig/bin/add_rel_link.sh0000755000175000017500000000505315027201773016710 0ustar sudipsudip#!/bin/sh # This script assumes it is being run by bash # ======= needed functions ====== # abspath relpath curentpath abspath () { # treat "./" as a special case if expr "$1" : '\./' >/dev/null; then b=`echo $1 | sed 's@\./@@'` echo $2/$b return 0 fi b=$1 a=$2 # for each "../" we remove one directory from the current path # and leading "../" from the relative path # until we have the unique part in b and the abs prefix in a while expr "$b" : '\.\./' >/dev/null do b=`echo $b | sed 's@\.\./@@'` a=`echo $a | sed 's@/[^/]*$@@'` done # return the completed absolute path echo $a/$b } # relpath abspath curentpath relpath () { # take "/" off beginning a=`echo $1 | sed 's@^/@@'` # take "/" off beginning and add to end b=`echo $2 | sed 's@^/@@;s@$@/@'` while true do if [ "$b" = "" ]; then break; fi a1=`echo $a | sed 's@\([^/]*\)/.*@\1@'` b1=`echo $b | sed 's@\([^/]*\)/.*@\1@'` if [ "$a1" != "$b1" ]; then break; fi a=`echo $a | sed 's@[^/]*/@@'` b=`echo $b | sed 's@[^/]*/@@'` done # a now has the unique part of the path c="" # c will have the required number of "../"'s while [ "$b" != "" ] do c="../$c" b=`echo $b | sed 's@[^/]*/@@'` done # return the completed relative path echo "$c$a" } # ====== MAIN ====== # Assume any relative path passed in is relative to the current directory # Given $1 is a path to the source file # Given $2 is a path of the link to be created # Create a link that has the relative path to the source file # That is, $1 converted relative to $2 # Check if $1 is absolute or already relative #echo add_rel_link.sh $1 $2 if expr "$1" : '\/' >/dev/null; then # The source path is absolute, this is the expected case # Check if $2 is absolute or relative if expr "$2" : '\/' >/dev/null; then # The link path is already absolute, so just use it lpath=$2 else # The link path is relative, this is the expected case # WARNING: don't use $PWD here, it won't work right # WARNING: pwd may be a shell alias. Use /bin/pwd. cur=`/bin/pwd` lpath=`abspath $2 $cur` fi # take name off the end of the dest ldir=`echo $lpath | sed 's@/[^/]*$@@'` # If the original path and the ldir do not originate in the same # directory tree, we should just use absolute paths if [ "`echo $1 | cut -d/ -f2`" != "`echo $ldir | cut -d/ -f2`" ]; then spath=$1 else spath=`relpath $1 $ldir` fi # use the completed relative path and the given designation path echo ln -s $spath $2 ln -s $spath $2 else # The source path is already relative, so just use it echo ln -s $1 $2 ln -s $1 $2 fi ace-8.0.4+dfsg.orig/bin/update_gitignore.sh0000755000175000017500000000244315027201773017632 0ustar sudipsudip#!/usr/bin/env bash cmd="$1" if [[ "$cmd" == "help" ]] || [[ "$cmd" != "run" && "$cmd" != "dry-run" ]] then if [[ "$cmd" != "help" ]] then echo "Error: Unrecognized command '$0 $1'" echo "" fi echo "Usage:" echo " update_gitignore.sh run" echo " update_gitignore.sh dry-run" echo "" echo "This command finds all untracked and un-git-add-ed files in the repository and adds each file name to " echo "a '.gitignore' file in the same directory. If a '.gitignore' file does not exist, one will be created. " echo "Otherwise, the existing '.gitignore' file will be appended to. The 'dry-run' command enables you to " echo "see a list of all detected file names that will be added to '.gitignore' files without making any " echo "changes." echo "" echo "If the 'run' command does its job properly, running 'dry-run' immediately after should display no " echo "planned actions." if [[ "$cmd" == "help" ]] then exit 0 fi exit 1 fi export IFS=$'\n'; for line in $(git status --short --untracked-files) do if [[ $line == '??'* ]] then file="${line:3}" d="$(dirname "${file}")" f="$(basename "${file}")" if [[ "$cmd" == "run" ]] then echo "Ignoring ${f} in ${d}/.gitignore" echo "${f}" >> "${d}/.gitignore" else echo "Will ignore ${f} in ${d}/.gitignore" fi fi done ace-8.0.4+dfsg.orig/bin/g++_metric.sh0000755000175000017500000000113215027201773016212 0ustar sudipsudip#!/bin/sh # # This simple script is used to gather compile time metrics. You can use # it with make like this: # # $ make CXX=g++_metric.sh # commandline=$@ # find the target and save it to a variable until [ -z "$1" ] # test all command line parameters do if [ "-o" = "$1" ] then shift target=$1 break fi shift done # echo out "(%x)", the return value from g++, so the script processes the output # will only use times for successful compilations, i.e., "(0)". /usr/bin/time -f "//compile time(%x): ${PWD#$ACE_ROOT/}/${target} %U %S" g++ $commandline retval=$? exit $retval ace-8.0.4+dfsg.orig/bin/ACEutils.pm0000644000175000017500000000406115027201773015747 0ustar sudipsudip require Process; $EXEPREFIX = ".".$DIR_SEPARATOR; $TARGETHOSTNAME = "localhost"; package ACE; sub CheckForExeDir { for($i = 0; $i <= $#ARGV; $i++) { if ($ARGV[$i] eq '-ExeSubDir') { if (defined $ARGV[$i + 1]) { $::EXEPREFIX = $ARGV[$i + 1].$::DIR_SEPARATOR; } else { print STDERR "You must pass a directory with ExeSubDir\n"; exit(1); } splice(@ARGV, $i, 2); } } } ### Check and remove, but don't actually use sub CheckForConfig { for($i = 0; $i <= $#ARGV;) { if ($ARGV[$i] eq '-Config') { if (!defined $ARGV[$i + 1]) { print STDERR "You must pass a configuration with Config\n"; exit(1); } splice(@ARGV, $i, 2); } else { $i++; } } } sub checkForTarget { my($cwd) = shift; for($i = 0; $i <= $#ARGV; $i++) { if ($ARGV[$i] eq '-chorus') { if (defined $ARGV[$i + 1]) { $::TARGETHOSTNAME = $ARGV[$i + 1]; $::EXEPREFIX = "rsh $::TARGETHOSTNAME arun $cwd$::DIR_SEPARATOR"; } else { print STDERR "The -chorus option requires " . "the hostname of the target\n"; exit(1); } splice(@ARGV, $i, 2); # Don't break from the loop just in case there # is an accidental duplication of the -chorus option } } } # Returns a unique id, uid for unix, last digit of IP for NT sub uniqueid { if ($^O eq "MSWin32") { my $uid = 1; open (IPNUM, "ipconfig|") || die "Can't run ipconfig: $!\n"; while () { if (/Address/) { $uid = (split (/: (\d+)\.(\d+)\.(\d+)\.(\d+)/))[4]; } } close IPNUM; return $uid; } else { return getpwnam (getlogin ()); } } # Waits until a file exists sub waitforfile { local($file) = @_; sleep 1 while (!(-e $file && -s $file)); } sub waitforfile_timed { my $file = shift; my $maxtime = shift; while ($maxtime-- != 0) { if (-e $file && -s $file) { return 0; } sleep 1; } return -1; } $sleeptime = 5; CheckForExeDir (); CheckForConfig (); 1; ace-8.0.4+dfsg.orig/bin/ace_components0000755000175000017500000000452515027201773016670 0ustar sudipsudip#! /bin/sh # # Encapsulates set/access of a components file, which records set of # components that were built in a library. Intended to be used by # GNUmakefiles and scripts. See ACE_wrappers/ace/GNUmakefile for an # example. # usage="usage: $0 --ace | --orbsvcs | --tao \ [--remove | --set \" \"]" #### #### Make sure that ACE_ROOT, and TAO_ROOT are set. #### if [ ! "$ACE_ROOT" ]; then echo $0': your ACE_ROOT environment variable is not set!' 1>&2 exit -1 fi if [ ! "$TAO_ROOT" ]; then TAO_ROOT=$ACE_ROOT/TAO export TAO_ROOT fi #### #### Process command line arguments. #### if [ $# -ge 1 ]; then case $1 in --ace) components_file=$ACE_ROOT/ace/ACE_COMPONENTS.list ;; --orbsvcs) components_file=$TAO_ROOT/orbsvcs/orbsvcs/ORBSVCS_COMPONENTS.list ;; --tao) components_file=$TAO_ROOT/tao/TAO_COMPONENTS.list ;; *) echo $usage; exit -1 ;; esac shift else echo $usage exit -1 fi set_components=0 append_components=0 if [ $# -ge 1 ]; then if [ $1 = '--set' ]; then set_components=1 shift if [ $# -eq 1 ]; then components=$1 shift else echo $usage exit -1 fi elif [ $1 = '--append' ]; then append_components=1 shift if [ $# -eq 1 ]; then components=$1 shift else echo $usage exit -1 fi elif [ $1 = '--remove' ]; then rm -f $components_file else echo $usage exit -1 fi fi if [ $set_components -eq 1 ]; then #### #### Update the components file, if it has changed since last set. #### if [ -f $components_file ]; then if echo "$components" | diff - $components_file > /dev/null; then : else echo "$components" > $components_file fi else echo "$components" > $components_file fi elif [ $append_components -eq 1 ]; then #### #### Update the components file, if it has changed since last set. #### if [ -f $components_file ]; then if cat $components_file | grep "$components" > /dev/null; then : else (cat $components_file; echo "$components") | tr ' ' '\012' | sort -u > $components_file.$$ mv -f $components_file.$$ $components_file fi else echo "$components" > $components_file fi else #### #### Access the contents of the components file, if it exists. #### if [ -f $components_file ]; then cat $components_file fi fi ace-8.0.4+dfsg.orig/bin/make-components0000755000175000017500000000055015027201773016765 0ustar sudipsudip#! /bin/sh # Allow each ACE component to be built in a simple way, as follows: # # $ACE_ROOT/bin/make-components "your flags" # # to build libACE.$(SOEXT), libACE_OS.$(SOEXT), etc. flags="$*" cd $ACE_ROOT/ace make $flags for component in `cat $ACE_ROOT/ace/ACE_COMPONENTS.list` do make $flags LIBACE=libACE_$component ACE_COMPONENTS=$component done exit 0 ace-8.0.4+dfsg.orig/bin/generate_rel_manpages0000755000175000017500000000455715027201773020207 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; use strict; require Cwd; ########### ###### Sanity Checks ########## my $perl_path = '/usr/bin/perl'; my $status= 0; &can_run($perl_path.' -V') || die "$0: perl path is incorrect, please fix the script\n"; my $doxy_path = '/usr/local/bin'; $ENV{'PATH'} = $ENV{'PATH'}.':'.$doxy_path; print "Starting doxygen document generation \n"; my $chgrp = 'chgrp'; my $cpio = 'cpio'; my $date = 'date'; my $egrep = 'egrep'; my $find = 'find'; my $gzip = 'gzip'; my $bzip = 'bzip2'; my $tar = 'tar'; my $mv = 'mv -f'; my $scp = 'scp '; my $rm = 'rm -f'; my $cp = 'cp -f'; my $md5sum = 'md5sum'; my $shell_cd = 'cd'; my $cksum_ext = 'md5'; my $redirect = '>'; my $checksum = '$md5sum'; $SIG{'HUP'} = $SIG{'INT'} = $SIG{'QUIT'} = $SIG{'TERM'} = 'cleanup'; my $release_filter = '\\( -name .svn -o -name build \\) -prune -o ' . '! -name \'.\#*\' ! -name \'\#*\' ! -name \'*~\' ' . '! -name \'*.MAK\' -print'; my $bin_files = "\"\\.mak|\\.mdp|\\.ide|\\.exe\|\\.ico\|\\.gz\|\\.zip\|" . "\\.gif|\\.vcp|\\.vcproj|\\.vcw|\\.sln\""; ######## ######## Main execution thread. ######## &ex ("bin/generate_doxygen.pl -is_release -perl_path $perl_path") && die "$0: failed to generate ACE man pages\n"; my $build_command = "$find ./html $release_filter | $cpio -o -H tar | " . "$gzip -9 > ACE-html.tar.gz && ". "$find ./html $release_filter | $cpio -o -H tar | " . "$bzip -9 > ACE-html.tar.bz2 && ". "$find ./html $release_filter | $egrep -v $bin_files | " . "zip ACE-html.zip -q9@ &&" . "md5sum ACE-html.tar.gz > ACE-html.tar.gz.md5 &&" . "md5sum ACE-html.tar.bz2 > ACE-html.tar.bz2.md5 &&" . "md5sum ACE-html.zip > ACE-html.zip.md5;"; &ex ($build_command) && die "$0: failed to package ACE man pages\n"; print "Finished doxygen document generation \n"; exit $status; ######## ######## Verify that a command can be executed, return 1 on sucess ######## sub can_run { my $command = shift; open (RUN, "$command 2>&1 |") || return 0; while () {} close(RUN) || return 0; return 1; } ######## ######## Execute a command, unless -n had been specified. Return value ######## of 0 indicates success. ######## sub ex () { my ($command) = @_; print "Command is $command \n"; system ("$command"); } ace-8.0.4+dfsg.orig/bin/auto_run_tests.pl0000755000175000017500000002160515027201773017361 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # -*- perl -*- # Executes test list files (*.lst), which contain commands with conditions # called configurations under which the commands are run. use strict; use lib "$ENV{ACE_ROOT}/bin"; if (defined $ENV{srcdir}) { use lib "$ENV{srcdir}/bin"; } use PerlACE::Run_Test; use Getopt::Long; use Cwd; use Env qw(ACE_ROOT PATH TAO_ROOT); if (!defined $TAO_ROOT && -d "$ACE_ROOT/TAO") { $TAO_ROOT = "$ACE_ROOT/TAO"; } sub run_command { my $test = shift; my $command = shift; my $print_error = shift; my $result = 0; if (system($command)) { $result = $? >> 8; if ($print_error) { my $signal = $? & 127; my $coredump = $? & 128; my $error_message; if ($? == -1) { $error_message = "failed to run: $!"; } elsif ($signal) { $error_message = sprintf("exited on signal %d", ($signal)); $error_message .= " and created coredump" if ($coredump); } else { $error_message = sprintf("returned with status %d", $result); } print "Error: $test $error_message\n"; } } return $result; } sub print_help { my $fd = shift; print $fd "auto_run_tests.pl [ ...] [ ...]\n" . "\n" . "Executes test list files (*.lst), which contain commands with conditions called\n" . "configurations under which the commands are run.\n" . "\n" . "Test lists files can be specified using the -l option or as non-option\n" . "arguments. The standard test list files for ACE/TAO and related software are\n" . "built-in and can be included via the listed options before. If not test list\n" . "files are specified, the script tries to use all the standard test list files\n" . "that can be found.\n" . "\n" . "Options:\n" . " --help | -h Display this help\n" . " --ace | -a Include the ACE tests\n" . " --orb | -o Include the TAO ORB tests\n" . " --tao | -t Include the TAO non-ORB tests\n" . " -l Include the tests from \n" . " --sandbox | -s Runs each program using a sandbox program\n" . " --root | -r Root directory for running the tests\n" . " --dry-run | -z Just print the commands that would be ran\n" . " --show-configs Just print possible values for -Config\n" . # These two are processed by PerlACE/ConfigList.pm " -Config Include tests with configuration\n" . " -Exclude Exclude tests with configuration\n" . # This one is processed by PerlACE/Process.pm " -ExeSubDir Subdirectory for finding the executables\n"; } ################################################################################ # Parse Options my $help = 0; my $ace_tests = 0; my $tao_orb_tests = 0; my $tao_tests = 0; my @l_options = (); my $sandbox = ''; my $dry_run = 0; my $startdir = ''; my $show_configs = 0; Getopt::Long::Configure('bundling', 'no_auto_abbrev'); my $invalid_arguments = !GetOptions( 'help|h' => \$help, 'ace|a' => \$ace_tests, 'orb|o' => \$tao_orb_tests, 'tao|t' => \$tao_tests, 'l=s' => \@l_options, 'sandbox|s=s' => \$sandbox, 'dry-run|z' => \$dry_run, 'root|r=s' => \$startdir, 'show-configs' => \$show_configs, ); if ($invalid_arguments || $help) { print_help($invalid_arguments ? *STDERR : *STDOUT); exit($invalid_arguments ? 1 : 0); } # Determine what test list files to use my @main_test_lists = ( [\$ace_tests, $ACE_ROOT, "bin/ace_tests.lst", "ACE"], [\$tao_orb_tests, $TAO_ROOT, "bin/tao_orb_tests.lst", "TAO ORB"], [\$tao_tests, $TAO_ROOT, "bin/tao_other_tests.lst", "TAO non-ORB"], ); my @file_list = (); my $list_error = 0; foreach my $i (@main_test_lists) { my $enabled_ref = $i->[0]; my $root = $i->[1]; my $list_file = $i->[2]; my $name = $i->[3]; my $list_file_path = "$root/$list_file"; if (defined $root && $$enabled_ref) { push(@file_list, $list_file_path); } elsif ($$enabled_ref) { $list_error = "option for $name tests passed, but the root enviroment variable isn't set"; } } push(@file_list, @l_options); push(@file_list, @ARGV); if (!scalar(@file_list)) { foreach my $i (@main_test_lists) { my $root = $i->[1]; my $list_file = $i->[2]; my $list_file_path = "$root/$list_file"; if (defined $root && -f $list_file_path) { push (@file_list, $list_file_path); } } if (!scalar(@file_list)) { $list_error = "no default test lists could be found"; } } if ($list_error) { print STDERR "ERROR: $list_error\n"; exit(1); } if ($show_configs) { foreach my $test_list (@file_list) { my $config_list = new PerlACE::ConfigList; $config_list->load($test_list); print "$test_list: " . $config_list->list_configs() . "\n"; } exit (0); } my $explicit_startdir = 0; if ($startdir) { $explicit_startdir = 1; } else { $startdir = "$ACE_ROOT"; } foreach my $test_lst (@file_list) { my $config_list = new PerlACE::ConfigList; if (-r $ACE_ROOT.$test_lst) { $config_list->load($ACE_ROOT.$test_lst); } elsif (-r "$startdir/$test_lst") { $config_list->load("$startdir/$test_lst"); } else { $config_list->load($test_lst); } # Insures that we search for stuff in the current directory. $PATH .= $Config::Config{path_sep} . '.'; foreach my $test ($config_list->valid_entries()) { my $directory = "."; my $program = "."; ## Remove intermediate '.' directories to allow the ## scoreboard matrix to read things correctly $test =~ s!/./!/!g; if ($test =~ /(.*)\/([^\/]*)$/) { $directory = $1; $program = $2; } else { $program = $test; } # this is to ensure that we dont print out the time for tests/run_test.pl # that test prints out the times for each of the ace tests individually my $is_ace_test = ($directory eq "tests"); if (! $is_ace_test) { print "auto_run_tests: $test\n"; if ($config_list->check_config('Coverity')) { $ENV{COVERITY_TEST_NAME} = $test; $ENV{COVERITY_SUITE_NAME} = $test_lst; $ENV{COVERITY_TEST_SOURCE} = "$directory/$program"; } } my($orig_dir) = $directory; if ($directory =~ m:^TAO/(.*):) { $directory = $1; } my $status; my @dirlist = ($ACE_ROOT."/$directory", $TAO_ROOT."/$directory"); # make sure to *first* check the explicitly specified directory and # only when nothing found there check the default dirs if ($explicit_startdir) { unshift (@dirlist, $startdir."/$directory"); unshift (@dirlist, $startdir."/$orig_dir"); } foreach my $path (@dirlist) { if (-d $path && ($status = chdir($path))) { last; } } if (!$status) { if ($explicit_startdir) { print STDERR "ERROR: Cannot chdir to $startdir/$directory\n"; } else { print STDERR "ERROR: Cannot chdir to $directory\n"; } next; } if ($program =~ /(.*?) (.*)/) { if (! -e $1) { print STDERR "ERROR: $directory.$1 does not exist\n"; next; } } else { if (! -e $program) { print STDERR "ERROR: $directory.$program does not exist\n"; next; } } ### Generate the -ExeSubDir and -Config options my $inherited_options = " -ExeSubDir $PerlACE::Process::ExeSubDir "; foreach my $config ($config_list->my_config_list()) { $inherited_options .= " -Config $config "; } my $cmd = ''; if ($sandbox) { #The Win32 sandbox takes the program and options in quotes, but the #posix sandbox takes the program and options as separate args. my($q) = ($^O eq 'MSWin32') ? '"' : ''; $cmd = "$sandbox ${q}perl $program $inherited_options${q}"; } else { $cmd = "perl $program$inherited_options"; } if ($dry_run) { my $cwd = getcwd(); print "In \"$cwd\" would run:\n $cmd\n"; } else { my $start_time = time(); my $result = run_command($test, $cmd, !$is_ace_test); my $time = time() - $start_time; # see note about tests/run_test.pl printing reports for ace tests individually if (!$is_ace_test) { print "\nauto_run_tests_finished: $test Time:$time"."s Result:$result\n"; print "==============================================================================\n"; } } } } ace-8.0.4+dfsg.orig/bin/make_release.py0000755000175000017500000007101315027201773016733 0ustar sudipsudip#!/usr/bin/env python3 # -*- coding: utf-8 -*- # @file make_release.py # @author William R. Otte # # Packaging script for ACE/TAO # # Requires Python 3.4+ from time import strftime import re import subprocess import shlex import multiprocessing import sys import enum import os from os.path import join import shutil ################################################## #### Global variables ################################################## """ Options from the command line """ opts=None """ Absolute path from the git workspace to be used for the release""" doc_root=None """ A dict containing version information used for the release. This dict contains entries of the form COMPONENT_version COMPONENT_micro COMPONENT_minor COMPONENT_major COMPONENT_code """ comp_versions = {} old_comp_versions = {} release_date = strftime (# ie: Mon Jan 23 00:35:37 CST 2006 "%a %b %d %H:%M:%S %Z %Y") cpu_count = multiprocessing.cpu_count() # Packaging configuration """ This is a regex that detects files that SHOULD NOT have line endings converted to CRLF when being put into a ZIP file """ bin_regex = re.compile ("\.(mak|mdp|ide|exe|ico|gz|zip|xls|sxd|gif|vcp|vcproj|vcw|sln|dfm|jpg|png|vsd|bz2|pdf|ppt|graffle|pptx|odt|sh)$") version_restr = r'(\d+)(?:\.(\d+)(?:\.(\d+))?)?' version_re = re.compile(version_restr) ################################################## #### Utility Methods ################################################## class ReleaseType(enum.Enum): major = enum.auto() minor = enum.auto() micro = enum.auto() def parse_args (): from argparse import ArgumentParser parser = ArgumentParser () mutex_args = parser.add_mutually_exclusive_group(required=True) for rt in ReleaseType: mutex_args.add_argument ('--' + rt.name, dest="release_type", default=None, action="store_const", const=rt, help="Create a " + rt.name + " release.") mutex_args.add_argument ("--kit", dest="action", default=None, action="store_const", const="kit", help="Create kits.") parser.add_argument ("--tag", action="store_true", help="Update tags and branches of the repositories", default=False) parser.add_argument ("--update", action="store_true", help="Update the version numbers", default=False) parser.add_argument ("--push", action="store_true", help="Push all changes to remote", default=False) parser.add_argument ("--dest", dest="package_dir", help="Specify destination for the created packages.", default=None) parser.add_argument ("--root", dest="repo_root", help="Specify an alternate repository root", default="https://github.com/DOCGroup/ACE_TAO.git") parser.add_argument ("--ace-tao-branch", help="ACE/TAO branch to update", default="master") parser.add_argument ("--mpc_root", help="Specify an alternate MPC repository root", default="https://github.com/DOCGroup/MPC.git") parser.add_argument ("--mpc-branch", help="MPC branch to update", default="master") parser.add_argument ("-n", dest="take_action", action="store_false", help="Take no action", default=True) parser.add_argument ("--verbose", action="store_true", help="Print out actions as they are being performed", default=False) options = parser.parse_args () if options.tag: if not options.update: print ("Warning: You are tagging a release, but not requesting a version increment") if not options.push: print ("Warning: You are tagging a release, but not requesting a push to remote") return options def ex (command, allow_fail=False): if vprint ("Executing", command, take_action=True): return status = os.system(command) if status != 0: print (("ERROR" if allow_fail else "WARNING") + ": Nonzero return value from " + command, file=sys.stderr) if not allow_fail: raise Exception def vprint (*args, take_action=False, **kwargs): """Prints the supplied message if verbose is enabled or this is a dry-run print statement. Return a bool of the latter case, so the caller can act differently. """ take_action = take_action and not opts.take_action if opts.verbose or take_action: print (*args, **kwargs) return take_action def get_tag (verdict, component): return "ACE+TAO-%d_%d_%d" % ( verdict[component + '_major'], verdict[component + '_minor'], verdict[component + '_micro']) def get_path (*args): if not args: args = ('',) return join (doc_root, 'ACE_TAO', *args) ################################################## #### Tagging methods ################################################## def commit (files): """ Commits the supplied list of files to the repository. """ version = get_tag(comp_versions, 'ACE') root_path = get_path() files = [i[len(root_path):] if i.startswith(root_path) else i for i in files] print ("Committing the following files for " + version + ':', " ".join (files)) if opts.take_action: for file in files: print ("Adding file " + file + " to commit") ex ("cd $DOC_ROOT/ACE_TAO && git add " + file) ex ("cd $DOC_ROOT/ACE_TAO && git commit -m\"" + version + "\"") def check_workspace (): """ Checks that the DOC and MPC repositories are up to date. """ try: ex ("cd $DOC_ROOT/ACE_TAO && git pull -p") print ("Successfully updated ACE/TAO working copy") except: print ("Unable to update ACE/TAO workspace at " + doc_root) raise try: ex ("cd $DOC_ROOT/MPC && git pull -p") print ("Successfully updated MPC working copy to revision ") except: print ("Unable to update the MPC workspace at " + doc_root + "/ACE/MPC") raise vprint ("Repos root URL = " + opts.repo_root + "\n") vprint ("Repos MPC root URL = " + opts.mpc_root + "\n") def update_version_files (component): """ Updates the version files for a given component. This includes Version.h, the PRF, and the VERSION.txt file.""" vprint ("Updating version files for " + component) retval = [] ## Update component/VERSION.txt path = get_path(component, "VERSION.txt") with open (path, "r+") as version_file: new_version = re.sub (component + " version .*", "%s version %s, released %s" % (component, comp_versions[component + "_version"], release_date), version_file.read ()) if opts.take_action: version_file.seek (0) version_file.truncate (0) version_file.write (new_version) else: print ("New version file for " + component) print (new_version) vprint ("Updating Version.h for " + component) retval.append(path) ## Update COMPONENT/component/Version.h comp_l = len(component + "_") parts = {k[comp_l:]:v for (k, v) in comp_versions.items() if k.startswith(component)} parts["comp"] = component version_header = """ // -*- C++ -*- // This is file was automatically generated by $ACE_ROOT/bin/make_release.py #define {comp}_MAJOR_VERSION {major} #define {comp}_MINOR_VERSION {minor} #define {comp}_MICRO_VERSION {micro} #define {comp}_VERSION \"{version}\" #define {comp}_VERSION_CODE 0x{code:x} #if !defined ({comp}_PATCH) # define {comp}_PATCH \"\" #endif #define {comp}_MAKE_VERSION_CODE(a,b,c) (((a) << 16) + ((b) << 8) + (c)) """.format(**parts) path = get_path(component, component.lower (), "Version.h") if opts.take_action: with open (path, 'w+') as version_h: version_h.write (version_header) else: print ("New Version.h for " + component) print (version_header) retval.append(path) # Update component/PROBLEM-REPORT-FORM vprint ("Updating PRF for " + component) version_line_re = re.compile (r"^\s*(\w+) +VERSION ?:") path = get_path(component, "PROBLEM-REPORT-FORM") with open (path, 'r+') as prf: new_prf = "" for line in prf.readlines (): match = version_line_re.search (line) if match is not None: vprint ("Found PRF Version for " + match.group (1)) new_version = comp_versions[match.group(1) + "_version"] line = version_re.sub (new_version, line) new_prf += line if opts.take_action: prf.seek (0) prf.truncate (0) prf.writelines (new_prf) else: print ("New PRF for " + component) print ("".join (new_prf)) retval.append(path) return retval def update_spec_file (): path = get_path('ACE', "rpmbuild", "ace-tao.spec") with open (path, 'r+') as spec_file: new_spec = "" for line in spec_file.readlines (): if line.find ("define ACEVER ") != -1: line = "%define ACEVER " + comp_versions["ACE_version"] + "\n" if line.find ("define TAOVER ") != -1: line = "%define TAOVER " + comp_versions["TAO_version"] + "\n" if line.find ("define is_major_ver") != -1: line = "%define is_major_ver {}\n".format( int(opts.release_type != ReleaseType.micro)) new_spec += line if opts.take_action: spec_file.seek (0) spec_file.truncate (0) spec_file.writelines (new_spec) else: print ("New spec file:") print ("".join (new_spec)) return [path] def update_debianbuild (): """ Updates ACE_ROOT/debian directory. - renames all files with version numbers in name; if file contains lintian overrides, update version numbers inside file - updates version numbers inside file debian/control Currently ONLY ACE is handled here """ prev_ace_ver = None path = get_path('ACE', 'debian', 'control') mask = re.compile ("(libace|libACE|libkokyu|libKokyu|libnetsvcs)([^\s,:]*-)(\d+\.\d+\.\d+)([^\s,:]*)") def update_ver (match): return match.group (1) + match.group (2) + comp_versions["ACE_version"] + match.group (4) # update debian/control with open (path, 'r+') as control_file: new_ctrl = "" for line in control_file.readlines (): if re.search ("^(Package|Depends|Suggests):", line) is not None: line = mask.sub (update_ver, line) elif re.search ('^Replaces:', line) is not None: line = line.replace (old_comp_versions["ACE_version"], comp_versions["ACE_version"]) new_ctrl += line if opts.take_action: control_file.seek (0) control_file.truncate (0) control_file.writelines (new_ctrl) else: print ("New control file:") print ("".join (new_ctrl)) return [path] def get_and_update_versions (): """ Gets current version information for each component, updates the version files, creates changelog entries, and commit the changes into the repository.""" try: get_comp_versions ("ACE") get_comp_versions ("TAO") if opts.update: files = [] files += update_version_files ("ACE") files += update_version_files ("TAO") files += create_changelog ("ACE") files += create_changelog ("TAO") files += update_spec_file () files += update_debianbuild () commit (files) except: print ("Fatal error in get_and_update_versions.") raise def create_changelog (component): """ Creates a changelog entry for the supplied component that includes the version number being released""" vprint ("Creating ChangeLog entry for " + component) old_tag = get_tag (old_comp_versions, 'ACE') # Generate changelogs per component path = get_path(component, "ChangeLogs", component + "-" + comp_versions[component + "_version_"]) ex ("cd $DOC_ROOT/ACE_TAO && git log " + old_tag + "..HEAD " + component + " > " + path) return [path] def get_comp_versions (component): """ Extracts the current version number from the VERSION.txt file and increments it appropriately for the release type requested.""" vprint ("Detecting current version for " + component) regex = re.compile (r"version " + version_restr) major = component + "_major" minor = component + "_minor" micro = component + "_micro" version = (None, None, None) with open (doc_root + "/ACE_TAO/" + component + "/VERSION.txt") as version_file: for line in version_file: match = regex.search (line) if match is not None: version = match.groups(default=0) vprint ("Detected version %s.%s.%s" % version) comp_versions[major] = int (version[0]) comp_versions[minor] = int (version[1]) comp_versions[micro] = int (version[2]) break print ("FATAL ERROR: Unable to locate current version for " + component) raise Exception # Also store the current release (old from now) old_comp_versions[major] = comp_versions[major] old_comp_versions[minor] = comp_versions[minor] old_comp_versions[micro] = comp_versions[micro] if opts.update: if opts.release_type == ReleaseType.major: comp_versions[major] += 1 comp_versions[minor] = 0 comp_versions[micro] = 0 elif opts.release_type == ReleaseType.minor: comp_versions[minor] += 1 comp_versions[micro] = 0 elif opts.release_type == ReleaseType.micro: comp_versions[micro] += 1 def make_version (versions, joiner): return joiner.join ([ str (versions[component + '_' + x]) for x in ReleaseType.__members__.keys () ]) comp_versions [component + "_version"] = make_version (comp_versions, '.') comp_versions [component + "_version_"] = make_version (comp_versions, '_') comp_versions [component + "_code"] = \ (comp_versions[major] << 16) + \ (comp_versions[minor] << 8) + \ comp_versions[micro] old_comp_versions [component + "_version"] = make_version (old_comp_versions, '.') old_comp_versions [component + "_version_"] = make_version (old_comp_versions, '_') if opts.update: vprint ("Updating from version %s to version %s" % (old_comp_versions [component + "_version"], comp_versions [component + "_version"])) else: vprint ("Found version %s" % (comp_versions [component + "_version"])) # else: # comp_versions [component + "_version"] = \ # str (comp_versions[major]) + '.' + \ # str (comp_versions[minor]) def update_latest_branch (product, which, main_branch): """Update one of the Latest_ACE8TAO4_* branches to point to the new release. """ name = "Latest_ACE8TAO4_" + which vprint ('Fast-forwarding', name, 'to', main_branch) ex ("cd $DOC_ROOT/" + product + " && git fetch . " + main_branch + ":" + name) def push_latest_branch (product, which, main_branch): """Update one of the remote Latest_ACE8TAO4_* branches to point to the new release. """ name = "Latest_ACE8TAO4_" + which if opts.push: vprint ("Pushing branch", name) ex ("cd $DOC_ROOT/" + product + " && git push origin refs/heads/" + name, allow_fail=True) def latest_branch_helper (fn, release_type): release_types = tuple(ReleaseType.__members__.values()) do = release_types[release_types.index(release_type):] if ReleaseType.micro in do: fn ("ACE_TAO", "Micro", opts.ace_tao_branch) fn ("MPC", "Micro", opts.mpc_branch) if ReleaseType.minor in do: fn ("ACE_TAO", "Minor", opts.ace_tao_branch) fn ("MPC", "Minor", opts.mpc_branch) if ReleaseType.major in do: fn ("ACE_TAO", "Major", opts.ace_tao_branch) fn ("MPC", "Major", opts.mpc_branch) def tag (): """Add the release tag and fast-forward the release branches on DOC and MPC repositories. """ tagname = get_tag(comp_versions, 'ACE') if opts.tag: if opts.take_action: vprint ("Placing tag %s on ACE_TAO" % (tagname)) ex ("cd $DOC_ROOT/ACE_TAO && git tag -a " + tagname + " -m\"" + tagname + "\"") vprint ("Placing tag %s on MPC" % (tagname)) ex ("cd $DOC_ROOT/MPC && git tag -a " + tagname + " -m\"" + tagname + "\"") # Update release branches latest_branch_helper (update_latest_branch, opts.release_type) else: vprint ("Placing tag %s on ACE_TAO" % (tagname)) vprint ("Placing tag %s on MPC" % (tagname)) print ("Creating tags:\n") print ("Placing tag " + tagname + "\n") def push (): """Push the release tag and the fast-forwarded release branches on DOC and MPC repositories. """ tagname = get_tag (comp_versions, 'ACE') if opts.push: if opts.take_action: vprint ("Pushing ACE_TAO", opts.ace_tao_branch, "to origin") ex ("cd $DOC_ROOT/ACE_TAO && git push origin " + opts.ace_tao_branch) vprint ("Pushing tag %s on ACE_TAO" % (tagname)) ex ("cd $DOC_ROOT/ACE_TAO && git push origin tag " + tagname) vprint ("Pushing tag %s on MPC" % (tagname)) ex ("cd $DOC_ROOT/MPC && git push origin tag " + tagname) # Push release branches latest_branch_helper (push_latest_branch, opts.release_type) else: vprint ("Pushing tag %s on ACE_TAO" % (tagname)) vprint ("Pushing tag %s on MPC" % (tagname)) print ("Pushing tags:\n") print ("Pushing tag " + tagname + "\n") ################################################## #### Packaging methods ################################################## def export_wc (stage_dir): tag = get_tag (comp_versions, 'ACE') # Clone the ACE repository with the needed tag print ("Retrieving ACE with tag " + tag) ex ("git clone --depth 1 --branch " + tag + " " + opts.repo_root + " " + stage_dir + "/ACE_TAO") # Clone the MPC repository with the needed tag print ("Retrieving MPC with tag " + tag) ex ("git clone --depth 1 --branch " + tag + " " + opts.mpc_root + " " + stage_dir + "/MPC") # Setting up stage_dir print ("Moving ACE") ex ("mv " + stage_dir + "/ACE_TAO/ACE " + stage_dir + "/ACE_wrappers") print ("Moving TAO") ex ("mv " + stage_dir + "/ACE_TAO/TAO " + stage_dir + "/ACE_wrappers/TAO") print ("Moving MPC") ex ("mv " + stage_dir + "/MPC " + stage_dir + "/ACE_wrappers/MPC") def update_packages (text_files_list, bin_files_list, stage_dir, package_dir): stream_encoding = 'utf-8' list_to_bytes = lambda l: ('\n'.join (l)).encode (stream_encoding) text_files = list_to_bytes (text_files_list) bin_files = list_to_bytes (bin_files_list) print ("Updating packages....") os.chdir (stage_dir) # -g appends, -q for quiet operation zip_base_args = " -gqu " # -l causes line ending conversion for windows zip_text_args = " -l " zip_file = stage_dir + "/zip-archive.zip" # -r appends, -f specifies file. tar_args = "-uf " tar_file = stage_dir + "/tar-archive.tar" # Zip binary files print ("\tAdding binary files to zip....") p = subprocess.Popen ( shlex.split ("xargs zip " + zip_base_args + zip_file), stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True) instream, outstream = (p.stdin, p.stdout) instream.write (bin_files) instream.close () outstream.close () # Need to wait for zip process spawned by popen2 to complete # before proceeding. os.wait () print ("\tAdding text files to zip.....") p = subprocess.Popen ( shlex.split ("xargs zip " + zip_base_args + zip_text_args + zip_file), stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True) instream, outstream = (p.stdin, p.stdout) instream.write (text_files) instream.close () outstream.close () # Need to wait for zip process spawned by popen2 to complete # before proceeding. os.wait () # Tar files print ("\tAdding to tar file....") if not os.path.exists (tar_file): open(tar_file, 'w').close () p = subprocess.Popen ( shlex.split ("xargs tar " + tar_args + tar_file), stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True) instream, outstream = (p.stdin, p.stdout) instream.write (b' ' + bin_files + b' ' + text_files) instream.close () print (outstream.read ().decode(stream_encoding)) outstream.close () os.wait () def move_packages (name, stage_dir, package_dir): """ Copies the temporary files from the stage_dir to the package_dir. Renames them to name.tar and name.zip, respectively, and compresses the tarfile with gzip and bzip2. """ print ("Storing packages for ", name) # Take care of the zip file print ("\tZip file...") target_file = join (package_dir, name + ".zip") shutil.copy (join (stage_dir, "zip-archive.zip"), target_file) ex ("md5sum " + target_file + " > " + target_file + ".md5") tar_file = join (stage_dir, "tar-archive.tar") target_file = join (package_dir, name + ".tar") # bzip print ("\tBzip2 file.....") shutil.copy (tar_file, target_file) ex ("bzip2 " + target_file) ex ("md5sum " + target_file + ".bz2 > " + target_file + ".bz2.md5") print ("\tgzip file.....") shutil.copy (tar_file, target_file) ex ("gzip " + target_file) ex ("md5sum " + target_file + ".gz > " + target_file + ".gz.md5") def create_file_lists (base_dir, prefix, exclude): """ Creates two lists of files: files that need CR->CRLF conversions (useful for zip files) and those that don't, excluding files/directories found in exclude. """ text_files = list () bin_files = list () for root, dirs, files in os.walk (base_dir, topdown=True): # print "root", root relroot = root.replace (base_dir, "") # print "relroot", relroot if relroot and relroot[0] == '/': relroot = relroot [1:] excluded = False for item in exclude: dir_item = item + '/' if relroot.startswith (dir_item) or relroot.startswith (item): # print "excluding", relroot excluded = True # else: # print relroot, "does not start with", dir_item, "or", item if excluded: continue # Remove dirs that are listed in our exclude pattern for item in dirs: # print "item", item # Remove our excludes if (item) in exclude: # print "Removing " + item + " from consideration...." dirs.remove (item) # Remove files that are listed in our exclude pattern for item in files: fullitem = os.path.join (relroot, item) if fullitem in exclude or item in exclude: # print "Removing " + fullitem + " from consideration...." continue else: if bin_regex.search (fullitem) is not None: bin_files.append ('"' + os.path.join (prefix, fullitem) + '"') else: text_files.append ('"' + os.path.join (prefix, fullitem) + '"') return (text_files, bin_files) def write_file_lists (comp, text, bin): with open (comp + ".files", 'w') as outfile: outfile.write ("\n".join (text)) outfile.write (".............\nbin files\n.............\n") outfile.write ("\n".join (bin)) def package (stage_dir, package_dir, decorator): """ Packages ACE, ACE+TAO releases of current staged tree, with decorator appended to the name of the archive. """ os.chdir (stage_dir) # Erase our old temp files try: # print "removing files", join (stage_dir, "zip-archive.zip"), join (stage_dir, "tar-archive.tar") os.remove (join (stage_dir, "zip-archive.zip")) os.remove (join (stage_dir, "tar-archive.tar")) except: print ("error removing files", join (stage_dir, "zip-archive.zip"), join (stage_dir, "tar-archive.tar")) pass # swallow any errors text_files, bin_files = create_file_lists (join (stage_dir, "ACE_wrappers"), "ACE_wrappers", ["TAO", ".gitignore", ".git"]) # write_file_lists ("fACE" + decorator, text_files, bin_files) update_packages (text_files, bin_files, stage_dir, package_dir) move_packages ("ACE" + decorator, stage_dir, package_dir) # for TAO: text_files, bin_files = create_file_lists (join (stage_dir, "ACE_wrappers/TAO"), "ACE_wrappers/TAO", [".gitignore", ".git"]) # write_file_lists ("fTAO" + decorator, text_files, bin_files) update_packages (text_files, bin_files, stage_dir, package_dir) move_packages ("ACE+TAO" + decorator, stage_dir, package_dir) def generate_workspaces (stage_dir): """ Generates workspaces in the given stage_dir """ print ("Generating workspaces...") # Make sure we are in the right directory... os.chdir (os.path.join (stage_dir, "ACE_wrappers")) # Set up our environment os.putenv ("ACE_ROOT", os.path.join (stage_dir, "ACE_wrappers")) os.putenv ("MPC_ROOT", os.path.join (stage_dir, "ACE_wrappers", "MPC")) os.putenv ("TAO_ROOT", os.path.join (stage_dir, "ACE_wrappers", "TAO")) os.putenv ("DDS_ROOT", "") # Create option strings mpc_command = os.path.join (stage_dir, "ACE_wrappers", "bin", "mwc.pl") exclude_option = ' -exclude TAO/TAO_*.mwc ' workers_option = ' -workers ' + str(cpu_count) mpc_option = ' -recurse -hierarchy -relative ACE_ROOT=' + stage_dir + '/ACE_wrappers ' mpc_option += ' -relative TAO_ROOT=' + stage_dir + '/ACE_wrappers/TAO ' msvc_exclude_option = ' ' vs2019_option = ' -name_modifier *_vs2019 ' vs2022_option = ' -name_modifier *_vs2022 ' redirect_option = str () if not opts.verbose: redirect_option = " >> ../mpc.log 2>&1" print ("\tGenerating GNUmakefiles....") ex (mpc_command + " -type gnuace " + \ exclude_option + workers_option + mpc_option + redirect_option) print ("\tGenerating VS2019 solutions...") ex (mpc_command + " -type vs2019 " + \ msvc_exclude_option + mpc_option + workers_option + vs2019_option + redirect_option) print ("\tGenerating VS2022 solutions...") ex (mpc_command + " -type vs2022 " + \ msvc_exclude_option + mpc_option + workers_option + vs2022_option + redirect_option) print ("\tCorrecting permissions for all generated files...") regex = [ '*.vc[p,w]', '*.bmak', '*.vcproj', '*.sln', '*.vcxproj', '*.filters', 'GNUmake*', ] ex ("find ./ " + ' -or '.join(["-name '%s'" % (i,) for i in regex]) + " | xargs chmod 0644") def create_kit (): """ Creates kits """ # Get version numbers for this working copy, note this will # not update the numbers. print ("Getting current version information....") get_comp_versions ("ACE") get_comp_versions ("TAO") print ("Creating working directories....") stage_dir, package_dir = make_working_directories () print ("Exporting working copy...") export_wc (stage_dir) ### make source only packages package (stage_dir, package_dir, "-src") generate_workspaces (stage_dir) ### create standard packages. package (stage_dir, package_dir, "") def make_working_directories (): """ Creates directories that we will be working in. In particular, we will have DOC_ROOT/stage-PID and DOC_ROOT/packages-PID """ stage_dir = join (doc_root, "stage-" + str (os.getpid ())) package_dir = join (doc_root, "package-" + str (os.getpid ())) os.mkdir (stage_dir) os.mkdir (package_dir) return (stage_dir, package_dir) def main (): if opts.action == "kit": print ("Creating a kit.") input ("Press enter to continue") create_kit () else: print ("Making a " + opts.release_type.name + " release.") input ("Press enter to continue") get_and_update_versions () tag () push () if __name__ == "__main__": opts = parse_args () doc_root = os.getenv ("DOC_ROOT") if doc_root is None: sys.exit ("ERROR: Environment DOC_ROOT must be defined.") main () ace-8.0.4+dfsg.orig/bin/inspxe-cl.sup0000644000175000017500000000504515027201773016376 0ustar sudipsudipsuppression = { type = {thread_start} stacks = { { !!!; func=_start,mod=ld-linux-x86-64.so.2,line=4496,func_line=4496; } } } suppression = { type = {uninitialized_memory_access} stacks = { allocation={ !!!; func=call_init,mod=ld-linux-x86-64.so.2,src=dl-init.c,line=84,func_line=50; } { !!!; func=strlen,mod=libc.so.6,src=strlen.S,line=205,func_line=139; } } } suppression = { type = {uninitialized_memory_access} stacks = { allocation={ !!!; func=call_init,mod=ld-linux-x86-64.so.2,src=dl-init.c,line=84,func_line=50; } { !!!; func=strlen,mod=libc.so.6,src=strlen.S,line=206,func_line=140; } } } suppression = { type = {uninitialized_memory_access} stacks = { allocation={ !!!; func=__libc_start_main,mod=libc.so.6,src=libc-start.c,line=269,func_line=150; } { !!!; func=strlen,mod=libc.so.6,src=strlen.S,line=205,func_line=139; } } } suppression = { type = {uninitialized_memory_access} stacks = { allocation={ !!!; func=__libc_start_main,mod=libc.so.6,src=libc-start.c,line=269,func_line=150; } { !!!; func=strlen,mod=libc.so.6,src=strlen.S,line=206,func_line=140; } } } suppression = { type = {uninitialized_memory_access} stacks = { allocation={ !!!; func=__libc_start_main,mod=libc.so.6,src=libc-start.c,line=269,func_line=150; } { !!!; func=strlen,mod=libc.so.6,src=strlen.S,line=204,func_line=138; } } } suppression = { type = {invalid_memory_access} stacks = { { !!!; func=strlen,mod=libc.so.6,src=strlen.S,line=137,func_line=71; } } } suppression = { type = {invalid_memory_access} stacks = { { !!!; func=__get_nprocs,mod=libc.so.6,src=getsysstats.c,line=132,func_line=5; } } } suppression = { type = {uninitialized_memory_access} stacks = { allocation={ !!!; func=__libc_start_main,mod=libc.so.6,src=libc-start.c,line=269,func_line=150; } { !!!; func=strlen,mod=libc.so.6,src=strlen.S,line=216,func_line=150; } } } suppression = { type = {uninitialized_memory_access} stacks = { allocation={ !!!; func=__libc_start_main,mod=libc.so.6,src=libc-start.c,line=269,func_line=150; } { !!!; func=strlen,mod=libc.so.6,src=strlen.S,line=217,func_line=151; } } } suppression = { type = {unreachable_memory_leak} stacks = { allocation={ !!!; func=strsignal,mod=libc.so.6,src=strsignal.c,line=56,func_line=15; } } } suppression = { type = {reachable_memory_leak} stacks = { allocation={ !!!; func=__cxa_finalize,mod=libc.so.6,src=cxa_finalize.c,line=56,func_line=26; } } } ace-8.0.4+dfsg.orig/bin/zap_svn_id.pl0000755000175000017500000000761715027201773016446 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -pi -S $0 ${1+"$@"}' & eval 'exec perl -0 -S $0 $argv:q' if 0; # You may want to run the "find" command with this script, which maybe # something like this: # # find . -type f \( -name "*.inl" -o -name "*.h" -o -name "*.cxx" -o -name "*.java" -o -name "*.l" -o -name "*.c" -o -name "*.mpd" -o -name "*.py" -o -name "*.cpp" -o -name "*.mpc" -o -name "*.idl" -o -name "*.conf" -o -name "*.mpb" -o -name "*.hpp" -o -name "*.pl" -o -name "*.mpt" -o -name "*.pm" -o -name "*.html" -o -name "*.xml" -o -name "*.y" \) -print | xargs $ACE_ROOT/bin/zap_svn_id.pl # The first three lines above let this script run without specifying the # full path to perl, as long as it is in the user's PATH. # Taken from perlrun man page. # Replace the old cvs-id tag with nothing BEGIN{undef $/;} s///smg; # Replace a single doxygen style with two spaces before the Id with one space BEGIN{undef $/;} s/ \*\n \* \$Id\$\n \*\n/ \*\n \* \$Id\$\n \*\n/smg; # Replace a three line doxygen style Id tag with just line * BEGIN{undef $/;} s/ \*\n \* \$Id\$\n \*\n/ \*\n/smg; # Replace a three line doxygen style Id tag with just line * BEGIN{undef $/;} s/\*\*\n \* \$Id\$\n \*\n/\*\*\n/smg; # Replace a three line c-style id tag with an empty line below that with nothing BEGIN{undef $/;} s/\/\/\n\/\/ \$Id\$\n\/\/\n\n//smg; # Replace a three line c-style id tag with nothing BEGIN{undef $/;} s/\/\/\n\/\/ \$Id\$\n\/\/\n//smg; # Replace a two line c-style id tag with an empty line below that with nothing BEGIN{undef $/;} s/\/\/\n\/\/ \$Id\$\n\n//smg; # Replace a two line c-style id tag with nothing BEGIN{undef $/;} s/\/\/\n\/\/ \$Id\$\n//smg; # Replace a one line c-style id tag with an empty line below that with nothing BEGIN{undef $/;} s/\/\/ \$Id\$\n\n//smg; # Replace a one line c-style id tag with nothing BEGIN{undef $/;} s/\/\/ \$Id\$\n//smg; # Replace a one line c-style id tag with an empty line below that with nothing BEGIN{undef $/;} s/\/\/\$Id\$\n\n//smg; # Replace a one line c-style id tag with nothing BEGIN{undef $/;} s/\/\/\$Id\$\n//smg; # Replace a one line start C++ line with Id with BEGIN{undef $/;} s/\/\/ -\*- C\+\+ -\*- \$Id\$\n/\/\/ -\*- C\+\+ -\*-\n/smg; # Replace a one line start C++ line with Id with BEGIN{undef $/;} s/\/\/ -\*- C\+\+ -\*- \$Id\$\n/\/\/ -\*- C\+\+ -\*-\n/smg; # Replace a one line start C++ line with Id with BEGIN{undef $/;} s/\/\/ -\*- C\+\+ -\*- \$Id\$\n/\/\/ -\*- C\+\+ -\*-\n/smg; # Replace a three line doxygen style Id tag with just line * BEGIN{undef $/;} s/\/\*\n \* \$Id\$\n \*\n/\/\*\n/smg; # Replace a one line c++-style id tag with an empty line below that with nothing BEGIN{undef $/;} s/\/\* \$Id\$ \*\/\n\n//smg; # Replace a one line c++-style id tag with an empty line below that with nothing BEGIN{undef $/;} s/\/\* \$Id\$ \*\/\n//smg; # Replace a three perl style Id tag with just line # BEGIN{undef $/;} s/ \#\n \# \$Id\$\n \#\n/ \#\n/smg; BEGIN{undef $/;} s/\#\n\# \$Id\$\n\#\n/\#\n/smg; BEGIN{undef $/;} s/ \#\n \#\$Id\$\n \#\n/ \#\n/smg; BEGIN{undef $/;} s/\#\n\#\$Id\$\n\#\n/\#\n/smg; BEGIN{undef $/;} s/\#\$Id\$\n//smg; BEGIN{undef $/;} s/\# \$Id\$\n//smg; BEGIN{undef $/;} s/\$Id\$//smg; # Trailing whitespaces BEGIN{undef $/;} s/\# \n//smg; BEGIN{undef $/;} s/\*\* \n/\*\*\n/smg; BEGIN{undef $/;} s/\/\*\n\*\*\n\*\*\n/\/\*\n/smg; BEGIN{undef $/;} s/\/\* \n/\/\*\n/smg; BEGIN{undef $/;} s/ \* \n/ \*\n/smg; BEGIN{undef $/;} s/ \* \n/ \*\n/smg; BEGIN{undef $/;} s/\*\n\* \n\*\n/\*\n/smg; BEGIN{undef $/;} s/ \*\n \*\n \*\n/ \*\n/smg; BEGIN{undef $/;} s/ \*\n \*\/\n/ \*\/\n/smg; BEGIN{undef $/;} s/\/\/ \n/\/\/\n/smg; BEGIN{undef $/;} s/ \*\n \*\n/ \*\n/smg; BEGIN{undef $/;} s/\/\/\n\/\/\n/\/\/\n/smg; BEGIN{undef $/;} s/ \n/\n/smg; BEGIN{undef $/;} s/\/\/ cvs-id :\n//smg; # Empty header BEGIN{undef $/;} s/\/\*\n \*\/\n//smg; BEGIN{undef $/;} s/\/\*\*\n \*\/\n//smg; BEGIN{undef $/;} s/\/\*\*\n \*\n \*\/\n//smg; BEGIN{undef $/;} s/\/\*\*\n\*\n\*\/\n//smg; ace-8.0.4+dfsg.orig/bin/copy-local-script.sh0000755000175000017500000000021615027201773017641 0ustar sudipsudip#!/bin/sh for i in *.gz *.bz2 *.zip *.md5; do d=`echo $i | sed 's/\.[tz][ai][rp]/-8.0.4&/'` echo "Copying $i to $d" cp -ip $i $d done ace-8.0.4+dfsg.orig/bin/ace_tests.lst0000644000175000017500000000206115027201773016434 0ustar sudipsudip# This is the list of run_test.pl's that need to be run by # auto_run_tests.pl. # Each line has its own test, and a test can be followed by a # list of configurations it does _not_ run on. # # Example: TAO\examples\foo\run_test.pl: !MINIMUM !ST # # NOTE: This file contains tests only for ACE. Please do not include # tests in TAO here.. tests/run_test.pl examples/Reactor/WFMO_Reactor/run_test.pl: !Cygwin !VxWorks !ACE_FOR_TAO !LabVIEW_RT !FACE_SAFETY protocols/tests/RMCast/run_test.pl: RMCAST !ST !NO_MCAST !nsk !LynxOS !ACE_FOR_TAO !VxWorks !LabVIEW_RT protocols/tests/HTBP/ping/run_test.pl: !NO_UUID !nsk !LynxOS !ACE_FOR_TAO !VxWorks !LabVIEW_RT !FACE_SAFETY protocols/tests/HTBP/Send_Recv_Tests/run_test.pl: !NO_UUID !nsk !LynxOS !ACE_FOR_TAO !VxWorks !LabVIEW_RT !FACE_SAFETY protocols/tests/HTBP/Send_Large_Msg/run_test.pl: !NO_UUID !nsk !LynxOS !ACE_FOR_TAO !VxWorks !LabVIEW_RT !FACE_SAFETY protocols/tests/HTBP/Reactor_Tests/run_test.pl: !NO_UUID !nsk !LynxOS !ACE_FOR_TAO !VxWorks !LabVIEW_RT !FACE_SAFETY tests/non_mpc_makefile/Bug_3708_Regression.pl: !ARCH ace-8.0.4+dfsg.orig/bin/regenerate_exports.pl0000755000175000017500000000212015027201773020177 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # Goes through ACE/TAO and replaces use File::Find; use Cwd; $args = ''; $root = cwd.'/'; while ($#ARGV >= 0) { $args = $args . ' ' . shift @ARGV; } # wanted is only used for the File::Find sub wanted { my $file = $File::Find::name; $file =~ s/\.\//$root/; if ($File::Find::name =~ /\_export\.h$/i) { my $flag = 0; my $name = ''; if (!open (FILE, $file)) { print STDERR "Error: Could not open $file\n"; } while () { $flag = 1 if ((/generate_export/ || /GenExportH/) && $flag == 0); $name = $1 if (/define (\w*)_Export/); } if ($flag == 1) { print "Regenerating: $file\n"; if ($OSNAME eq 'MSWIn32') { $file =~ s/\//\\/g; } system ("perl -S generate_export_file.pl $args $name > $file"); } else { print "Skipping: $file\n"; } close FILE; } } find (\&wanted, "."); ace-8.0.4+dfsg.orig/bin/install_proj.sh0000755000175000017500000000103415027201773016774 0ustar sudipsudip#!/bin/sh # ACE's "make install" for an MPC-generated workspace will build all targets that aren't yet built # This script looks for projects that have been built and installs just those projects this_dir=$(realpath $(dirname $0)) for makefile in $(find . -type f -name 'GNUmakefile.*'); do if grep -q 'GNU Makefile' $makefile; then echo Checking $makefile cd $(dirname $makefile) make -f $this_dir/install_proj.mk PROJECT_MAKEFILE=$(basename $makefile) checked-install "$@" cd - >/dev/null fi done ace-8.0.4+dfsg.orig/bin/mpc.pl0000755000175000017500000000365615027201773015070 0ustar sudipsudip#!/usr/bin/env perl eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}' & eval 'exec perl -w -S $0 $argv:q' if 0; # ****************************************************************** # Author: Chad Elliott # Date: 6/17/2002 # ****************************************************************** # ****************************************************************** # Pragma Section # ****************************************************************** require 5.006; use strict; use FindBin; use File::Spec; use File::Basename; my($basePath) = (defined $FindBin::RealBin ? $FindBin::RealBin : File::Spec->rel2abs(dirname($0))); if ($^O eq 'VMS') { $basePath = File::Spec->rel2abs(dirname($0)) if ($basePath eq ''); $basePath = VMS::Filespec::unixify($basePath); } $basePath .= '/MakeProjectCreator'; my($mpcroot) = $ENV{MPC_ROOT}; my($mpcpath) = (defined $mpcroot ? $mpcroot : dirname(dirname($basePath)) . '/MPC'); unshift(@INC, $mpcpath . '/modules'); if (defined $mpcroot) { print STDERR "MPC_ROOT was set to $mpcroot.\n"; } if (! -d "$mpcpath/modules") { print STDERR "ERROR: Unable to find the MPC modules in $mpcpath.\n"; if (defined $mpcroot) { print STDERR "Your MPC_ROOT environment variable does not point to a ", "valid MPC location.\n"; } else { print STDERR "You can set the MPC_ROOT environment variable to the ", "location of MPC.\n"; } exit(255); } require Driver; # ************************************************************ # Subroutine Section # ************************************************************ sub getBasePath { return $mpcpath; } # ************************************************************ # Main Section # ************************************************************ my($driver) = new Driver($basePath, Driver::projects()); exit($driver->run(@ARGV)); ace-8.0.4+dfsg.orig/bin/PerlACE/0000755000175000017500000000000015046037655015161 5ustar sudipsudipace-8.0.4+dfsg.orig/bin/PerlACE/ProcessVX_Unix.pm0000644000175000017500000003757715027201773020432 0ustar sudipsudip#!/usr/bin/env perl package PerlACE::ProcessVX; use strict; use POSIX "sys_wait_h"; use File::Basename; use File::Spec; use Config; use FileHandle; use Cwd; eval { require Net::Telnet; }; ############################################################################### ### Grab signal names my @signame; if (defined $Config{sig_name}) { my $i = 0; foreach my $name (split (' ', $Config{sig_name})) { $signame[$i] = $name; $i++; } } else { my $i; for ($i = 0; $i < 255; ++$i) { $signame[$i] = $i; } } ############################################################################### # This is what GetExitCode will return if the process is still running. my $STILL_ACTIVE = 259; ############################################################################### ### Constructor and Destructor sub new { my $proto = shift; my $class = ref ($proto) || $proto; my $self = {}; $self->{RUNNING} = 0; $self->{IGNOREEXESUBDIR} = 1; $self->{IGNOREHOSTROOT} = 0; $self->{PROCESS} = undef; $self->{EXECUTABLE} = shift; $self->{ARGUMENTS} = shift; if (!defined $PerlACE::ProcessVX::WAIT_DELAY_FACTOR) { $PerlACE::ProcessVX::WAIT_DELAY_FACTOR = 2; } if (!defined $PerlACE::ProcessVX::RebootCmd) { $PerlACE::ProcessVX::RebootCmd = "reboot 0x02"; } bless ($self, $class); return $self; } sub DESTROY { my $self = shift; if ($self->{RUNNING} == 1) { print STDERR "ERROR: <", $self->{EXECUTABLE}, "> still running upon object destruction\n"; $self->Kill (); } if (defined $ENV{'ACE_RUN_VX_IBOOT'} && !defined $ENV{'ACE_RUN_VX_NO_SHUTDOWN'}) { # Shutdown the target to save power $self->iboot_cycle_power(1); } } ############################################################################### # Use the "expect" program to invoke telnet, doesn't need Perl's Net::Telnet. # This is run by the child process which was forked from Spawn(). sub expect_telnet { my($host, $port, $prompt, $cmdsRef) = @_; my $pid = open(EXP, "|expect -f -") or die "ERROR: Could not run 'expect'"; $SIG{'TERM'} = sub { # If the parent wants to Kill() this process, kill 'TERM', $pid; # send a SIGTERM to the expect process and $SIG{'TERM'} = 'DEFAULT'; # then go back to the normal handler for TERM kill 'TERM', $$; # and invoke it. }; print EXP <{RUNNING} == 1) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> already running\n"; return -1; } if (!defined $self->{EXECUTABLE}) { print STDERR "ERROR: Cannot Spawn: No executable specified\n"; return -1; } if ($self->{IGNOREEXESUBDIR} == 0) { if (!-f $self->Executable ()) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> not found\n"; return -1; } } my $status = 0; my $cmdline; # Reboot the target if necessery $self->reboot(); my $program = $self->Executable (); my $exe_cwdrel = dirname ($program); my $prjroot = defined $ENV{'ACE_RUN_VX_PRJ_ROOT'} ? $ENV{'ACE_RUN_VX_PRJ_ROOT'} : $ENV{'ACE_ROOT'}; $exe_cwdrel = cwd() if length ($exe_cwdrel) == 0; $exe_cwdrel = File::Spec->abs2rel($exe_cwdrel, $prjroot); my $cwdrel = File::Spec->abs2rel(cwd(), $prjroot); $program = basename($program, $PerlACE::ProcessVX::ExeExt); my @cmds; my $cmdnr = 0; my $arguments = ""; my $prompt = ''; my $exesubdir = defined $ENV{'ACE_RUN_VX_EXE_SUBDIR'} ? $ENV{'ACE_RUN_VX_EXE_SUBDIR'} : ""; if (defined $ENV{'ACE_RUN_VX_STARTUP_SCRIPT'}) { if (defined $ENV{'ACE_RUN_VX_STARTUP_SCRIPT_ROOT'}) { $cmds[$cmdnr++] = 'cd "' . $ENV{'ACE_RUN_VX_STARTUP_SCRIPT_ROOT'} . '"'; } $cmds[$cmdnr++] = '< ' . $ENV{'ACE_RUN_VX_STARTUP_SCRIPT'}; } if (defined $ENV{'ACE_RUN_VX_STARTUP_COMMAND'}) { $cmds[$cmdnr++] = $ENV{'ACE_RUN_VX_STARTUP_COMMAND'}; } if ($PerlACE::VxWorks_RTP_Test) { $cmds[$cmdnr++] = 'cmd'; if ( defined $ENV{'ACE_RUN_VX_TGTSVR_DEFGW'} && $self->{SET_VX_DEFGW}) { $cmds[$cmdnr++] = "C mRouteAdd(\"0.0.0.0\", \"" . $ENV{'ACE_RUN_VX_TGTSVR_DEFGW'} . "\", 0,0,0)"; $PerlACE::ProcessVX::VxDefGw = 0; } if (defined $ENV{'ACE_RUN_VX_TGT_STARTUP_SCRIPT'}) { my(@start_commands); if (handle_startup_script ($ENV{'ACE_RUN_VX_TGT_STARTUP_SCRIPT'}, \@start_commands)) { push @cmds, @start_commands; $cmdnr += scalar @start_commands; } } $cmds[$cmdnr++] = 'cd "' . $ENV{'ACE_RUN_VX_TGTSVR_ROOT'} . "/" . $cwdrel . '"'; $cmds[$cmdnr++] = 'C putenv("TMPDIR=' . $ENV{'ACE_RUN_VX_TGTSVR_ROOT'} . "/" . $cwdrel . '")'; if (defined $ENV{'ACE_RUN_ACE_DEBUG'}) { $cmds[$cmdnr++] = 'C putenv("ACE_DEBUG=' . $ENV{'ACE_RUN_ACE_DEBUG'} . '")'; } if (defined $ENV{'ACE_RUN_TAO_ORB_DEBUG'}) { $cmds[$cmdnr++] = 'C putenv("TAO_ORB_DEBUG=' . $ENV{'ACE_RUN_TAO_ORB_DEBUG'} . '")'; } if (defined $ENV{'ACE_RUN_ACE_LD_SEARCH_PATH'}) { $cmds[$cmdnr++] = 'C putenv("ACE_LD_SEARCH_PATH=' . $ENV{'ACE_RUN_ACE_LD_SEARCH_PATH'} . '")'; } if (defined $self->{TARGET}) { my $x_env_ref = $self->{TARGET}->{EXTRA_ENV}; while ( my ($env_key, $env_value) = each(%$x_env_ref) ) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "INFO: adding target environment $env_key=$env_value\n"; } $cmds[$cmdnr++] = 'C putenv("' . $env_key. '=' . $env_value . '")'; } } if (defined $ENV{'ACE_RUN_VX_CHECK_RESOURCES'}) { $cmds[$cmdnr++] = 'C memShow()'; } $cmdline = $program . $PerlACE::ProcessVX::ExeExt . ' ' . $self->{ARGUMENTS}; $cmds[$cmdnr++] = $cmdline; $prompt = '\[vxWorks \*\]\# $'; } if ($PerlACE::VxWorks_Test) { if ( defined $ENV{'ACE_RUN_VX_TGTSVR_DEFGW'} && $PerlACE::ProcessVX::VxDefGw) { $cmds[$cmdnr++] = "mRouteAdd(\"0.0.0.0\", \"" . $ENV{'ACE_RUN_VX_TGTSVR_DEFGW'} . "\", 0,0,0)"; $PerlACE::ProcessVX::VxDefGw = 0; } if (defined $ENV{'ACE_RUN_VX_TGT_STARTUP_SCRIPT'}) { my(@start_commands); if (handle_startup_script ($ENV{'ACE_RUN_VX_TGT_STARTUP_SCRIPT'}, \@start_commands)) { push @cmds, @start_commands; $cmdnr += scalar @start_commands; } } my(@load_commands); my(@unload_commands); if (!$PerlACE::Static && !$PerlACE::VxWorks_RTP_Test) { my $vxtest_file = $program . '.vxtest'; if (handle_vxtest_file($self, $vxtest_file, \@load_commands, \@unload_commands)) { $cmds[$cmdnr++] = "cd \"$ENV{'ACE_RUN_VX_TGTSVR_ROOT'}/lib\""; push @cmds, @load_commands; $cmdnr += scalar @load_commands; } else { print STDERR "ERROR: Cannot find <", $vxtest_file, ">\n"; return -1; } } $cmds[$cmdnr++] = 'cd "' . $ENV{'ACE_RUN_VX_TGTSVR_ROOT'} . "/" . $exe_cwdrel . "/" . $exesubdir . '"'; $cmds[$cmdnr++] = 'putenv("TMPDIR=' . $ENV{'ACE_RUN_VX_TGTSVR_ROOT'} . "/" . $cwdrel . '")'; if (defined $ENV{'ACE_RUN_VX_CHECK_RESOURCES'}) { $cmds[$cmdnr++] = 'memShow()'; } if (defined $ENV{'ACE_RUN_ACE_DEBUG'}) { $cmds[$cmdnr++] = 'putenv("ACE_DEBUG=' . $ENV{'ACE_RUN_ACE_DEBUG'} . '")'; } if (defined $ENV{'ACE_RUN_TAO_ORB_DEBUG'}) { $cmds[$cmdnr++] = 'putenv("TAO_ORB_DEBUG=' . $ENV{'ACE_RUN_TAO_ORB_DEBUG'} . '")'; } if (defined $ENV{'ACE_RUN_ACE_LD_SEARCH_PATH'}) { $cmds[$cmdnr++] = 'putenv("ACE_LD_SEARCH_PATH=' . $ENV{'ACE_RUN_ACE_LD_SEARCH_PATH'} . '")'; } if (defined $self->{TARGET}) { my $x_env_ref = $self->{TARGET}->{EXTRA_ENV}; while ( my ($env_key, $env_value) = each(%$x_env_ref) ) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "INFO: adding target environment $env_key=$env_value\n"; } $cmds[$cmdnr++] = 'putenv("' . $env_key. '=' . $env_value . '")'; } } $cmds[$cmdnr++] = 'ld <'. $program . $PerlACE::ProcessVX::ExeExt; $cmdline = $program . $PerlACE::ProcessVX::ExeExt . ' ' . $self->{ARGUMENTS}; if (defined $self->{ARGUMENTS}) { ($arguments = $self->{ARGUMENTS})=~ s/\"/\\\"/g; ($arguments = $self->{ARGUMENTS})=~ s/\'/\\\'/g; $arguments = ",\"" . $arguments . "\""; } if (defined $ENV{'ACE_RUN_VX_TGTSRV_WORKINGDIR'}) { $cmds[$cmdnr++] = 'cd "' . $ENV{'ACE_RUN_VX_TGTSRV_WORKINGDIR'} . '"'; } else { $cmds[$cmdnr++] = 'cd "' . $ENV{'ACE_RUN_VX_TGTSVR_ROOT'} . "/" . $cwdrel . '"'; } $cmds[$cmdnr++] = 'ace_vx_rc = vx_execae(ace_main' . $arguments . ')'; $cmds[$cmdnr++] = 'unld "'. $program . $PerlACE::ProcessVX::ExeExt . '"'; push @cmds, @unload_commands; $cmdnr += scalar @unload_commands; $prompt = '-> $'; } FORK: { if ($self->{PROCESS} = fork) { #parent here bless $self; } elsif (defined $self->{PROCESS}) { #child here my $telnet_port = $ENV{'ACE_RUN_VX_TGT_TELNET_PORT'}; my $telnet_host = $ENV{'ACE_RUN_VX_TGT_TELNET_HOST'}; if (!defined $telnet_host) { $telnet_host = $ENV{'ACE_RUN_VX_TGTHOST'}; } if (!defined $telnet_port) { $telnet_port = 23; } if (defined $ENV{'ACE_RUN_VX_USE_EXPECT'}) { expect_telnet($telnet_host, $telnet_port, $prompt, \@cmds); sleep(2); exit; } if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "Opening telnet connection <" . $telnet_host . ":". $telnet_port . ">\n"; } my $t = new Net::Telnet(Timeout => 600, Errmode => 'return', Host => $telnet_host, Port => $telnet_port); if (!defined $t) { die "ERROR: Telnet failed to <" . $telnet_host . ":". $telnet_port . ">"; } my $retries = 10; while ($retries--) { if (!$t->open()) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "Couldn't open telnet connection; sleeping then retrying\n"; } if ($retries == 0) { die "ERROR: Telnet open to <" . $telnet_host . ":". $telnet_port . "> " . $t->errmsg; } sleep(5); } else { last; } } my $target_login = $ENV{'ACE_RUN_VX_LOGIN'}; my $target_password = $ENV{'ACE_RUN_VX_PASSWORD'}; if (defined $target_login) { $t->waitfor('/VxWorks login: $/'); $t->print("$target_login"); } if (defined $target_password) { $t->waitfor('/Password: $/'); $t->print("$target_password"); } my $buf = ''; # wait for the prompt my $prompt1 = '->[\ ]$'; while (1) { my $blk = $t->get; print $blk; $buf .= $blk; if ($buf =~ /$prompt1/) { last; } } if ($buf !~ /$prompt1/) { die "ERROR: Didn't got prompt but got <$buf>"; } my $i = 0; my @lines; while($i < $cmdnr) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print $cmds[$i]."\n"; } if ($t->print ($cmds[$i++])) { # After each command wait for the prompt my $buf = ''; while (1) { my $blk = $t->get; print $blk; $buf .= $blk; if ($buf =~ /$prompt/) { last; } } } else { print $t->errmsg; } } $t->close(); sleep(2); exit; } elsif ($! =~ /No more process/) { #EAGAIN, supposedly recoverable fork error sleep 5; redo FORK; } else { # weird fork error print STDERR "ERROR: Can't fork <" . $cmdline . ">: $!\n"; } } $self->{RUNNING} = 1; return 0; } # Terminate the process and wait for it to finish sub TerminateWaitKill ($) { my $self = shift; my $timeout = shift; if ($self->{RUNNING}) { print STDERR "INFO: $self->{EXECUTABLE} being killed.\n"; kill ('TERM', $self->{PROCESS}); $PerlACE::ProcessVX::DoVxInit = 1; # force reboot on next run } return $self->WaitKill ($timeout); } # really only for internal use sub check_return_value ($) { my $self = shift; my $rc = shift; my $CC_MASK = 0xff00; # Exit code processing if ($rc == 0) { return 0; } elsif ($rc == $CC_MASK) { print STDERR "ERROR: <", $self->{EXECUTABLE}, "> failed: $!\n"; $PerlACE::ProcessVX::DoVxInit = 1; # force reboot on next run return ($rc >> 8); } elsif (($rc & 0xff) == 0) { $rc >>= 8; return $rc; } # Remember Core dump flag my $dump = 0; if ($rc & 0x80) { $rc &= ~0x80; $dump = 1; } # check for ABRT, KILL or TERM if ($rc == 6 || $rc == 9 || $rc == 15) { return 0; } print STDERR "ERROR: <", $self->{EXECUTABLE}, "> exited with "; print STDERR "coredump from " if ($dump == 1); print STDERR "signal $rc : ", $signame[$rc], "\n"; $PerlACE::ProcessVX::DoVxInit = 1; # force reboot on next run return 0; } sub Kill () { my $self = shift; if ($self->{RUNNING} && !defined $ENV{'ACE_TEST_WINDOW'}) { kill ((defined $ENV{'ACE_RUN_VX_USE_EXPECT'}) ? 'TERM' : 'KILL', $self->{PROCESS}); waitpid ($self->{PROCESS}, 0); $self->check_return_value ($?); } $self->{RUNNING} = 0; } # Wait until a process exits. # return -1 if the process is still alive. sub Wait ($) { my $self = shift; my $timeout = shift; if (!defined $timeout || $timeout < 0) { waitpid ($self->{PROCESS}, 0); } else { return TimedWait($self, $timeout); } } sub TimedWait ($) { my $self = shift; my $timeout = shift; if ($PerlACE::Process::WAIT_DELAY_FACTOR > 0) { $timeout *= $PerlACE::Process::WAIT_DELAY_FACTOR; } # Multiply with 10 because we wait a tenth of a second each time $timeout *= 10; while ($timeout-- != 0) { my $pid = waitpid ($self->{PROCESS}, &WNOHANG); if ($pid != 0 && $? != -1) { return $self->check_return_value ($?); } select(undef, undef, undef, 0.1); } $PerlACE::ProcessVX::DoVxInit = 1; # force reboot on next run return -1; } 1; ace-8.0.4+dfsg.orig/bin/PerlACE/ProcessWinCE_Unix.pm0000644000175000017500000002733615027201773021032 0ustar sudipsudip#!/usr/bin/env perl package PerlACE::ProcessVX; use strict; use POSIX "sys_wait_h"; use File::Basename; use File::Spec; use Config; use FileHandle; use Cwd; eval { require Net::Telnet; }; ############################################################################### ### Grab signal names my @signame; if (defined $Config{sig_name}) { my $i = 0; foreach my $name (split (' ', $Config{sig_name})) { $signame[$i] = $name; $i++; } } else { my $i; for ($i = 0; $i < 255; ++$i) { $signame[$i] = $i; } } ############################################################################### # This is what GetExitCode will return if the process is still running. my $STILL_ACTIVE = 259; ############################################################################### ### Constructor and Destructor sub new { my $proto = shift; my $class = ref ($proto) || $proto; my $self = {}; $self->{RUNNING} = 0; $self->{IGNOREEXESUBDIR} = 1; $self->{IGNOREHOSTROOT} = 0; $self->{PROCESS} = undef; $self->{EXECUTABLE} = shift; $self->{ARGUMENTS} = shift; $self->{TARGET} = shift; if (!defined $PerlACE::ProcessVX::WAIT_DELAY_FACTOR) { $PerlACE::ProcessVX::WAIT_DELAY_FACTOR = 2; } if (!defined $PerlACE::ProcessVX::RebootCmd) { $PerlACE::ProcessVX::RebootCmd = "reboot 0x02"; } bless ($self, $class); return $self; } sub DESTROY { my $self = shift; if ($self->{RUNNING} == 1) { print STDERR "ERROR: <", $self->{EXECUTABLE}, "> still running upon object destruction\n"; $self->Kill (); } if (defined $ENV{'ACE_RUN_VX_IBOOT'} && !defined $ENV{'ACE_RUN_VX_NO_SHUTDOWN'}) { # Shutdown the target to save power $self->iboot_cycle_power(1); } } ############################################################################### # Spawn the process and continue. sub Spawn () { my $self = shift; if ($self->{RUNNING} == 1) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> already running\n"; return -1; } if (!defined $self->{EXECUTABLE}) { print STDERR "ERROR: Cannot Spawn: No executable specified\n"; return -1; } if ($self->{IGNOREEXESUBDIR} == 0) { if (!-f $self->Executable ()) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> not found\n"; return -1; } } my $status = 0; my $cmdline; # Reboot the target if necessery $self->reboot(); my $program = $self->Executable (); my $cwdrel = dirname ($program); my $prjroot = defined $ENV{'ACE_RUN_VX_PRJ_ROOT'} ? $ENV{'ACE_RUN_VX_PRJ_ROOT'} : $ENV{'ACE_ROOT'}; if (length ($cwdrel) > 0) { $cwdrel = File::Spec->abs2rel( cwd(), $prjroot ); } else { $cwdrel = File::Spec->abs2rel( $cwdrel, $prjroot ); } $program = basename($program, $PerlACE::ProcessVX::ExeExt); my @cmds; my $cmdnr = 0; my $arguments = ""; my $prompt = ''; my $exesubdir = defined $ENV{'ACE_RUN_VX_EXE_SUBDIR'} ? $ENV{'ACE_RUN_VX_EXE_SUBDIR'} : ""; if (defined $ENV{'ACE_RUN_VX_STARTUP_SCRIPT'}) { if (defined $ENV{'ACE_RUN_VX_STARTUP_SCRIPT_ROOT'}) { $cmds[$cmdnr++] = 'cd "' . $ENV{'ACE_RUN_VX_STARTUP_SCRIPT_ROOT'} . '"'; } $cmds[$cmdnr++] = '< ' . $ENV{'ACE_RUN_VX_STARTUP_SCRIPT'}; } if (defined $ENV{'ACE_RUN_VX_STARTUP_COMMAND'}) { $cmds[$cmdnr++] = $ENV{'ACE_RUN_VX_STARTUP_COMMAND'}; } $cmds[$cmdnr++] = 'cd ' . $ENV{'ACE_RUN_VX_TGTSVR_ROOT'} . "/" . $cwdrel . "/" . $exesubdir; $cmds[$cmdnr++] = 'set TMPDIR=' . $ENV{'ACE_RUN_VX_TGTSVR_ROOT'} . "/" . $cwdrel; if (defined $ENV{'ACE_RUN_ACE_DEBUG'}) { $cmds[$cmdnr++] = 'set ACE_DEBUG=' . $ENV{'ACE_RUN_ACE_DEBUG'}; } if (defined $ENV{'ACE_RUN_TAO_ORB_DEBUG'}) { $cmds[$cmdnr++] = 'set TAO_ORB_DEBUG=' . $ENV{'ACE_RUN_TAO_ORB_DEBUG'}; } if (defined $ENV{'ACE_RUN_ACE_LD_SEARCH_PATH'}) { $cmds[$cmdnr++] = 'set ACE_LD_SEARCH_PATH=' . $ENV{'ACE_RUN_ACE_LD_SEARCH_PATH'}; } my(@load_commands); my(@unload_commands); my $vxtest_file = $program . '.vxtest'; if (handle_vxtest_file($self, $vxtest_file, \@load_commands, \@unload_commands)) { push @cmds, @load_commands; $cmdnr += scalar @load_commands; } else { print STDERR "ERROR: Cannot find <", $vxtest_file, ">\n"; } if (defined $self->{ARGUMENTS}) { ($arguments = $self->{ARGUMENTS})=~ s/\"/\\\"/g; ($arguments = $self->{ARGUMENTS})=~ s/\'/\\\'/g; } $cmdline = $program . ' ' . $arguments; if (defined $ENV{'ACE_RUN_VX_TGTSRV_WORKINGDIR'}) { $cmds[$cmdnr++] = 'cd ' . $ENV{'ACE_RUN_VX_TGTSRV_WORKINGDIR'}; } else { $cmds[$cmdnr++] = 'cd ' . $ENV{'ACE_RUN_VX_TGTSVR_ROOT'} . "/" . $cwdrel; } $cmds[$cmdnr++] = $cmdline; if (!defined $ENV{'ACE_TEST_VERBOSE'}) { push @cmds, @unload_commands; $cmdnr += scalar @unload_commands; } $prompt = '[\\\\].*>[\ ]$'; FORK: { if ($self->{PROCESS} = fork) { #parent here bless $self; } elsif (defined $self->{PROCESS}) { #child here my $telnet_port = $ENV{'ACE_RUN_VX_TGT_TELNET_PORT'}; my $telnet_host = $ENV{'ACE_RUN_VX_TGT_TELNET_HOST'}; if (!defined $telnet_host) { $telnet_host = $ENV{'ACE_RUN_VX_TGTHOST'}; } if (!defined $telnet_port) { $telnet_port = 23; } if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "Opening telnet connection <" . $telnet_host . ":". $telnet_port . ">\n"; } my $t = new Net::Telnet(Timeout => 600, Errmode => 'return', Host => $telnet_host, Port => $telnet_port); if (!defined $t) { die "ERROR: Telnet failed to <" . $telnet_host . ":". $telnet_port . ">"; } my $retries = 10; while ($retries--) { if (!$t->open()) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "Couldn't open telnet connection; sleeping then retrying\n"; } if ($retries == 0) { die "ERROR: Telnet open to <" . $telnet_host . ":". $telnet_port . "> " . $t->errmsg; } sleep(5); } else { last; } } my $target_login = $ENV{'ACE_RUN_VX_LOGIN'}; my $target_password = $ENV{'ACE_RUN_VX_PASSWORD'}; if (defined $target_login) { $t->waitfor('/VxWorks login: $/'); $t->print("$target_login"); } if (defined $target_password) { $t->waitfor('/Password: $/'); $t->print("$target_password"); } my $buf = ''; # wait for the prompt while (1) { my $blk = $t->get; print $blk; $buf .= $blk; if ($buf =~ /$prompt/) { last; } } if ($buf !~ /$prompt/) { die "ERROR: Didn't got prompt but got <$buf>"; } my $i = 0; my @lines; while($i < $cmdnr) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print $cmds[$i]."\n"; } if ($t->print ($cmds[$i++])) { # After each command wait for the prompt my $buf = ''; while (1) { my $blk = $t->get; print $blk; $buf .= $blk; if ($buf =~ /$prompt/) { last; } } } else { print $t->errmsg; } } $t->close(); sleep(2); exit; } elsif ($! =~ /No more process/) { #EAGAIN, supposedly recoverable fork error sleep 5; redo FORK; } else { # weird fork error print STDERR "ERROR: Can't fork <" . $cmdline . ">: $!\n"; } } $self->{RUNNING} = 1; return 0; } # Terminate the process and wait for it to finish sub TerminateWaitKill ($) { my $self = shift; my $timeout = shift; if ($self->{RUNNING}) { print STDERR "INFO: $self->{EXECUTABLE} being killed.\n"; kill ('TERM', $self->{PROCESS}); $PerlACE::ProcessVX::DoVxInit = 1; # force reboot on next run } return $self->WaitKill ($timeout); } # really only for internal use sub check_return_value ($) { my $self = shift; my $rc = shift; my $CC_MASK = 0xff00; # Exit code processing if ($rc == 0) { return 0; } elsif ($rc == $CC_MASK) { print STDERR "ERROR: <", $self->{EXECUTABLE}, "> failed: $!\n"; $PerlACE::ProcessVX::DoVxInit = 1; # force reboot on next run return ($rc >> 8); } elsif (($rc & 0xff) == 0) { $rc >>= 8; return $rc; } # Remember Core dump flag my $dump = 0; if ($rc & 0x80) { $rc &= ~0x80; $dump = 1; } # check for ABRT, KILL or TERM if ($rc == 6 || $rc == 9 || $rc == 15) { return 0; } print STDERR "ERROR: <", $self->{EXECUTABLE}, "> exited with "; print STDERR "coredump from " if ($dump == 1); print STDERR "signal $rc : ", $signame[$rc], "\n"; $PerlACE::ProcessVX::DoVxInit = 1; # force reboot on next run return 0; } sub Kill () { my $self = shift; if ($self->{RUNNING} && !defined $ENV{'ACE_TEST_WINDOW'}) { kill ('KILL', $self->{PROCESS}); waitpid ($self->{PROCESS}, 0); $self->check_return_value ($?); } $self->{RUNNING} = 0; } # Wait until a process exits. # return -1 if the process is still alive. sub Wait ($) { my $self = shift; my $timeout = shift; if (!defined $timeout || $timeout < 0) { waitpid ($self->{PROCESS}, 0); } else { return TimedWait($self, $timeout); } } sub TimedWait ($) { my $self = shift; my $timeout = shift; if ($PerlACE::Process::WAIT_DELAY_FACTOR > 0) { $timeout *= $PerlACE::Process::WAIT_DELAY_FACTOR; } while ($timeout-- != 0) { my $pid = waitpid ($self->{PROCESS}, &WNOHANG); if ($pid != 0 && $? != -1) { return $self->check_return_value ($?); } sleep 1; } $PerlACE::ProcessVX::DoVxInit = 1; # force reboot on next run return -1; } sub handle_vxtest_file { my $self = shift; my $vxtestfile = shift; my $vx_ref = shift; my $unld_ref = shift; my $fh = new FileHandle; if (defined $self->{TARGET} && $self->{TARGET}->SystemLibs()) { my @tokens = split(/;/, $self->{TARGET}->SystemLibs()); foreach my $token (@tokens) { push @$vx_ref, "copy " . $ENV{'ACE_RUN_VX_TGTSVR_ROOT'} . "/lib/" . $token . " ."; unshift @$unld_ref, "del " . $token; } } if (!$PerlACE::Static) { if (open ($fh, $vxtestfile)) { my $line1 = <$fh>; chomp $line1; while(<$fh>) { $line1 = $_; chomp $line1; push @$vx_ref, "copy " . $ENV{'ACE_RUN_VX_TGTSVR_ROOT'} . "/lib/$line1" . ".dll ."; unshift @$unld_ref, "del $line1" . ".dll"; } close $fh; } else { return 0; } } return 1; } 1; ace-8.0.4+dfsg.orig/bin/PerlACE/TestTarget_Android.pm0000644000175000017500000002567415027201773021254 0ustar sudipsudip#!/usr/bin/env perl package PerlACE::TestTarget_Android; # ****************************************************************** # Description : Creates a PerlACE::Android # Author : Marcel Smit # Create Date : 29/20/2008 # ****************************************************************** # ****************************************************************** # Pragma Section # ****************************************************************** use strict; use PerlACE::TestTarget; use PerlACE::ProcessVX; use File::Copy; use File::Glob; use File::Spec; use File::Basename; use Cwd; use English; use POSIX "sys_wait_h"; require PerlACE::ProcessAndroid; our @ISA = qw(PerlACE::TestTarget); $PerlACE::TestTarget_Android::EMULATOR_RUNNING = 0; $PerlACE::TestTarget_Android::LIBS = (); sub new { my $proto = shift; my $config_name = shift; my $component = shift; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "New Android target: $config_name : $component\n"; } my $class = ref ($proto) || $proto; my $self = {}; bless ($self, $class); $self->GetConfigSettings($config_name); $self->{FSROOT} = $ENV{'ANDROID_FS_ROOT'}; $self->{PROCESS} = undef; $self->{RUNNING} = 0; # Start the target. if ($PerlACE::TestTarget_Android::EMULATOR_RUNNING == 0) { $self->start_target (); } return $self; } sub DESTROY { my $self = shift; if ($self->{RUNNING} == 1) { # kill the emulator. No need to shutdown gracefully. if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Killing the Android emulator\n"; } $self->KillAll ('emulator*'); $self->KillAll ('adb'); $PerlACE::TestTarget_Android::EMULATOR_RUNNING = 0; $PerlACE::TestTarget_Android::LIBS = (); } } # ****************************************************************** # Subroutine Section # ****************************************************************** sub LocalFile { my $self = shift; my $file = shift; my $newfile = $self->{FSROOT} . "/" . $file; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Android LocalFile for $file is $newfile\n"; } return $newfile; } sub AddLibPath ($) { my $self = shift; my $dir = shift; my $noarch = shift; # If we have -Config ARCH, use the -ExeSubDir setting as a sub-directory # of the lib path. This is in addition to the regular LibPath. if (!$noarch && defined $self->{ARCH}) { $self->AddLibPath($dir, 1); $dir .= '/' . $self->{EXE_SUBDIR}; } if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Adding libpath $dir\n"; } $self->{LIBPATH} = PerlACE::concat_path ($self->{LIBPATH}, $dir); } sub CreateProcess { my $self = shift; my $process = new PerlACE::ProcessAndroid ($self, @_); return $process; } sub NeedReboot ($) { my $self = shift; $self->{REBOOT_NEEDED} = 1; } # Reboot target sub RebootNow ($) { my $self = shift; $self->{REBOOT_NEEDED} = undef; print STDERR "Attempting to reboot target...\n"; $self->reboot (); } sub start_target () { # For now, we're assuming one target (avd) is running in the test environment. # Need to change this when more than one avd's need to start my $self = shift; my $silent; if (!defined $ENV{'ACE_TEST_VERBOSE'}) { $silent = "2> /dev/null" } if (! defined ($ENV{'ANDROID_SDK_ROOT'})) { print STDERR "Error: Android SDK root not defined.\n"; return 0; } if (! defined ($ENV{'ANDROID_AVD_NAME'})) { print STDERR "Error: Android AVD name not defined.\n"; return 0; } my $avd_name = $ENV{'ANDROID_AVD_NAME'}; my $android_process = $ENV{'ANDROID_SDK_ROOT'} . "/tools/android"; my $avd_process = $ENV{'ANDROID_SDK_ROOT'} . "/tools/emulator"; my $adb_process = $ENV{'ANDROID_SDK_ROOT'} . "/platform-tools/adb"; my $user_data_image = $ENV{'ANDROID_SDK_HOME'} . "/.android/avd/" . $avd_name . ".avd/userdata-qemu.img"; my $avd_options = "-noaudio -no-window -wipe-data"; if (defined ($ENV{'ANDROID_AVD_OPTIONS'})) { print STDERR "Resetting AVD options\n"; $avd_options = $ENV{'ANDROID_AVD_OPTIONS'}; } $self->KillAll ("emulator*"); FORK: { if ($self->{PROCESS} = fork) { #parent here bless $self; } elsif (defined $self->{PROCESS}) { #child here my $user_image_cmd = "rm -f " . $user_data_image; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Removing user data image: $user_image_cmd\n"; } system ( $user_image_cmd ); if ($? != 0) { print STDERR "failed to execute: $!\n"; } my $avd_cmd = "$avd_process" .' -avd ' . "$avd_name $avd_options"; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Starting emulator cmd: $avd_cmd\n"; } system ( $avd_cmd ); if ($? != 0) { print STDERR "failed to execute: $!\n"; } exit; } elsif ($! =~ /No more process/) { #EAGAIN, supposedly recoverable fork error sleep 5; redo FORK; } else { # weird fork error print STDERR "ERROR: Can't fork <" . $avd_process . ">: $!\n"; } } eval { my $timeout = $self->AdbWaitForDeviceTimeout (); local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required alarm $timeout; # start the waiting... my $wait_cmd = $adb_process . ' wait-for-device'; system ( $wait_cmd ); # reset alarm alarm 0; }; if ($@) { # timed out exit unless $@ eq "alarm\n"; # propagate unexpected errors } else { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Emulator is running <$self->{PROCESS}> -> start the tests.\n"; } } # AVD is up and running and ready to spawn executables. # First some preparation. my $cmd = $adb_process . ' shell "mkdir ' . $self->{FSROOT} . '/tmp "' . $silent; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Start to execute : $cmd\n"; } system ( $cmd ); $self->{RUNNING} = 1; $PerlACE::TestTarget_Android::EMULATOR_RUNNING = 1; return 0; } sub WaitForFileTimed ($) { my $self = shift; my $file = shift; my $timeout = shift; my $silent; if (!defined $ENV{'ACE_TEST_VERBOSE'}) { $silent = ' > /dev/null 2>&1'; } if ($PerlACE::Process::WAIT_DELAY_FACTOR > 0) { $timeout *= $PerlACE::Process::WAIT_DELAY_FACTOR; } my $newfile = $self->LocalFile ($file); if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Android waits $timeout seconds for $newfile\n"; } # Since the file is available on the target (which we cannot reach), # we will try to pull the file from the target to a local directory. # If succeed, the the file is there an we can continue. my $adb_process = $ENV{'ANDROID_SDK_ROOT'} . "/platform-tools/adb"; my $fsroot_target = $self->{FSROOT}; my $cmd_copy_ior = $adb_process . ' pull ' . $newfile . ' ' . File::Spec->tmpdir() . '/' . basename ($newfile) . $silent; while ($timeout-- != 0) { # copy the ior back to the host sytem if (system ( $cmd_copy_ior ) == 0) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Pull $newfile succeeded\n"; } return 0; } sleep (1); } return -1; } sub DeleteFile ($) { my $self = shift; my $file = shift; my $adb_process = $ENV{'ANDROID_SDK_ROOT'} . "/platform-tools/adb"; my $silent; if (!defined $ENV{'ACE_TEST_VERBOSE'}) { $silent = ' > /dev/null 2>&1'; } my $targetfile = $self->LocalFile ($file); my $cmd = "$adb_process" . ' shell rm '. "$targetfile" . $silent; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "DeleteFile cmd: $cmd\n"; } system ( $cmd ); if ($? != 0) { return -1; } return 0; } sub Kill () { my $self = shift; if ($self->{RUNNING} == 1) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Killing emulator process <$self->{PROCESS}>\n"; } my $cnt = kill (1, $self->{PROCESS}); waitpid ($self->{PROCESS}, WNOHANG); if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Killed $cnt process(es)\n"; } # $self->check_return_value ($?); } $self->{RUNNING} = 0; } sub KillAll ($) { my $self = shift; my $procmask = shift; if ($OSNAME eq 'MSWin32') { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Killall not implemented for Windows\n"; return; } } else { my $cmd_killall = "killall -q -r $procmask"; system ( $cmd_killall ); } } sub PutFile ($) { my $self = shift; my $src = shift; my $silent; if (!defined $ENV{'ACE_TEST_VERBOSE'}) { $silent = "2> /dev/null" } my $adb_process = $ENV{'ANDROID_SDK_ROOT'} . "/platform-tools/adb"; my $targetfile = $self->LocalFile ($src); my $cmd = "$adb_process" . ' push '. "\"$src\" \"$targetfile\" $silent"; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "PutFile cmd: $cmd\n"; } system ( $cmd ); if ($? != 0) { return -1; } return 0; } sub GetFile ($) { my $self = shift; my $remote_file = shift; my $local_file = shift; my $silent; if (!defined $ENV{'ACE_TEST_VERBOSE'}) { $silent = "2> /dev/null" } my $adb_process = $ENV{'ANDROID_SDK_ROOT'} . "/platform-tools/adb"; if (!defined $local_file) { $local_file = $remote_file; } $remote_file = $self->LocalFile($remote_file); my $cmd = "$adb_process" . ' pull '. "$remote_file $local_file $silent"; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "GetFile cmd: $cmd\n"; } system ( $cmd ); if ($? != 0) { return -1; } return 0; } sub PutLib ($) { my $self = shift; my $newlib = shift; my $tgtlib = shift; my $silent; if (!defined $ENV{'ACE_TEST_VERBOSE'}) { $silent = "2> /dev/null" } foreach my $lib (@{$PerlACE::TestTarget_Android::LIBS}) { if ($lib eq $newlib) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Duplicate lib $newlib\n"; } return 0; } } my $adb_process = $ENV{'ANDROID_SDK_ROOT'} . "/platform-tools/adb"; my $cmd = "$adb_process" . ' push '. "\"$newlib\" \"$tgtlib\" $silent"; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "PutLib cmd: $cmd\n"; } system ( $cmd ); if ($? != 0) { return -1; } # keep tabs on copied libs push(@{$PerlACE::TestTarget_Android::LIBS}, $newlib); return 0; } 1; ace-8.0.4+dfsg.orig/bin/PerlACE/MSProject.pm0000644000175000017500000002121215027201773017354 0ustar sudipsudip#!/usr/bin/env perl package PerlACE::MSProject; use strict; use FileHandle; ############################################################################### # Constructor sub new { my $proto = shift; my $class = ref ($proto) || $proto; my $self = {}; $self->{FILENAME} = shift; $self->{VERSION} = undef; $self->{NAME} = undef; %{$self->{CONFIGS}} = (); bless ($self, $class); return $self; } ############################################################################### # Accessors sub Filename { my $self = shift; if (@_ != 0) { $self->{FILENAME} = shift; } return $self->{FILENAME}; } sub Version () { my $self = shift; return $self->{VERSION}; } sub Name () { my $self = shift; return $self->{NAME}; } sub Configs () { my $self = shift; return keys %{$self->{CONFIGS}}; } sub DepOutputFile ($) { my $self = shift; my $config = shift; if (!defined $config) { print STDERR "Error: No configuration specified\n"; return; } my $name = $self->OutputFile ($config); if ($name =~ m/\.dll$/) { $name = $self->LibraryFile ($config); } $name =~ s/.*\\//; # / <- For devenv $name =~ s/.*\///; return $name; } sub OutputFile ($) { my $self = shift; my $config = shift; if (!defined $config) { print STDERR "Error: No configuration specified\n"; return; } if (%{$self->{CONFIGS}}->{$config}->{LINK} =~ m/out\:\"([^\"]*)\"/) { return $1; } elsif (defined $self->Name ()) { my $filename = $self->Filename; my $ext = ""; if (%{$self->{CONFIGS}}->{$config}->{LINK} =~ m/\/dll/) { $ext = ".dll"; } elsif (%{$self->{CONFIGS}}->{$config}->{LINK} =~ m/\/subsystem\:/) { $ext = ".exe"; } else { $ext = ".lib"; } $filename =~ s/\.[^\.]*$/$ext/; return $filename; } } sub LibraryFile ($) { my $self = shift; my $config = shift; my $dll = undef; if (!defined $config) { print STDERR "Error: No configuration specified\n"; return; } if ($self->OutputFile ($config) =~ m/([^\/\\]*)\.dll$/i) { $dll = $1; } if (defined $dll) { if (%{$self->{CONFIGS}}->{$config}->{LINK} =~ m/implib\:\"([^\"]*)\"/i) { return $1; } else { $dll =~ s/.*\\//ig; # / <- Just here to fix color coding in devenv beta return $self->OutputDir ($config). $dll . ".lib"; } } } sub OutputDir ($) { my $self = shift; my $config = shift; if (!defined $config) { print STDERR "Error: No configuration specified\n"; return; } return %{$self->{CONFIGS}}->{$config}->{OUTPUTDIR}; } sub IntermidiateDir ($) { my $self = shift; my $config = shift; if (!defined $config) { print STDERR "Error: No configuration specified\n"; return; } return %{$self->{CONFIGS}}->{$config}->{INTERMEDIATEDIR}; } sub TargetDir ($) { my $self = shift; my $config = shift; if (!defined $config) { print STDERR "Error: No configuration specified\n"; return; } return %{$self->{CONFIGS}}->{$config}->{TARGETDIR}; } sub CPPOptions ($) { my $self = shift; my $config = shift; if (!defined $config) { print STDERR "Error: No configuration specified\n"; return; } return %{$self->{CONFIGS}}->{$config}->{CPP}; } sub LINKOptions ($) { my $self = shift; my $config = shift; if (!defined $config) { print STDERR "Error: No configuration specified\n"; return; } return %{$self->{CONFIGS}}->{$config}->{LINK}; } sub Libs($) { my $self = shift; my $config = shift; if (!defined $config) { print STDERR "Error: No configuration specified\n"; return; } return %{$self->{CONFIGS}}->{$config}->{LIBS}; } sub UsesTAOIDL () { my $self = shift; return $self->{TAOIDL}; } sub Compiler () { my $self = shift; return $self->{COMPILER}; } ############################################################################### # Big methods sub Load () { my $self = shift; my $config = "Unknown"; $self->{valid} = 0; my $fh = new FileHandle; unless ($fh->open ("<" . $self->{FILENAME})) { print "Could not open file ", $self->{FILENAME}, ": ", $_; return; } while (<$fh>) { if (m/^\#.*Project File - Name=\"([^\"]*)\"/) { $self->{NAME} = $1; } if (m/^\#.*Format Version (.*)/) { $self->{VERSION} = $1; } # Check for configurations if (m/^\!.*IF \"\$\(CFG\)\" == \".* - (.*)$\"/) { $config = $1; } elsif (m/^\!ENDIF$/) { $config = ""; } # Check for directories if (m/\# PROP Output_Dir \"(.*)\"/) { %{$self->{CONFIGS}}->{$config}->{OUTPUTDIR} = $1; } elsif (m/\# PROP Intermediate_Dir \"(.*)\"/) { %{$self->{CONFIGS}}->{$config}->{INTERMEDIATEDIR} = $1; } elsif (m/\# PROP Target_Dir \"(.*)\"/) { %{$self->{CONFIGS}}->{$config}->{TARGETDIR} = $1; } # Look at CPP options if (m/\# ADD BASE CPP(.*)$/ || m/\# ADD CPP(.*)$/) { my @flags = split (/ \//, $1); foreach my $flag (@flags) { if ($flag && %{$self->{CONFIGS}}->{$config}->{CPP} !~ m/$flag/) { %{$self->{CONFIGS}}->{$config}->{CPP} .= " /$flag"; } } } elsif (m/\# SUBTRACT CPP(.*)$/ || m/\# SUBTRACT BASE CPP(.*)$/) { my @flags = split (/ \//, $1); foreach my $flag (@flags) { if ($flag && %{$self->{CONFIGS}}->{$config}->{CPP} =~ m/$flag/) { %{$self->{CONFIGS}}->{$config}->{CPP} =~ s/ \/$flag//g; } } } # Look at LINK32 options if (m/\# ADD BASE LINK32(.*)$/ || m/\# ADD LINK32(.*)$/ || m/\# ADD BASE LIB32(.*)$/ || m/\# ADD LIB32(.*)$/) { my @flags = split (/ \//, $1); foreach my $flag (@flags) { my $found = 0; my @libs = split (/ /, $flag); foreach my $lib (@libs) { if ($lib =~ m/\.lib$/) { if (%{$self->{CONFIGS}}->{$config}->{LIBS} !~ m/\Q$lib\E/) { %{$self->{CONFIGS}}->{$config}->{LIBS} .= " $lib"; } $found = 1; } } if (!$found && $flag) { my $shortflag = $flag; if ($flag =~ m/^(.*)\:/) { $shortflag = $1; } if (%{$self->{CONFIGS}}->{$config}->{LINK} !~ m/ \/$shortflag/) { %{$self->{CONFIGS}}->{$config}->{LINK} .= " /$flag"; } } } } elsif (m/\# SUBTRACT BASE LINK32(.*)$/ || m/\# SUBTRACT LINK32(.*)$/ || m/\# SUBTRACT BASE LIB32(.*)$/ || m/\# SUBTRACT LIB32(.*)$/) { my @flags = split (/ \//, $1); foreach my $flag (@flags) { my $shortflag = $flag; if ($flag =~ m/^(.*)\:/) { $shortflag = $1; } if ($flag && %{$self->{CONFIGS}}->{$config}->{LINK} =~ m/ (\/$shortflag\:[^ ]*)/) { %{$self->{CONFIGS}}->{$config}->{LINK} =~ s/ \Q$1\E//ig; } } } if (m/^\# Name \".* - (.*)\"/ && defined %{$self->{CONFIGS}}->{"Unknown"}) { %{$self->{CONFIGS}}->{$1} = %{$self->{CONFIGS}}->{"Unknown"}; delete %{$self->{CONFIGS}}->{"Unknown"}; } if (m/tao\_idl/ && m/\$\(InputName\)\.idl/ || m/tao\_idl/ && m/\$\(InputPath\)/) { $self->{TAOIDL} = 1; } } $fh->close (); $self->{valid} = 1; } ############################################################################### # Build functions sub Build ($) { my $self = shift; my ($config) = @_; my $command = $self->Compiler () . " " . $self->Filename () . " /USEENV" . " /MAKE \"" . $self->Name () . " - " . $config . "\""; system $command; } sub Clean ($) { my $self = shift; my ($config) = @_; my $command = $self->Compiler () . " " . $self->Filename () . " /USEENV" . " /MAKE \"" . $self->Name () . " - " . $config . "\" /CLEAN"; system $command; } 1;ace-8.0.4+dfsg.orig/bin/PerlACE/Process.pm0000644000175000017500000000334315027201773017131 0ustar sudipsudip#!/usr/bin/env perl package PerlACE::Process; use strict; use English; use POSIX qw(:time_h); $PerlACE::Process::ExeSubDir = './'; sub delay_factor { my($lps) = 128; my($factor) = 1; ## Keep increasing the loops per second until the amount of time ## exceeds the number of clocks per second. The original code ## did not multiply $ticks by 8 but, for faster machines, it doesn't ## seem to return false values. The multiplication is done to minimize ## the amount of time it takes to determine the correct factor. while(($lps <<= 1)) { my($ticks) = clock(); for(my $i = $lps; $i >= 0; $i--) { } $ticks = clock() - $ticks; if ($ticks * 8 >= CLOCKS_PER_SEC) { $factor = 500000 / (($lps / $ticks) * CLOCKS_PER_SEC); last; } } return $factor; } ### Check for -ExeSubDir commands, store the last one my @new_argv = (); for(my $i = 0; $i <= $#ARGV; ++$i) { if ($ARGV[$i] eq '-ExeSubDir') { if (defined $ARGV[$i + 1]) { $PerlACE::Process::ExeSubDir = $ARGV[++$i].'/'; } else { print STDERR "You must pass a directory with ExeSubDir\n"; exit(1); } } else { push @new_argv, $ARGV[$i]; } } @ARGV = @new_argv; $PerlACE::Process::WAIT_DELAY_FACTOR = (defined $ENV{'ACE_RUNTEST_DELAY'}) ? $ENV{'ACE_RUNTEST_DELAY'} : 1; # Set the process's target. If there's none, behavior falls back to pre-target # behavior. sub Target($) { my $self = shift; $self->{TARGET} = shift; } if ($OSNAME eq "MSWin32") { require PerlACE::Process_Win32; } elsif ($OSNAME eq "VMS") { require PerlACE::Process_VMS; } else { require PerlACE::Process_Unix; } 1; ace-8.0.4+dfsg.orig/bin/PerlACE/Run_Test.pm0000644000175000017500000001653115027201773017261 0ustar sudipsudip#!/usr/bin/env perl # This module contains a few miscellaneous functions and some # startup ARGV processing that is used by all tests. use PerlACE::Process; use PerlACE::ConfigList; package PerlACE; use File::Spec; use Cwd; $PerlACE::ACE_ROOT = $ENV{ACE_ROOT}; if(exists $ENV{TAO_ROOT}) { $PerlACE::TAO_ROOT = $ENV{TAO_ROOT}; } else { $PerlACE::TAO_ROOT = "$PerlACE::ACE_ROOT/TAO"; } my $config = new PerlACE::ConfigList; $PerlACE::TestConfig = $config; # load VxWorks Process helpers in case this is a VxWorks target build $PerlACE::Static = $config->check_config("STATIC"); $PerlACE::VxWorks_Test = $config->check_config("VxWorks"); $PerlACE::VxWorks_RTP_Test = $config->check_config("VxWorks_RTP"); if ($PerlACE::VxWorks_Test or $PerlACE::VxWorks_RTP_Test) { require PerlACE::ProcessVX; } # Load LabVIEW RT Process helpers in case this is a LabVIEW RT target build. $PerlACE::LabVIEW_RT_Test = $config->check_config("LabVIEW_RT"); if ($PerlACE::LabVIEW_RT_Test) { require PerlACE::ProcessLVRT; } $PerlACE::WinCE_Test = $config->check_config("WINCE"); if ($PerlACE::WinCE_Test) { if ($OSNAME eq "MSWin32") { require PerlACE::ProcessWinCE; } else { require PerlACE::ProcessWinCE_Unix; } } $PerlACE::Android_Test = $config->check_config("ANDROID"); if ($PerlACE::Android_Test) { require PerlACE::ProcessAndroid; } # Figure out the svc.conf extension $svcconf_ext = $ENV{'ACE_RUNTEST_SVCCONF_EXT'}; if (!defined $svcconf_ext) { $svcconf_ext = ".conf"; } # Default timeout. NSCORBA needs more time for process start up. $wait_interval_for_process_creation = (($PerlACE::VxWorks_Test or $PerlACE::VxWorks_RTP_Test) ? 60 : 15); if ($^O eq 'VMS') { $wait_interval_for_process_creation *= 3; } elsif ($^O eq 'nto') { ## QNX can be slow to start processes $wait_interval_for_process_creation += 5; } $wait_interval_for_process_shutdown = (($PerlACE::VxWorks_Test or $PerlACE::VxWorks_RTP_Test) ? 30 : 10); # Turn on autoflush $| = 1; sub LocalFile ($) { my $file = shift; if (File::Spec->file_name_is_absolute( $file )) { return $file; } my $newfile = getcwd () . '/' . $file; if ($^O eq "MSWin32") { $newfile =~ s/\//\\/g; } elsif ($^O eq 'cygwin') { chop($newfile = `/usr/bin/cygpath -w $newfile`); $newfile =~ s/\\/\\\\/g; } return $newfile; } sub rebase_path { my $path = shift; my $cur_root = shift; my $new_root = shift; $path = File::Spec->rel2abs ($path); $path = File::Spec->abs2rel ($path, $cur_root); return $new_root."/".$path; } sub VX_HostFile($) { my $file = shift; return rebase_path ($file, $ENV{'ACE_ROOT'}, $ENV{'HOST_ROOT'}); } # Returns a random port within the range of 10002 - 32767 sub random_port { return (int(rand($$)) % 22766) + 10002; } # Returns a unique id, uid for unix, last digit of IP for NT sub uniqueid { if ($^O eq "MSWin32") { my $uid = 1; open (IPNUM, "ipconfig|") || die "Can't run ipconfig: $!\n"; while () { if (/Address/) { $uid = (split (/: (\d+)\.(\d+)\.(\d+)\.(\d+)/))[4]; } } close IPNUM; return $uid; } else { return $>; } } # Waits until a file exists sub waitforfile { local($file) = @_; select(undef, undef, undef, 0.1) while (!(-e $file && -s $file)); } sub waitforfile_timed { my $file = shift; my $maxtime = shift; $maxtime *= (($PerlACE::VxWorks_Test || $PerlACE::VxWorks_RTP_Test) ? $PerlACE::ProcessVX::WAIT_DELAY_FACTOR : $PerlACE::Process::WAIT_DELAY_FACTOR); # Multiply with 10 because we wait a tenth of a second each time $maxtime *= 10; while ($maxtime-- != 0) { if (-e $file && -s $file) { return 0; } select(undef, undef, undef, 0.1); } return -1; } sub check_n_cleanup_files { my $file = shift; my @flist = glob ($file); my $cntr = 0; my $nfile = scalar(@flist); if ($nfile != 0) { for (; $cntr < $nfile; $cntr++) { print STDERR "File <$flist[$cntr]> exists but should be cleaned up\n"; } unlink @flist; } } sub generate_test_file { my $file = shift; my $size = shift; while ( -e $file ) { $file = $file."X"; } my $data = "abcdefghijklmnopqrstuvwxyz"; $data = $data.uc($data)."0123456789"; open( INPUT, "> $file" ) || die( "can't create input file: $file" ); for($i=62; $i < $size ; $i += 62 ) { print INPUT $data; } $i -= 62; if ($i < $size) { print INPUT substr($data, 0, $size-$i); } close(INPUT); return $file; } sub is_labview_rt_test() { return ($PerlACE::LabVIEW_RT_Test); } sub is_vxworks_test() { return ($PerlACE::VxWorks_Test || $PerlACE::VxWorks_RTP_Test); } sub is_vxworks_rtp_test() { return ($PerlACE::VxWorks_RTP_Test); } sub concat_path { my $pathlist = shift; my $path = shift; if ((!defined $pathlist) || $pathlist =~ /^\s*$/) { return $path; } else { return $pathlist . ($^O eq 'MSWin32' ? ';' : ':') . $path; } } sub add_path { my $name = shift; my $value = shift; $ENV{$name} = concat_path ($ENV{$name}, $value); } sub add_lib_path { my($value) = shift; # Set the library path supporting various platforms. foreach my $env ('PATH', 'DYLD_LIBRARY_PATH', 'LD_LIBRARY_PATH', 'SHLIB_PATH') { add_path($env, $value); if (grep(($_ eq 'ARCH'), @PerlACE::ConfigList::Configs)) { add_path($env, $value . '/' . $PerlACE::Process::ExeSubDir); } } if (defined $ENV{'HOST_ROOT'}) { add_path('PATH', VX_HostFile ($value)); add_path('LD_LIBRARY_PATH', VX_HostFile ($value)); add_path('LIBPATH', VX_HostFile ($value)); add_path('SHLIB_PATH', VX_HostFile ($value)); } } sub check_privilege_group { } # waits until it finds a matching regular expression in a file # escape metacharacters in the text to wait for sub waitforfileoutput { my $file = shift; my $waittext = shift; if (-e $file && -s $file) { open (DATA, $file); while (my $line = ) { if ($line =~ /($waittext)/) { close(DATA); return 0; } } close(DATA); } sleep 1; } sub waitforfileoutput_timed { my $file = shift; my $waittext = shift; my $maxtime = shift; $maxtime *= (($PerlACE::VxWorks_Test || $PerlACE::VxWorks_RTP_Test) ? $PerlACE::ProcessVX::WAIT_DELAY_FACTOR : $PerlACE::Process::WAIT_DELAY_FACTOR); # Multiply with 10 because we wait a tenth of a second each time $maxtime *= 10; while ($maxtime-- != 0) { if (-e $file && -s $file) { open (DATA, $file); while (my $line = ) { if ($line =~ /($waittext)/) { close(DATA); return 0; } } close(DATA); } select(undef, undef, undef, 0.1); } return -1; } sub GetArchDir { my $dir = shift; if (grep(($_ eq 'ARCH'), @PerlACE::ConfigList::Configs)) { return $dir . $PerlACE::Process::ExeSubDir; } return $dir; } # Add PWD to the load library path add_lib_path ('.'); $sleeptime = 5; 1; ace-8.0.4+dfsg.orig/bin/PerlACE/ProcessVX_Win32.pm0000644000175000017500000003124315027201773020371 0ustar sudipsudip#!/usr/bin/env perl package PerlACE::ProcessVX; use strict; use Win32::Process; use File::Basename; use File::Spec; use FileHandle; use Cwd; eval { require Net::Telnet; }; ############################################################################### # This is what GetExitCode will return if the process is still running. my $STILL_ACTIVE = 259; ############################################################################### ### Constructor and Destructor sub new { my $proto = shift; my $class = ref ($proto) || $proto; my $self = {}; $self->{RUNNING} = 0; $self->{IGNOREEXESUBDIR} = 1; $self->{IGNOREHOSTROOT} = 0; $self->{PROCESS} = undef; $self->{EXECUTABLE} = shift; $self->{ARGUMENTS} = shift; if (!defined $PerlACE::ProcessVX::WAIT_DELAY_FACTOR) { $PerlACE::ProcessVX::WAIT_DELAY_FACTOR = 3; } if (!defined $PerlACE::ProcessVX::RebootCmd) { $PerlACE::ProcessVX::RebootCmd = "reboot"; } bless ($self, $class); return $self; } sub DESTROY { my $self = shift; if ($self->{RUNNING} == 1) { print STDERR "ERROR: <", $self->{EXECUTABLE}, "> still running upon object destruction\n"; $self->Kill (); } if (!defined $ENV{'ACE_TEST_VERBOSE'}) { unlink "run_vx.pl"; } if (defined $ENV{'ACE_RUN_VX_IBOOT'} && !defined $ENV{'ACE_RUN_VX_NO_SHUTDOWN'}) { # Shutdown the target to save power $self->iboot_cycle_power(1); } } ############################################################################### ### Spawning processes # Spawn the process and continue. sub Spawn () { my $self = shift; if ($self->{RUNNING} == 1) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> already running\n"; return -1; } if (!defined $self->{EXECUTABLE}) { print STDERR "ERROR: Cannot Spawn: No executable specified\n"; return -1; } if ($self->{IGNOREEXESUBDIR} == 0) { if (!-f $self->Executable ()) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> not found\n"; return -1; } } my $status = 0; my $cmdline; # Reboot the target if necessery $self->reboot(); my $program = $self->Executable (); my $cwdrel = dirname ($program); my $prjroot = defined $ENV{'ACE_RUN_VX_PRJ_ROOT'} ? $ENV{'ACE_RUN_VX_PRJ_ROOT'} : $ENV{'ACE_ROOT'}; if (length ($cwdrel) > 0) { $cwdrel = File::Spec->abs2rel( cwd(), $prjroot ); } else { $cwdrel = File::Spec->abs2rel( $cwdrel, $prjroot ); } $cwdrel =~ s/\\/\//g; $program = basename($program, $PerlACE::ProcessVX::ExeExt); unlink "run_vx.pl"; my $oh = new FileHandle(); if (!open($oh, ">run_vx.pl")) { print STDERR "ERROR: Unable to write to run_vx.pl\n"; exit -1; } my @cmds; my $cmdnr = 0; my $arguments = ""; my $prompt = ''; my $exesubdir = defined $ENV{'ACE_RUN_VX_EXE_SUBDIR'} ? $ENV{'ACE_RUN_VX_EXE_SUBDIR'} : ""; if (defined $ENV{'ACE_RUN_VX_STARTUP_SCRIPT'}) { if (defined $ENV{'ACE_RUN_VX_STARTUP_SCRIPT_ROOT'}) { @cmds[$cmdnr++] = 'cd "' . $ENV{'ACE_RUN_VX_STARTUP_SCRIPT_ROOT'} . '"'; } @cmds[$cmdnr++] = '< ' . $ENV{'ACE_RUN_VX_STARTUP_SCRIPT'}; } if (defined $ENV{'ACE_RUN_VX_STARTUP_COMMAND'}) { @cmds[$cmdnr++] = $ENV{'ACE_RUN_VX_STARTUP_COMMAND'}; } if ($PerlACE::VxWorks_RTP_Test) { @cmds[$cmdnr++] = 'cmd'; if ( defined $ENV{'ACE_RUN_VX_TGTSVR_DEFGW'} && $PerlACE::ProcessVX::VxDefGw) { @cmds[$cmdnr++] = "C mRouteAdd(\"0.0.0.0\", \"" . $ENV{'ACE_RUN_VX_TGTSVR_DEFGW'} . "\", 0,0,0)"; $PerlACE::ProcessVX::VxDefGw = 0; } if (defined $ENV{'ACE_RUN_VX_TGT_STARTUP_SCRIPT'}) { my(@start_commands); if (handle_startup_script ($ENV{'ACE_RUN_VX_TGT_STARTUP_SCRIPT'}, \@start_commands)) { push @cmds, @start_commands; $cmdnr += scalar @start_commands; } } @cmds[$cmdnr++] = 'cd "' . $ENV{'ACE_RUN_VX_TGTSVR_ROOT'} . "/" . $cwdrel . '"'; @cmds[$cmdnr++] = 'C putenv("TMPDIR=' . $ENV{'ACE_RUN_VX_TGTSVR_ROOT'} . "/" . $cwdrel . '")'; if (defined $ENV{'ACE_RUN_ACE_DEBUG'}) { @cmds[$cmdnr++] = 'C putenv("ACE_DEBUG=' . $ENV{'ACE_RUN_ACE_DEBUG'} . '")'; } if (defined $ENV{'ACE_RUN_TAO_ORB_DEBUG'}) { @cmds[$cmdnr++] = 'C putenv("TAO_ORB_DEBUG=' . $ENV{'ACE_RUN_TAO_ORB_DEBUG'} . '")'; } if (defined $ENV{'ACE_RUN_ACE_LD_SEARCH_PATH'}) { @cmds[$cmdnr++] = 'C putenv("ACE_LD_SEARCH_PATH=' . $ENV{'ACE_RUN_ACE_LD_SEARCH_PATH'} . '")'; } if (defined $self->{TARGET}) { my $x_env_ref = $self->{TARGET}->{EXTRA_ENV}; while ( my ($env_key, $env_value) = each(%$x_env_ref) ) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "INFO: adding target environment $env_key=$env_value\n"; } @cmds[$cmdnr++] = 'C putenv("' . $env_key. '=' . $env_value . '")'; } } if (defined $ENV{'ACE_RUN_VX_CHECK_RESOURCES'}) { @cmds[$cmdnr++] = 'C memShow()'; } $cmdline = $program . $PerlACE::ProcessVX::ExeExt . ' ' . $self->{ARGUMENTS}; @cmds[$cmdnr++] = $cmdline; $prompt = '\[vxWorks \*\]\# $'; } if ($PerlACE::VxWorks_Test) { if ( defined $ENV{'ACE_RUN_VX_TGTSVR_DEFGW'} && $PerlACE::ProcessVX::VxDefGw) { @cmds[$cmdnr++] = "mRouteAdd(\"0.0.0.0\", \"" . $ENV{'ACE_RUN_VX_TGTSVR_DEFGW'} . "\", 0,0,0)"; $PerlACE::ProcessVX::VxDefGw = 0; } if (defined $ENV{'ACE_RUN_VX_TGT_STARTUP_SCRIPT'}) { my(@start_commands); if (handle_startup_script ($ENV{'ACE_RUN_VX_TGT_STARTUP_SCRIPT'}, \@start_commands)) { push @cmds, @start_commands; $cmdnr += scalar @start_commands; } } my(@load_commands); my(@unload_commands); if (!$PerlACE::Static && !$PerlACE::VxWorks_RTP_Test) { my $vxtest_file = $program . '.vxtest'; if (handle_vxtest_file($self, $vxtest_file, \@load_commands, \@unload_commands)) { @cmds[$cmdnr++] = "cd \"$ENV{'ACE_RUN_VX_TGTSVR_ROOT'}/lib\""; push @cmds, @load_commands; $cmdnr += scalar @load_commands; } else { print STDERR "ERROR: Cannot find <", $vxtest_file, ">\n"; return -1; } } @cmds[$cmdnr++] = 'cd "' . $ENV{'ACE_RUN_VX_TGTSVR_ROOT'} . "/" . $cwdrel . "/" . $exesubdir . '"'; @cmds[$cmdnr++] = 'putenv("TMPDIR=' . $ENV{'ACE_RUN_VX_TGTSVR_ROOT'} . "/" . $cwdrel . '")'; if (defined $ENV{'ACE_RUN_VX_CHECK_RESOURCES'}) { @cmds[$cmdnr++] = 'memShow()'; } if (defined $ENV{'ACE_RUN_ACE_DEBUG'}) { @cmds[$cmdnr++] = 'putenv("ACE_DEBUG=' . $ENV{'ACE_RUN_ACE_DEBUG'} . '")'; } if (defined $ENV{'ACE_RUN_TAO_ORB_DEBUG'}) { @cmds[$cmdnr++] = 'putenv("TAO_ORB_DEBUG=' . $ENV{'ACE_RUN_TAO_ORB_DEBUG'} . '")'; } if (defined $ENV{'ACE_RUN_ACE_LD_SEARCH_PATH'}) { @cmds[$cmdnr++] = 'putenv("ACE_LD_SEARCH_PATH=' . $ENV{'ACE_RUN_ACE_LD_SEARCH_PATH'} . '")'; } if (defined $self->{TARGET}) { my $x_env_ref = $self->{TARGET}->{EXTRA_ENV}; while ( my ($env_key, $env_value) = each(%$x_env_ref) ) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "INFO: adding target environment $env_key=$env_value\n"; } @cmds[$cmdnr++] = 'putenv("' . $env_key. '=' . $env_value . '")'; } } @cmds[$cmdnr++] = 'ld <'. $program . $PerlACE::ProcessVX::ExeExt; if (defined $self->{ARGUMENTS}) { ($arguments = $self->{ARGUMENTS})=~ s/\"/\\\"/g; ($arguments = $self->{ARGUMENTS})=~ s/\'/\\\'/g; $arguments = ",\"" . $arguments . "\""; } if (defined $ENV{'ACE_RUN_VX_TGTSRV_WORKINGDIR'}) { @cmds[$cmdnr++] = 'cd "' . $ENV{'ACE_RUN_VX_TGTSRV_WORKINGDIR'} . '"'; } else { @cmds[$cmdnr++] = 'cd "' . $ENV{'ACE_RUN_VX_TGTSVR_ROOT'} . "/" . $cwdrel . '"'; } @cmds[$cmdnr++] = 'ace_vx_rc = vx_execae(ace_main' . $arguments . ')'; @cmds[$cmdnr++] = 'unld "'. $program . $PerlACE::ProcessVX::ExeExt . '"'; push @cmds, @unload_commands; $cmdnr += scalar @unload_commands; $prompt = '-> $'; } print $oh "require Net::Telnet;\n"; print $oh "my \@cmds;\n"; print $oh "my \$prompt = '$prompt';\n"; my $i = 0; while($i < $cmdnr) { print $oh "\@cmds[$i] = '" . @cmds[$i++] . "';\n"; } print $oh "my \$cmdnr = $cmdnr;\n\n"; print $oh <<'__END__'; my $ok; my $telnet_port = $ENV{'ACE_RUN_VX_TGT_TELNET_PORT'}; my $telnet_host = $ENV{'ACE_RUN_VX_TGT_TELNET_HOST'}; if (!defined $telnet_host) { $telnet_host = $ENV{'ACE_RUN_VX_TGTHOST'}; } if (!defined $telnet_port) { $telnet_port = 23; } my $t = new Net::Telnet(Timeout => 600, Errmode => 'return', Host => $telnet_host, Port => $telnet_port); if (!defined $t) { die "ERROR: Telnet failed to <" . $telnet_host . ":". $telnet_port . ">"; } if (!$t->open()) { die "ERROR: Telnet open to <" . $telnet_host . ":". $telnet_port . "> " . $t->errmsg; } __END__ if (defined $ENV{'ACE_RUN_VX_TERMSERV_DEV'}) { print $oh <<'__END__'; $t->prompt('/' . $ENV{'ACE_RUN_VX_IBOOT_USER'} . '>$/'); $t->login($ENV{'ACE_RUN_VX_IBOOT_USER'}, $ENV{'ACE_RUN_VX_IBOOT_PASSWORD'}); $t->print('direct ' . $ENV{'ACE_RUN_VX_TERMSERV_DEV'}); $t->waitfor('/Entering Direct mode/'); $t->print(''); __END__ } print $oh <<'__END__'; my $target_login = $ENV{'ACE_RUN_VX_LOGIN'}; my $target_password = $ENV{'ACE_RUN_VX_PASSWORD'}; if (defined $target_login) { $t->waitfor('/VxWorks login: $/'); $t->print("$target_login"); } if (defined $target_password) { $t->waitfor('/Password: $/'); $t->print("$target_password"); } # wait for the prompt my $buf = ''; my $prompt1 = '-> $'; while (1) { my $blk = $t->get; print $blk; $buf .= $blk; if ($buf =~ /$prompt1/) { last; } } if ($buf !~ /$prompt1/) { die "ERROR: Didn't got prompt but got <$buf>"; } my $i = 0; my @lines; while($i < $cmdnr) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print @cmds[$i]."\n"; } if ($t->print (@cmds[$i++])) { my $buf = ''; while (1) { my $blk = $t->get; print $blk; $buf .= $blk; if ($buf =~ /$prompt/) { last; } } } else { print $t->errmsg; } } $t->close(); sleep(2); exit; __END__ close($oh); Win32::Process::Create ($self->{PROCESS}, "$^X", "$^X run_vx.pl", 0, 0, '.'); Win32::Process::GetExitCode ($self->{PROCESS}, $status); if ($status != $STILL_ACTIVE) { print STDERR "ERROR: Spawn failed for <", "$^X run_vx.pl", ">\n"; exit $status; } $self->{RUNNING} = 1; return 0; } # Wait for a process to exit with a timeout sub TimedWait ($) { my($self) = shift; my($timeout) = shift; return $self->Wait($timeout); } # Terminate the process and wait for it to finish sub TerminateWaitKill ($) { my $self = shift; my $timeout = shift; if ($self->{RUNNING}) { print STDERR "INFO: $self->{EXECUTABLE} being killed.\n"; Win32::Process::Kill ($self->{PROCESS}, 0); $PerlACE::ProcessVX::DoVxInit = 1; # force reboot on next run } return $self->WaitKill ($timeout); } # Wait until a process exits. # return -1 if the process is still alive. sub Wait ($) { my $self = shift; my $timeout = shift; if (!defined $timeout || $timeout < 0) { $timeout = INFINITE; } else { $timeout = $timeout * 1000 * $PerlACE::ProcessVX::WAIT_DELAY_FACTOR; } my $result = 0; if ($self->{RUNNING}) { $result = Win32::Process::Wait ($self->{PROCESS}, $timeout); if ($result == 0) { return -1; } } Win32::Process::GetExitCode ($self->{PROCESS}, $result); $self->{RUNNING} = 0; if ($result != 0) { $PerlACE::ProcessVX::DoVxInit = 1; # force reboot on next run } return $result; } # Kill the process sub Kill () { my $self = shift; if ($self->{RUNNING}) { Win32::Process::Kill ($self->{PROCESS}, -1); } $self->{RUNNING} = 0; } 1; ace-8.0.4+dfsg.orig/bin/PerlACE/ProcessAndroid.pm0000644000175000017500000004574515027201773020446 0ustar sudipsudip#!/usr/bin/env perl package PerlACE::ProcessAndroid; use POSIX "sys_wait_h"; use File::Basename; use File::Spec; use FileHandle; use Cwd; use Config; use strict; ############################################################################### ### Grab signal names my @signame; if (defined $Config{sig_name}) { my $i = 0; foreach my $name (split (' ', $Config{sig_name})) { $signame[$i] = $name; $i++; } } else { my $i; for ($i = 0; $i < 255; ++$i) { $signame[$i] = $i; } } ############################################################################### ### Constructor and Destructor sub new { my $proto = shift; my $class = ref ($proto) || $proto; my $self = {}; $self->{TARGET} = shift; $self->{RUNNING} = 0; $self->{IGNOREEXESUBDIR} = 1; $self->{IGNOREHOSTROOT} = 0; $self->{PROCESS} = undef; $self->{EXECUTABLE} = shift; # Only set argument when they are really supplied via the # CreateProcess call. If the weren't supplied, an error like # Process_Android::HASH (0x...) is generated. if (@_ == 1) { $self->{ARGUMENTS} = shift; } else { $self->{ARGUMENTS} = ""; } $self->{FSROOT} = $ENV{'ANDROID_FS_ROOT'}; bless ($self, $class); # copy the test executable to the target at forehand $self->copy_executable (); return $self; } sub DESTROY { my $self = shift; if ($self->{RUNNING} == 1) { print STDERR "ERROR: <", $self->{EXECUTABLE}, "> still running upon object destruction\n"; $self->Kill (); } if (defined $self->{SCRIPTFILE}) { unlink $self->{SCRIPTFILE}; } if (defined $self->{UNLINKLIST}) { foreach my $ul (@{$self->{UNLINKLIST}}) { unlink $ul; } } } ############################################################################### sub Arguments { my $self = shift; if (@_ != 0) { $self->{ARGUMENTS} = shift; if (defined $self->{SCRIPTFILE}) { if (!defined $self->{UNLINKLIST}) { $self->{UNLINKLIST} = (); } push(@{$self->{UNLINKLIST}}, $self->{SCRIPTFILE}); $self->{SCRIPTFILE} = undef; } } return $self->{ARGUMENTS}; } sub Executable { my $self = shift; if (@_ != 0) { $self->{EXECUTABLE} = shift; if (defined $self->{SCRIPTFILE}) { if (!defined $self->{UNLINKLIST}) { $self->{UNLINKLIST} = (); } push(@{$self->{UNLINKLIST}}, $self->{SCRIPTFILE}); $self->{SCRIPTFILE} = undef; } # copy the (new) test executable to the target # previously scanned .vxtest files and detected libraries # will not be scanned/copied twice $self->copy_executable (); } my $executable = $self->{EXECUTABLE}; # If the target's config has a different ACE_ROOT, rebase the executable # from $ACE_ROOT to the target's root. if (defined $self->{TARGET} && $self->{TARGET}->ACE_ROOT() ne $ENV{'ACE_ROOT'}) { $executable = PerlACE::rebase_path ($executable, $ENV{'ACE_ROOT'}, $self->{TARGET}->ACE_ROOT()); } if ($self->{IGNOREEXESUBDIR}) { return $executable; } my $basename = basename ($executable); my $dirname = dirname ($executable).'/'; my $subdir = $PerlACE::Process::ExeSubDir; if (defined $self->{TARGET} && defined $self->{TARGET}->{EXE_SUBDIR}) { $subdir = $self->{TARGET}->{EXE_SUBDIR}; } $executable = $dirname . $subdir . $basename; return $executable; } sub Wait ($) { my $self = shift; my $timeout = shift; if (!defined $timeout || $timeout < 0) { waitpid ($self->{PROCESS}, 0); } else { return $self->TimedWait($timeout); } } # really only for internal use sub check_return_value ($) { my $self = shift; my $rc = shift; if ($rc < 0x80) { return $rc; } # Remember Core dump flag my $dump = 0; if ($rc & 0x80) { $rc &= ~0x80; $dump = 1; } # check for ABRT, KILL or TERM if ($rc == 6 || $rc == 9 || $rc == 15) { return 0; } print STDERR "ERROR: <", $self->{EXECUTABLE}, "> exited with "; print STDERR "coredump from " if ($dump == 1); print STDERR "signal $rc : ", $signame[$rc], "\n"; return 255; } sub TimedWait ($) { my $self = shift; my $timeout = shift; if ($PerlACE::Process::WAIT_DELAY_FACTOR > 0) { $timeout *= $PerlACE::Process::WAIT_DELAY_FACTOR; } if (defined $ENV{'ACE_TEST_VERBOSE'} && $self->{PROCESS} > 0) { print STDERR "Wait $timeout to finish executable $self->{PROCESS}. "; print STDERR "RUNNING: $self->{RUNNING}\n"; } # Multiply with 10 because we wait a tenth of a second each time $timeout *= 10; while ($timeout-- != 0 && $self->{PROCESS} > 0 && $self->{RUNNING} == 1) { my $pid = waitpid ($self->{PROCESS}, WNOHANG); if ($pid != 0 && $? != -1) { if (defined $ENV{'ACE_TEST_VERBOSE'} && $self->{PROCESS} > 0) { print STDERR "Executable $self->{PROCESS} finished ($pid)\n"; } last; } select(undef, undef, undef, 0.1); } # attempt to retrieve exitstatus from remote .rc file my $shell = $ENV{'ANDROID_SDK_ROOT'} . '/platform-tools/adb shell'; my $rcfile = $self->{RCFILE}; ## wait max 5 * $PerlACE::Process::WAIT_DELAY_FACTOR sec for RC file to appear my $start_tm = time (); my $max_wait = 5; if ($PerlACE::Process::WAIT_DELAY_FACTOR > 0) { $max_wait *= $PerlACE::Process::WAIT_DELAY_FACTOR; } my $rc = -255; while ((time() - $start_tm) < $max_wait) { select(undef, undef, undef, 0.2); $rc = int(`$shell 'if [ -e $rcfile -a -s $rcfile ] ; then cat $rcfile; rm -f $rcfile >/dev/null 2>&1; else echo -255; fi'`); if ($rc != -255) { return $self->check_return_value ($rc); } } if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Exit TimedWait with Process: $self->{PROCESS}, Running: $self->{RUNNING}\n"; } return -1; } sub Kill () { my $self = shift; if ($self->{RUNNING} == 1) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Killing process <$self->{PROCESS}>\n"; } # killing the adb process, not the actual test executable. kill (1, $self->{PROCESS}); my $pid = waitpid ($self->{PROCESS}, WNOHANG); if ($pid == -1) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Process <$self->{PROCESS}> already ended\n"; } } elsif ($pid == $self->{PROCESS}) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Process <$self->{PROCESS}> ended\n"; } } } $self->{RUNNING} = 0; } sub WaitKill ($) { my $self = shift; my $timeout = shift; if ($self->{RUNNING} == 0) { return 0; } my $status = $self->TimedWait ($timeout); if ($status == -1) { print STDERR "ERROR: $self->{EXECUTABLE} timedout\n"; $self->Kill (); } $self->{RUNNING} = 0; return $status; } # Do a Spawn and immediately WaitKill # sub SpawnWaitKill ($) { my $self = shift; my $timeout = shift; if ($self->Spawn () == -1) { return -1; } my $result = 0; if ($self->{RUNNING} == 1) { $result = $self->WaitKill ($timeout); } return $result; } sub TerminateWaitKill ($) { my $self = shift; my $timeout = shift; if ($self->{RUNNING}) { print STDERR "INFO: $self->{EXECUTABLE} being killed.\n"; my $killcmd = $ENV{'ANDROID_SDK_ROOT'} . '/platform-tools/adb shell "kill -s TERM ' . $self->{REMOTE_PID} . '"'; system ($killcmd); } return $self->WaitKill ($timeout); } sub IgnoreExeSubDir { my $self = shift; if (@_ != 0) { $self->{IGNOREEXESUBDIR} = shift; } return $self->{IGNOREEXESUBDIR}; } sub IgnoreHostRoot { my $self = shift; if (@_ != 0) { $self->{IGNOREHOSTROOT} = shift; } return $self->{IGNOREHOSTROOT}; } sub Spawn () { my $self = shift; if ($self->{RUNNING} == 1) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> already running\n"; return -1; } if (!defined $self->{EXECUTABLE}) { print STDERR "ERROR: Cannot Spawn: No executable specified\n"; return -1; } if ($self->{IGNOREEXESUBDIR} == 0) { if (!-f $self->Executable ()) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> not found\n"; return -1; } } my $status = 0; my $fsroot_target = $ENV{'ANDROID_FS_ROOT'}; my $exe = $self->Executable (); my $program = "$fsroot_target/".basename($exe); my($test, $dir, $suffix) = fileparse($program); my $local_xdir = cwd (); if (!defined $self->{PIDFILE}) { $self->{PIDFILE} = "$fsroot_target/ace-".rand(time).".pid"; } if (!defined $self->{RCFILE}) { $self->{RCFILE} = "$fsroot_target/ace-".rand(time).".rc"; } if (!defined $self->{SCRIPTFILE}) { $self->{SCRIPTFILE} = "$local_xdir/run-".rand(time).".sh"; } ## create scriptfile my $run_script = # "if [ ! -e /tmp/.acerun ]; then mkdir /tmp/.acerun; fi\n". "cd $fsroot_target\n". "export LD_LIBRARY_PATH=$fsroot_target/lib:.:\$LD_LIBRARY_PATH\n". "export PATH=\$PATH:$fsroot_target/lib:.\n". "export ACE_ROOT=$fsroot_target\n"; if (defined $self->{TARGET} && defined $self->{TARGET}->{EXTRA_ENV}) { my $x_env_ref = $self->{TARGET}->{EXTRA_ENV}; while ( my ($env_key, $env_value) = each(%$x_env_ref) ) { $run_script .= "export $env_key=\"$env_value\"\n"; } } $run_script .= "./$test $self->{ARGUMENTS} &\n"; $run_script .= "MY_PID=\$!\n". "echo \$MY_PID > ".$self->{PIDFILE}."\n"; if (defined $ENV{'ACE_TEST_VERBOSE'}) { $run_script .= "echo INFO: Process started remote with pid [\$MY_PID]\n"; } $run_script .= "wait \$MY_PID\n"; $run_script .= "MY_RC=\$?\n". "echo \$MY_RC > ".$self->{RCFILE}."\n"; if (defined $ENV{'ACE_TEST_VERBOSE'}) { $run_script .= "echo INFO: Process [\$MY_PID] returned exit code [\$MY_RC]\n"; } unless (open (RUN_SCRIPT, ">".$self->{SCRIPTFILE})) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> failed to create ",$self->{SCRIPTFILE},"\n"; return -1; } print RUN_SCRIPT $run_script; close RUN_SCRIPT; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "INFO: created run script [",$self->{SCRIPTFILE},"]\n", $run_script; } $self->PutFile ($self->{SCRIPTFILE}, "$fsroot_target/".basename($self->{SCRIPTFILE})); my $adb_process = $ENV{'ANDROID_SDK_ROOT'} . "/platform-tools/adb"; my $cmd = $adb_process . ' shell "cd ' . $fsroot_target . ' && source ./' . basename($self->{SCRIPTFILE}) . '"'; FORK: { if ($self->{PROCESS} = fork) { bless $self; } elsif (defined $self->{PROCESS}) { $self->{RUNNING} = 1; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Start to execute: $cmd\n"; } exec ( $cmd ); exit; } elsif ($! =~ /No more process/) { sleep 5; redo FORK; } else { print STDERR "ERROR: Can't fork <" . $cmd . ">: $!\n"; } } my $shell = $adb_process . ' shell'; my $pidfile = $self->{PIDFILE}; ## wait max 10 * $PerlACE::Process::WAIT_DELAY_FACTOR sec for pid file to appear my $start_tm = time (); my $max_wait = 10; if ($PerlACE::Process::WAIT_DELAY_FACTOR > 0) { $max_wait *= $PerlACE::Process::WAIT_DELAY_FACTOR; } my $rc = 1; while ((time() - $start_tm) < $max_wait) { select(undef, undef, undef, 0.2); $rc = int(`$shell 'if [ -e $pidfile -a -s $pidfile ] ; then cat $pidfile; rm -f $pidfile >/dev/null 2>&1; else echo 0; fi'`); if ($rc != 0) { $self->{REMOTE_PID} = $rc; last; } } if (!defined $self->{REMOTE_PID}) { print STDERR "ERROR: Remote command failed <" . $test . ' ' . $self->{ARGUMENTS} . ">: $! No PID found.\n"; return -1; } $self->{RUNNING} = 1; return 0; } sub copy_executable ($) { my $self = shift; my $fsroot_target = $ENV{'ANDROID_FS_ROOT'}; my $program = $self->Executable (); # never copy program subdirectory if specified (like '../Generic_Servant/server') my $exe = "$fsroot_target/".basename($program); $self->{SHLIBS} = (); $self->{VXTESTS} = (); $self->{XLIBPATH} = (); push (@{$self->{XLIBPATH}}, '.'); if (defined $self->{TARGET} && defined $self->{TARGET}->{LIBPATH}) { foreach my $libpath (split(/:|;/, $self->{TARGET}->{LIBPATH})) { push(@{$self->{XLIBPATH}}, $libpath); } } $self->PutFile ("$program", $exe); if ($PerlACE::Static == 0) { # collect libraries from .vxtest file $self->process_vxtest ($program.'.vxtest'); # collect libraries from extra lib paths (might be dynamically loaded) $self->collect_extra_libs (); # collect any runtime lib dependencies specified $self->collect_runtime_libs (); # copy all collected libraries foreach my $lib (@{$self->{SHLIBS}}) { $self->PutFile ($lib, "$self->{FSROOT}/lib/".basename($lib)); } # handle defined system libraries if (defined $self->{TARGET} && defined $self->{TARGET}->{SYSTEM_LIBS}) { $self->copy_system_libs ($self->{TARGET}->{SYSTEM_LIBS}); } } } sub process_vxtest ($) { my $self = shift; my $newvxtest = shift; foreach my $vxtest (@{$self->{VXTESTS}}) { if ($vxtest eq $newvxtest) { return; } } if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Processing vxtest file $newvxtest\n"; } $self->collect_vxtest_libs ($newvxtest); } sub add_unique_lib ($) { my $self = shift; my $newlib = shift; foreach my $lib (@{$self->{SHLIBS}}) { if ($lib eq $newlib) { return 0; } } if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Collecting library $newlib\n"; } push(@{$self->{SHLIBS}}, $newlib); return 1; } sub collect_vxtest_libs () { my $self = shift; my $vxtestfile = shift; my $fh = new FileHandle; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Analyzing vxtest file <$vxtestfile>\n"; } if (open ($fh, $vxtestfile)) { my $line1 = <$fh>; chomp $line1; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Analyzing vxtest file: Found line $line1\n"; } while(<$fh>) { $line1 = $_; chomp $line1; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Analyzing vxtest file: Found line $line1\n"; } $self->collect_vxtest_lib ($line1); } } close $fh; } sub collect_vxtest_lib ($) { my $self = shift; my $name = shift; my $query; my @libpaths = ("$ENV{'ACE_ROOT'}/lib"); push (@libpaths, @{$self->{XLIBPATH}}); foreach my $libpath (@libpaths) { $query = "$libpath/lib$name.so"; if (-e $query) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Found $name in library directory $libpath\n"; } # look for versioned and non-versioned filenames my @files = glob ($query . '*'); foreach my $file (@files) { $self->add_unique_lib ($file); } } } } sub collect_extra_libs () { my $self = shift; # treat current dir as extra libpath my @libpaths = (@{$self->{XLIBPATH}}); my $query; my $vxtest; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Inspecting libpaths (@libpaths) for extra libraries\n"; } foreach my $libpath (@libpaths) { # look for versioned and non-versioned libraries $query = "$libpath/lib*.so*"; my @files = glob ($query); foreach my $file (@files) { if ($self->add_unique_lib ($file) == 1) { # check for possible .vxtest for new lib dependency $vxtest = basename ($file); $vxtest =~ s/^lib(.*)[\.]so([\.].*)?$/\1/; if (-e "$libpath/$vxtest.vxtest") { # process .vxtest file if not yet processed before $self->process_vxtest ("$libpath/$vxtest.vxtest"); } } } } } sub collect_runtime_libs () { my $self = shift; # only need to test ACE_ROOT/lib since all libs from '.' and extra libpaths are copied already my @libpaths = ("$ENV{'ACE_ROOT'}/lib"); my $query; if (defined $self->{TARGET} && defined $self->{TARGET}->{RUNTIME_LIBDEP}) { foreach my $runtimelib (@{$self->{TARGET}->{RUNTIME_LIBDEP}}) { if (-e $runtimelib) { $self->add_unique_lib ($runtimelib); } else { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Inspecting libpaths (@libpaths) for runtime libe $runtimelib\n"; } foreach my $libpath (@libpaths) { # look for versioned and non-versioned libraries $query = "$libpath/lib$runtimelib.so*"; my @files = glob ($query); foreach my $file (@files) { $self->add_unique_lib ($file); } } } } } } sub copy_system_libs () { my $self = shift; my $syslibs = shift; my @liblist = split (',', $syslibs); foreach my $lib (@liblist) { if (-e $lib) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Found system library $lib\n"; } $self->PutFile ($lib, "$self->{FSROOT}/lib/" . basename ($lib)); } else { print STDERR "Cannot find system library $lib!\n"; } } } sub PutFile ($) { my $self = shift; my $src = shift; my $dest = shift; if (defined $self->{TARGET}) { return $self->{TARGET}->PutLib($src, $dest); } else { my $silent; if (!defined $ENV{'ACE_TEST_VERBOSE'}) { $silent = "2> /dev/null" } my $adb_process = $ENV{'ANDROID_SDK_ROOT'} . "/platform-tools/adb"; my $cmd = "$adb_process" . ' push '. "\"$src\" \"$dest\" $silent"; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "PutFile cmd: $cmd\n"; } system ( $cmd ); if ($? != 0) { return -1; } return 0; } } 1; ace-8.0.4+dfsg.orig/bin/PerlACE/TestTarget_VxWorks.pm0000644000175000017500000000420515027201773021302 0ustar sudipsudip#!/usr/bin/env perl package PerlACE::TestTarget_VxWorks; # ****************************************************************** # Description : Creates a PerlACE::ProcessVX # Author : Chad Elliott # Create Date : 6/20/2008 # ****************************************************************** # ****************************************************************** # Pragma Section # ****************************************************************** use PerlACE::TestTarget; use strict; use PerlACE::ProcessVX; use Cwd; use English; our @ISA = qw(PerlACE::TestTarget); # ****************************************************************** # Subroutine Section # ****************************************************************** sub LocalFile { my($self, $file) = @_; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "LocalFile is $file\n"; } return $file; } sub AddLibPath ($) { my $self = shift; my $dir = shift; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Adding libpath $dir\n"; } PerlACE::add_lib_path ($dir); } sub CreateProcess { my $self = shift; my $process = new PerlACE::ProcessVX (@_); $process->{TARGET} = $self; return $process; } # Need a reboot when this target is destroyed. sub NeedReboot ($) { my $self = shift; $self->{REBOOT_NEEDED} = 1; } # Reboot target sub RebootNow ($) { my $self = shift; $self->{REBOOT_NEEDED} = undef; print STDERR "Attempting to reboot target...\n"; reboot (); } sub WaitForFileTimed ($) { my $self = shift; my $file = shift; my $timeout = shift; my $cwdrel = $file; my $prjroot = defined $ENV{'ACE_RUN_VX_PRJ_ROOT'} ? $ENV{'ACE_RUN_VX_PRJ_ROOT'} : $ENV{'ACE_ROOT'}; if (length ($cwdrel) > 0) { $cwdrel = File::Spec->abs2rel( cwd(), $prjroot ); } else { $cwdrel = File::Spec->abs2rel( $cwdrel, $prjroot ); } my $newfile = $self->{HOST_ROOT} . "/" . $cwdrel . "/" . $file; return PerlACE::waitforfile_timed ($newfile, $timeout); } sub KillAll ($) { my $self = shift; my $procmask = shift; PerlACE::ProcessVX::kill_all ($procmask, $self); } 1; ace-8.0.4+dfsg.orig/bin/PerlACE/TestTarget.pm0000644000175000017500000004231415027201773017602 0ustar sudipsudip#!/usr/bin/env perl # # The TestTarget class is for operations that are per-target while testing. # They can be overridden for specific needs like embedded systems, etc. package PerlACE::TestTarget; use strict; use English; use POSIX qw(:time_h); use File::Copy; use File::Spec; use File::Basename; use PerlACE::Run_Test; use Socket; use Sys::Hostname; use Cwd; ############################################################################### # Create the proper kind of TestTarget based on specified test component. # Pass the component number as the first argument. If there's no # DOC_TEST_ environment variable, use the local machine. sub create_target { my $component = shift; if ($component == 0) { print STDERR "Warning: components should be numbers, not names\n"; } my $target = undef; my $envname = "DOC_TEST_\U$component"; if (!exists $ENV{$envname}) { $envname = "DOC_TEST_DEFAULT"; if (!exists $ENV{$envname}) { $target = new PerlACE::TestTarget("default"); return $target; } } my $config_name = $ENV{$envname}; # There's a configuration name; use it to look up the platform. $config_name = uc $config_name; $envname = $config_name.'_OS'; if (!exists $ENV{$envname}) { print STDERR "$config_name requires an OS type in $envname\n"; return undef; } my $config_os = $ENV{$envname}; SWITCH: { if ($config_os =~ m/local|remote|avd/i) { $target = new PerlACE::TestTarget ($config_name); last SWITCH; } if ($config_os =~ m/LabVIEW_RT/i) { require PerlACE::TestTarget_LVRT; $target = new PerlACE::TestTarget_LVRT ($config_name); last SWITCH; } if ($config_os =~ /VxWorks/i) { require PerlACE::TestTarget_VxWorks; $target = new PerlACE::TestTarget_VxWorks ($config_name); last SWITCH; } if ($config_os =~ /WinCE/i) { require PerlACE::TestTarget_WinCE; $target = new PerlACE::TestTarget_WinCE ($config_name); last SWITCH; } if ($config_os =~ /ANDROID/i) { require PerlACE::TestTarget_Android; $target = new PerlACE::TestTarget_Android ($config_name, $component); last SWITCH; } print STDERR "$config_os is an unknown OS type!\n"; } return $target; } ### Constructor and Destructor sub new { my $proto = shift; my $class = ref ($proto) || $proto; my $self = {}; my $config_name = shift; bless ($self, $class); $self->GetConfigSettings($config_name); return $self; } sub DESTROY { my $self = shift; } # If there was a config name specified, use it to look up the configure # info. Else, use the traditional defaults. sub GetConfigSettings ($) { my $self = shift; my $config_name = shift; my $env_prefix = ''; my $fs_root; my $tgt_fs_root; if (defined $config_name) { $env_prefix = $config_name."_"; } my $env_name = $env_prefix.'ACE_ROOT'; if (exists $ENV{$env_name}) { $self->{ace_root} = $ENV{$env_name}; } else { # Fall back to naked ACE_ROOT if no config-specific one. $self->{ace_root} = $ENV{'ACE_ROOT'}; } $tgt_fs_root = dirname($self->{ace_root}); if (exists $ENV{'ACE_ROOT'}) { $fs_root = dirname($ENV{'ACE_ROOT'}); } else { $fs_root = $tgt_fs_root; } $env_name = $env_prefix.'TAO_ROOT'; if (exists $ENV{$env_name}) { $self->{tao_root} = $ENV{$env_name}; } elsif ($fs_root ne $tgt_fs_root && -d "$fs_root/TAO") { # flat directory structure $self->{tao_root} = "$tgt_fs_root/TAO"; } elsif ($fs_root ne $tgt_fs_root && -d "$fs_root/ACE/TAO") { # hierarchical struture $self->{tao_root} = "$self->{ace_root}/TAO"; } elsif (exists $ENV{'TAO_ROOT'}) { if ($fs_root ne $tgt_fs_root) { $self->{tao_root} = PerlACE::rebase_path ($ENV{'TAO_ROOT'}, $fs_root, $tgt_fs_root); } else { $self->{tao_root} = $ENV{'TAO_ROOT'}; } } else { # fall back to assuming classic hierarchical structure $self->{tao_root} = "$self->{ace_root}/TAO"; } $env_name = $env_prefix.'TEST_ROOT'; if (exists $ENV{$env_name}) { $self->{TEST_ROOT} = $ENV{$env_name}; } else { $self->{TEST_ROOT} = $self->{ACE_ROOT}; } $env_name = $env_prefix.'TEST_FSROOT'; if (exists $ENV{$env_name}) { $self->{TEST_FSROOT} = $ENV{$env_name}; } if ($fs_root ne $tgt_fs_root) { $self->{HOST_FSROOT} = $fs_root; $self->{TARGET_FSROOT} = $tgt_fs_root; } $env_name = $env_prefix.'EXE_SUBDIR'; if (exists $ENV{$env_name}) { $self->{EXE_SUBDIR} = $ENV{$env_name}.'/'; } else { # If no ExeSubDir given via env variable, and this is an unnamed # config, allow use of the subdir specified on the command line. # This preserves historical behavior. if (defined $config_name && $config_name ne 'default') { $self->{EXE_SUBDIR} = './'; } else { $self->{EXE_SUBDIR} = $PerlACE::Process::ExeSubDir; } } $env_name = $env_prefix.'ARCH'; if (exists $ENV{$env_name}) { $self->{ARCH} = $ENV{$env_name}; } elsif ($config_name eq 'default' && grep(($_ eq 'ARCH'), @PerlACE::ConfigList::Configs)) { $self->{ARCH} = 1; } $env_name = $env_prefix.'PROCESS_START_WAIT_INTERVAL'; if (exists $ENV{$env_name}) { $self->{PROCESS_START_WAIT_INTERVAL} = $ENV{$env_name}; } else { $self->{PROCESS_START_WAIT_INTERVAL} = 15; } $env_name = $env_prefix.'PROCESS_STOP_WAIT_INTERVAL'; if (exists $ENV{$env_name}) { $self->{PROCESS_STOP_WAIT_INTERVAL} = $ENV{$env_name}; } else { $self->{PROCESS_STOP_WAIT_INTERVAL} = 10; } $env_name = $env_prefix.'ADB_WAIT_FOR_DEVICE_TIMEOUT'; if (exists $ENV{$env_name}) { $self->{ADB_WAIT_FOR_DEVICE_TIMEOUT} = $ENV{$env_name}; } else { $self->{ADB_WAIT_FOR_DEVICE_TIMEOUT} = 120; } $env_name = $env_prefix.'HOSTNAME'; if (exists $ENV{$env_name}) { $self->{HOSTNAME} = $ENV{$env_name}; } else { $self->{HOSTNAME} = hostname(); } $env_name = $env_prefix.'IP_ADDRESS'; if (exists $ENV{$env_name}) { $self->{IP_ADDRESS} = $ENV{$env_name}; } $env_name = $env_prefix.'IBOOT'; if (exists $ENV{$env_name}) { $self->{IBOOT} = $ENV{$env_name}; } $env_name = $env_prefix.'IBOOT_PASSWD'; if (exists $ENV{$env_name}) { $self->{IBOOT_PASSWD} = $ENV{$env_name}; } $env_name = $env_prefix.'IBOOT_OUTLET'; if (exists $ENV{$env_name}) { $self->{IBOOT_OUTLET} = $ENV{$env_name}; } $env_name = $env_prefix.'IBOOT_USER'; if (exists $ENV{$env_name}) { $self->{IBOOT_USER} = $ENV{$env_name}; } $env_name = $env_prefix.'IBOOT_PASSWD'; if (exists $ENV{$env_name}) { $self->{IBOOT_PASSWD} = $ENV{$env_name}; } $env_name = $env_prefix.'REBOOT_TIME'; if (exists $ENV{$env_name}) { $self->{REBOOT_TIME} = $ENV{$env_name}; } else { $self->{REBOOT_TIME} = 0; } $env_name = $env_prefix.'REBOOT'; if (exists $ENV{$env_name}) { $self->{REBOOT} = $ENV{$env_name}; } else { $self->{REBOOT} = 0; } $env_name = $env_prefix.'STARTUP_COMMAND'; if (exists $ENV{$env_name}) { $self->{STARTUP_COMMAND} = $ENV{$env_name}; } $env_name = $env_prefix.'TELNET_HOST'; if (exists $ENV{$env_name}) { $self->{TELNET_HOST} = $ENV{$env_name}; } else { $self->{TELNET_HOST} = $self->{HOSTNAME}; } $env_name = $env_prefix.'TELNET_PORT'; if (exists $ENV{$env_name}) { $self->{TELNET_PORT} = $ENV{$env_name}; } else { $self->{TELNET_PORT} = 23; } $env_name = $env_prefix.'HOST_ROOT'; if (exists $ENV{$env_name}) { $self->{HOST_ROOT} = $ENV{$env_name}; } $env_name = $env_prefix.'SYSTEM_LIBS'; if (exists $ENV{$env_name}) { $self->{SYSTEM_LIBS} = $ENV{$env_name}; } $env_name = $env_prefix.'REMOTE_SHELL'; if (exists $ENV{$env_name}) { $self->{REMOTE_SHELL} = $ENV{$env_name}; } $env_name = $env_prefix.'PUT_CMD'; if (exists $ENV{$env_name}) { $self->{PUT_CMD} = $ENV{$env_name}; } $env_name = $env_prefix.'GET_CMD'; if (exists $ENV{$env_name}) { $self->{GET_CMD} = $ENV{$env_name}; } $env_name = $env_prefix.'LIBPATH'; if (exists $ENV{$env_name}) { $self->{LIBPATH} = $ENV{$env_name}; } $env_name = $env_prefix.'REMOTE_FILETEST'; if (exists $ENV{$env_name}) { $self->{REMOTE_FILETEST} = $ENV{$env_name}; } $env_name = $env_prefix.'REMOTE_FILERM'; if (exists $ENV{$env_name}) { $self->{REMOTE_FILERM} = $ENV{$env_name}; } $env_name = $env_prefix.'PS_CMD'; if (exists $ENV{$env_name}) { $self->{PS_CMD} = $ENV{$env_name}; } $env_name = $env_prefix.'KILLALL_CMD'; if (exists $ENV{$env_name}) { $self->{KILLALL_CMD} = $ENV{$env_name}; } $self->{EXTRA_ENV} = {}; $env_name = $env_prefix.'EXTRA_ENV'; if (exists $ENV{$env_name}) { my @x_env = split (' ', $ENV{$env_name}); foreach my $x_env_s (@x_env) { if ($x_env_s =~ /(\w+)=(.*)/) { $self->{EXTRA_ENV}->{$1} = $2; } elsif (exists $ENV{$env_prefix.$x_env_s}) { $self->{EXTRA_ENV}->{$x_env_s} = $ENV{$env_prefix.$x_env_s}; } } } $self->{RUNTIME_LIBDEP} = (); } ################################################################## sub ACE_ROOT ($) { my $self = shift; return $self->{ace_root}; } sub TAO_ROOT ($) { my $self = shift; return $self->{tao_root}; } sub HostName ($) { my $self = shift; return $self->{HOSTNAME}; } sub IP_Address ($) { my $self = shift; if (!defined $self->{IP_ADDRESS}) { my @host = gethostbyname($self->{HOSTNAME}); if (scalar(@host) == 0) { $self->{IP_ADDRESS} = "not found"; } else { $self->{IP_ADDRESS} = inet_ntoa($host[4]); } if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Target host [" . $self->{HOSTNAME} . "] has ipaddres : " . $self->{IP_ADDRESS}; } } return $self->{IP_ADDRESS}; } sub ExeSubDir ($) { my $self = shift; my $new_val = shift; if (defined $new_val) { $self->{EXE_SUBDIR} = $new_val; } return $self->{EXE_SUBDIR}; } sub GetArchDir { my $self = shift; my $dir = shift; if (exists $self->{ARCH}) { return $dir . $self->{EXE_SUBDIR}; } return $dir; } sub SystemLibs ($) { my $self = shift; return $self->{SYSTEM_LIBS}; } sub RandomPort ($) { my $self = shift; return (int(rand($$)) % 22766) + 10002; } sub ProcessStartWaitInterval ($) { my $self = shift; return $self->{PROCESS_START_WAIT_INTERVAL}; } sub ProcessStopWaitInterval ($) { my $self = shift; return $self->{PROCESS_STOP_WAIT_INTERVAL}; } sub AdbWaitForDeviceTimeout ($) { my $self = shift; return $self->{ADB_WAIT_FOR_DEVICE_TIMEOUT}; } sub LocalEnvDir ($) { my $self = shift; my $dir = shift; my $newdir = $dir; if (defined $self->{TARGET_FSROOT}) { $newdir = PerlACE::rebase_path ($dir, $self->{HOST_FSROOT}, $self->{TARGET_FSROOT}); } if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "LocalEnvDir for $dir is $newdir\n"; } return $newdir; } # Convert a file in current directory to be local to the target sub LocalFile ($) { my $self = shift; my $file = shift; my $newfile = PerlACE::LocalFile($file); if (defined $self->{TARGET_FSROOT}) { $newfile = PerlACE::rebase_path ($newfile, $self->{HOST_FSROOT}, $self->{TARGET_FSROOT}); } if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "LocalFile for $file is $newfile\n"; } return $newfile; } sub AddLibPath ($) { my $self = shift; my $dir = shift; my $noarch = shift; # If we have -Config ARCH, use the -ExeSubDir setting as a sub-directory # of the lib path. This is in addition to the regular LibPath. if ((defined $noarch && !$noarch) && defined $self->{ARCH}) { $self->AddLibPath($dir, 1); $dir .= '/' . $self->{EXE_SUBDIR}; } if ($self->ACE_ROOT () eq $ENV{'ACE_ROOT'}) { # add (relative) path without rebasing if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Adding libpath $dir\n"; } $self->{LIBPATH} = PerlACE::concat_path ($self->{LIBPATH}, $dir); } else { # add rebased path $dir = PerlACE::rebase_path ($dir, $self->{HOST_FSROOT}, $self->{TARGET_FSROOT}); if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Adding libpath $dir\n"; } $self->{LIBPATH} = PerlACE::concat_path ($self->{LIBPATH}, $dir); } } sub AddRuntimeLibrary ($) { my $self = shift; my $lib = shift; push(@{$self->{RUNTIME_LIBDEP}}, $lib); } sub SetEnv ($) { my $self = shift; my $env_name = shift; my $env_value = shift; $self->{EXTRA_ENV}->{$env_name} = $env_value; } sub GetEnv ($) { my $self = shift; my $env_name = shift; return $self->{EXTRA_ENV}->{$env_name}; } sub DeleteFile ($) { my $self = shift; my $file = shift; # expand path and possibly map to remote target root my $newfile = $self->LocalFile($file); if (defined $self->{REMOTE_SHELL} && defined $self->{REMOTE_FILERM}) { my $cmd = $self->{REMOTE_SHELL}; if ($self->{REMOTE_FILERM} =~ /^\d*$/) { $cmd .= " 'test -e $newfile && rm $newfile'"; } else { $cmd .= ' ' . $self->{REMOTE_FILERM} . ' ' . $newfile; } if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Deleting remote $file from path $newfile using $cmd\n"; } if (system ($cmd) != 0) { print STDERR "ERROR executing [".$cmd."]\n"; } } else { unlink ($newfile); } } sub GetFile ($) { # On local host, the file is already there. my $self = shift; my $remote_file = shift; my $local_file = shift; if (!defined $local_file) { $local_file = $remote_file; $remote_file = $self->LocalFile($local_file); } if (defined $self->{GET_CMD}) { if (system ($self->{GET_CMD}.' '.$remote_file.' '.$local_file) != 0) { print STDERR "ERROR executing [".$self->{GET_CMD}." $remote_file $local_file]\n"; } } elsif (($remote_file ne $local_file) && (File::Spec->rel2abs($remote_file) ne File::Spec->rel2abs($local_file))) { copy ($remote_file, $local_file); } return 0; } # Put file from a to b sub PutFile ($) { my $self = shift; my $src = shift; my $dest = $self->LocalFile ($src); if (defined $self->{PUT_CMD}) { if (system ($self->{PUT_CMD}.' '.$src.' '.$dest) != 0) { print STDERR "ERROR executing [".$self->{PUT_CMD}." $src $dest]\n"; } } elsif (($src ne $dest) && (File::Spec->rel2abs($src) ne File::Spec->rel2abs($dest))) { copy ($src, $dest); } return 0; } sub WaitForFileTimed ($) { my $self = shift; my $file = shift; my $timeout = shift; # expand path and possibly map to remote target root my $newfile = $self->LocalFile($file); if (defined $self->{REMOTE_SHELL} && defined $self->{REMOTE_FILETEST}) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Waiting for remote $file using path $newfile\n"; } $timeout *= $PerlACE::Process::WAIT_DELAY_FACTOR; my $cmd = $self->{REMOTE_SHELL}; if ($self->{REMOTE_FILETEST} =~ /^\d*$/) { $cmd .= " 'test -e $newfile && test -s $newfile ; echo \$?'"; } else { $cmd .= $self->{REMOTE_FILETEST} . ' ' . $file; } my $rc = 1; my $mark_tm = time (); # start time while ($timeout > 0) { $rc = int(`$cmd`); if ($rc == 0) { return 0; } select(undef, undef, undef, 0.1); $timeout -= (time () - $mark_tm); $mark_tm = time (); } return -1; } else { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Waiting for local $file using path $newfile\n"; } return PerlACE::waitforfile_timed ($newfile, $timeout); } } sub CreateProcess ($) { my $self = shift; my $process = new PerlACE::Process (@_); $process->Target($self); return $process; } # Don't need to do anything in most cases. sub GetStderrLog ($) { my $self = shift; return; } sub KillAll ($) { my $self = shift; my $procmask = shift; if (defined $self->{KILLALL_CMD}) { my $cmd = $self->{KILLALL_CMD} . ' ' . $procmask; if (defined $self->{REMOTE_SHELL}) { $cmd = $self->{REMOTE_SHELL} . ' ' . $cmd; } if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Executing $cmd\n"; } system ($cmd); } else { PerlACE::Process::kill_all ($procmask, $self); } } 1; ace-8.0.4+dfsg.orig/bin/PerlACE/ConfigList.pm0000644000175000017500000000751015027201773017554 0ustar sudipsudip#!/usr/bin/env perl package PerlACE::ConfigList; use strict; use FileHandle; @PerlACE::ConfigList::Configs = (); @PerlACE::ConfigList::Excludes = (); my @new_argv = (); for(my $i = 0; $i <= $#ARGV; ++$i) { if ($ARGV[$i] eq '-Config') { if (defined $ARGV[$i + 1]) { push @PerlACE::ConfigList::Configs, $ARGV[++$i]; } else { print STDERR "You must pass a configuration with -Config\n"; exit(1); } } elsif ($ARGV[$i] eq '-Exclude') { if (defined $ARGV[$i + 1]) { push @PerlACE::ConfigList::Excludes, $ARGV[++$i]; } else { print STDERR "You must pass an exclude pattern with -Exclude\n"; exit(1); } } else { push @new_argv, $ARGV[$i]; } } @ARGV = @new_argv; sub new () { my $self = {}; @{$self->{MY_CONFIGS}} = @PerlACE::ConfigList::Configs; bless $self; return $self; } sub my_config_list { my $self = shift; if (@_) { @{$self->{MY_CONFIGS}} = @_; } return @{$self->{MY_CONFIGS}}; } sub add_one_config ($) { my $self = shift; my $newconfig = shift; push @{$self->{MY_CONFIGS}}, $newconfig; } sub check_config (@) { my $self = shift; my @testconfigs = @_; my $the_config_allows_this = 1; # default case is true # Go though each ID on the line in turn... foreach my $config (@testconfigs) { my $required_found = !($config =~ /^\w/); foreach my $myconfig (@{$self->{MY_CONFIGS}}) { if ($config eq "!$myconfig") { $the_config_allows_this = 0; } if ($config eq $myconfig) { $required_found = 1; } } if (!$required_found) { $the_config_allows_this = 0; } } return $the_config_allows_this; } sub load ($) { my $self = shift; my $filename = shift; my $fh = new FileHandle; if (!$fh->open ("< $filename")) { print STDERR "Could not open $filename: $!\n"; exit (1); } while (<$fh>) { chomp; if (/^\s*$/ || /^#/) { next; } # compress white space s/\s+/ /g; my $entry = ''; my $configs = ''; ($entry, $configs) = split /:/; # remove trailing white spaces $entry =~ s/\s+$//; push @{$self->{ENTRIES}}, $entry; if (defined $configs) { @{$self->{CONFIGS}->{$entry}} = split (" ", $configs); } } $fh->close (); } sub valid_entries () { my $self = shift; my @entries = (); my $exclude = 0; foreach my $entry (@{$self->{ENTRIES}}) { $exclude = 0; foreach my $expat (@PerlACE::ConfigList::Excludes) { if ($entry =~ /$expat/) { $exclude = 1; last; } } if (!$exclude && $self->check_config (@{$self->{CONFIGS}->{$entry}})) { push @entries, $entry; } } return @entries; } sub list_configs () { my $self = shift; my %allconfigs = {}; my $list = ''; foreach my $entry (@{$self->{ENTRIES}}) { foreach my $config (@{$self->{CONFIGS}->{$entry}}) { $config =~ s/!//g; if ($allconfigs{$config} != 1) { $list .= $config.' '; $allconfigs{$config} = 1; } } } return $list; } sub dump () { my $self = shift; print "============================================================\n"; print "Config\n"; foreach my $config (@{$self->{MY_CONFIGS}}) { print $config, "\n"; } print "\n"; print "Entries\n"; foreach my $entry (@{$self->{ENTRIES}}) { print "- ", $entry, ": "; foreach my $config (@{$self->{CONFIGS}->{$entry}}) { print $config, " "; } print "\n"; } print "============================================================\n"; } 1; ace-8.0.4+dfsg.orig/bin/PerlACE/TestTarget_LVRT.pm0000644000175000017500000002023215027201773020444 0ustar sudipsudip#!/usr/bin/env perl # # TestTarget_LVRT - how to manage the test environment on a LabVIEW RT target. # # We can FTP files to and from the LabVIEW target, but there's no NFS or # SMB shares. # Most information about the target itself is specified via environment # variables. Environment variables with settings are named using the target's # config name with a specific suffix. The current environment variables are: # _IPNAME - the host name/IP of the target. # _CTLPORT- the TCP port number to connect to for the test # controller. If this is not set, port 8888 is used. # _FSROOT - the root of the filesystem on the target where # ACE files will be created from (cwd, if you will). # If this is not set, "\ni-rt" is used as the root. # # Each of these settings are stored in a member variable of the same name in # each object. The process objects can access them using, e.g., # $self->{TARGET}->{IPNAME}. # # This class also makes an FTP object available to process objects that are # created. FTP is set up before creating a process object and can be used to # transfer files to and from the LVRT target. package PerlACE::TestTarget_LVRT; our @ISA = "PerlACE::TestTarget"; ### Constructor and Destructor sub new { my $proto = shift; my $config_name = shift; my $class = ref ($proto) || $proto; my $self = {}; bless ($self, $class); $self->GetConfigSettings($config_name); my $targethost; my $env_name = $config_name.'_IPNAME'; if (exists $ENV{$env_name}) { $targethost = $ENV{$env_name}; } else { print STDERR "You must define target hostname/IP with $env_name\n"; undef $self; return undef; } $env_name = $config_name.'_CTLPORT'; if (exists $ENV{$env_name}) { $self->{CTLPORT} = $ENV{$env_name}; } else { print STDERR "Warning: no $env_name variable; falling back to ", "port 8888\n"; $self->{CTLPORT} = 8888; } $env_name = $config_name.'_FSROOT'; my $fsroot = '\\ni-rt\\system'; if (exists $ENV{$env_name}) { $fsroot = $ENV{$env_name}; } else { print STDERR "Warning: no $env_name variable; falling back ", "to $fsroot\n"; } $self->{FSROOT} = $fsroot; $self->{REBOOT_CMD} = $ENV{'ACE_REBOOT_LVRT_CMD'}; if (!defined $self->{REBOOT_CMD}) { $self->{REBOOT_CMD} = 'I_Need_A_Reboot_Command'; } $self->{REBOOT_TIME} = $ENV{'ACE_LVRT_REBOOT_TIME'}; if (!defined $self->{REBOOT_TIME}) { $self->{REBOOT_TIME} = 200; } $self->{REBOOT_TIME} = $ENV{'ACE_RUN_LVRT_REBOOT_TIME'}; if (!defined $self->{REBOOT_TIME}) { $self->{REBOOT_TIME} = 200; } $self->{REBOOT_NEEDED} = undef; $self->{FTP} = new Net::FTP ($targethost); $self->{IPNAME} = $targethost; if (!defined $self->{FTP}) { print STDERR "Error opening FTP to $targethost: $@\n"; $self->{REBOOT_NEEDED} = 1; undef $self; return undef; } $self->{FTP}->login("",""); return $self; } sub DESTROY { my $self = shift; # Reboot if needed; set up clean for the next test. if (defined $self->{REBOOT_NEEDED} && $self->{REBOOT_CMD}) { $self->RebootNow; } # See if there's a log; should be able to retrieve it from rebooted target. if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "LVRT target checking for remaining log...\n"; } $self->GetStderrLog(); if (defined $self->{FTP}) { $self->{FTP}->close; $self->{FTP} = undef; } } ################################################################## sub LocalFile ($) { my $self = shift; my $file = shift; my $newfile = $self->{FSROOT} . '\\' . $file; print STDERR "LVRT LocalFile for $file is $newfile\n"; return $newfile; } sub DeleteFile ($) { my $self = shift; $self->{FTP}->login("",""); foreach my $file (@_) { my $newfile = $self->LocalFile($file); $self->{FTP}->delete($newfile); } } sub GetFile ($) { # Use FTP to retrieve the file from the target; should still be open. # If only one name is given, use it for both local and remote (after # properly LocalFile-ing it). If both names are given, assume the caller # knows what he wants and don't adjust the paths. my $self = shift; my $remote_file = shift; my $local_file = shift; if (!defined $local_file) { $local_file = $remote_file; $remote_file = $self->LocalFile($local_file); } $self->{FTP}->ascii(); if ($self->{FTP}->get($remote_file, $local_file)) { return 0; } return -1; } sub WaitForFileTimed ($) { my $self = shift; my $file = shift; my $timeout = shift; my $newfile = $self->LocalFile($file); my $targetport = $self->{CTLPORT}; my $target = new Net::Telnet(Errmode => 'return'); if (!$target->open(Host => $self->{IPNAME}, Port => $targetport)) { print STDERR "ERROR: target $self->{IPNAME}:$targetport: ", $target->errmsg(), "\n"; return -1; } my $cmdline = "waitforfile $newfile $timeout"; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "-> $cmdline\n"; } $target->print("$cmdline"); my $reply; # Add a small comms delay factor to the timeout $timeout = $timeout + 2; $reply = $target->getline(Timeout => $timeout); if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "<- $reply\n"; } $target->close(); if ($reply eq "OK\n") { return 0; } return -1; } sub CreateProcess ($) { my $self = shift; my $process = new PerlACE::ProcessLVRT ($self, @_); return $process; } sub GetStderrLog ($) { my $self = shift; # Tell the target to snapshot the stderr log; if there is one, copy # it up here and put it out to our stderr. my $targetport = $self->{CTLPORT}; my $target = new Net::Telnet(Errmode => 'return'); if (!$target->open(Host => $self->{IPNAME}, Port => $targetport)) { print STDERR "ERROR: target $self->{IPNAME}:$targetport: ", $target->errmsg(), "\n"; return; } my $cmdline = "snaplog"; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "-> $cmdline\n"; } $target->print("$cmdline"); my $reply; $reply = $target->getline(); if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "<- $reply\n"; } $target->close(); if ($reply eq "NONE\n") { return; } chomp $reply; if (undef $self->{FTP}) { $self->{FTP} = new Net::FTP ($self->{IPNAME}); if (!defined $self->{FTP}) { print STDERR "$@\n"; return -1; } $self->{FTP}->login("",""); } $self->{FTP}->ascii(); if ($self->{FTP}->get($reply, "stderr.txt")) { $self->{FTP}->delete($reply); open(LOG, "stderr.txt"); while () { print STDERR; } close LOG; unlink "stderr.txt"; } return; } # Copy a file to the target. Adjust for different types (DLL, EXE, TEXT) # and debug/non (for DLLs). Additionally, a file can be removed when this # object is deleted, or left in place. sub NeedFile ($) { my $self = shift; } # Need a reboot when this target is destroyed. sub NeedReboot ($) { my $self = shift; $self->{REBOOT_NEEDED} = 1; } # Reboot target sub RebootNow ($) { my $self = shift; $self->{REBOOT_NEEDED} = undef; print STDERR "Attempting to reboot target...\n"; if (defined $self->{FTP}) { $self->{FTP}->close; $self->{FTP} = undef; } system ($self->{REBOOT_CMD}); sleep ($self->{REBOOT_TIME}); } # Reboot now then try to restore the FTP connection. sub RebootReset ($) { my $self = shift; $self->RebootNow; my $targethost = $self->{IPNAME}; $self->{FTP} = new Net::FTP ($targethost); if (!defined $self->{FTP}) { print STDERR "Error reestablishing FTP to $targethost: $@\n"; } else { $self->{FTP}->login("",""); } } sub KillAll ($) { my $self = shift; my $procmask = shift; PerlACE::ProcessLVRT::kill_all ($procmask, $self); } 1; ace-8.0.4+dfsg.orig/bin/PerlACE/perlace.mpc0000644000175000017500000000025515027201773017270 0ustar sudipsudip// -*- MPC -*- project(PerlACE) : script { Script_Files { ConfigList.pm Process.pm Process_Unix.pm Process_Win32.pm Run_Test.pm } custom_only=1 } ace-8.0.4+dfsg.orig/bin/PerlACE/ProcessLVRT.pm0000644000175000017500000002115315027201773017640 0ustar sudipsudip#!/usr/bin/env perl # # ProcessLVRT - how to run ACE+TAO tests on a LabVIEW RT target. # Tests on LabVIEW RT are not executables - LabVIEW RT can't start plain # executables; the tests are built/packaged as DLLs and loaded and executed # from a DLL loaded at LabVIEW RT boot time. The DLL on the target listens # on a TCP port (8888 by default) for connections from the host. Host requests # actions using text commands to the target. # # NOTE: This module requires the Net-Telnet Perl module. # # We can FTP files to and from the LabVIEW target, but there's no NFS or # SMB shares. package PerlACE::ProcessLVRT; our @ISA = "PerlACE::Process"; use strict; use Cwd; use English; use File::Basename; use Net::FTP; use Net::Telnet; use POSIX qw(:time_h); $PerlACE::ProcessLVRT::ExeSubDir = './'; ### Check for -ExeSubDir commands, store the last one my @new_argv = (); for(my $i = 0; $i <= $#ARGV; ++$i) { if ($ARGV[$i] eq '-ExeSubDir') { if (defined $ARGV[$i + 1]) { $PerlACE::ProcessLVRT::ExeSubDir = $ARGV[++$i].'/'; } else { print STDERR "You must pass a directory with ExeSubDir\n"; exit(1); } } else { push @new_argv, $ARGV[$i]; } } @ARGV = @new_argv; ### Constructor and Destructor sub new { my $proto = shift; my $class = ref ($proto) || $proto; my $self = {}; $self->{TARGET} = shift; $self->{EXECUTABLE} = shift; $self->{ARGUMENTS} = shift; $self->{RUNNING} = 0; $self->{IGNOREEXESUBDIR} = 1; bless ($self, $class); return $self; } sub DESTROY { my $self = shift; if ($self->{RUNNING} == 1) { print STDERR "ERROR: <", $self->{EXECUTABLE}, "> still running upon object destruction\n"; $self->Kill (); } if (defined $self->{TELNET}) { $self->{TELNET}->close(); $self->{TELNET} = undef; } } ############################################################################### # Adjust executable name for LabVIEW RT testing needs. These tests are DLLs. sub Executable { my $self = shift; if (@_ != 0) { $self->{EXECUTABLE} = shift; } my $executable = $self->{EXECUTABLE}; my $basename = basename ($executable); my $dirname = dirname ($executable). '/'; my $subdir = $PerlACE::ProcessLVRT::ExeSubDir; if (defined $self->{TARGET}) { $subdir = $self->{TARGET}->ExeSubDir(); } $executable = $dirname.$subdir.$basename.".DLL"; $executable =~ s/\//\\/g; # / <- # color coding issue in devenv return $executable; } sub Arguments { my $self = shift; if (@_ != 0) { $self->{ARGUMENTS} = shift; } return $self->{ARGUMENTS}; } sub CommandLine () { my $self = shift; my $commandline = "run " . basename($self->Executable(), ".dll"); if (defined $self->{ARGUMENTS}) { $commandline .= ' '.$self->{ARGUMENTS}; } return $commandline; } ############################################################################### # Spawn the process and continue. sub Spawn () { my $self = shift; if ($self->{RUNNING} == 1) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> already running\n"; return -1; } if (!defined $self->{EXECUTABLE}) { print STDERR "ERROR: Cannot Spawn: No executable specified\n"; return -1; } if ($self->{IGNOREEXESUBDIR} == 0) { if (!-f $self->Executable ()) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> not found\n"; return -1; } } my $status = 0; my $program = $self->Executable (); my $cwdrel = dirname ($program); my $target_ace_root = $self->{TARGET}->ACE_ROOT(); if (length ($cwdrel) > 0) { $cwdrel = File::Spec->abs2rel(cwd(), $target_ace_root); } else { $cwdrel = File::Spec->abs2rel($cwdrel, $target_ace_root); } $self->{TARGET}->{FTP}->cwd($self->{TARGET}->{FSROOT}); $self->{TARGET}->{FTP}->binary(); $self->{TARGET}->{FTP}->put($program); my $targethost = $self->{TARGET}->{IPNAME}; my $targetport = $self->{TARGET}->{CTLPORT}; $self->{TELNET} = new Net::Telnet(Errmode => 'return'); if (!$self->{TELNET}->open(Host => $targethost, Port => $targetport)) { print STDERR "ERROR: target $targethost:$targetport: ", $self->{TELNET}->errmsg(), "\n"; $self->{TELNET} = undef; $self->{TARGET}->NeedReboot; $self->{TARGET}->{FTP}->delete($program); return -1; } my $cmdline = $self->CommandLine(); if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "-> $cmdline\n"; } $self->{TELNET}->print("$cmdline"); my $reply; $reply = $self->{TELNET}->getline(); if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "<- $reply\n"; } if ($reply eq "OK\n") { $self->{RUNNING} = 1; return 0; } print STDERR "ERROR: can't $cmdline: " . $reply . "\n"; $self->{TARGET}->{FTP}->delete($program); # Not unless can't get the response. $self->{TARGET}->NeedReboot; return -1; } # Wait for the process to exit or kill after a time period sub WaitKill ($) { my $self = shift; my $timeout = shift; my $status = $self->TimedWait ($timeout); $self->{RUNNING} = 0; # If the test timed out, the target is probably toast. Don't bother # trying to get the log file until after rebooting and resetting FTP. if ($status == -1) { print STDERR "ERROR: $self->{EXECUTABLE} timedout\n"; $self->Kill(); } # Now get the log file from the test, and delete the test from # the target. The FTP session should still be open. my $program = $self->Executable (); my $logname = basename($program,".dll") . ".log"; my $target_log_path = $self->{TARGET}->{FSROOT} . "\\log\\" . $logname; $program = basename($program); $self->{TARGET}->{FTP}->delete($program); $self->{TARGET}->{FTP}->get($target_log_path,"log\\$logname"); $self->{TARGET}->{FTP}->delete($target_log_path); return $status; } # Do a Spawn and immediately WaitKill sub SpawnWaitKill ($) { my $self = shift; my $timeout = shift; my $status = $self->Spawn (); if ($status == 0) { $status = $self->WaitKill ($timeout); } return $status; } sub TerminateWaitKill ($) { my $self = shift; my $timeout = shift; if ($self->{RUNNING}) { print STDERR "INFO: $self->{EXECUTABLE} being killed.\n"; $self->Kill(); } return $self->WaitKill ($timeout); } sub Kill () { my $self = shift; if ($self->{RUNNING}) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "-> kill\n"; } $self->{TELNET}->print("kill"); # Just wait for any reply; don't care what it is. my $reply = $self->{TELNET}->getline(); if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "<- $reply\n"; } } $self->{RUNNING} = 0; # Trying to kill a LabVIEW RT thread and recover is probably futile. Just # reboot and reset the FTP connection. if (defined $self->{TELNET}) { $self->{TELNET}->close(); $self->{TELNET} = undef; } $self->{TARGET}->RebootReset; } # Wait until a process exits. # return -1 if the process is still alive. sub Wait ($) { my $self = shift; my $timeout = shift; if (!defined $timeout || $timeout < 0) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "-> wait\n"; } $self->{TELNET}->print("wait"); my $reply = $self->{TELNET}->getline(Timeout => 300); $self->{RUNNING} = 0; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "<- $reply\n"; } return 0+ $reply; } else { return TimedWait($self, $timeout); } } sub TimedWait ($) { my $self = shift; my $timeout = shift; my $reply; if (!$self->{RUNNING}) { return -1; } CHECK: while ($timeout > 0) { $self->{TELNET}->print ("status"); if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "-> status\n"; } $reply = $self->{TELNET}->getline(Timeout => $timeout); if (!defined $reply) { last CHECK; } if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "<- $reply\n"; } if ($reply =~ /^RUNNING/) { sleep 2; $timeout -= 2; next CHECK; } # Have a status; return it. $self->{RUNNING} = 0; return 0+ $reply; } return -1; } ### sub kill_all { my $procmask = shift; my $target = shift; ## NOT IMPLEMENTED YET } 1; ace-8.0.4+dfsg.orig/bin/PerlACE/ProcessVX.pm0000644000175000017500000003024515027201773017410 0ustar sudipsudip#!/usr/bin/env perl package PerlACE::ProcessVX; use strict; use English; use POSIX qw(:time_h); $PerlACE::ProcessVX::ExeSubDir = './'; $PerlACE::ProcessVX::DoVxInit = (defined $ENV{'ACE_RUN_VX_NO_INITIAL_REBOOT'}) ? 0 : 1; $PerlACE::ProcessVX::VxDefGw = 1; $PerlACE::ProcessVX::RebootTime = (defined $ENV{'ACE_RUN_VX_REBOOT_TIME'}) ? $ENV{'ACE_RUN_VX_REBOOT_TIME'} : 90; $PerlACE::ProcessVX::ExeExt = ($PerlACE::VxWorks_RTP_Test) ? '.vxe' : '.out'; $PerlACE::ProcessVX::RebootCmd = $ENV{'ACE_RUN_VX_REBOOT_CMD'}; # Wait for the process to exit or kill after a time period sub WaitKill ($) { my $self = shift; my $timeout = shift; my $status = $self->TimedWait ($timeout); if ($status == -1) { print STDERR "ERROR: $self->{EXECUTABLE} timedout\n"; $self->Kill (); # Don't need to Wait since we are on Win32 $PerlACE::ProcessVX::DoVxInit = 1; # force reboot on next run } $self->{RUNNING} = 0; return $status; } # Do a Spawn and immediately WaitKill sub SpawnWaitKill ($) { my $self = shift; my $timeout = shift; if ($self->Spawn () == -1) { return -1; } return $self->WaitKill ($timeout); } ############################################################################### ### Some Accessors sub Normalize_Executable_Name { my $self = shift; my $executable = shift; my $basename = basename ($executable); my $dirname = dirname ($executable). '/'; $executable = $dirname.$PerlACE::ProcessVX::ExeSubDir.$basename.$PerlACE::ProcessVX::ExeExt; ## Installed executables do not conform to the ExeSubDir if (! -e $executable && -e $dirname.$basename.$PerlACE::ProcessVX::ExeExt) { $executable = $dirname.$basename.$PerlACE::ProcessVX::ExeExt; } return $executable; } sub Executable { my $self = shift; if (@_ != 0) { $self->{EXECUTABLE} = shift; } my $executable = $self->{EXECUTABLE}; if ($self->{IGNOREEXESUBDIR} == 0) { $executable = $self->Normalize_Executable_Name ($executable); } else { $executable = $executable.$PerlACE::ProcessVX::ExeExt; } return $executable; } sub Arguments { my $self = shift; if (@_ != 0) { $self->{ARGUMENTS} = shift; } return $self->{ARGUMENTS}; } sub CommandLine () { my $self = shift; my $commandline = $self->Executable (); if (defined $self->{ARGUMENTS}) { $commandline .= ' '.$self->{ARGUMENTS}; } return $commandline; } sub IgnoreExeSubDir { my $self = shift; if (@_ != 0) { $self->{IGNOREEXESUBDIR} = shift; } return $self->{IGNOREEXESUBDIR}; } sub IgnoreHostRoot { my $self = shift; if (@_ != 0) { $self->{IGNOREHOSTROOT} = shift; } return $self->{IGNOREHOSTROOT}; } sub delay_factor { my($lps) = 128; my($factor) = 1; ## Keep increasing the loops per second until the amount of time ## exceeds the number of clocks per second. The original code ## did not multiply $ticks by 8 but, for faster machines, it doesn't ## seem to return false values. The multiplication is done to minimize ## the amount of time it takes to determine the correct factor. while(($lps <<= 1)) { my($ticks) = clock(); for(my $i = $lps; $i >= 0; $i--) { } $ticks = clock() - $ticks; if ($ticks * 8 >= CLOCKS_PER_SEC) { $factor = 500000 / (($lps / $ticks) * CLOCKS_PER_SEC); last; } } return $factor; } sub iboot_cycle_power { my $self = shift; my $mode = shift; # mode 0 is reboot, mode 1 is just shutdown my ($iboot_host, $iboot_outlet, $iboot_user, $iboot_passwd ) = ($ENV{'ACE_RUN_VX_IBOOT'}, $ENV{'ACE_RUN_VX_IBOOT_OUTLET'}, $ENV{'ACE_RUN_VX_IBOOT_USER'}, $ENV{'ACE_RUN_VX_IBOOT_PASSWORD'}); my $v = $ENV{'ACE_TEST_VERBOSE'}; if ($v) { print "Using iBoot: $iboot_host\n"; if (defined $iboot_outlet) { print "Using iBoot Outlet #: $iboot_outlet\n"; } } # There are three cases to handle here: # 1. using a single-outlet iBoot # 2. using a multi-outlet iBootBar with custom firmware # 3. using a multi-outlet iBootBar with standard firmware # # In cases 1 & 2, we use the iPAL protocol; in case 3 we # use a telnet connection and the command-line syntax. # # We determine that it's case #3 by the concurrent presence # of an outlet number, an iboot username, and an iboot password # in the environment. # if (defined($iboot_outlet) && defined($iboot_user) && defined($iboot_passwd)) { # We perform case #3 # This case doesn't support shutdown return if $mode == 1; my $t = new Net::Telnet(); $t->prompt('/iBootBar \> /'); my $savedmode = $t->errmode(); $t->errmode("return"); my $retries = 5; my $is_open = 0; while ($retries--) { my $r = $t->open($iboot_host); if ($r == 1) { $is_open = 1; last; } } continue { print "Couldn't open connection; sleeping then retrying\n" if ($v); sleep(5); } if (! $is_open) { print "Unable to open $iboot_host.\n" if ($v); return 0; } $t->errmode($savedmode); # Simple login b/c Net::Telnet::login hardcodes the prompts $t->waitfor('/User Name:\s*$/i'); $t->print($iboot_user); $t->waitfor('/password:\s*/i'); $t->print($iboot_passwd); $t->waitfor($t->prompt); print "successfully logged in to $iboot_host\n" if ($v); my $output = $t->cmd("set outlet $iboot_outlet cycle"); print "successfully cycled power on outlet $iboot_outlet\n" if ($v); $t->close(); } else { # Perform cases 1 & 2 my $iboot; my $text; if (!defined($iboot_passwd)) { $iboot_passwd = "PASS"; } my $ipal_command_series; if (defined $iboot_outlet) { $ipal_command_series = ($mode == 0 ? ['E', 'D'] : ['E']); } else { $ipal_command_series = ($mode == 0 ? ['f', 'n'] : ['f']); } foreach my $ipal_cmd (@$ipal_command_series) { my $retries = 3; my $is_open = 0; while ($retries--) { $iboot = IO::Socket::INET->new ("$iboot_host"); if ($iboot) { # if ACE_RUN_VX_IBOOT_OUTLET is defined, we're using # the iBootBar, and we're using the iPAL Protocol # to communicate with the iBootBar if (defined $iboot_outlet) { $iboot->send ("\e".$iboot_passwd."\e".$iboot_outlet.$ipal_cmd); } else { $iboot->send ("\e".$iboot_passwd."\e$ipal_cmd\r"); } $iboot->recv ($text,128); print "iBoot is currently: $text (iteration $retries)\n" if ($v); $iboot->close(); if (defined $iboot_outlet) { $text = substr $text, $iboot_outlet - 1, 1; if ($text eq "0" || $text eq "1") { $is_open = 1; last; } else { print "iBoot is $text; sleeping then retrying\n" if ($v); sleep(5); } } else { if ($text eq "OFF" || $text eq "ON") { $is_open = 1; last; } else { print "iBoot is $text; sleeping then retrying\n" if ($v); sleep(5); } } } else { print "Unable to execute 'reboot' command, going to try another $retries times!\n"; } } if (!$is_open) { print "Unable to reboot using $iboot_host.\n" if ($v); return 0; } } } } sub reboot { my $self = shift; my $iboot; my $text; my $t; my $ok; my $target_login = $ENV{'ACE_RUN_VX_LOGIN'}; my $target_password = $ENV{'ACE_RUN_VX_PASSWORD'}; ## ## initialize VxWorks kernel (reboot!) if needed if ($PerlACE::ProcessVX::DoVxInit || $ENV{'ACE_RUN_VX_TGT_REBOOT'}) { if (defined $ENV{'ACE_RUN_VX_REBOOT_TOOL'}) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "Calling: $ENV{'ACE_RUN_VX_REBOOT_TOOL'}\n"; } system ($ENV{'ACE_RUN_VX_REBOOT_TOOL'}); } else { if (defined $ENV{'ACE_RUN_VX_IBOOT'}) { $self->iboot_cycle_power(0); } else { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "Executing 'reboot' command over Telnet to ".$ENV{'ACE_RUN_VX_TGTHOST'}.".\n"; } $t = new Net::Telnet(Timeout => 10, Prompt => '/-> $/', Errmode => 'return'); $t->open($ENV{'ACE_RUN_VX_TGTHOST'}); if (defined $target_login) { $t->waitfor('/VxWorks login: $/'); $t->print("$target_login"); } if (defined $target_password) { $t->waitfor('/Password: $/'); $t->print("$target_password"); } $t->print(""); $ok = $t->waitfor('/-> $/'); if ($ok) { $t->print($PerlACE::ProcessVX::RebootCmd); sleep(5); } else { print "ERROR: FAILED to execute 'reboot' command!\n"; } $t->close(); } } $PerlACE::ProcessVX::VxDefGw = 1; $PerlACE::ProcessVX::DoVxInit = 0; sleep($PerlACE::ProcessVX::RebootTime); } } # Helper for spawning with list of kernel modules in a .vxtest file sub handle_vxtest_file { my $self = shift; my $vxtestfile = shift; my $vx_ref = shift; my $unld_ref = shift; my $fh = new FileHandle; if (open ($fh, $vxtestfile)) { my $line1 = <$fh>; chomp $line1; while(<$fh>) { $line1 = $_; chomp $line1; push @$vx_ref, "ld < lib$line1" . ".so"; unshift @$unld_ref, "unld \"lib$line1" . ".so\""; } close $fh; } else { return 0; } return 1; } # Load a file that is used as startup script. This script has to be # located on the host system sub handle_startup_script { my $script = shift; my $cmds = shift; my $fh = new FileHandle; if (open ($fh, $script)) { while(<$fh>) { my $line1 = $_; chomp $line1; push @$cmds, "$line1"; } close $fh; } else { return 0; } return 1; } ### Check for -ExeSubDir commands, store the last one my @new_argv = (); for(my $i = 0; $i <= $#ARGV; ++$i) { if ($ARGV[$i] eq '-ExeSubDir') { if (defined $ARGV[$i + 1]) { $PerlACE::ProcessVX::ExeSubDir = $ARGV[++$i].'/'; } else { print STDERR "You must pass a directory with ExeSubDir\n"; exit(1); } } else { push @new_argv, $ARGV[$i]; } } @ARGV = @new_argv; $PerlACE::ProcessVX::WAIT_DELAY_FACTOR = $ENV{'ACE_RUNTEST_DELAY'}; if (defined $ENV{'ACE_TEST_WINCE'}) { if ($OSNAME eq "MSWin32") { require PerlACE::ProcessWinCE; } else { require PerlACE::ProcessWinCE_Unix; } } else { if ($OSNAME eq "MSWin32") { require PerlACE::ProcessVX_Win32; } else { require PerlACE::ProcessVX_Unix; } } ### sub kill_all { my $procmask = shift; my $target = shift; ## NOT IMPLEMENTED YET } 1; ace-8.0.4+dfsg.orig/bin/PerlACE/Process_VMS.pm0000644000175000017500000001706315027201773017662 0ustar sudipsudip#!/usr/bin/env perl package PerlACE::Process; use strict; use POSIX "sys_wait_h"; use Cwd; use File::Basename; use Config; use VmsProcess; ############################################################################### ############################################################################### ### Grab signal names my @signame; if (defined $Config{sig_name}) { my $i = 0; foreach my $name (split (' ', $Config{sig_name})) { $signame[$i] = $name; $i++; } } else { my $i; for ($i = 0; $i < 255; ++$i) { $signame[$i] = $i; } } ############################################################################### ### Constructor and Destructor sub new { my $proto = shift; my $class = ref ($proto) || $proto; my $self = {}; $self->{RUNNING} = 0; $self->{IGNOREEXESUBDIR} = 0; $self->{PROCESS} = undef; $self->{EXECUTABLE} = shift; $self->{ARGUMENTS} = shift; $self->{VALGRIND_CMD} = $ENV{'ACE_RUN_VALGRIND_CMD'}; if (!defined $PerlACE::Process::WAIT_DELAY_FACTOR) { if (defined $self->{PURIFY_CMD}) { $PerlACE::Process::WAIT_DELAY_FACTOR = 10; } elsif (defined $self->{VALGRIND_CMD}) { $PerlACE::Process::WAIT_DELAY_FACTOR = 5; } else { $PerlACE::Process::WAIT_DELAY_FACTOR = 1; } } bless ($self, $class); return $self; } sub DESTROY { my $self = shift; if ($self->{RUNNING} == 1) { print STDERR "ERROR: <", $self->{EXECUTABLE}, "> still running upon object destruction\n"; $self->Kill (); } } ############################################################################### ### Some Accessors sub Executable { my $self = shift; if (@_ != 0) { $self->{EXECUTABLE} = shift; } my $executable = $self->{EXECUTABLE}; if ($self->{IGNOREEXESUBDIR}) { return $executable; } my $basename = basename ($executable); my $dirname = dirname ($executable). '/'; if ($dirname != "") { $executable = $dirname.$PerlACE::Process::ExeSubDir.$basename; } else { $executable = $dirname.$basename; } if ( !-x $executable ) { if ( -x $executable.'.exe' ) { $executable = $executable.'.exe'; } } return $executable; } sub Arguments { my $self = shift; if (@_ != 0) { $self->{ARGUMENTS} = shift; } return $self->{ARGUMENTS}; } sub CommandLine () { my $self = shift; my $commandline = $self->Executable (); if (defined $self->{ARGUMENTS}) { $commandline .= ' '.$self->{ARGUMENTS}; } return $commandline; } sub IgnoreExeSubDir { my $self = shift; if (@_ != 0) { $self->{IGNOREEXESUBDIR} = shift; } return $self->{IGNOREEXESUBDIR}; } sub IgnoreHostRoot { my $self = shift; if (@_ != 0) { $self->{IGNOREHOSTROOT} = shift; } return $self->{IGNOREHOSTROOT}; } ############################################################################### # Spawn the process and continue; sub Spawn () { my $self = shift; if ($self->{RUNNING} == 1) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> already running\n"; return -1; } if (!defined $self->{EXECUTABLE}) { print STDERR "ERROR: Cannot Spawn: No executable specified\n"; return -1; } if ($self->{IGNOREEXESUBDIR} == 0) { if (!-f $self->Executable ()) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> not found\n"; return -1; } if (!-x $self->Executable ()) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> not executable\n"; return -1; } } $self->{PROCESS} = VmsProcess::Spawn $self->{EXECUTABLE}, $self->{ARGUMENTS}; if ($self->{PROCESS}) { #parent here bless $self; } else { # weird fork error print STDERR "ERROR: Can't spawn <" . $self->CommandLine () . ">: $!\n"; } $self->{RUNNING} = 1; return 0; } # The second argument is an optional output argument that, if present, # will be passed to check_return_value function to get the signal number # the process has received, if any, and/or whether there was a core dump. sub WaitKill ($;$) { my $self = shift; my $timeout = shift; my $opts = shift; my $status = $self->TimedWait ($timeout, $opts); if ($status == -1) { print STDERR "ERROR: $self->{EXECUTABLE} timedout\n"; $self->Kill (); } $self->{RUNNING} = 0; return $status; } # Do a Spawn and immediately WaitKill sub SpawnWaitKill ($) { my $self = shift; my $timeout = shift; if ($self->Spawn () == -1) { return -1; } return $self->WaitKill ($timeout); } sub TerminateWaitKill ($) { my $self = shift; my $timeout = shift; if ($self->{RUNNING}) { print STDERR "INFO: $self->{EXECUTABLE} being killed.\n"; kill ('TERM', $self->{PROCESS}); } return $self->WaitKill ($timeout); } # Really only for internal use. # The second optional argument indicates whether the corresponding process # may deliberately send a signal to itself or not. It also contains output # data indicating whether there was a core dump and/or the signal nubmer # the process has died from, if any. sub check_return_value ($) { my $self = shift; my $rc = shift; my $opts = shift // {}; if ($rc == 0) { return 0; } elsif ($rc == 0xff00) { print STDERR "ERROR: <", $self->{EXECUTABLE}, "> failed: $!\n"; return ($rc >> 8); } elsif (($rc & 0xff) == 0) { return ($rc >> 8); } my $dump = 0; if ($rc & 0x80) { $rc &= ~0x80; $dump = 1; } my $self_crash = $opts->{self_crash}; # ABRT, KILL or TERM can be sent deliberately if ($self_crash && ($rc == 6 || $rc == 9 || $rc == 15)) { return 0; } my $signal_ref = $opts->{signal_ref}; if (defined $signal_ref) { ${$signal_ref} = $rc; } my $dump_ref = $opts->{dump_ref}; if (defined $dump_ref) { ${$dump_ref} = $dump; } print STDERR "ERROR: <", $self->{EXECUTABLE}, "> exited with "; print STDERR "coredump from " if ($dump == 1); print STDERR "signal $rc : ", $signame[$rc], "\n"; return 255; } sub Kill () { my $self = shift; if ($self->{RUNNING}) { kill ('KILL', $self->{PROCESS}); waitpid ($self->{PROCESS}, 0); $self->check_return_value ($?, {self_crash => 1}); } $self->{RUNNING} = 0; } # Wait until a process exits. # return -1 if the process is still alive. sub Wait ($) { my $self = shift; my $timeout = shift; if (!defined $timeout || $timeout < 0) { waitpid ($self->{PROCESS}, 0); } else { return TimedWait($self, $timeout); } } # The second argument is an optional output argument that, if present, # will contain the signal number that the process has received, if any, # and/or whether there was a core dump. sub TimedWait ($;$) { my $self = shift; my $timeout = shift; my $opts = shift; $timeout *= $PerlACE::Process::WAIT_DELAY_FACTOR; my $status; my $pid = VmsProcess::TimedWaitPid ($self->{PROCESS}, $timeout, $status); if ($pid > 0) { return $self->check_return_value ($status, $opts); } return -1; } ### sub kill_all { my $procmask = shift; my $target = shift; ## NOT IMPLEMENTED YET } 1; ace-8.0.4+dfsg.orig/bin/PerlACE/README0000644000175000017500000001071315027201773016034 0ustar sudipsudip HOW TO USE THE DOC TEST FRAMEWORK --------------------------------- The test framework is driven by a Perl script. Run_Test.pm contains some useful, miscellaneous functions. The main classes that control test runs are TestTarget and Process, and the platform-specific derivations of these. The test framework runs scripted tests, examines the output, and writes results to an output file that's parsed for scoreboard generation. It's very important to get the output; from ACE, it's test log files, for TAO, it's stderr output from the test procedures. Either way, it has to get back to somewhere the locally running script can process it. By default, all test procedures run on the local host. It is possible to redirect the execution to other machines. This is necessary for testing environments such as VxWorks and LabVIEW RT, which do not support the local execution of these build and testing scripts. Thus, the build is done on a host system and executed on the target. For multi-component tests, such as TAO server and client, the components can (and most often do) run on different machines. For example, a test may run the server component on the embedded target and the client component on the local build host. To redirect execution of a test's component, you must do three things: 1. Assign a number to the component in the test script. By convention, 1 is the component that runs on a target. In TAO, this is generally the server; in the case of ACE tests, it is the only part. Number 2 is, by convention, the TAO client, or the piece to run on the build host. 2. Set an environment variable, DOC_TEST_. For example, DOC_TEST_1, DOC_TEST_2. The value of the environment variable is a configuration name. 3. Set environment variables for the configuration name. These environment variables hold the information used to run the test component on the configuration. The environment variables are named _. Different types of configurations may require different configuration items, depending on their capabilities and needs. However, the following must be set: _OS: The OS type, e.g., vxworks or labview_rt. If this is "local", the component runs on the local host but with an alternate set of settings, such as ACE_ROOT, TAO_ROOT. _IPNAME: The machine's IP hostname or address _ACE_ROOT: ACE_ROOT for the configuration's files _TAO_ROOT: TAO_ROOT for the configuration's files _TEST_ROOT: Root directory for target path translation, when $TEST_ROOT is set, indicating both are reachable from host. _TEST_FSROOT: Root directory for target node path, translation, when $TEST_ROOT is set. Used to translate to a different filesystem, when not reachable from host. _EXE_SUBDIR: Subdirectory for the executable _PROCESS_START_WAIT_INTERVAL: Time waited for the process to start. Default 15 seconds. _PROCESS_STOP_WAIT_INTERVAL: Time waited for the process to stop. Default 10 seconds. _HOSTNAME: Hostname that has to be used _IBOOT: iBoot for this target _REBOOT_TIME: How long does it take to reboot this target _REBOOT: Do we need to reboot this target _STARTUP_COMMAND: Command to be executed after target has been booted _TELNET_HOST: Host name where we have to connect to with telnet _TELNET_PORT: Port number where we have to connect to with telnet If there is no DOC_TEST_ environment variable when the component runs, that component is executed on the local machine. This is the case for most builds. ace-8.0.4+dfsg.orig/bin/PerlACE/Process_Win32.pm0000644000175000017500000003250215027201773020112 0ustar sudipsudip#!/usr/bin/env perl use PerlACE::Run_Test; package PerlACE::Process; use strict; use Win32::Process; use File::Basename; use Cwd; # Make sure the File::Which module is installed on the machine # before trying to use it. If the module is installed on this # machine, then it will be included because of the eval () # statement below. my $has_which = eval ("use File::Which; 1;") ? 1 : 0; ############################################################################### # This is what GetExitCode will return if the process is still running. my $STILL_ACTIVE = 259; ############################################################################### ### Constructor and Destructor # # Hack in purify support thru 2 environment variables: # ACE_RUN_PURIFY_CMD: complete path to purify executable # ACE_RUNTEST_DELAY: wait delay factor, default to 10 if # ACE_RUN_PURIFY_CMD is defined, or 1 if # ACE_RUN_PURIFY_CMD is not defined. # ** Notice that when ACE_RUN_PURIFY_CMD is define, PerlACE::Process # reports the return status of *purify*, not the process being purified. # # Also hack in the ability to run the test on a WinCE device using the # ACE_WINCE_TEST_CONTROLLER environment variable. If set, it specifies a # controlling program to use for setting up and executing the test. # Further setup can be specialized depending on the value of the variable. sub new { my $proto = shift; my $class = ref ($proto) || $proto; my $self = {}; $self->{EXECUTABLE} = shift; $self->{ARGUMENTS} = shift; $self->{TARGET} = undef; $self->{RUNNING} = 0; $self->{IGNOREEXESUBDIR} = 0; $self->{IGNOREHOSTROOT} = 0; $self->{PROCESS} = undef; $self->{PURIFY_CMD} = $ENV{'ACE_RUN_PURIFY_CMD'}; $self->{PURIFY_OPT} = $ENV{'ACE_RUN_PURIFY_OPT'}; if (!defined $PerlACE::Process::WAIT_DELAY_FACTOR) { if (defined $self->{PURIFY_CMD}) { $PerlACE::Process::WAIT_DELAY_FACTOR = 10; } else { $PerlACE::Process::WAIT_DELAY_FACTOR = 1; } } $self->{WINCE_CTL} = $ENV{'ACE_WINCE_TEST_CONTROLLER'}; bless ($self, $class); return $self; } sub DESTROY { my $self = shift; if ($self->{RUNNING} == 1) { print STDERR "ERROR: <", $self->{EXECUTABLE}, "> still running upon object destruction\n"; $self->Kill (); } } ############################################################################### ### Some Accessors sub Normalize_Executable_Name($) { my $self = shift; my $executable = shift; my $basename = basename ($executable); my $dirname = dirname ($executable). '/'; my $subdir; if (defined $self->{TARGET}) { $subdir = $self->{TARGET}->ExeSubDir(); } else { $subdir = $PerlACE::Process::ExeSubDir; } $executable = $dirname.$subdir.$basename.".EXE"; ## Installed executables do not conform to the ExeSubDir if (! -x $executable && -x $dirname.$basename.'.EXE') { $executable = $dirname.$basename.'.EXE'; } $executable =~ s/\//\\/g; # / <- # color coding issue in devenv return $executable; } sub Executable { my $self = shift; if (@_ != 0) { $self->{EXECUTABLE} = shift; } my $executable = $self->{EXECUTABLE}; # If the target's config has a different ACE_ROOT, rebase the executable # from $ACE_ROOT to the target's root. if (defined $self->{TARGET} && $self->{TARGET}->ACE_ROOT() ne $ENV{'ACE_ROOT'}) { $executable = File::Spec->rel2abs($executable); $executable = File::Spec->abs2rel($executable, $ENV{'ACE_ROOT'}); $executable = $self->{TARGET}->ACE_ROOT() . "/$executable"; } # After VxWorks adopts the TARGET scheme, can do away with this block. if ($self->{IGNOREHOSTROOT} == 0) { if (PerlACE::is_vxworks_test()) { $executable = PerlACE::VX_HostFile ($executable); } } if ($self->{IGNOREEXESUBDIR} == 0) { $executable = $self->Normalize_Executable_Name ($executable); } else { if ($executable !~ m/\.(BAT|EXE|COM)$/i) { $executable = $executable.".EXE"; } $executable =~ s/\//\\/g; # / <- # color coding issue in devenv # If there is no directory in the executable name, then we are going # to search the PATH for the executable. if ($has_which && $executable !~ m/\//) { my $which = File::Which::which ($executable); if ($which ne "") { $executable = $which; } } } return $executable; } sub Arguments { my $self = shift; if (@_ != 0) { $self->{ARGUMENTS} = shift; } return $self->{ARGUMENTS}; } sub CommandLine () { my $self = shift; my $commandline = $self->Executable (); $commandline = '"' . $commandline . '"' if $commandline =~ /\s/; if (defined $self->{ARGUMENTS}) { $commandline .= ' '.$self->{ARGUMENTS}; } return $commandline; } sub IgnoreExeSubDir { my $self = shift; # If we have -Config ARCH, do not set IGNOREEXESUBDIR, since with ARCH # all executables (even those in $ACE_ROOT/bin, etc.) are located in the # architecture-specific subdirectory. if (@_ != 0 && !grep(($_ eq 'ARCH'), @PerlACE::ConfigList::Configs)) { $self->{IGNOREEXESUBDIR} = shift; } elsif (@_ != 0 && $self->{EXECUTABLE} =~ /perl$/) { print ("==== automatically ignoring...\n"); $self->{IGNOREEXESUBDIR} = shift; } return $self->{IGNOREEXESUBDIR}; } sub IgnoreHostRoot { my $self = shift; if (@_ != 0) { $self->{IGNOREHOSTROOT} = shift; } return $self->{IGNOREHOSTROOT}; } ############################################################################### ### Spawning processes # Spawn the process and continue. sub Spawn () { my $self = shift; if ($self->{RUNNING} == 1) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> already running\n"; return -1; } if (!defined $self->{EXECUTABLE}) { print STDERR "ERROR: Cannot Spawn: No executable specified\n"; return -1; } if ($self->{IGNOREEXESUBDIR} == 0) { if (!-f $self->Executable ()) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> not found\n"; return -1; } if (!-x $self->Executable ()) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> not executable\n"; return -1; } } my $state = 0; my $cmdline = ""; my $executable = ""; my $chdir_needed = 0; my $curdir_bak; if (defined $self->{PURIFY_CMD}) { my $orig_cmdline = $self->CommandLine (); $executable = $self->{PURIFY_CMD}; my $basename = basename ($self->{EXECUTABLE}); my $PurifyOptions = $self->{PURIFY_OPT}; if (!defined $PurifyOptions) { $PurifyOptions = "/run ". # "/save-data=$basename.pfy ". "/save-text-data=$basename.pfytxt ". "/AllocCallStackLength=20 ". "/ErrorCallStackLength=20 ". "/HandlesInUseAtExit ". "/InUseAtExit ". "/LeaksAtExit "; } $cmdline = "purify " . "$PurifyOptions ". "$orig_cmdline" ; } elsif (defined $self->{WINCE_CTL}) { $executable = $self->Executable (); $cmdline = $self->CommandLine (); # Generate a script to copy the test down to the device, run it, # copy the log file(s) back to the log directory, then delete the # program and log files on the remote device. unless (open (SCRIPT, ">start_test.cmd")) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> failed to create start_test.cmd\n"; return -1; } my $testname = basename($executable,'.EXE'); my $here = getcwd(); $here =~ s/\//\\/g; $executable =~ s/^\.//; # Chop leading . $executable = $here . $executable; # Fully qualified name # Take off the test name from the start of the command line. # The command name is preprended in the script below. my @tokens = split(' ', $cmdline); @tokens = splice(@tokens,1); $cmdline = join(' ', @tokens); print SCRIPT "copy $executable 1:\\Windows\n"; print SCRIPT "start /wait $testname $cmdline\n"; print SCRIPT "copy 1:\\log\\$testname*.txt $here\\log\n"; print SCRIPT "del 1:\\Windows\\$testname.exe\n"; print SCRIPT "del 1:\\log\\$testname*.txt\n"; close SCRIPT; $executable = $ENV{'ComSpec'}; my $pocket_device_opts = $ENV{'ACE_PCE_DEVICE'}; $cmdline = "cmd /C start /B /WAIT $self->{WINCE_CTL} $pocket_device_opts -m NAME=start_test.cmd;WAIT=401000; -e" } elsif (defined $ENV{'ACE_TEST_WINDOW'}) { $state = ($ENV{'ACE_TEST_WINDOW'} =~ /\/k/i ? CREATE_NEW_CONSOLE : DETACHED_PROCESS); $executable = $ENV{'ComSpec'}; $cmdline = $ENV{'ACE_TEST_WINDOW'} . ' ' . $self->CommandLine(); } else { $executable = $self->Executable (); $cmdline = $self->CommandLine (); if ((defined $self->{TARGET}) && ($ENV{'ACE_ROOT'} ne $self->{TARGET}->ACE_ROOT ())) { $chdir_needed = 1; $curdir_bak = cwd (); chdir (dirname ($executable)); } } if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "$executable $cmdline\n"; } my %backup_ENV = %ENV; # update environment for target if (defined $self->{TARGET}) { if (!defined $self->{TARGET}->{REMOTE_SHELL}) { my $x_env_ref = $self->{TARGET}->{EXTRA_ENV}; while ( my ($env_key, $env_value) = each(%$x_env_ref) ) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "INFO: adding target environment $env_key=$env_value\n"; } $ENV{$env_key} = $env_value; } } if ($self->{TARGET}->{LIBPATH}) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "INFO: adding target libpath ".$self->{TARGET}->{LIBPATH}."\n"; } PerlACE::add_lib_path ($self->{TARGET}->{LIBPATH}); } } my $status = Win32::Process::Create ($self->{PROCESS}, $executable, $cmdline, ($state == 0 ? 1 : 0), $state, '.'); %ENV = %backup_ENV; if ($chdir_needed) { chdir ($curdir_bak); } if ($status == 0) { print STDERR "ERROR: Spawn failed for <", $self->CommandLine (), ">\n"; return -1; } $self->{RUNNING} = 1; return 0; } # Wait for the process to exit or kill after a time period sub WaitKill ($) { my $self = shift; my $timeout = shift; my $status = $self->TimedWait ($timeout); if ($status == -1) { print STDERR "ERROR: $self->{EXECUTABLE} timedout\n"; $self->Kill (); # Don't need to Wait since we are on Win32 } $self->{RUNNING} = 0; return $status; } # Do a Spawn and immediately WaitKill sub SpawnWaitKill ($) { my $self = shift; my $timeout = shift; if ($self->Spawn () == -1) { return -1; } return $self->WaitKill ($timeout); } # Kill the process sub Kill ($) { my $self = shift; my $notused = shift; #Used in Process_Unix.pm if ($self->{RUNNING} && !defined $ENV{'ACE_TEST_WINDOW'}) { Win32::Process::Kill ($self->{PROCESS}, -1); } $self->{RUNNING} = 0; } # Terminate the process and wait for it to finish sub TerminateWaitKill ($) { my $self = shift; my $timeout = shift; if ($self->{RUNNING}) { print STDERR "INFO: $self->{EXECUTABLE} being killed.\n"; Win32::Process::Kill ($self->{PROCESS}, 0); } return $self->WaitKill ($timeout); } # Wait until a process exits. # return -1 if the process is still alive. sub Wait ($) { my $self = shift; my $timeout = shift; if (!defined $timeout || $timeout < 0) { $timeout = INFINITE; } else { $timeout = $timeout * 1000 * $PerlACE::Process::WAIT_DELAY_FACTOR; } my $result = 0; if ($self->{RUNNING}) { $result = Win32::Process::Wait ($self->{PROCESS}, $timeout); if ($result == 0) { return -1; } } Win32::Process::GetExitCode ($self->{PROCESS}, $result); $self->{RUNNING} = 0; return $result; } # Wait for a process to exit with a timeout sub TimedWait ($) { my($self) = shift; my($timeout) = shift; return $self->Wait($timeout); } ### sub kill_all { my $procmask = shift; my $target = shift; my $pid = -1; for my $line (`tasklist /nh /fo csv`) { # find matching process line if ($line =~ /$procmask/) { # find process PID if ($line =~ /^\"[^\"]+\",\"(\d+)\",/) { $pid = $1; Win32::Process::KillProcess ($pid, 0); # kill process if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "INFO: Killed process at [$line]\n" } } } } } 1; ace-8.0.4+dfsg.orig/bin/PerlACE/MSProject/0000755000175000017500000000000015046037655017027 5ustar sudipsudipace-8.0.4+dfsg.orig/bin/PerlACE/MSProject/VCP.pm0000644000175000017500000000076215027201773020013 0ustar sudipsudip package PerlACE::MSProject::VCP; use strict; use PerlACE::MSProject; our @ISA = ("PerlACE::MSProject"); ############################################################################### # Constructor sub new { my $proto = shift; my $class = ref ($proto) || $proto; my $self = $class->SUPER::new (@_); $self->{COMPILER} = "evc.com"; bless ($self, $class); return $self; } ############################################################################### # Accessors 1;ace-8.0.4+dfsg.orig/bin/PerlACE/MSProject/DSP.pm0000644000175000017500000000074715027201773020014 0ustar sudipsudip package PerlACE::MSProject::DSP; use strict; use PerlACE::MSProject; our @ISA = ("PerlACE::MSProject"); ############################################################################### # Constructor sub new { my $proto = shift; my $class = ref ($proto) || $proto; my $self = $class->SUPER::new (@_); $self->{COMPILER} = "msdev.com"; bless ($self, $class); return $self; } ############################################################################### 1;ace-8.0.4+dfsg.orig/bin/PerlACE/TestTarget_WinCE.pm0000644000175000017500000001135215027201773020625 0ustar sudipsudip#!/usr/bin/env perl package PerlACE::TestTarget_WinCE; # ****************************************************************** # Description : Creates a PerlACE::WinCE # Author : Johnny Willemsen # Create Date : 29/20/2008 # ****************************************************************** # ****************************************************************** # Pragma Section # ****************************************************************** use strict; use PerlACE::TestTarget; use PerlACE::ProcessVX; use File::Copy; use Cwd; use English; our @ISA = qw(PerlACE::TestTarget); sub new { my $proto = shift; my $config_name = shift; my $class = ref ($proto) || $proto; my $self = {}; bless ($self, $class); $self->GetConfigSettings($config_name); my $targethost; my $env_name = $config_name.'_IPNAME'; if (exists $ENV{$env_name}) { $targethost = $ENV{$env_name}; } else { print STDERR "You must define target hostname/IP with $env_name\n"; undef $self; return undef; } $env_name = $config_name.'_FS_ROOT'; my $fsroot = '\network\temp\ACE\wince6'; if (exists $ENV{$env_name}) { $fsroot = $ENV{$env_name}; } else { print STDERR "Warning: no $env_name variable; falling back ", "to $fsroot\n"; } $self->{FSROOT} = $fsroot; $self->{REBOOT_CMD} = $ENV{'ACE_REBOOT_LVRT_CMD'}; if (!defined $self->{REBOOT_CMD}) { $self->{REBOOT_CMD} = 'I_Need_A_Reboot_Command'; } $self->{REBOOT_TIME} = $ENV{'ACE_LVRT_REBOOT_TIME'}; if (!defined $self->{REBOOT_TIME}) { $self->{REBOOT_TIME} = 200; } $self->{REBOOT_TIME} = $ENV{'ACE_RUN_LVRT_REBOOT_TIME'}; if (!defined $self->{REBOOT_TIME}) { $self->{REBOOT_TIME} = 200; } $self->{REBOOT_NEEDED} = undef; my $telnet_port = $ENV{'ACE_RUN_VX_TGT_TELNET_PORT'}; my $telnet_host = $ENV{'ACE_RUN_VX_TGT_TELNET_HOST'}; if (!defined $telnet_host) { $telnet_host = $ENV{'ACE_RUN_VX_TGTHOST'}; } if (!defined $telnet_port) { $telnet_port = 23; } if (!defined $self->{HOST_ROOT}) { $self->{HOST_ROOT} = $self->{FSROOT}; } $PerlACE::ProcessVX::ExeExt = '.exe'; return $self; } # ****************************************************************** # Subroutine Section # ****************************************************************** sub LocalFile { my $self = shift; my $file = shift; my $cwdrel = $file; my $prjroot = defined $ENV{'ACE_RUN_VX_PRJ_ROOT'} ? $ENV{'ACE_RUN_VX_PRJ_ROOT'} : $ENV{'ACE_ROOT'}; if (length ($cwdrel) > 0) { $cwdrel = File::Spec->abs2rel( cwd(), $prjroot ); } else { $cwdrel = File::Spec->abs2rel( $cwdrel, $prjroot ); } my $newfile = $self->{FSROOT} . "/" . $cwdrel . "/" . $file; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "WinCE LocalFile for $file is $newfile\n"; } return $newfile; } sub AddLibPath ($) { my $self = shift; my $dir = shift; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Adding libpath $dir\n"; } PerlACE::add_lib_path ($dir); } sub CreateProcess { my $self = shift; if ($OSNAME eq "MSWin32") { my $process = new PerlACE::ProcessVX ($self, @_); return $process; } else { my $process = new PerlACE::ProcessVX (@_, $self); return $process; } } # Need a reboot when this target is destroyed. sub NeedReboot ($) { my $self = shift; $self->{REBOOT_NEEDED} = 1; } # Reboot target sub RebootNow ($) { my $self = shift; $self->{REBOOT_NEEDED} = undef; print STDERR "Attempting to reboot target...\n"; reboot (); } sub WaitForFileTimed ($) { my $self = shift; my $file = shift; my $timeout = shift; my $cwdrel = $file; my $prjroot = defined $ENV{'ACE_RUN_VX_PRJ_ROOT'} ? $ENV{'ACE_RUN_VX_PRJ_ROOT'} : $ENV{'ACE_ROOT'}; if (length ($cwdrel) > 0) { $cwdrel = File::Spec->abs2rel( cwd(), $prjroot ); } else { $cwdrel = File::Spec->abs2rel( $cwdrel, $prjroot ); } my $newfile = $self->{HOST_ROOT} . "/" . $cwdrel . "/" . $file; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "WinCE waits for $newfile timeout $timeout\n"; } return PerlACE::waitforfile_timed ($newfile, $timeout); } # Put file from a to b sub PutFile ($) { my $self = shift; my $src = shift; return 0; } sub DeleteFile ($) { my $self = shift; my $file = shift; my $newfile = $self->LocalFile($file); if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "delete $newfile\n"; } unlink ("$newfile"); } sub KillAll ($) { my $self = shift; my $procmask = shift; PerlACE::ProcessVX::kill_all ($procmask, $self); } 1; ace-8.0.4+dfsg.orig/bin/PerlACE/Process_Unix.pm0000644000175000017500000011107715027201773020140 0ustar sudipsudip#!/usr/bin/env perl package PerlACE::Process; use strict; use POSIX "sys_wait_h"; use Cwd; use File::Basename; use Config; ############################################################################### ### Grab signal names my @signame; if (defined $Config{sig_name}) { my $i = 0; foreach my $name (split (' ', $Config{sig_name})) { $signame[$i] = $name; $i++; } } else { my $i; for ($i = 0; $i < 255; ++$i) { $signame[$i] = $i; } } ############################################################################### ### Constructor and Destructor sub new { my $proto = shift; my $class = ref ($proto) || $proto; my $self = {}; $self->{RUNNING} = 0; $self->{IGNOREEXESUBDIR} = 0; $self->{IGNOREHOSTROOT} = 0; $self->{PROCESS} = undef; $self->{EXECUTABLE} = shift; $self->{ARGUMENTS} = shift; $self->{VALGRIND_CMD} = $ENV{'ACE_RUN_VALGRIND_CMD'}; if (!defined $PerlACE::Process::WAIT_DELAY_FACTOR) { if (defined $self->{PURIFY_CMD}) { $PerlACE::Process::WAIT_DELAY_FACTOR = 10; } elsif (defined $self->{VALGRIND_CMD}) { $PerlACE::Process::WAIT_DELAY_FACTOR = 10; } else { $PerlACE::Process::WAIT_DELAY_FACTOR = 1; } } bless ($self, $class); return $self; } sub DESTROY { my $self = shift; if ($self->{RUNNING} == 1) { print STDERR "ERROR: <", $self->{EXECUTABLE}, "> still running upon object destruction\n"; $self->Kill (); } if (defined $self->{SCRIPTFILE}) { unlink $self->{SCRIPTFILE}; } } ############################################################################### ### Some Accessors sub Executable { my $self = shift; if (@_ != 0) { $self->{EXECUTABLE} = shift; } my $executable = $self->{EXECUTABLE}; if ($self->{IGNOREHOSTROOT} == 0) { if (PerlACE::is_vxworks_test()) { $executable = PerlACE::VX_HostFile ($executable); } } if ($self->{IGNOREEXESUBDIR}) { return $executable; } my $basename = basename ($executable); my $dirname = dirname ($executable).'/'; my $subdir = $PerlACE::Process::ExeSubDir; if (defined $self->{TARGET} && defined $self->{TARGET}->{EXE_SUBDIR}) { $subdir = $self->{TARGET}->{EXE_SUBDIR}; } $executable = $dirname . $subdir . $basename; return $executable; } sub Arguments { my $self = shift; if (@_ != 0) { $self->{ARGUMENTS} = shift; } return $self->{ARGUMENTS}; } sub ReadPidFile () { my $self = shift; my $tgt_pidfile = shift; my $rc = 0; # If a filesystem mapping exists if (defined $self->{TARGET} && defined $self->{TARGET}{TEST_FSROOT} && defined $ENV{TEST_ROOT}) { my $pidfile = PerlACE::rebase_path ($tgt_pidfile, $self->{TARGET}->{TEST_FSROOT}, $self->{TARGET}->{TEST_ROOT}); if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Checking for pid file $pidfile\n"; } if (-f $pidfile) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Found mapped pid file\n"; } if (open(PID, "<$pidfile")) { $rc = ; close PID; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Read $rc from mapped file\n"; } if ($rc) { unlink $pidfile; } } else { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Could not open mapped pid file\n"; } } } else { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "Could not find mapped file " . basename($pidfile) . "\n"; } } } else { my $shell = $self->{TARGET}->{REMOTE_SHELL}; print STDERR "trying to remote read PID from file $tgt_pidfile\n"; $rc = int(`$shell 'if [ -e $tgt_pidfile -a -s $tgt_pidfile ] ; then cat $tgt_pidfile; rm -f $tgt_pidfile >/dev/null 2>&1; else echo 0; fi'`); } return $rc; } sub CommandLine () { my $self = shift; my $exe = File::Spec->rel2abs ($self->Executable ()); my $cur_root = $ENV{TEST_ROOT}; # Translate to target if (defined $self->{TARGET} && defined $ENV{TEST_ROOT} && defined $self->{TARGET}->{TEST_ROOT}) { $exe = PerlACE::rebase_path ($exe, $ENV{TEST_ROOT}, $self->{TARGET}->{TEST_ROOT}); $cur_root = $self->{TARGET}->{TEST_ROOT}; } # Translate to different filesystem if (defined $self->{TARGET} && defined $ENV{TEST_ROOT} && defined $self->{TARGET}->{TEST_FSROOT}) { $exe = PerlACE::rebase_path ($exe, $cur_root, $self->{TARGET}->{TEST_FSROOT}); } elsif (defined $self->{TARGET} && defined $self->{TARGET}->{TARGET_FSROOT}) { # If the target's config has a different filesystem root, rebase the executable # from local root to the target's root. $exe = File::Spec->rel2abs ($exe); $exe = PerlACE::rebase_path ($exe, $self->{TARGET}->{HOST_FSROOT}, $self->{TARGET}->{TARGET_FSROOT}); } my $commandline = $exe; if (defined $self->{REMOTEINFO}) { my($method) = $self->{REMOTEINFO}->{method}; my($username) = $self->{REMOTEINFO}->{username}; my($remote) = $self->{REMOTEINFO}->{hostname}; my($exepath) = $self->{REMOTEINFO}->{exepath}; my($libpath) = $self->{REMOTEINFO}->{libpath}; my($exe) = (defined $exepath ? "$exepath/" . basename($commandline) : $commandline); $commandline = "$method -l $username $remote \""; if (defined $libpath) { my($csh) = (defined $self->{REMOTEINFO}->{shell} && $self->{REMOTEINFO}->{shell} =~ /csh/); foreach my $pvar ('DYLD_LIBRARY_PATH', 'LD_LIBRARY_PATH', 'LIBPATH', 'SHLIB_PATH') { if ($csh) { $commandline .= "if (! \\\$?$pvar) setenv $pvar; " . "setenv $pvar $libpath:\\\$$pvar; "; } else { $commandline .= "$pvar=$libpath:\\\$$pvar; export $pvar; "; } } my($env) = $self->{REMOTEINFO}->{env}; if (defined $env) { foreach my $pvar (keys %$env) { if ($csh) { $commandline .= "setenv $pvar $$env{$pvar}; "; } else { $commandline .= "$pvar=$$env{$pvar}; export $pvar; "; } } } } $commandline .= $exe; } if (defined $self->{ARGUMENTS}) { $commandline .= ' '.$self->{ARGUMENTS}; } # Avoid modifying TAO/tests run_test.pl scripts by using the # ACE_RUNTEST_ARGS environment variable to append command line # arguments. if ($^O eq "nonstop_kernel") { my $global_args = $ENV{'ACE_RUNTEST_ARGS'}; if ((length($global_args) > 0) && ($commandline !~ /tao_idl/)) { $commandline = $commandline . ' ' . $global_args; } } if (defined $self->{REMOTEINFO}) { $commandline .= '"'; } elsif (defined $self->{TARGET} && defined $self->{TARGET}->{REMOTE_SHELL}) { my($shell) = $self->{TARGET}->{REMOTE_SHELL}; my $x_env_ref = $self->{TARGET}->{EXTRA_ENV}; my($root) = $self->{TARGET}->ACE_ROOT(); if (!defined $root) { $root = $ENV{'ACE_ROOT'}; } my $exedir = cwd (); if (defined $self->{TARGET} && defined $ENV{TEST_ROOT} && defined $self->{TARGET}->{TEST_ROOT}) { $exedir = PerlACE::rebase_path ($exedir, $ENV{TEST_ROOT}, $self->{TARGET}->{TEST_ROOT}); if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "INFO: rebased run script exedir to [",$exedir,"]\n"; } } my $tgt_exedir = $exedir; if (defined $self->{TARGET} && defined $ENV{TEST_ROOT} && defined $self->{TARGET}->{TEST_FSROOT}) { $tgt_exedir = PerlACE::rebase_path ($exedir, $self->{TARGET}->{TEST_ROOT}, $self->{TARGET}->{TEST_FSROOT}); } elsif (defined $self->{TARGET} && defined $self->{TARGET}->{TARGET_FSROOT}) { $tgt_exedir = PerlACE::rebase_path ($exedir, $self->{TARGET}->{HOST_FSROOT}, $self->{TARGET}->{TARGET_FSROOT}); if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "INFO: rebased run script exedir to [",$tgt_exedir,"]\n"; } } if (!defined $self->{PIDFILE}) { # PIDFILE is based on target file system $self->{PIDFILE} = "$tgt_exedir/ace-".rand(time).".pid"; } if (!defined $self->{SCRIPTFILE}) { # SCRIPTFILE is based on host file system $self->{SCRIPTFILE} = "$exedir/run-".rand(time).".sh"; } ## create scriptfile my $libpath = "$root/lib"; if (defined $self->{TARGET}->{LIBPATH}) { $libpath = PerlACE::concat_path ($libpath, $self->{TARGET}->{LIBPATH}); } # add working dir by default as for local executions my $run_script = # "if [ ! -e /tmp/.acerun ]; then mkdir /tmp/.acerun; fi\n". "cd $tgt_exedir\n". "export LD_LIBRARY_PATH=$libpath:.:\$LD_LIBRARY_PATH\n". "export DYLD_LIBRARY_PATH=$libpath:.:\$DYLD_LIBRARY_PATH\n". "export LIBPATH=$libpath:.:\$LIBPATH\n". "export SHLIB_PATH=$libpath:.:\$SHLIB_PATH\n". "export PATH=\$PATH:$root/bin:$root/lib:$libpath:.\n"; if (defined $self->{TARGET}->{ace_root}) { $run_script .= "export ACE_ROOT=$self->{TARGET}->{ace_root}\n"; } if (defined $self->{TARGET}->{tao_root}) { $run_script .= "export TAO_ROOT=$self->{TARGET}->{tao_root}\n"; } while ( my ($env_key, $env_value) = each(%$x_env_ref) ) { $run_script .= "export $env_key=\"$env_value\"\n"; } $run_script .= "$commandline &\n"; $run_script .= "MY_PID=\$!\n". "echo \$MY_PID > ".$self->{PIDFILE}."\n"; if (defined $ENV{'ACE_TEST_VERBOSE'}) { $run_script .= "echo INFO: Process started remote with pid [\$MY_PID]\n"; } $run_script .= "wait \$MY_PID\n"; unless (open (RUN_SCRIPT, ">".$self->{SCRIPTFILE})) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> failed to create ",$self->{SCRIPTFILE},"\n"; return -1; } print RUN_SCRIPT $run_script; close RUN_SCRIPT; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "INFO: created run script [",$self->{SCRIPTFILE},"]\n", $run_script; } if ($self->{TARGET}->PutFile ($self->{SCRIPTFILE}) == -1) { print STDERR "ERROR: Failed to copy <", $self->{SCRIPTFILE}, "> to target \n"; return -1; } $commandline = "$shell \"source $tgt_exedir/".basename ($self->{SCRIPTFILE})."\""; } return $commandline; } sub IgnoreExeSubDir { my $self = shift; # If we have -Config ARCH, do not set IGNOREEXESUBDIR, since with ARCH # all executables (even those in $ACE_ROOT/bin, etc.) are located in the # architecture-specific subdirectory. if (@_ != 0 && !grep(($_ eq 'ARCH'), @PerlACE::ConfigList::Configs)) { $self->{IGNOREEXESUBDIR} = shift; } elsif (@_ != 0 && $self->{EXECUTABLE} =~ /perl$/) { $self->{IGNOREEXESUBDIR} = shift; } return $self->{IGNOREEXESUBDIR}; } sub IgnoreHostRoot { my $self = shift; if (@_ != 0) { $self->{IGNOREHOSTROOT} = shift; } return $self->{IGNOREHOSTROOT}; } sub RemoteInformation { my($self) = shift; my(%params) = @_; ## Valid keys for %params ## hostname - The remote hostname ## method - either rsh or ssh ## username - The remote user name ## exepath - The remote path to the executable ## shell - The shell of the remote user ## libpath - A library path for libraries required by the executable ## env - A hash reference of name value pairs to be set in the ## environment prior to executing the executable. ## ## At a minimum, the user must provide the remote hostname. if (defined $params{'hostname'}) { my(@pwd) = getpwuid($<); $self->{REMOTEINFO} = \%params; if (!defined $self->{REMOTEINFO}->{'method'}) { $self->{REMOTEINFO}->{'method'} = 'ssh'; } if (!defined $self->{REMOTEINFO}->{'username'}) { $self->{REMOTEINFO}->{'username'} = $pwd[0] || $ENV{LOGNAME} || $ENV{USERNAME}; } if (!defined $self->{REMOTEINFO}->{'shell'}) { $self->{REMOTEINFO}->{'shell'} = basename($pwd[8]); } } } ############################################################################### # Spawn the process and continue; sub Normalize_Executable_Name { my $executable = shift; my $basename = basename ($executable); my $dirname = dirname ($executable). '/'; $executable = $dirname.$PerlACE::Process::ExeSubDir.$basename; return $executable; } sub Spawn () { my $self = shift; if ($self->{RUNNING} == 1) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> already running\n"; return -1; } if (!defined $self->{EXECUTABLE}) { print STDERR "ERROR: Cannot Spawn: No executable specified\n"; return -1; } if ($self->{IGNOREEXESUBDIR} == 0) { if (!defined $self->{REMOTEINFO} && !(defined $self->{TARGET} && (defined $self->{TARGET}->{REMOTE_SHELL} || defined $self->{TARGET}->{TARGET_FSROOT})) && !-f $self->Executable ()) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> not found\n"; return -1; } } my $cmdline = ""; my $executable = ""; if (defined $self->{VALGRIND_CMD}) { my $orig_cmdline = $self->CommandLine(); $executable = $self->{VALGRIND_CMD}; my $basename = basename ($self->{EXECUTABLE}); $cmdline = "$executable $orig_cmdline"; } elsif (defined $ENV{'ACE_TEST_WINDOW'}) { $cmdline = $ENV{'ACE_TEST_WINDOW'} . ' ' . $self->CommandLine(); } else { $executable = $self->Executable(); $executable = File::Spec->rel2abs ($executable); if (defined $self->{TARGET} && defined $self->{TARGET}->{TARGET_FSROOT}) { # If the target's config has a different filesystem root, rebase the executable # from local root to the target's root. $executable = PerlACE::rebase_path ($executable, $self->{TARGET}->{HOST_FSROOT}, $self->{TARGET}->{TARGET_FSROOT}); } $cmdline = $self->CommandLine(); } FORK: { if ($self->{PROCESS} = fork) { #parent here bless $self; } elsif (defined $self->{PROCESS}) { #child here my @cmdlist = $self->parse_command_line($cmdline); if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "INFO: $cmdline\n"; foreach my $arg (@cmdlist) { print "INFO: argument - '$arg'\n"; } } # update environment for target if (defined $self->{TARGET}) { if (!(defined $self->{TARGET}->{REMOTE_SHELL} || defined $self->{REMOTEINFO})) { my $x_env_ref = $self->{TARGET}->{EXTRA_ENV}; while ( my ($env_key, $env_value) = each(%$x_env_ref) ) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "INFO: adding target environment $env_key=$env_value\n"; } $ENV{$env_key} = $env_value; } } if ($self->{TARGET}->{LIBPATH}) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print "INFO: adding target libpath ".$self->{TARGET}->{LIBPATH}."\n"; } PerlACE::add_lib_path ($self->{TARGET}->{LIBPATH}); } } if (!(defined $self->{VALGRIND_CMD} || defined $ENV{'ACE_TEST_WINDOW'}) && (defined $self->{TARGET}) && ($ENV{'ACE_ROOT'} ne $self->{TARGET}->ACE_ROOT ())) { my $x_dir = dirname ($executable); chdir ($x_dir); } exec @cmdlist; die "ERROR: exec failed for <" . $cmdline . ">\n"; } elsif ($! =~ /No more process/) { #EAGAIN, supposedly recoverable fork error sleep 5; redo FORK; } else { # weird fork error print STDERR "ERROR: Can't fork <" . $cmdline . ">: $!\n"; } } if (defined $self->{TARGET} && defined $self->{TARGET}->{REMOTE_SHELL}) { my $pidfile = $self->{PIDFILE}; ## wait max 10 * $PerlACE::Process::WAIT_DELAY_FACTOR sec for pid file to appear my $start_tm = time (); my $max_wait = 10; if ($PerlACE::Process::WAIT_DELAY_FACTOR > 0) { $max_wait *= $PerlACE::Process::WAIT_DELAY_FACTOR; } my $rc = 1; while ((time() - $start_tm) < $max_wait) { select(undef, undef, undef, 0.2); $rc = $self->ReadPidFile($pidfile); if ($rc != 0) { $self->{REMOTE_PID} = $rc; last; } } if (!defined $self->{REMOTE_PID}) { print STDERR "Remote command <" . $cmdline . ">: No PID found at Spawn.\n"; } } $self->{RUNNING} = 1; return 0; } sub print_stacktrace_linux { my $self = shift; # Get the core file pattern my $core_pattern_file = "/proc/sys/kernel/core_pattern"; if (!(-e $core_pattern_file)) { print STDERR "WARNING: print_stacktrace_linux: Core file pattern $core_pattern_file does not exist\n"; return; } my $pattern_fh; if (!open ($pattern_fh, "<", "$core_pattern_file")) { print STDERR "WARNING: print_stacktrace_linux: Could not open $core_pattern_file: $!\n"; return; } my $line = <$pattern_fh>; chomp ($line); close ($pattern_fh); if ($line =~ /\|/) { print STDERR "WARNING: print_stacktrace_linux: Core files are handled by a separate service. Core pattern: $line\n"; return; } # Find the core file from the pattern my $path = "."; my $pattern; if ($line =~ /^(.*)\/([^\/]*)$/) { $path = $1; $pattern = $2; } else { $pattern = $line; } # If /proc/sys/kernel/core_uses_pid is non-zero and the pattern # doesn't have %p, then .PID is appended to the core file name. my $uses_pid_file = "/proc/sys/kernel/core_uses_pid"; my $uses_pid = 0; if (!open (my $uses_pid_fh, "<", "$uses_pid_file")) { print STDERR "WARNING: print_stacktrace_linux: Could not open $uses_pid_file: $!\n"; } else { $line = <$uses_pid_fh>; chomp ($line); if ($line ne "" || $line ne "\n") { $uses_pid = $line; } close ($uses_pid_fh); } my $exec_path = $self->Executable (); my $exec_name_idx = index ($pattern, "%e"); if ($exec_name_idx != -1) { my $exec_name = File::Basename::basename ($exec_path); # The core file name contains at most 15 characters from the executable name # (https://man7.org/linux/man-pages/man5/core.5.html). $exec_name = substr ($exec_name, 0, 15); substr ($pattern, $exec_name_idx, 2) = $exec_name; } my $hname_idx = index ($pattern, "%h"); if ($hname_idx != -1) { substr ($pattern, $hname_idx, 2) = Sys::Hostname::hostname (); } my $pid_idx = index ($pattern, "%p"); if ($pid_idx != -1) { substr ($pattern, $pid_idx, 2) = $self->{PROCESS}; } elsif ($uses_pid != 0) { $pattern = $pattern . "." . $self->{PROCESS}; } my $timestamp_idx = index ($pattern, "%t"); my $core_file_path; if ($timestamp_idx != -1) { my $prefix = substr ($pattern, 0, $timestamp_idx); my $suffix_len = length ($pattern) - $timestamp_idx - 2; my $suffix = substr ($pattern, $timestamp_idx + 2, $suffix_len); # Get the core file with latest timestamp. my $dh; if (!opendir ($dh, $path)) { print STDERR "WARNING: print_stacktrace_linux: Couldn't opendir $path: $!\n"; return; } my @files = grep (/$prefix[0-9]+$suffix/, readdir ($dh)); my $latest_timestamp; my $chosen_core_file; foreach my $file (@files) { my $timestamp_len = length ($file) - $timestamp_idx - $suffix_len; my $timestamp = substr ($file, $timestamp_idx, $timestamp_len); if (!defined $latest_timestamp) { $latest_timestamp = $timestamp; $chosen_core_file = $file; } elsif ($latest_timestamp < $timestamp) { $latest_timestamp = $timestamp; $chosen_core_file = $file; } } closedir ($dh); if (defined $chosen_core_file) { $core_file_path = $path . "/" . $chosen_core_file; } else { print STDERR "WARNING: print_stacktrace_linux: Could not determine a core file with timestamp\n"; return; } } else { $core_file_path = $path . "/" . $pattern; } my $debugger = "gdb"; if ($ENV{ACE_TEST_DEBUGGER}) { $debugger = $ENV{ACE_TEST_DEBUGGER}; } $self->print_stacktrace_common($exec_path, $core_file_path, $debugger); } sub print_stacktrace_darwin { my $self = shift; my $core_file_path = "/cores/core." . $self->{PROCESS}; my $debugger = "lldb"; if ($ENV{ACE_TEST_DEBUGGER}) { $debugger = $ENV{ACE_TEST_DEBUGGER}; } $self->print_stacktrace_common($self->Executable (), $core_file_path, $debugger); } sub print_stacktrace_common { my $self = shift; my $exec_path = shift; my $core_file_path = shift; my $preferred_db = shift; if (!(-e $core_file_path)) { print STDERR "WARNING: print_stacktrace_common: Core file $core_file_path does not exist\n"; return; } if (!defined $preferred_db) { $preferred_db = "gdb"; } my $preferred_cmd; my $secondary_db; my $secondary_cmd; my $gdb_args = " $exec_path -c $core_file_path -ex bt -ex quit"; my $lldb_args = " $exec_path -c $core_file_path -o bt -o quit"; if ($preferred_db =~ /gdb/) { $preferred_cmd = $preferred_db . $gdb_args; $secondary_db = "lldb"; $secondary_cmd = $secondary_db . $lldb_args; } elsif ($preferred_db =~ /lldb/) { $preferred_cmd = $preferred_db . $lldb_args; $secondary_db = "gdb"; $secondary_cmd = $secondary_db . $gdb_args; } else { print STDERR "ERROR: print_stacktrace_common: Unknown debugger ($preferred_db) requested\n"; return; } my $stack_trace; if (system ("$preferred_db --version") != -1) { $stack_trace = `$preferred_cmd`; } elsif (system ("$secondary_db --version") != -1) { print STDERR "WARNING: print_stacktrace_common: Failed printing stack trace with $preferred_db. Trying $secondary_db...\n"; $stack_trace = `$secondary_cmd`; } else { print STDERR "WARNING: print_stacktrace_common: Failed printing stack trace with both $preferred_db and $secondary_db\n"; } if (defined $stack_trace) { print STDERR "\n======= Begin stack trace of $exec_path from core file $core_file_path =======\n"; print STDERR $stack_trace; print STDERR "======= End stack trace =======\n"; } } # The second argument is an optional output argument that, if present, # will be passed to check_return_value function to get the signal number # the process has received, if any, and/or whether there was a core dump. sub WaitKill ($;$) { my $self = shift; my $timeout = shift; my $opts = shift; if ($self->{RUNNING} == 0) { return 0; } my $has_core; my %my_opts = (dump_ref => \$has_core); if (defined $opts) { if (defined $opts->{self_crash}) { $my_opts{self_crash} = $opts->{self_crash}; } if (defined $opts->{signal_ref}) { $my_opts{signal_ref} = $opts->{signal_ref}; } } my $status = $self->TimedWait ($timeout, \%my_opts); if ($status == -1) { print STDERR "ERROR: $self->{EXECUTABLE} timedout\n"; if ($ENV{ACE_TEST_LOG_STUCK_STACKS}) { my $debugger = $ENV{ACE_TEST_DEBUGGER}; if (!defined $debugger) { $debugger = ($^O eq 'darwin') ? 'lldb' : 'gdb'; } my $commands = ($debugger eq 'gdb') ? "-ex 'set pagination off' -ex 'thread apply all backtrace'" : "-o 'bt all'"; print STDERR "\n======= Begin stuck stacks =======\n"; system "$debugger --batch -p $self->{PROCESS} $commands"; print STDERR "======= End stuck stacks =======\n"; } if ($ENV{ACE_TEST_GENERATE_CORE_FILE}) { system ($^O ne 'darwin') ? "gcore $self->{PROCESS}" : "lldb -b -p $self->{PROCESS} -o " . "'process save-core core.$self->{PROCESS}'"; } $self->Kill (); } elsif ($status == 255 && $has_core && !$ENV{ACE_TEST_DISABLE_STACK_TRACE}) { if ($^O eq 'linux') { $self->print_stacktrace_linux (); } elsif ($^O eq 'darwin') { $self->print_stacktrace_darwin (); } } if (defined $opts && defined $opts->{dump_ref}) { ${$opts->{dump_ref}} = $has_core; } $self->{RUNNING} = 0; return $status; } # Do a Spawn and immediately WaitKill sub SpawnWaitKill ($;$) { my $self = shift; my $timeout = shift; my $opts = shift; if ($self->Spawn () == -1) { return -1; } return $self->WaitKill ($timeout, $opts); } sub TerminateWaitKill ($) { my $self = shift; my $timeout = shift; if ($self->{RUNNING}) { print STDERR "INFO: $self->{EXECUTABLE} being killed.\n"; kill ('TERM', $self->{PROCESS}); } return $self->WaitKill ($timeout, {self_crash => 1}); } # Really only for internal use. # The second optional argument is a hash reference with the following keys. # 1. "self_crash" indicates if the process may receive a signal intentionally. # In that case, a signal may originate from the process, e.g., by calling abort(), # or from an associated Perl script, e.g., by calling kill. If "self_crash" is # missing, it has the same meaning as if "self_crash" is evaluated to false. # A signal intentionally received can be either KILL, TERM, or ABRT. Any other # signal indicates there was an actual error. # 2. "signal_ref" is a scalar reference that will hold the signal number, if any. # 3. "dump_ref" is a scalar reference that indicates if there was a core dump. sub check_return_value ($) { my $self = shift; my $rc = shift; my $opts = shift // {}; # NSK OSS has a 32-bit waitpid() status my $is_NSK = ($^O eq "nonstop_kernel"); my $CC_MASK = $is_NSK ? 0xffff00 : 0xff00; # Exit code processing if ($rc == 0) { return 0; } elsif ($rc == $CC_MASK) { print STDERR "ERROR: <", $self->{EXECUTABLE}, "> failed: $!\n"; return ($rc >> 8); } elsif (($rc & 0xff) == 0) { return ($rc >> 8); } # Ignore NSK 16-bit completion code $rc &= 0xff if $is_NSK; # Remember Core dump flag my $dump = 0; if ($rc & 0x80) { $rc &= ~0x80; $dump = 1; } # A undef means the process does not self crash my $self_crash = $opts->{self_crash}; # ABRT, KILL or TERM can be sent deliberately if ($self_crash && ($rc == 6 || $rc == 9 || $rc == 15)) { return 0; } my $signal_ref = $opts->{signal_ref}; if (defined $signal_ref) { ${$signal_ref} = $rc; } my $dump_ref = $opts->{dump_ref}; if (defined $dump_ref) { ${$dump_ref} = $dump; } print STDERR "ERROR: <", $self->{EXECUTABLE}, "> exited with "; print STDERR "coredump from " if ($dump == 1); print STDERR "signal $rc : ", $signame[$rc], "\n"; return 255; } # for internal use sub parse_command_line ($) { my $self = shift; my $cmdline = shift; $cmdline =~ s/^\s+//; my @cmdlist = (); while ($cmdline ne '') { if ($cmdline =~ /^\"([^\"\\]*(?:\\.[^\"\\]*)*)\"(.*)/) { my $unquoted = $1; $cmdline = $2; $unquoted =~ s/\\\"/\"/g; push @cmdlist, $unquoted; } elsif ($cmdline =~ /^\'([^\'\\]*(?:\\.[^\'\\]*)*)\'(.*)/) { my $unquoted = $1; $cmdline = $2; $unquoted =~ s/\\\'/\'/g; push @cmdlist, $unquoted; } elsif ($cmdline =~ /^([^\s]*)(.*)/) { push @cmdlist, $1; $cmdline = $2; } else { # this must be some kind of error push @cmdlist, $cmdline; } $cmdline =~ s/^\s+//; } return @cmdlist; } sub Kill ($) { my $self = shift; my $ignore_return_value = shift; # If Remote PID not known, but should be if (defined $self->{TARGET} && defined $self->{TARGET}->{REMOTE_SHELL} && !defined $self->{REMOTE_PID}) { my $rc = $self->ReadPidFile($self->{PIDFILE}); if ($rc != 0) { $self->{REMOTE_PID} = $rc; } } my $child_killed = 0; if ($self->{RUNNING} && !defined $ENV{'ACE_TEST_WINDOW'}) { if (defined $self->{TARGET} && defined $self->{TARGET}->{REMOTE_SHELL}) { # Kill remote process if (defined $self->{REMOTE_PID}) { my $cmd = $self->{TARGET}->{REMOTE_SHELL}." kill -s KILL ".$self->{REMOTE_PID}; if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "INFO: Killing remote process <", $cmd, ">\n"; select(undef, undef, undef, .5); } $cmd = `$cmd 2>&1`; # Wait to give remote process time to exit select(undef, undef, undef, 3.0); } else { print STDERR "INFO: remote process PID unknown, can't kill\n"; } } else { kill ('KILL', $self->{PROCESS}); $child_killed = 1; } for(my $i = 0; $i < 10; $i++) { my $pid = waitpid ($self->{PROCESS}, WNOHANG); if ($pid > 0) { if (! $ignore_return_value) { $self->check_return_value ($?, {self_crash => 1}); } last; } else { if (!$child_killed) { # Kill child process (may be remote shell)) kill ('KILL', $self->{PROCESS}); $child_killed = 1; } select(undef, undef, undef, .5); } } } $self->{RUNNING} = 0; } # Wait until a process exits. # return -1 if the process is still alive. sub Wait ($) { my $self = shift; my $timeout = shift; if (!defined $self->{PROCESS}) { return 0; } if (!defined $timeout || $timeout < 0) { return waitpid ($self->{PROCESS}, 0); } else { return TimedWait($self, $timeout); } } # The second argument is an optional output argument that, if present, # will contain the signal number that the process has received, if any, # and/or whether there was a core dump. sub TimedWait ($;$) { my $self = shift; my $timeout = shift; my $opts = shift; if (!defined $self->{PROCESS}) { return 0; } if ($PerlACE::Process::WAIT_DELAY_FACTOR > 0) { $timeout *= $PerlACE::Process::WAIT_DELAY_FACTOR; } # Multiply with 10 because we wait a tenth of a second each time $timeout *= 10; while ($timeout-- != 0) { my $pid = waitpid ($self->{PROCESS}, &WNOHANG); if ($pid != 0 && $? != -1) { return $self->check_return_value ($?, $opts); } select(undef, undef, undef, 0.1); } return -1; } ### sub kill_all { my $procmask = shift; my $target = shift; my $pid = -1; my $cmd; my $valgrind_cmd = $ENV{'ACE_RUN_VALGRIND_CMD'}; my $ps_cmd = 'ps -ef'; my $ps_pid_field = 1; my $ps_cmd_field = 7; my $ps_skip_first = 1; my @ps_fields = 0; if (defined $target && defined $target->{PS_CMD}) { ## in case a special command is required ## format: ::[:] $ps_cmd_field = -1; @ps_fields = split (/:/, $target->{PS_CMD}); $ps_cmd = $ps_fields[0]; if (@ps_fields > 1) { $ps_pid_field = $ps_fields[1]; if (@ps_fields > 2) { $ps_cmd_field = $ps_fields[2]; if (@ps_fields > 3) { $ps_skip_first = ($ps_fields[3] == '1' ? 1 : 0); } } } else { print STDERR "ERROR: Missing field index for PID in [PS_CMD=".$target->{PS_CMD}."]\n"; return 0; } @ps_fields = 0; } else { my $which_ps; if (defined $target && defined $target->{REMOTE_SHELL}) { $which_ps = $target->{REMOTE_SHELL} . ' which ps'; } else { $which_ps = 'which ps'; } my $ps_file = `$which_ps`; if (defined $target && defined $target->{REMOTE_SHELL}) { $which_ps = $target->{REMOTE_SHELL} . " readlink $ps_file"; $ps_file = `$which_ps`; } $ps_file =~ s/^\s+//; $ps_file =~ s/\s+$//; if (($ps_file =~ /busybox/) or ((-l $ps_file) and (readlink ($ps_file)) =~ /busybox/)) { ## some embedded targets use BusyBox for base tools ## with different arguments $ps_cmd = 'ps w'; $ps_pid_field = 0; $ps_cmd_field = 4; } } if (defined $target && defined $target->{REMOTE_SHELL}) { $ps_cmd = $target->{REMOTE_SHELL}.' '.$ps_cmd; } for my $line (`$ps_cmd`) { if ($ps_skip_first) { # skip first line (headers) $ps_skip_first = 0; } else { # split line @ps_fields = split (/\s+/, $line); if (@ps_fields > $ps_pid_field && @ps_fields > $ps_cmd_field) { $pid = $ps_fields[$ps_pid_field]; # process PID # take care of valgrind runs if (defined $valgrind_cmd) { my $pos = index ($line, $valgrind_cmd); if ($pos >= 0) { $cmd = substr ($line, $pos + length ($valgrind_cmd)); $cmd =~ s/^\s+//; # strip leading ws @ps_fields = split (/\s+/, $cmd); $cmd = $ps_fields[0]; } else { $cmd = $line; } } else { if ($ps_cmd_field >= 0) { $cmd = $ps_fields[$ps_cmd_field]; # process cmd / executable } else { $cmd = $line; } } # match process cmd if ($cmd =~ /$procmask/) { if (defined $target && defined $target->{REMOTE_SHELL}) { my $kill_cmd = $target->{REMOTE_SHELL}." kill -s KILL $pid"; $kill_cmd = `$kill_cmd`; } else { kill ('KILL', $pid); # kill process } if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR "INFO: Killed process at [$line]\n"; } } } } } } 1; ace-8.0.4+dfsg.orig/bin/PerlACE/ProcessWinCE.pm0000644000175000017500000002253415027201773020022 0ustar sudipsudip#!/usr/bin/env perl package PerlACE::ProcessVX; use strict; use Win32::Process; use File::Basename; use File::Spec; use FileHandle; use Cwd; eval { require Net::Telnet; }; ############################################################################### # This is what GetExitCode will return if the process is still running. my $STILL_ACTIVE = 259; ############################################################################### ### Constructor and Destructor sub new { my $proto = shift; my $class = ref ($proto) || $proto; my $self = {}; $self->{RUNNING} = 0; $self->{IGNOREEXESUBDIR} = 1; $self->{IGNOREHOSTROOT} = 0; $self->{PROCESS} = undef; $self->{TARGET} = shift; $self->{EXECUTABLE} = shift; $self->{ARGUMENTS} = shift; if (!defined $PerlACE::ProcessVX::WAIT_DELAY_FACTOR) { $PerlACE::ProcessVX::WAIT_DELAY_FACTOR = 3; } if (!defined $PerlACE::ProcessVX::RebootCmd) { $PerlACE::ProcessVX::RebootCmd = "reboot"; } bless ($self, $class); return $self; } sub DESTROY { my $self = shift; if ($self->{RUNNING} == 1) { print STDERR "ERROR: <", $self->{EXECUTABLE}, "> still running upon object destruction\n"; $self->Kill (); } if (!defined $ENV{'ACE_TEST_VERBOSE'}) { unlink "run_vx.pl"; } if (defined $ENV{'ACE_RUN_VX_IBOOT'} && !defined $ENV{'ACE_RUN_VX_NO_SHUTDOWN'}) { # Shutdown the target to save power $self->iboot_cycle_power(1); } } ############################################################################### ### Spawning processes # Spawn the process and continue. sub Spawn () { my $self = shift; if ($self->{RUNNING} == 1) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> already running\n"; return -1; } if (!defined $self->{EXECUTABLE}) { print STDERR "ERROR: Cannot Spawn: No executable specified\n"; return -1; } if ($self->{IGNOREEXESUBDIR} == 0) { if (!-f $self->Executable ()) { print STDERR "ERROR: Cannot Spawn: <", $self->Executable (), "> not found\n"; return -1; } } my $status = 0; my $cmdline; # Reboot the target if necessery $self->reboot(); my $program = $self->Executable (); my $cwdrel = dirname ($program); my $prjroot = defined $ENV{'ACE_RUN_VX_PRJ_ROOT'} ? $ENV{'ACE_RUN_VX_PRJ_ROOT'} : $ENV{'ACE_ROOT'}; if (length ($cwdrel) > 0) { $cwdrel = File::Spec->abs2rel( cwd(), $prjroot ); } else { $cwdrel = File::Spec->abs2rel( $cwdrel, $prjroot ); } $cwdrel =~ s/\\/\//g; $program = basename($program, $PerlACE::ProcessVX::ExeExt); unlink "run_vx.pl"; my $oh = new FileHandle(); if (!open($oh, ">run_vx.pl")) { print STDERR "ERROR: Unable to write to run_vx.pl\n"; exit -1; } my @cmds; my $cmdnr = 0; my $arguments = ""; my $prompt = ''; my $exesubdir = defined $ENV{'ACE_RUN_VX_EXE_SUBDIR'} ? $ENV{'ACE_RUN_VX_EXE_SUBDIR'} : ""; if (defined $ENV{'ACE_RUN_VX_STARTUP_SCRIPT'}) { if (defined $ENV{'ACE_RUN_VX_STARTUP_SCRIPT_ROOT'}) { @cmds[$cmdnr++] = 'cd "' . $ENV{'ACE_RUN_VX_STARTUP_SCRIPT_ROOT'} . '"'; } @cmds[$cmdnr++] = '< ' . $ENV{'ACE_RUN_VX_STARTUP_SCRIPT'}; } if (defined $ENV{'ACE_RUN_VX_STARTUP_COMMAND'}) { @cmds[$cmdnr++] = $ENV{'ACE_RUN_VX_STARTUP_COMMAND'}; } @cmds[$cmdnr++] = 'cd ' . $ENV{'ACE_RUN_VX_TGTSVR_ROOT'} . "/" . $cwdrel . "/" . $exesubdir; @cmds[$cmdnr++] = 'set TMPDIR=' . $ENV{'ACE_RUN_VX_TGTSVR_ROOT'} . "/" . $cwdrel; if (defined $ENV{'ACE_RUN_ACE_DEBUG'}) { @cmds[$cmdnr++] = 'set ACE_DEBUG=' . $ENV{'ACE_RUN_ACE_DEBUG'}; } if (defined $ENV{'ACE_RUN_TAO_ORB_DEBUG'}) { @cmds[$cmdnr++] = 'set TAO_ORB_DEBUG=' . $ENV{'ACE_RUN_TAO_ORB_DEBUG'}; } if (defined $ENV{'ACE_RUN_ACE_LD_SEARCH_PATH'}) { @cmds[$cmdnr++] = 'set ACE_LD_SEARCH_PATH=' . $ENV{'ACE_RUN_ACE_LD_SEARCH_PATH'}; } my(@load_commands); my(@unload_commands); my $vxtest_file = $program . '.vxtest'; if (handle_vxtest_file($self, $vxtest_file, \@load_commands, \@unload_commands)) { push @cmds, @load_commands; $cmdnr += scalar @load_commands; } else { print STDERR "ERROR: Cannot find <", $vxtest_file, ">\n"; } if (defined $self->{ARGUMENTS}) { ($arguments = $self->{ARGUMENTS})=~ s/\"/\\\"/g; ($arguments = $self->{ARGUMENTS})=~ s/\'/\\\'/g; } $cmdline = $program . ' ' . $arguments; if (defined $ENV{'ACE_RUN_VX_TGTSRV_WORKINGDIR'}) { @cmds[$cmdnr++] = 'cd ' . $ENV{'ACE_RUN_VX_TGTSRV_WORKINGDIR'}; } else { @cmds[$cmdnr++] = 'cd ' . $ENV{'ACE_RUN_VX_TGTSVR_ROOT'} . "/" . $cwdrel; } @cmds[$cmdnr++] = $cmdline; if (!defined $ENV{'ACE_TEST_VERBOSE'}) { push @cmds, @unload_commands; $cmdnr += scalar @unload_commands; } $prompt = '\> $'; print $oh "require Net::Telnet;\n"; print $oh "my \@cmds;\n"; print $oh "my \$prompt = '$prompt';\n"; my $i = 0; while($i < $cmdnr) { print $oh "\@cmds[$i] = '" . @cmds[$i++] . "';\n"; } print $oh "my \$cmdnr = $cmdnr;\n\n"; print $oh <<'__END__'; my $telnet_port = $ENV{'ACE_RUN_VX_TGT_TELNET_PORT'}; my $telnet_host = $ENV{'ACE_RUN_VX_TGT_TELNET_HOST'}; if (!defined $telnet_host) { $telnet_host = $ENV{'ACE_RUN_VX_TGTHOST'}; } if (!defined $telnet_port) { $telnet_port = 23; } my $t = new Net::Telnet(Timeout => 600, Errmode => 'return', Host => $telnet_host, Port => $telnet_port); if (!defined $t) { die "ERROR: Telnet failed to <" . $telnet_host . ":". $telnet_port . ">"; } $t->open(); my $ok = false; my $buf = ''; while (1) { my $blk = $t->get; print $blk; $buf .= $blk; if ($buf =~ /$prompt/) { $ok = true; last; } } if ($ok) { my $i = 0; my @lines; while($i < $cmdnr) { if (defined $ENV{'ACE_TEST_VERBOSE'}) { print STDERR @cmds[$i]."\n"; } if ($t->print (@cmds[$i++])) { my $buf = ''; while (1) { my $blk = $t->get; printf $blk; $buf .= $blk; if ($buf =~ /$prompt/) { last; } } } else { print $t->errmsg; } } } else { die "ERROR: No prompt appeared\n"; } $t->close(); sleep(2); exit; __END__ close($oh); Win32::Process::Create ($self->{PROCESS}, "$^X", "$^X run_vx.pl", 0, 0, '.'); Win32::Process::GetExitCode ($self->{PROCESS}, $status); if ($status != $STILL_ACTIVE) { print STDERR "ERROR: Spawn failed for <", "$^X run_vx.pl", ">\n"; exit $status; } $self->{RUNNING} = 1; return 0; } # Wait for a process to exit with a timeout sub TimedWait ($) { my($self) = shift; my($timeout) = shift; return $self->Wait($timeout); } # Terminate the process and wait for it to finish sub TerminateWaitKill ($) { my $self = shift; my $timeout = shift; if ($self->{RUNNING}) { print STDERR "INFO: $self->{EXECUTABLE} being killed.\n"; Win32::Process::Kill ($self->{PROCESS}, 0); $PerlACE::ProcessVX::DoVxInit = 1; # force reboot on next run } return $self->WaitKill ($timeout); } # Wait until a process exits. # return -1 if the process is still alive. sub Wait ($) { my $self = shift; my $timeout = shift; if (!defined $timeout || $timeout < 0) { $timeout = INFINITE; } else { $timeout = $timeout * 1000 * $PerlACE::ProcessVX::WAIT_DELAY_FACTOR; } my $result = 0; if ($self->{RUNNING}) { $result = Win32::Process::Wait ($self->{PROCESS}, $timeout); if ($result == 0) { return -1; } } Win32::Process::GetExitCode ($self->{PROCESS}, $result); if ($result != 0) { $PerlACE::ProcessVX::DoVxInit = 1; # force reboot on next run } return $result; } # Kill the process sub Kill () { my $self = shift; if ($self->{RUNNING}) { Win32::Process::Kill ($self->{PROCESS}, -1); } $self->{RUNNING} = 0; } sub handle_vxtest_file { my $self = shift; my $vxtestfile = shift; my $vx_ref = shift; my $unld_ref = shift; my $fh = new FileHandle; if (defined $self->{TARGET} && $self->{TARGET}->SystemLibs()) { my @tokens = split(/;/, $self->{TARGET}->SystemLibs()); foreach my $token (@tokens) { push @$vx_ref, "copy \"" . $ENV{'ACE_RUN_VX_TGTSVR_ROOT'} . "/lib/" . $token . "\" ."; } } if (!$PerlACE::Static) { if (open ($fh, $vxtestfile)) { my $line1 = <$fh>; chomp $line1; while(<$fh>) { $line1 = $_; chomp $line1; push @$vx_ref, "copy \"" . $ENV{'ACE_RUN_VX_TGTSVR_ROOT'} . "/lib/$line1" . "d.dll\" ."; unshift @$unld_ref, "del $line1" . "d.dll"; } close $fh; } else { return 0; } } return 1; } 1; ace-8.0.4+dfsg.orig/bin/Uniqueid.pm0000644000175000017500000000055715027201773016067 0ustar sudipsudip#!/usr/bin/env perl sub uniqueid { if ($^O eq "MSWin32") { my $uid = 1; open (IPNUM, "ipconfig|") || die "Can't run ipconfig: $!\n"; while () { if (/Address/) { $uid = (split (/: (\d+)\.(\d+)\.(\d+)\.(\d+)/))[4]; } } close IPNUM; return $uid; } else { return getpwnam (getlogin ()); } } 1; ace-8.0.4+dfsg.orig/bin/svcconf-convert.pl0000755000175000017500000001762515027201773017431 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # # File: svcconf-convert.pl: # Purpose: This perl script convert classic svc.conf file into XML svc.conf file format. # Usage: svcconf-convert.pl [-i infile] [-o outfile] [-verbose] [-nocomment] # -i: Specify the input classic svc.conf filename. # If omitted, the default input filename is "svc.conf". # -o: Specify the output XML svc.conf filename. # If this argument is omitted, the resulting XML file will be written # to file called .xml. # -verbose: Verbose output. # -nocomment: Remove all comments. Use this argument if you have comments # mixing in the middle of a classic svc.conf directive. $indent = 0; sub inc_indent { $indent += 2; } sub dec_indent { $indent -= 2; } sub get_indent { $retv = 0; print STDERR "$0 (", $lineno, "): Unbalanced macro pairs\n" if ($indent < 0); $retv = $indent - 1 if ($indent > 0); $retv; } sub acexml_comment { my $comment = shift; print OUT " " x &get_indent (), "\n"; } sub acexml_start { my $name = shift; my $standalone = shift; print OUT " " x &get_indent (), "<$name"; while (@attnames) { print OUT " ", pop (@attnames), '="', pop (@attvalues), '"'; } if ($standalone != 0) { print OUT "/>\n"; } else { print OUT ">\n"; inc_indent (); } } sub acexml_end { my $name = shift; dec_indent (); print OUT " " x &get_indent (), "\n"; } $verbose = 0; $nocomment = 0; @attvalues = (); @attnames = (); $stream = ""; $infile = ""; $outfile = ""; while ( $#ARGV >= 0) { if ($ARGV[0] =~ m/^-i/i) { shift; $infile = "$ARGV[0]"; } elsif ($ARGV[0] =~ m/^-o/i) { shift; $outfile = "$ARGV[0]"; } elsif ($ARGV[0] =~ m/^-verbose/i) { $verbose = 1; } elsif ($ARGV[0] =~ m/^-nocomment/i) { $nocomment = 1; } elsif ($ARGV[0] =~ m/^-(\?|h|help)/i) { # Help information print " Usage: svcconf-convert.pl [-i infile] [-o outfile] [-verbose] [-nocomment] -i: Specify the input classic svc.conf filename. If omitted, the default input filename is 'svc.conf'. -o: Specify the output XML svc.conf filename. If this argument is omitted, the resulting XML file will be written to file called .xml. -verbose: Verbose output. -nocomment: Remove all comments. Use this argument if you have comments mixing in the middle of a classic svc.conf directive. "; exit; } elsif ($ARGV[0] =~ m/^-/) { warn "$0: unknown option $ARGV[0]\n"; exit 1; } else { die "unknow argument\n"; } shift; } if ($infile eq "") { print "Using default svc.conf name\n" if ($verbose != 0); $infile = "svc.conf"; } if ($outfile eq "") { $outfile = "$infile.xml"; } print "OUTFILE = $outfile \n" if ($verbose); open (OUT, "> $outfile") or die "Unable to open $outfile\n"; undef $/; open (FH, "< $infile"); $_ = ; if ($nocomment) { if (s/^\#(.*)$//mg) { print "ts = $_\n" if ($verbose != 0); } } print "------------------------------------------------------------\n" if ($verbose != 0); print OUT "\n"; print OUT "\n"; acexml_start ("ACE_Svc_Conf", 0); while (length ($_) != 0) { s/^\s*$//mg; print "INPUT =\n$_\n" if ($verbose); PARSE: { if (s/^\s*\#(.*)//) { acexml_comment ($1); print "# $1\n" if ($verbose); } if (s/^\s*{//) { acexml_start ("module", 0); print "open module\n" if ($verbose); } if (s/^\s*}//) { acexml_end ("module"); acexml_end ($stream); print "close module\n" if ($verbose); } if (s/^\s*stream\s+dynamic\s+(\w+)\s+(\w+)\s*\*\s*(\S+):(\S+)\s*\(\s*\)(\s+(active|inactive))?(\s+"([^"]*)")?//) { $name = $1; $type = $2; $path = $3; $init = $4; $state = $6; $param = $8; acexml_start ("streamdef"); if ($status ne "") { push @attnames, ("status"); push @attvalues, ("$state"); } push @attnames, ("type"); push @attvalues, ("$type"); push @attnames, ("id"); push @attvalues, ("$name"); acexml_start ("dynamic", 0); if ($param ne "") { push @attnames, ("params"); push @attvalues, ("$param"); } push @attnames, ("init"); push @attvalues, ("$init"); push @attnames, ("path"); push @attvalues, ("$path"); acexml_start ("initializer", 1); acexml_end ("dynamic"); $stream = "streamdef"; print "stream dynamic $name $type * $init:$path \"$param\" $state\n" if ($verbose); } if (s/^\s*stream\s+static\s+(\w+)(\s+("(.*)"))?//) { $name = $1; $param = $4; acexml_start ("streamdef", 0); if ($param ne "") { push @attnames, ("params"); push @attvalues, ("$param"); } push @attnames, ("id"); push @attvalues, ("$name"); acexml_start ("static", 1); $stream = "streamdef"; print "static $name \"$param\"\n" if ($verbose); } if (s/^\s*stream\s+(\w+)//) { $name = $1; push @attnames, ("id"); push @attvalues, ("$name"); acexml_start ("stream", 0); $stream = "stream"; print "stream $name\n" if ($verbose); } if (s/^\s*dynamic\s+(\w+)\s+(\w+)\s*\*\s*(\S+):(\S+)\s*\(\s*\)(\s+(active|inactive))?(\s+"([^"]*)")?//) { $name = $1; $type = $2; $path = $3; $init = $4; $state = $6; $param = $8; if ($status ne "") { push @attnames, ("status"); push @attvalues, ("$state"); } push @attnames, ("type"); push @attvalues, ("$type"); push @attnames, ("id"); push @attvalues, ("$name"); acexml_start ("dynamic", 0); if ($param ne "") { push @attnames, ("params"); push @attvalues, ("$param"); } push @attnames, ("init"); push @attvalues, ("$init"); push @attnames, ("path"); push @attvalues, ("$path"); acexml_start ("initializer", 1); acexml_end ("dynamic"); print "dynamic $name $type * $init:$path \"$param\" $state\n" if ($verbose); } if (s/^\s*static\s+(\w+)(\s+("(.*)"))?//) { $name = $1; $param = $4; if ($param ne "") { push @attnames, ("params"); push @attvalues, ("$param"); } push @attnames, ("id"); push @attvalues, ("$name"); acexml_start ("static", 1); print "static $name \"$param\"\n" if ($verbose); } if ( s/^\s*resume\s+(\w+)//) { $name = $1; push @attnames, ("id"); push @attvalues, ("$name"); acexml_start ("resume", 1); print "resume $name\n" if ($verbose); } if ( s/^\s*remove\s+(\w+)//) { $name = $1; push @attnames, ("id"); push @attvalues, ("$name"); acexml_start ("remove", 1); print "remove $name\n" if ($verbose); } if ( s/^\s*suspend\s+(\w+)//) { $name = $1; push @attnames, ("id"); push @attvalues, ("$name"); acexml_start ("suspend", 1); print "suspend $name\n" if ($verbose); } $nothing = 1; } } acexml_end ("ACE_Svc_Conf"); ace-8.0.4+dfsg.orig/bin/mwc.pl0000755000175000017500000000365115027201773015072 0ustar sudipsudip#!/usr/bin/env perl eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}' & eval 'exec perl -w -S $0 $argv:q' if 0; # ****************************************************************** # Author: Chad Elliott # Date: 6/17/2002 # ****************************************************************** # ****************************************************************** # Pragma Section # ****************************************************************** require 5.006; use strict; use FindBin; use File::Spec; use File::Basename; my($basePath) = (defined $FindBin::RealBin ? $FindBin::RealBin : File::Spec->rel2abs(dirname($0))); if ($^O eq 'VMS') { $basePath = File::Spec->rel2abs(dirname($0)) if ($basePath eq ''); $basePath = VMS::Filespec::unixify($basePath); } $basePath .= '/MakeProjectCreator'; my($mpcroot) = $ENV{MPC_ROOT}; my($mpcpath) = (defined $mpcroot ? $mpcroot : dirname(dirname($basePath)) . '/MPC'); unshift(@INC, $mpcpath . '/modules'); if (defined $mpcroot) { print "MPC_ROOT was set to $mpcroot.\n"; } if (! -d "$mpcpath/modules") { print STDERR "ERROR: Unable to find the MPC modules in $mpcpath.\n"; if (defined $mpcroot) { print STDERR "Your MPC_ROOT environment variable does not point to a ", "valid MPC location.\n"; } else { print STDERR "You can set the MPC_ROOT environment variable to the ", "location of MPC.\n"; } exit(255); } require Driver; # ************************************************************ # Subroutine Section # ************************************************************ sub getBasePath { return $mpcpath; } # ************************************************************ # Main Section # ************************************************************ my($driver) = new Driver($basePath, Driver::workspaces()); exit($driver->run(@ARGV)); ace-8.0.4+dfsg.orig/tests/0000755000175000017500000000000015046037655014340 5ustar sudipsudipace-8.0.4+dfsg.orig/tests/Bug_3673_Regression_Test.cpp0000644000175000017500000000343015027201773021433 0ustar sudipsudip/** * @file Bug_3673_Regression_Test.cpp * * Reproduces the problems reported in bug 3673 * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=3673 */ #include "test_config.h" #include "ace/ACE.h" #include "ace/OS_NS_stdio.h" static bool construct_alpha = false; static bool destruct_alpha = false; static bool construct_beta = false; static bool destruct_beta = false; template struct Alpha { Alpha() { ACE_DEBUG ((LM_DEBUG, ACE_TEXT("construct alpha\n"))); construct_alpha = true;} ~Alpha() { ACE_DEBUG ((LM_DEBUG, ACE_TEXT("destruct alpha\n"))); destruct_alpha = true;} }; struct Beta { Beta() { ACE_DEBUG ((LM_DEBUG, ACE_TEXT("construct beta\n"))); construct_beta = true;} ~Beta() { ACE_DEBUG ((LM_DEBUG, ACE_TEXT("destruct bepha\n"))); destruct_beta = true;} }; struct Test { Alpha a; Beta b; Test() { ACE_DEBUG ((LM_DEBUG, ACE_TEXT("throw oops\n"))); throw "oops"; } }; int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Bug_3673_Regression_Test")); int result = 0; bool caught_excep = false; try { Test test; } catch (...) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Caught exception!\n"))); caught_excep = true; } if (!caught_excep) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Not caught exception\n"))); ++result; } if (!construct_alpha) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Constructor alpha not called\n"))); ++result; } if (!construct_beta) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Constructor beta not called\n"))); ++result; } if (!destruct_alpha) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Destructor alpha not called\n"))); ++result; } if (!destruct_beta) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Destructor beta not called\n"))); ++result; } ACE_END_TEST; return result; } ace-8.0.4+dfsg.orig/tests/DLL_Test_Impl.cpp0000644000175000017500000000771615027201773017443 0ustar sudipsudip //============================================================================= /** * @file DLL_Test_Impl.cpp * * This test illustrates the use of wrapper class. * * @author Kirthika Parameswaran */ //============================================================================= #include "DLL_Test_Impl.h" #include "ace/ACE.h" #include "ace/OS_Errno.h" #include "ace/svc_export.h" #include "ace/OS_NS_string.h" #include #include Hello_Impl::Hello_Impl () { ACE_DEBUG ((LM_DEBUG, "Hello_Impl::Hello_Impl\n")); } Hello_Impl::~Hello_Impl () { ACE_DEBUG ((LM_DEBUG, "Hello_Impl::~Hello_Impl\n")); } void Hello_Impl::say_next () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("How are you?\n"))); } ACE_TCHAR * Hello_Impl::new_info () { return ACE::strnew (ACE_TEXT ("Hello_Impl::new_info() allocated by ACE::strnew()")); } ACE_TCHAR * Hello_Impl::malloc_info () { return ACE_OS::strdup (ACE_TEXT ("Hello_Impl::new_info() allocated by ACE_OS::malloc()")); } void * Hello_Impl::operator new (size_t bytes) { ACE_DEBUG ((LM_INFO, "Hello_Impl::new\n")); return ::new char[bytes]; } /// Overloaded new operator, nothrow_t variant. void * Hello_Impl::operator new (size_t bytes, const std::nothrow_t &nt) { ACE_DEBUG ((LM_INFO, "Hello_Impl::new\n")); return ::new (nt) char[bytes]; } void Hello_Impl::operator delete (void *ptr, const std::nothrow_t&) noexcept { ACE_DEBUG ((LM_INFO, "Hello_Impl::delete\n")); ::delete [] static_cast (ptr); } void Hello_Impl::operator delete (void *ptr) { ACE_DEBUG ((LM_INFO, "Hello_Impl::delete\n")); ::delete [] static_cast (ptr); } extern "C" ACE_Svc_Export Hello * get_hello () { Hello *hello {}; ACE_NEW_RETURN (hello, Hello_Impl, nullptr); return hello; } class Static_Constructor_Test { public: Static_Constructor_Test () { ACE_DEBUG ((LM_DEBUG, "Static_Constructor_Test::Static_Constructor_Test\n")); } ~Static_Constructor_Test () { ACE_DEBUG ((LM_DEBUG, "Static_Constructor_Test::~Static_Constructor_Test\n")); } }; static Static_Constructor_Test the_instance; // -------------------------------------------------------- Child::Child () { } Child::~Child () { } void Child::test () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("child test called\n"))); Data d; Data f(d); Data g; g = d; g = std::move(d); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("testing base exception\n"))); std::unique_ptr base_excep (new Base ()); try { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("throwing base exception\n"))); base_excep->_raise(); } catch (const Base&) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("caught base\n"))); } std::unique_ptr derived_excep (new Derived ()); try { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("throwing derived exception\n"))); derived_excep->_raise(); } catch (const Derived&) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("caught derived\n"))); } std::unique_ptr derived_excep_base (new Derived ()); try { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("throwing derived exception\n"))); derived_excep_base->_raise(); } catch (const Base&) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("caught derived as base\n"))); } std::unique_ptr derived_excep_alloc (Derived::_alloc ()); try { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("throwing derived exception allocated with _alloc\n"))); derived_excep_base->_raise(); } catch (const Derived&) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("caught derived exception\n"))); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("testing exceptions finished\n"))); } // -------------------------------------------------------- // Test dynamic cast extern "C" ACE_Svc_Export int dynamic_cast_test (Parent *target) { Child *c {}; c = dynamic_cast (target); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("dynamic_cast_test: parent %@; child %@\n"), target, c)); return target == c ? 0 : -1; } ace-8.0.4+dfsg.orig/tests/acetest.mpb0000644000175000017500000000045215027201773016462 0ustar sudipsudip// -*- MPC -*- project : aceexe { after += Test_Output libs += Test_Output Source_Files { Main.cpp } Header_Files { } Resource_Files { } Documentation_Files { } Inline_Files { } Template_Files { } Build_Files { tests.mpc tests.mwc acetest.mpb } } ace-8.0.4+dfsg.orig/tests/FIFO_Test.cpp0000644000175000017500000002247115027201773016565 0ustar sudipsudip //============================================================================= /** * @file FIFO_Test.cpp * * This is a test of basic ACE_FIFO_* class functionality. * The test forks two processes or spawns two threads (depending * upon the platform) and then tests various data exchange * scenarios. * * @author Steve Huston */ //============================================================================= #include "test_config.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_sys_stat.h" #include "ace/OS_NS_sys_wait.h" #include "ace/OS_NS_unistd.h" #include "ace/ACE.h" #include "ace/FIFO_Send_Msg.h" #include "ace/FIFO_Recv_Msg.h" #include "ace/Handle_Set.h" #include "ace/Lib_Find.h" #include "ace/Thread.h" #include "ace/Thread_Manager.h" #if !defined (ACE_LACKS_MKFIFO) static const char ACE_ALPHABET[] = "abcdefghijklmnopqrstuvwxyz"; // This length is used for the "big buffer" send/receive. static const size_t big_size = (BUFSIZ * 4); static void * client (void *arg) { ACE_TCHAR *fifo_path = reinterpret_cast (arg); ACE_FIFO_Send_Msg fifo; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) client opening %s\n"), fifo_path)); if (fifo.open (fifo_path) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), fifo_path), 0); // Try some transfers - the server part is expecting this data. // First, try a nice, easy send. ssize_t send_count; ssize_t expect = static_cast (ACE_OS::strlen (ACE_ALPHABET)); send_count = fifo.send (ACE_ALPHABET, ACE_OS::strlen (ACE_ALPHABET)); if (send_count == expect) { // Ok, so far so good. Now try one that will overflow the reader // side to be sure it properly tosses the overflow. Then send another // to be sure it finds the start of the next message ok. char big[big_size]; for (size_t i = 0; i < big_size; ++i) big[i] = (i % 2) ? 0x05 : 0x0A; // Make nice pattern in blown stack expect = static_cast (big_size); send_count = fifo.send (big, big_size); if (send_count == expect) { expect = static_cast (ACE_OS::strlen (ACE_ALPHABET)); send_count = fifo.send (ACE_ALPHABET, ACE_OS::strlen (ACE_ALPHABET)); if (send_count != expect) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) Final send; sent %d, expected %d") ACE_TEXT ("%p\n"), send_count, expect, ACE_TEXT ("send"))); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) All sends ok\n"))); } else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) Second send expected %d; sent %d. %p\n"), expect, send_count, ACE_TEXT ("send"))); } } else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) First send expected %d; sent %d. %p\n"), expect, send_count, ACE_TEXT ("send"))); } if (fifo.close () != 0) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("fifo close"))); return 0; } static void * server (void *arg) { ACE_FIFO_Recv_Msg *fifo = reinterpret_cast (arg); // Wait for the client to get going and open the FIFO. errno = 0; ACE_Handle_Set h; ACE_Time_Value delay (10); h.set_bit (fifo->get_handle ()); if (ACE::select (h.max_set () + 1, h, &delay) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) server %p\n"), ACE_TEXT ("select")), 0); // Read the things the client is sending; alphabet, huge overflow, then // alphabet. char buf[BUFSIZ]; ssize_t recv_count; ssize_t expect = static_cast (ACE_OS::strlen (ACE_ALPHABET)); recv_count = fifo->recv (buf, sizeof (buf)); if (recv_count != expect) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) Recv 1 expected %d, got %d. %p\n"), expect, recv_count, ACE_TEXT ("recv")), 0); buf[recv_count] = '\0'; if (ACE_OS::strcmp (buf, ACE_ALPHABET) != 0) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) Recv 1 expected alphabet; got %s\n"), buf)); // See documented return values for ACE_FIFO_Recv_Msg... // We are being sent a message much longer than BUFSIZ. // If this platform has STREAM pipes, the entire message will come // through and we can grab it all. If not, then ACE_FIFO_Recv_Msg ditches // the part of the message we don't read. This is rather a pain in the // neck, but the API doesn't return info that more data is in the message // (for STREAM pipes). When non-ACE_HAS_STREAM_PIPES discards data, the // returned length will be larger than requested, though only the requested // number of bytes are written to the buffer. #if defined (ACE_HAS_STREAM_PIPES) for (size_t remaining = big_size; remaining > 0; remaining -= recv_count) { #endif /* ACE_HAS_STREAM_PIPES */ // recv_count is sizeof(buf) on ACE_HAS_STREAM_PIPES; big_size on others. #if defined (ACE_HAS_STREAM_PIPES) expect = static_cast (sizeof (buf)); #else expect = static_cast (big_size); #endif /* ACE_HAS_STREAM_PIPES */ recv_count = fifo->recv (buf, sizeof (buf)); if (recv_count != expect) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) Recv 2 expected %d, ") ACE_TEXT ("got %d. %p\n"), expect, recv_count, ACE_TEXT ("recv")), 0); #if defined (ACE_HAS_STREAM_PIPES) } #endif /* ACE_HAS_STREAM_PIPES */ expect = static_cast (ACE_OS::strlen (ACE_ALPHABET)); recv_count = fifo->recv (buf, sizeof (buf)); if (recv_count != expect) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) Recv 3 expected %d, got %d. %p\n"), expect, recv_count, ACE_TEXT ("recv")), 0); buf[recv_count] = '\0'; if (ACE_OS::strcmp (buf, ACE_ALPHABET) != 0) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) Recv 3 expected alphabet; got %s\n"), buf)); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) All receives ok\n"))); return 0; } static int test_fifo_msg () { // Reader side opens first - it may fail if fifo not supported on this // platform. ACE_TCHAR fifo_path[MAXPATHLEN]; if (ACE::get_temp_dir (fifo_path, MAXPATHLEN) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("get_temp_dir")), 1); ACE_OS::strcat (fifo_path, ACE_TEXT ("FIFO_Test")); ACE_FIFO_Recv_Msg read_side; // Open read only, not persistent (4th arg is 0) if (-1 == read_side.open (fifo_path, O_CREAT | O_RDONLY, ACE_DEFAULT_FILE_PERMS, 0)) { #if defined (ACE_WIN32) if (errno == ENOTSUP) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("FIFO not supported on Win32; ") ACE_TEXT ("this is correct.\n"))); return 0; } #endif /* ACE_WIN32 */ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_FIFO_Recv_Msg::open")), 1); } // Ok, the FIFO opened clean for read. Now it's safe to spawn a // process/thread and test some transfers. int status = 0; // Test status; innocent until proven guilty. #if !defined (ACE_LACKS_FORK) switch (ACE_OS::fork (ACE_TEXT ("child"))) { case -1: ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("fork failed"))); status = 1; break; case 0: client (fifo_path); ACE_OS::exit (0); /* NOTREACHED */ default: server (&read_side); ACE_OS::wait (); } #elif defined (ACE_HAS_THREADS) if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (server), &read_side, THR_NEW_LWP | THR_DETACHED) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("server spawn"))); ++status; } if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (client), fifo_path, THR_NEW_LWP | THR_DETACHED) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("client spawn"))); ++status; } // Wait for the threads to exit. ACE_Thread_Manager::instance ()->wait (); #else ACE_ERROR ((LM_INFO, ACE_TEXT ("This test requires multiple threads ") ACE_TEXT ("or processes.\n"))); #endif /* ACE_HAS_THREADS */ if (read_side.remove () != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("fifo remove"))); ++status; } ACE_stat fifo_stat; if (ACE_OS::stat (fifo_path, &fifo_stat) == 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("FIFO %s should be gone but isn't\n"), fifo_path)); ++status; ACE_OS::unlink (fifo_path); // Try to get rid of it. } return status; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("FIFO_Test")); int errors = 0; errors += test_fifo_msg (); ACE_END_TEST; return errors; } #else int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("FIFO_Test")); ACE_ERROR ((LM_INFO, ACE_TEXT ("FIFOs are not supported on this platform\n"))); ACE_END_TEST; return 0; } #endif /* !ACE_LACKS_MKFIFO */ ace-8.0.4+dfsg.orig/tests/UPIPE_SAP_Test.cpp0000644000175000017500000001237715027201773017433 0ustar sudipsudip //============================================================================= /** * @file UPIPE_SAP_Test.cpp * * This is a test that uses and for * intra-process communication. * * @author Gerhard Lenzer * @author Douglas C. Schmidt * @author and Prashant Jain */ //============================================================================= #include "test_config.h" #include "ace/Stream.h" #include "ace/UPIPE_Acceptor.h" #include "ace/UPIPE_Connector.h" #include "ace/OS_NS_unistd.h" #if defined (ACE_HAS_THREADS) && \ (defined (ACE_HAS_STREAM_PIPES) || defined (ACE_HAS_WIN32_NAMED_PIPES)) // Global pattern static ACE_UPIPE_Addr addr (ACE_TEXT ("pattern")); // connector thread. static void * connector (void *) { ACE_UPIPE_Stream c_stream; ACE_OS::sleep (5); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) connector starting connect\n"))); ACE_UPIPE_Connector con; if (con.connect (c_stream, addr) == -1) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) connector ACE_UPIPE_Connector failed\n"))); ACE_Message_Block *mb = 0; ACE_NEW_RETURN (mb, ACE_Message_Block (sizeof ("hello thanks") * sizeof (char)), 0); mb->copy ("hello"); if (c_stream.send (mb) == -1) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) error connector send\n"))); if (c_stream.recv (mb) == -1) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) error connector recv\n"))); ACE_TEST_ASSERT (ACE_OS::strcmp (mb->rd_ptr (), "thanks") == 0); // Free up the memory block. mb->release (); // Now try the send()/recv() interface. char mytext[] = "This string is sent by connector as a buffer"; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) connector sending text\n"))); if (c_stream.send (mytext, sizeof (mytext)) == -1) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) buffer send from connector failed\n"))); char conbuf[BUFSIZ]; // Buffer to receive response. int i = 0; for (char c = ' '; c != '!'; i++) { if (c_stream.recv (&c, 1) == -1) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) buffer recv from connector failed\n"))); else conbuf[i] = c; } conbuf[i] = '\0'; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) conbuf = %s\n"), conbuf)); ACE_TEST_ASSERT (ACE_OS::strcmp (conbuf, "this is the acceptor response!") == 0); c_stream.close (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) exiting thread\n"))); return 0; } static void * acceptor (void *args) { ACE_UPIPE_Acceptor *acceptor = (ACE_UPIPE_Acceptor *) args; ACE_UPIPE_Stream s_stream; if (acceptor->accept (s_stream) == -1) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) ACE_UPIPE_Acceptor.accept failed\n"))); ACE_Message_Block *mb = 0; if (s_stream.recv (mb) == -1) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) acceptor recv failed\n"))); ACE_TEST_ASSERT (ACE_OS::strcmp (mb->rd_ptr (), "hello") == 0); mb->wr_ptr (mb->rd_ptr ()); mb->copy ("thanks"); if (s_stream.send (mb) == -1) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) acceptor send failed\n"))); char s_buf[BUFSIZ]; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) acceptor sleeping on recv\n"))); if (s_stream.recv (s_buf, sizeof (s_buf)) == -1) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) acceptor recv failed\n"))); else ACE_TEST_ASSERT (ACE_OS::strcmp (s_buf, "This string is sent by connector as a buffer") == 0); const char svr_response[] = "this is the acceptor response!"; ACE_OS::strcpy (s_buf, svr_response); if (s_stream.send (s_buf, sizeof (svr_response)) == -1) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) acceptor send failed\n"))); s_stream.close (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) exiting thread\n"))); return 0; } #endif /* ACE_HAS_THREADS && (ACE_HAS_STREAM_PIPES || ACE_HAS_WIN32_NAMED_PIPES) */ int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("UPIPE_SAP_Test")); #if defined (ACE_HAS_THREADS) && \ (defined (ACE_HAS_STREAM_PIPES) || defined (ACE_HAS_WIN32_NAMED_PIPES)) ACE_UPIPE_Acceptor acc (addr); // Spawn a acceptor thread. if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (acceptor), (void *) &acc, THR_NEW_LWP, 0) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("spawn")), 1); // Spawn a connector thread. if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (connector), (void *) 0, THR_NEW_LWP, 0) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("spawn")), 1); ACE_Thread_Manager::instance ()->wait (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) joined with acceptor thread\n"))); // Close the acceptor acc.close (); #else #if !defined (ACE_HAS_THREADS) ACE_ERROR ((LM_INFO, ACE_TEXT ("threads not supported on this platform\n"))); #else ACE_ERROR ((LM_INFO, ACE_TEXT ("UPIPE is not supported on this platform\n"))); #endif /* !defined (ACE_HAS_THREADS) */ #endif /* ACE_HAS_THREADS && (ACE_HAS_STREAM_PIPES || ACE_HAS_WIN32_NAMED_PIPES) */ ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Based_Pointer_Test.cpp0000644000175000017500000002776615027201773020574 0ustar sudipsudip //============================================================================= /** * @file Based_Pointer_Test.cpp * * This test check the Based_Pointer and Based_Pointer_repository classes. * * @author Steve Williams */ //============================================================================= #include "test_config.h" #include "ace/DLL.h" #include "ace/ACE.h" #ifdef ACE_HAS_POSITION_INDEPENDENT_POINTERS #include "ace/Based_Pointer_Repository.h" #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS */ #include "ace/Malloc_T.h" #include "ace/MMAP_Memory_Pool.h" #include "ace/PI_Malloc.h" #include "ace/Null_Mutex.h" #include "ace/Based_Pointer_T.h" #include "ace/SString.h" #include "ace/OS_NS_unistd.h" class Foo { private: Foo(const Foo &) { } public: friend class ace_dewarn_gplusplus; ~Foo () { } }; class Void_Pointer : public ACE_Based_Pointer { }; #ifdef ACE_HAS_POSITION_INDEPENDENT_POINTERS #if defined (ACE_LD_DECORATOR_STR) # define OBJ_SUFFIX ACE_LD_DECORATOR_STR ACE_DLL_SUFFIX #else # define OBJ_SUFFIX ACE_DLL_SUFFIX #endif /* ACE_LD_DECORATOR_STR */ #if defined (ACE_WIN32) # define OBJ_PREFIX ACE_DLL_PREFIX #else # define OBJ_PREFIX ACE_TEXT("./") ACE_DLL_PREFIX #endif /* ACE_WIN32 */ // Declare the type of the DLL symbol: using Get_Bp_Repository_Inst = void *(*)(); // Declare an allocator based MMAP_Memory_Pool using MMAP_Allocator = ACE_Malloc_T; // Check that the ACE_Based_Pointer_Repository can be accessed // from a Windows DLL // (see http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=1991) int singleton_test () { void* baddr1 = ACE_BASED_POINTER_REPOSITORY::instance(); void* baddr2 = ACE_BASED_POINTER_REPOSITORY::instance(); if (baddr1 != baddr2) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("ACE_Based_Pointer_Repository is not a singleton\n")), -1); } // Protection against this test being run on platforms not supporting Dlls. #if defined(ACE_HAS_DYNAMIC_LINKING) ACE_TString dll_file; const char *subdir_env = ACE_OS::getenv ("ACE_EXE_SUB_DIR"); if (subdir_env) { dll_file = ACE_TEXT_CHAR_TO_TCHAR (subdir_env); dll_file += ACE_DIRECTORY_SEPARATOR_STR; } dll_file += OBJ_PREFIX ACE_TEXT ("Based_Pointer_Test_Lib") OBJ_SUFFIX; // If DLL causes multiple instances of singleton // then the ACE_Cleanup object registered // with the ACE_Object_manager will no longer be valid, // at exit time if the library is unloaded. Override // the default close on destruct. ACE_DLL dll; int retval = dll.open (dll_file.c_str (), ACE_DEFAULT_SHLIB_MODE, 0); if (retval != 0) { ACE_TCHAR *dll_error = dll.error (); ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Error in DLL Open: %s\n"), dll_error ? dll_error : ACE_TEXT ("unknown error")), -1); } void* foo = dll.symbol (ACE_TEXT ("get_based_pointer_repository_instance")); // Cast the void* to function* with a long as intermediate. ptrdiff_t tmp = reinterpret_cast (foo); Get_Bp_Repository_Inst get_bp_repository_inst = reinterpret_cast (tmp); if (get_bp_repository_inst == 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), dll.error ()), -1); void* baddr_dll = get_bp_repository_inst (); dll.close (); if (baddr_dll != baddr1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("ACE_Based_Pointer_Repository is not a ") ACE_TEXT ("singleton in DLL <%@> <%@>\n"), baddr_dll, baddr1), -1); } #endif /* ACE_HAS_DYNAMIC_LINKING */ return 0; } // Check that MMAP memory blocks are correctly mapped // into the Based_Pointer_Repository int mmap_map_test() { MMAP_Allocator* alloc = 0; ACE_OS::unlink("foo"); { // The 'options' are only here to quiet MSVC 6. It can be removed // when MSVC 6 support is removed. MMAP_Allocator::MEMORY_POOL_OPTIONS *options = 0; ACE_NEW_RETURN (alloc, MMAP_Allocator (ACE_TEXT ("foo"), ACE_TEXT ("foo"), options), -1); void* addr = alloc->base_addr(); if(addr == 0) { ACE_ERROR((LM_ERROR, ACE_TEXT ("Unable to get base to MMAP Memory Pool\n"))); alloc->remove(); delete alloc; return -1; } // Check a base address mapping was added to the Repository // when the pool was created void* ba = 0; if(ACE_BASED_POINTER_REPOSITORY::instance()->find(addr, ba) == -1) { ACE_ERROR((LM_ERROR, ACE_TEXT ("Unable to access repository\n"))); alloc->remove(); delete alloc; return -1; } alloc->remove(); delete alloc; if(ba != addr) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("MMAP pool mapping not present\n")), -1); } // Check Mapping is removed when object is deleted if (ACE_BASED_POINTER_REPOSITORY::instance()->find(addr, ba) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Unable to access repository\n")), -1); } if(ba != 0) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("MMAP pool mapping not removed\n")), -1); } } return 0; } // Check that persistent MMAP memory blocks are correctly remapped // into the Based_Pointer_Repository // (i.e. maps based on backing stores that are already // present in the filesystem) // (see http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=2216) int mmap_persistent_map_test() { MMAP_Allocator* alloc = 0; // The 'options' are only here to quiet MSVC 6. It can be removed // when MSVC 6 support is removed. MMAP_Allocator::MEMORY_POOL_OPTIONS *options = 0; ACE_OS::unlink("foo"); { ACE_NEW_RETURN (alloc, MMAP_Allocator (ACE_TEXT ("foo"), ACE_TEXT ("foo"), options), -1); alloc->sync(); // Delete Malloc and the memory pool, but do not remove // the backing store alloc->memory_pool().release(0); delete alloc; } // // Recreate segment with existing backing store // ACE_NEW_RETURN (alloc, MMAP_Allocator (ACE_TEXT ("foo"), ACE_TEXT("foo"), options), -1); void* addr = alloc->base_addr(); if(addr == 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Unable to get base to persistent MMAP Memory Pool\n"))); alloc->remove(); delete alloc; return -1; } void* ba = 0; if(ACE_BASED_POINTER_REPOSITORY::instance()->find(addr, ba) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Unable to find base address after map of persistent segment\n"))); alloc->remove(); delete alloc; return -1; } if(ba == 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Persistent MMAP Memory Pool not mapped\n"))); alloc->remove(); delete alloc; return -1; } alloc->remove(); delete alloc; return 0; } // Check that MMAP memory blocks are correctly remapped // into the Based_Pointer_Repository // (i.e. when a segment is resized it may move its base address // because the OS cannot fit the new segment size at the same // base address, in this case the Repository must be updated) // (see http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=2218) int mmap_remap_test() { // Use a Position Independent memory segment // because this one is going to move MMAP_Allocator *alloc[ 3 ]= {0, 0, 0}; void *pool_base[ 3 ]= {0, 0, 0}; // Make sure the Pool options are set to allow // the segment to move ACE_MMAP_Memory_Pool_Options data_opts( 0, ACE_MMAP_Memory_Pool_Options::NEVER_FIXED ); int i; for (i= 0; i<3; ++i) { ACE_TCHAR store[ MAXPATHLEN + 1 ]; ACE_OS::snprintf( store, MAXPATHLEN + 1, ACE_TEXT("foo%d"), i ); ACE_OS::unlink( store ); ACE_NEW_RETURN (alloc[ i ], MMAP_Allocator (store, store, &data_opts), -1); pool_base[ i ]= alloc[ i ]->base_addr(); } // sort pools into base address order for (i= 0; i<2; ++i) { if (pool_base[ i ] < pool_base[ i+1 ]) { void *tmp1= pool_base[ i ]; MMAP_Allocator *tmp2= alloc[ i ]; pool_base[ i ]= pool_base[ i+1 ]; alloc[ i ]= alloc[ i+1 ]; pool_base[ i+1 ]= tmp1; alloc[ i+1 ]= tmp2; i= -1; } } // alloc[1] is now bounded, whether memory grows up or // down, it will hit either alloc[0] or alloc[2] and have // to be remapped. // // Calculate maximum space between base addresses size_t size= (char *) pool_base[ 0 ] - (char *) pool_base[ 1 ]; size_t tmpsize= (char *) pool_base[ 1 ] - (char *) pool_base[ 2 ]; size= (size < tmpsize) ? tmpsize : size; // force pool to move ++size; (void)alloc[ 1 ]->malloc(size); void *nba= alloc[ 1 ]->base_addr(); if (pool_base[ 1 ] == nba) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("MMAP Pool did not move base address as expected\n"))); for (i= 0; i<3; ++i) { alloc[ i ]->remove(); delete alloc[ i ]; } return -1; } void *ba= 0; if (ACE_BASED_POINTER_REPOSITORY::instance()->find(nba, ba) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Unable to find base address after remap of segment\n"))); for (i= 0; i<3; ++i) { alloc[ i ]->remove(); delete alloc[ i ]; } return -1; } if (ba != nba) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("New base address not mapped after MMAP remap\n"))); for (i= 0; i<3; ++i) { alloc[ i ]->remove(); delete alloc[ i ]; } return -1; } // Check old base address has been removed // from the repository if (ACE_BASED_POINTER_REPOSITORY::instance()->find( pool_base[ 1 ], ba ) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Unable to find base address after remap of segment\n"))); for (i= 0; i<3; ++i) { alloc[ i ]->remove(); delete alloc[ i ]; } return -1; } if (ba == pool_base[ 1 ]) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Old base address not removed after MMAP remap\n"))); for (i= 0; i<3; ++i) { alloc[ i ]->remove(); delete alloc[ i ]; } return -1; } for (i= 0; i<3; ++i) { alloc[ i ]->remove(); delete alloc[ i ]; } return 0; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Based_Pointer_Test")); int retval = 0; retval += singleton_test (); retval += mmap_map_test(); retval += mmap_persistent_map_test(); retval += mmap_remap_test(); ACE_Based_Pointer_Basic Foo_Ptr; ACE_UNUSED_ARG (Foo_Ptr); ACE_END_TEST; return retval == 0 ? 0 : 1; } #else /* ! ACE_HAS_POSITION_INDEPENDENT_POINTERS */ // Nothing to test ! int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Based_Pointer_Test")); ACE_Based_Pointer_Basic Foo_Ptr; ACE_UNUSED_ARG (Foo_Ptr); ACE_END_TEST; return 0; } #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS */ ace-8.0.4+dfsg.orig/tests/Compiler_Features_18_Test.cpp0000644000175000017500000000137215027201773021757 0ustar sudipsudip/** * This program checks if the compiler / platform supports strongly * array */ #include "test_config.h" #include namespace Test { using arrayType = std::array; using array_array = std::array; }; int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT("Compiler_Features_18_Test")); Test::array_array v_in = { { Test::arrayType { { 1.0, 2.0, 3.0, 4.0, 5.0 } }, Test::arrayType { { 1.0, 2.0, 3.0, 4.0, 5.0 } }, Test::arrayType { { 1.0, 2.0, 3.0, 4.0, 5.0 } }, Test::arrayType { { 1.0, 2.0, 3.0, 4.0, 5.0 } }, Test::arrayType { { 1.0, 2.0, 3.0, 4.0, 5.0 } } } }; ACE_UNUSED_ARG (v_in); ACE_DEBUG ((LM_INFO, ACE_TEXT ("Std arrays work.\n"))); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Process_Manager_Test.cpp0000644000175000017500000004374515027201773021121 0ustar sudipsudip //============================================================================= /** * @file Process_Manager_Test.cpp * * This program tests the various methods provided by * . It illustrates both the explicit * functions and the Reactor-style auto-reaping. There's an * Exit_Handler class that can print out (in Debug mode) when a * child has been reaped. * * The child processes spawned are simply this program itself, with * an integer argument specifying how long to "process" (actually, * the child just sleeps for the specified length of time). * * @author Douglas C. Schmidt and Dave Madden */ //============================================================================= #include "test_config.h" #include "ace/SString.h" #include "ace/Atomic_Op.h" #include "ace/Task.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_string.h" #include "ace/Process_Manager.h" #include "ace/Synch_Traits.h" #include "ace/Get_Opt.h" #include "ace/Thread.h" #include "ace/Reactor.h" static u_int debug_test = 0; #if defined (ACE_HAS_WIN32_PRIORITY_CLASS) static u_int process_id = 0; #endif class Exit_Handler : public ACE_Event_Handler { public: Exit_Handler (const char *msg): msg_ (msg) { } ~Exit_Handler () override { } int handle_close (ACE_HANDLE, ACE_Reactor_Mask) override { delete this; return 0; } int handle_exit (ACE_Process *proc) override { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) Exit_Handler(%C) got %d: %d\n"), msg_, int (proc->getpid ()), int (proc->exit_code ()) )); return 0; } private: const char *msg_; }; static void usage (const ACE_TCHAR *argv0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("usage: %s [-d] [sleep-seconds]\n"), argv0)); ACE_OS::exit (0); } static pid_t spawn_child (const ACE_TCHAR *argv0, ACE_Process_Manager &mgr, int sleep_time, int my_process_id) { #if defined (ACE_WIN32) const ACE_TCHAR *cmdline_format = ACE_TEXT("\"%s\" %s %d"); #elif !defined (ACE_USES_WCHAR) const ACE_TCHAR *cmdline_format = ACE_TEXT (".") ACE_DIRECTORY_SEPARATOR_STR ACE_TEXT("%s %s %d"); #else const ACE_TCHAR *cmdline_format = ACE_TEXT (".") ACE_DIRECTORY_SEPARATOR_STR ACE_TEXT("%ls %ls %d"); #endif ACE_Process_Options opts; ACE_TCHAR prio[64]; ACE_TCHAR cmd[16]; if (debug_test) ACE_OS::strcpy (cmd, ACE_TEXT ("-d")); else cmd[0] = ACE_TEXT ('\0'); #if defined (ACE_HAS_WIN32_PRIORITY_CLASS) if (my_process_id == 1) { opts.creation_flags (ABOVE_NORMAL_PRIORITY_CLASS); ACE_OS::snprintf (prio, 64, ACE_TEXT ("and priority 'above normal'")); } else if (my_process_id == 2) { opts.creation_flags (BELOW_NORMAL_PRIORITY_CLASS); ACE_OS::snprintf (prio, 64, ACE_TEXT ("and priority 'below normal'")); } else if (my_process_id == 3) { opts.creation_flags (IDLE_PRIORITY_CLASS); ACE_OS::snprintf (prio, 64, ACE_TEXT ("and priority 'idle'")); } else if (my_process_id == 4) { opts.creation_flags (HIGH_PRIORITY_CLASS); ACE_OS::snprintf (prio, 64, ACE_TEXT ("and priority 'high'")); } else if (my_process_id == 5) { opts.creation_flags (NORMAL_PRIORITY_CLASS); ACE_OS::snprintf (prio, 64, ACE_TEXT ("and priority 'normal'")); } else prio[0] = ACE_TEXT ('\0'); ACE_TCHAR pd [16]; ACE_OS::snprintf (pd, 16, ACE_TEXT (" -p %d"), my_process_id); ACE_OS::strcat (cmd, pd); #else ACE_UNUSED_ARG (my_process_id); prio[0] = ACE_TEXT ('\0'); #endif opts.process_name (argv0); #ifndef ACE_LACKS_VA_FUNCTIONS opts.command_line (cmdline_format, argv0, cmd, sleep_time); #else ACE_UNUSED_ARG (cmdline_format); #endif /* ACE_LACKS_VA_FUNCTIONS */ ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Spawning <%s> <%s>\n"), opts.process_name(), opts.command_line_buf ())); pid_t result = mgr.spawn (opts); if (result != ACE_INVALID_PID) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) spawned child: pid %d time %d %s\n"), int (result), sleep_time, prio)); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("spawn failed"))); return result; } ACE_CString order; ACE_Atomic_Op running_tasks = 0; class Process_Task : public ACE_Task { public: Process_Task (const ACE_TCHAR *argv0, ACE_Process_Manager &mgr, int sleep_time) : argv0_ (argv0), mgr_ (mgr), sleep_time_ (sleep_time) { } // FUZZ: disable check_for_lack_ACE_OS /// FUZZ: enable check_for_lack_ACE_OS int open (void*) override { char tmp[10]; order += ACE_OS::itoa (sleep_time_, tmp, 10); ++running_tasks; activate (); return 0; } int svc () override { int result = 0; ACE_exitcode exitcode; pid_t my_child = spawn_child (argv0_, mgr_, sleep_time_, 0); result = mgr_.wait (my_child, &exitcode); if (result != my_child) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P) Error: expected to reap child (%d); got %d\n"), my_child, result)); if (result == ACE_INVALID_PID) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P) %p\n"), ACE_TEXT ("error"))); //test_status = 1; } else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) reaped child, pid %d: %d\n"), my_child, exitcode)); char tmp[10]; order += ACE_OS::itoa (sleep_time_, tmp, 10); return 0; } // FUZZ: disable check_for_lack_ACE_OS /// FUZZ: enable check_for_lack_ACE_OS int close (u_long) override { --running_tasks; return 0; } private: const ACE_TCHAR *argv0_; ACE_Process_Manager &mgr_; int sleep_time_; }; #ifdef ACE_HAS_PROCESS_SPAWN static int command_line_test () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing for last character of command line\n"))); int result = 0; const ACE_TCHAR *command = ACE_TEXT ("test Hello"); size_t command_len = ACE_OS::strlen (command); ACE_Process_Options options (1, command_len + 1); #ifndef ACE_LACKS_VA_FUNCTIONS options.command_line (ACE_TEXT ("%") ACE_TEXT_PRIs, command); #endif ACE_TCHAR * const *procargv = options.command_line_argv (); if (ACE_OS::strcmp (procargv [1], ACE_TEXT ("Hello")) != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("command_line_test failed: expected \"%s\"; got \"%s\"\n"), ACE_TEXT ("Hello"), procargv [1])); result = 1; } return result; } #endif #if defined (ACE_HAS_WIN32_PRIORITY_CLASS) void check_process_priority (DWORD priority) { if ((process_id == 0) || (process_id == 1 && priority == ABOVE_NORMAL_PRIORITY_CLASS) || (process_id == 2 && priority == BELOW_NORMAL_PRIORITY_CLASS) || (process_id == 3 && priority == IDLE_PRIORITY_CLASS) || (process_id == 4 && priority == HIGH_PRIORITY_CLASS) || (process_id == 5 && priority == NORMAL_PRIORITY_CLASS) || (process_id == 7 && priority == NORMAL_PRIORITY_CLASS)) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Process ID (%d) and priority (%d) match\n"), process_id, priority)); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("Given process priority (%d) and real priority (%d) differ.\n"), process_id, priority)); } #endif int run_main (int argc, ACE_TCHAR *argv[]) { #if defined (ACE_HAS_WIN32_PRIORITY_CLASS) ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("dp:")); #else ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("d")); #endif int opt; while ((opt = get_opt ()) != EOF) { switch (opt) { case 'd': debug_test = 1u; break; #if defined (ACE_HAS_WIN32_PRIORITY_CLASS) case 'p': process_id = ACE_OS::atoi (get_opt.opt_arg ()); break; #endif } } if (get_opt.opt_ind () == argc - 1) { // child process: sleep & exit ACE_TCHAR lognm[MAXPATHLEN]; int const mypid (ACE_OS::getpid ()); ACE_OS::snprintf (lognm, MAXPATHLEN, ACE_TEXT ("Process_Manager_Test-child-%d"), mypid); ACE_START_TEST (lognm); int const secs = ACE_OS::atoi (argv[get_opt.opt_ind ()]); ACE_OS::sleep (secs ? secs : 1); ACE_TCHAR prio[64]; #if defined (ACE_WIN32_HAS_PRIORITY_CLASS) DWORD priority = ::GetPriorityClass (::GetCurrentProcess()); check_process_priority(priority); if (priority == ABOVE_NORMAL_PRIORITY_CLASS) ACE_OS::snprintf (prio, 64, ACE_TEXT ("and priority 'above normal'")); else if (priority == BELOW_NORMAL_PRIORITY_CLASS) ACE_OS::snprintf (prio, 64, ACE_TEXT ("and priority 'below normal'")); else if (priority == HIGH_PRIORITY_CLASS) ACE_OS::snprintf (prio, 64, ACE_TEXT ("and priority 'high'")); else if (priority == IDLE_PRIORITY_CLASS) ACE_OS::snprintf (prio, 64, ACE_TEXT ("and priority 'idle'")); else if (priority == NORMAL_PRIORITY_CLASS) ACE_OS::snprintf (prio, 64, ACE_TEXT ("and priority 'normal'")); else if (priority == REALTIME_PRIORITY_CLASS) ACE_OS::snprintf (prio, 64, ACE_TEXT ("and priority 'realtime'")); #else prio[0] = ACE_TEXT ('\0'); #endif if (debug_test) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%T: pid %P about to exit with code %d %s\n"), secs, prio)); ACE_END_LOG; return secs; } if (get_opt.opt_ind () != argc) // incorrect usage usage (argv[0]); ACE_START_TEST (ACE_TEXT ("Process_Manager_Test")); int test_status = 0; #ifdef ACE_HAS_PROCESS_SPAWN int result = 0; if ((result = command_line_test ()) != 0) test_status = result; // Try the explicit functions ACE_Process_Manager mgr; mgr.register_handler (new Exit_Handler ("default")); ACE_exitcode exitcode; // -------------------------------------------------- // wait for a specific PID pid_t child1 = spawn_child (argc > 0 ? argv[0] : ACE_TEXT ("Process_Manager_Test"), mgr, 1, 1); result = mgr.wait (child1, &exitcode); if (result != child1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P) Error: expected to reap child1 (%d); got %d\n"), child1, result)); if (result == ACE_INVALID_PID) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P) %p\n"), ACE_TEXT ("error"))); test_status = 1; } else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) reaped child1, pid %d: %d\n"), child1, exitcode)); // -------------------------------------------------- // wait for a specific PID; another should finish first pid_t child2 = spawn_child (argc > 0 ? argv[0] : ACE_TEXT ("Process_Manager_Test"), mgr, 1, 2); pid_t child3 = spawn_child (argc > 0 ? argv[0] : ACE_TEXT ("Process_Manager_Test"), mgr, 4, 3); result = mgr.wait (child3, &exitcode); if (result != child3) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P) Error: expected to reap child3 (%d); got %d\n"), child3, result)); if (result == ACE_INVALID_PID) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P) %p\n"), ACE_TEXT ("error"))); test_status = 1; } else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) reaped child 3, pid %d: %d\n"), child3, exitcode)); // Now wait for any...should get the one that finished earlier. result = mgr.wait (0, &exitcode); if (result != child2) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P) Error: expected to reap child2 (%d); got %d\n"), child2, result)); if (result == ACE_INVALID_PID) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P) %p\n"), ACE_TEXT ("error"))); test_status = 1; } else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) reaped child 2, pid %d: %d\n"), result, exitcode)); // -------------------------------------------------- // Try the timed wait functions // This one shouldn't timeout: pid_t child4 = spawn_child (argc > 0 ? argv[0] : ACE_TEXT ("Process_Manager_Test"), mgr, 1, 4); result = mgr.wait (0, std::chrono::seconds (4), &exitcode); if (result != child4) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P) Error: expected to reap child4 (%d); got %d\n"), child4, result)); if (result == ACE_INVALID_PID) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P) %p\n"), ACE_TEXT ("error"))); test_status = 1; } else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) reaped child 4 pid %d: %d\n"), result, exitcode)); // This one should timeout: pid_t child5 = spawn_child (argc > 0 ? argv[0] : ACE_TEXT ("Process_Manager_Test"), mgr, 4, 5); result = mgr.wait (0, ACE_Time_Value (1), &exitcode); if (result != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P) Error: expected wait to time out; got %d\n"), result)); if (result == ACE_INVALID_PID) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P) %p\n"), ACE_TEXT ("error"))); test_status = 1; } else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) Correctly timed out wait at child 5\n"))); // Now wait indefinitely to clean up... result = mgr.wait (0, &exitcode); if (result != child5) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error: expected to reap child5 pid %d; got %d\n"), child5, result)); if (result == ACE_INVALID_PID) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P) %p\n"), ACE_TEXT ("error"))); test_status = 1; } else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) reaped child 5, pid %d: %d\n"), result, exitcode)); // Terminate a child process and make sure we can wait for it. pid_t child6 = spawn_child (argc > 0 ? argv[0] : ACE_TEXT ("Process_Manager_Test"), mgr, 5, 6); ACE_exitcode status6; if (-1 == mgr.terminate (child6)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P) %p\n"), ACE_TEXT ("terminate child6"))); test_status = 1; mgr.wait (child6, &status6); // Wait for child to exit just to clean up } else { if (-1 == mgr.wait (child6, &status6)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P) wait on child6 reported ACE_INVALID_PID\n"))); test_status = 1; } else { // Get the results of the termination. #if !defined(ACE_WIN32) if (WIFSIGNALED (status6) != 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) child6 died on signal %d - correct\n"), WTERMSIG (status6))); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P) child6 should have died on signal, ") ACE_TEXT ("but didn't; exit status %d\n"), WEXITSTATUS (status6))); #else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) The process terminated with exit code %d\n"), status6)); #endif /*ACE_WIN32*/ } } #ifdef ACE_HAS_THREADS Process_Task task1 (argc > 0 ? argv[0] : ACE_TEXT ("Process_Manager_Test"), mgr, 3); Process_Task task2 (argc > 0 ? argv[0] : ACE_TEXT ("Process_Manager_Test"), mgr, 2); Process_Task task3 (argc > 0 ? argv[0] : ACE_TEXT ("Process_Manager_Test"), mgr, 1); task1.open (0); task2.open (0); task3.open (0); while (running_tasks!=0) { ACE_OS::sleep (1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) still running tasks\n"))); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) result: '%C'\n"), order.c_str ())); if (order != "321123") { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P) wrong order of spawns ('%C', should be '321123')\n"), order.c_str ())); test_status = 1; } #endif /* ACE_HAS_THREADS */ #if defined ACE_WIN32 || !defined ACE_LACKS_UNIX_SIGNALS // -------------------------------------------------- // Finally, try the reactor stuff... mgr.open (ACE_Process_Manager::DEFAULT_SIZE, ACE_Reactor::instance ()); pid_t child7 = spawn_child (argc > 0 ? argv[0] : ACE_TEXT ("Process_Manager_Test"), mgr, 5, 7); /* pid_t child8 = */ spawn_child (argc > 0 ? argv[0] : ACE_TEXT ("Process_Manager_Test"), mgr, 6, 0); mgr.register_handler (new Exit_Handler ("specific"), child7); ACE_Time_Value how_long (10); ACE_Reactor::instance ()->run_reactor_event_loop (how_long); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) Reactor loop done!\n") )); size_t const nr_procs = mgr.managed (); if (nr_procs != 0) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P) %d processes left in manager\n"), nr_procs)); #endif /* defined (ACE_WIN32) */ #endif // ACE_HAS_PROCESS_SPAWN ACE_END_TEST; return test_status; } ace-8.0.4+dfsg.orig/tests/Bug_2772_Regression_Test.cpp0000644000175000017500000000743615027201773021444 0ustar sudipsudip// ============================================================================ // // = LIBRARY // tests // // = DESCRIPTION // Test bug 2772 regression // // = AUTHOR // Johnny Willemsen // // ============================================================================ #include "test_config.h" #include "ace/Recursive_Thread_Mutex.h" #include "ace/Condition_Recursive_Thread_Mutex.h" #include "ace/Thread.h" class ThreadTest { public: ThreadTest(); ~ThreadTest(); int run(bool doubleLock); private: static void * workerThreadWrapper(void *); void workerThread(); ACE_Recursive_Thread_Mutex m_mutex; ACE_Condition_Recursive_Thread_Mutex m_startedCondition; ACE_Condition_Recursive_Thread_Mutex m_stopCondition; bool m_workerRunning; bool m_doubleLock; }; ThreadTest::ThreadTest() : m_startedCondition(m_mutex), m_stopCondition(m_mutex), m_workerRunning(false), m_doubleLock(false) { } ThreadTest::~ThreadTest() { } int ThreadTest::run(bool doubleLock) { ACE_hthread_t m_workerThreadHandle; ACE_thread_t m_workerThreadId; m_workerRunning = false; m_doubleLock = doubleLock; m_mutex.acquire(); // Start worker thread int rval = ACE_Thread::spawn((ACE_THR_FUNC) workerThreadWrapper, this, THR_JOINABLE | THR_NEW_LWP, &m_workerThreadId, &m_workerThreadHandle, ACE_DEFAULT_THREAD_PRIORITY); if (rval == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%t Could not start worker thread!\n")), 1); } if (!m_workerRunning) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%t Waiting for worker thread to start running...\n"))); m_startedCondition.wait(); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%t Worker thread is running...\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%t Broadcasting STOP Condition...\n"))); m_stopCondition.broadcast(); m_mutex.release(); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%t Joining worker thread...\n"))); ACE_Thread::join(m_workerThreadHandle); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%t Test finished...\n"))); return 0; } void* ThreadTest::workerThreadWrapper(void *data) { ThreadTest *thisPtr = reinterpret_cast(data); thisPtr->workerThread(); return 0; } void ThreadTest::workerThread() { m_mutex.acquire(); m_workerRunning = true; m_startedCondition.broadcast(); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%t Thread running, waiting for stop condition.\n"))); if (m_doubleLock) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%t Thread starting double acquire.\n"))); m_mutex.acquire(); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%t Thread finished double acquire.\n"))); } // Wait for the STOP condition to occur m_stopCondition.wait(); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%t Thread received stop condition, exiting.\n"))); if (m_doubleLock) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%t Thread starting double release.\n"))); m_mutex.release(); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%t Thread finished double acquire.\n"))); } m_mutex.release(); } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Bug_2772_Regression_Test")); int status = 0; ThreadTest test; // This test passes ACE_DEBUG ((LM_DEBUG, "TEST 1 - Single Lock\n")); ACE_DEBUG ((LM_DEBUG, "--------------------\n")); status += test.run(false); // This test hangs; m_stopCondition.wait() in the worker thread // doesn't unlock the mutex twice and thus a deadlock occurs ACE_DEBUG ((LM_DEBUG, "TEST 2 - Double Lock\n")); ACE_DEBUG ((LM_DEBUG, "--------------------\n")); status += test.run(true); ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/High_Res_Timer_Test.cpp0000644000175000017500000001350215027201773020665 0ustar sudipsudip//============================================================================= /** * @file High_Res_Timer_Test.cpp * * Simple test of ACE_High_Res_Timer. * * @author David L. Levine */ //============================================================================= #include "test_config.h" #include "ace/Log_Msg.h" #include "ace/High_Res_Timer.h" #include "ace/Sched_Params.h" #include "ace/Get_Opt.h" #include "ace/OS_NS_unistd.h" static u_int check (const time_t interval, const time_t measured) { time_t const threshold = 25 /* percent */; time_t const difference = interval > measured ? interval - measured : measured - interval; time_t const percentage_difference = difference * 100 / interval; if (percentage_difference < threshold) return 0; else ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("The measured time of %Q differs from ") ACE_TEXT ("the interval of %Q by %Q percent.\n"), measured, interval, percentage_difference), 1); } // Does a sanity check of the microseconds vs nanoseconds. They're supposed // to represent the same interval. static u_int check_micro_nano (ACE_hrtime_t microinterval, ACE_hrtime_t nanointerval) { ACE_hrtime_t const threshold = 8 /* promille */; microinterval *= 1000u; ACE_hrtime_t const difference = (microinterval > nanointerval ? (microinterval - nanointerval) : (nanointerval - microinterval)); if (nanointerval == 0) { nanointerval = 1; // Prevent divide-by-zero } ACE_hrtime_t const promille_difference = difference * 1000 / nanointerval; if ((promille_difference < threshold) || (difference < 1500)) { return 0; } else ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("The microseconds * 1000 of %Q ") ACE_TEXT ("differs from the nanoseconds of %Q ") ACE_TEXT (" by %Q promille\n"), microinterval, nanointerval, promille_difference), 1); } static ACE_Time_Value time_interval (const ACE_Time_Value &interval, ACE_hrtime_t& nanoseconds, ACE_hrtime_t& microseconds) { ACE_High_Res_Timer timer; timer.start (); ACE_OS::sleep (interval); timer.stop (); ACE_Time_Value measured; timer.elapsed_time (measured); timer.elapsed_time (nanoseconds); timer.elapsed_microseconds (microseconds); return measured; } static u_int const intervals[] = {0, 1, 10, 100, 1000, 10000, 100000, 1000000, 4000000}; /*usec*/ int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("High_Res_Timer_Test")); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("The ACE_High_Res_Timer scale factor is %u ") ACE_TEXT ("1/microsecond\n"), ACE_High_Res_Timer::global_scale_factor ())); u_int errors = 0; u_int iterations = 1; ACE_Get_Opt getoptarg (argc, argv, ACE_TEXT ("i:")); for (int c; (c = getoptarg ()) != -1; ) { switch (c) { case 'i': iterations = ACE_OS::atoi (getoptarg.opt_arg ()); break; } } // We don't check for errors if the interval is shorter than this // value because the OS has a finite resolution anyway. static u_int const TIMER_RESOLUTION = 10000; for (u_int i = 0; i < sizeof intervals / sizeof (u_int); ++i) { for (u_int j = 0; j < iterations; ++j) { ACE_Time_Value const interval (0, intervals[i]); ACE_hrtime_t nanoseconds; ACE_hrtime_t microseconds; ACE_Time_Value const measured = time_interval (interval, nanoseconds, microseconds); time_t const interval_usec = interval.sec () * ACE_ONE_SECOND_IN_USECS + interval.usec (); time_t const measured_usec = measured.sec () * ACE_ONE_SECOND_IN_USECS + measured.usec (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("interval: %: usec, measured: %: usec %s\n"), interval_usec, measured_usec, (intervals[i] <= TIMER_RESOLUTION ? ACE_TEXT (" (interval and measured may differ)") : ACE_TEXT ("")))); if (intervals[i] > TIMER_RESOLUTION) { errors += check (interval.sec () * ACE_ONE_SECOND_IN_USECS + interval.usec (), measured.sec () * ACE_ONE_SECOND_IN_USECS + measured.usec ()); // Don't check for error for intervals below 10 msec. } // Check the ACE_Timer_Value-calculated microseconds against // the ACE_High_Res_Timer-calculated nanoseconds. ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Time_Value usec: %:, ACE_HR nsec: %Q\n"), measured_usec, nanoseconds)); // This gives problems -> should be fixed errors += check_micro_nano (measured.sec () * ACE_ONE_SECOND_IN_USECS + measured.usec (), nanoseconds); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_High_Res_Timer usec: %Q, nsec: %Q\n"), microseconds, nanoseconds)); // Now check the ACE_High_Res_Timer-calculated values against // each other. errors += check_micro_nano (microseconds, nanoseconds); } } ACE_END_TEST; return errors == 0 ? 0 : 1; } ace-8.0.4+dfsg.orig/tests/ACE_Init_Test_Resource.h0000644000175000017500000005711515027201773020734 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file ACE_Init_Test_Resource.h * * Header file for the ACE_INIT_TEST application. * * @author Steve Huston */ //============================================================================= //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by ACE_Init_Test.rc // #define ID_SEPARATOR 0 #define VS_VERSION_INFO 1 #define AFX_IDC_LISTBOX 100 #define AFX_IDC_CHANGE 101 #define IDD_ACE_INIT_TEST_DIALOG 102 #define AFX_IDC_BROWSER 102 #define IDR_MAINFRAME 128 #define IDR_VERSION2 129 #define AFX_IDC_PRINT_DOCNAME 201 #define AFX_IDC_PRINT_PRINTERNAME 202 #define AFX_IDC_PRINT_PORTNAME 203 #define AFX_IDC_PRINT_PAGENUM 204 #define SUBVERSION_MASK 0x000000FF #define _WIN32_IE_IE20 0x0200 #define _WIN32_IE_IE30 0x0300 #define _WIN32_IE_IE302 0x0302 #define ID_MFCLOC_MANIFEST 1000 #define AFX_IDC_FONTPROP 1000 #define AFX_IDC_FONTNAMES 1001 #define AFX_IDC_FONTSTYLES 1002 #define AFX_IDC_FONTSIZES 1003 #define AFX_IDC_STRIKEOUT 1004 #define AFX_IDC_UNDERLINE 1005 #define AFX_IDC_SAMPLEBOX 1006 #define _WIN32_WINNT_NT4 0x0400 #define _WIN32_IE_IE40 0x0400 #define _WIN32_IE_IE401 0x0401 #define AFX_IDC_COLOR_BLACK 1100 #define AFX_IDC_COLOR_WHITE 1101 #define AFX_IDC_COLOR_RED 1102 #define AFX_IDC_COLOR_GREEN 1103 #define AFX_IDC_COLOR_BLUE 1104 #define AFX_IDC_COLOR_YELLOW 1105 #define AFX_IDC_COLOR_MAGENTA 1106 #define AFX_IDC_COLOR_CYAN 1107 #define AFX_IDC_COLOR_GRAY 1108 #define AFX_IDC_COLOR_LIGHTGRAY 1109 #define AFX_IDC_COLOR_DARKRED 1110 #define AFX_IDC_COLOR_DARKGREEN 1111 #define AFX_IDC_COLOR_DARKBLUE 1112 #define AFX_IDC_COLOR_LIGHTBROWN 1113 #define AFX_IDC_COLOR_DARKMAGENTA 1114 #define AFX_IDC_COLOR_DARKCYAN 1115 #define AFX_IDC_COLORPROP 1116 #define AFX_IDC_SYSTEMCOLORS 1117 #define AFX_IDC_PROPNAME 1201 #define AFX_IDC_PICTURE 1202 #define AFX_IDC_BROWSE 1203 #define AFX_IDC_CLEAR 1204 #define _WIN32_WINNT_WIN2K 0x0500 #define _WIN32_IE_IE50 0x0500 #define _WIN32_WINNT_WINXP 0x0501 #define _WIN32_IE_IE501 0x0501 #define _WIN32_WINNT_WS03 0x0502 #define _WIN32_IE_IE55 0x0550 #define _WIN32_WINNT_LONGHORN 0x0600 #define _WIN32_IE_IE60 0x0600 #define _WIN32_IE_IE60SP1 0x0601 #define _WIN32_IE_WS03 0x0602 #define _WIN32_IE_IE60SP2 0x0603 #define _WIN32_IE_IE70 0x0700 #define AFX_IDC_TAB_CONTROL 0x3020 #define ID_APPLY_NOW 0x3021 #define ID_WIZBACK 0x3023 #define ID_WIZNEXT 0x3024 #define ID_WIZFINISH 0x3025 #define AFX_IDD_NEWTYPEDLG 30721 #define AFX_IDD_PRINTDLG 30722 #define AFX_IDD_PREVIEW_TOOLBAR 30723 #define AFX_IDD_INSERTOBJECT 30724 #define AFX_IDD_CHANGEICON 30725 #define AFX_IDD_CONVERT 30726 #define AFX_IDD_PASTESPECIAL 30727 #define AFX_IDD_EDITLINKS 30728 #define AFX_IDD_FILEBROWSE 30729 #define AFX_IDD_BUSY 30730 #define AFX_IDD_OBJECTPROPERTIES 30732 #define AFX_IDD_CHANGESOURCE 30733 #define AFX_IDD_EMPTYDIALOG 30734 #define AFX_IDC_CONTEXTHELP 30977 #define AFX_IDC_MAGNIFY 30978 #define AFX_IDC_SMALLARROWS 30979 #define AFX_IDC_HSPLITBAR 30980 #define AFX_IDC_VSPLITBAR 30981 #define AFX_IDC_NODROPCRSR 30982 #define AFX_IDC_TRACKNWSE 30983 #define AFX_IDC_TRACKNESW 30984 #define AFX_IDC_TRACKNS 30985 #define AFX_IDC_TRACKWE 30986 #define AFX_IDC_TRACK4WAY 30987 #define AFX_IDC_MOVE4WAY 30988 #define AFX_IDB_MINIFRAME_MENU 30994 #define AFX_IDB_CHECKLISTBOX_95 30996 #define AFX_IDR_PREVIEW_ACCEL 30997 #define AFX_IDC_MOUSE_PAN_NW 30998 #define AFX_IDC_MOUSE_PAN_N 30999 #define AFX_IDC_MOUSE_PAN_NE 31000 #define AFX_IDC_MOUSE_PAN_W 31001 #define AFX_IDC_MOUSE_PAN_HV 31002 #define AFX_IDC_MOUSE_PAN_E 31003 #define AFX_IDC_MOUSE_PAN_SW 31004 #define AFX_IDC_MOUSE_PAN_S 31005 #define AFX_IDC_MOUSE_PAN_SE 31006 #define AFX_IDC_MOUSE_PAN_HORZ 31007 #define AFX_IDC_MOUSE_PAN_VERT 31008 #define AFX_IDC_MOUSE_ORG_HORZ 31009 #define AFX_IDC_MOUSE_ORG_VERT 31010 #define AFX_IDC_MOUSE_ORG_HV 31011 #define AFX_IDC_MOUSE_MASK 31012 #define AFX_IDI_STD_MDIFRAME 31233 #define AFX_IDI_STD_FRAME 31234 #define AFX_IDD_PROPPAGE_COLOR 32257 #define AFX_IDD_PROPPAGE_FONT 32258 #define AFX_IDD_PROPPAGE_PICTURE 32259 #define AFX_IDB_TRUETYPE 32384 #define AFX_IDS_APP_TITLE 0xE000 #define AFX_IDS_IDLEMESSAGE 0xE001 #define AFX_IDS_HELPMODEMESSAGE 0xE002 #define AFX_IDS_APP_TITLE_EMBEDDING 0xE003 #define AFX_IDS_COMPANY_NAME 0xE004 #define AFX_IDS_OBJ_TITLE_INPLACE 0xE005 #define ID_FILE_NEW 0xE100 #define ID_FILE_OPEN 0xE101 #define ID_FILE_CLOSE 0xE102 #define ID_FILE_SAVE 0xE103 #define ID_FILE_SAVE_AS 0xE104 #define ID_FILE_PAGE_SETUP 0xE105 #define ID_FILE_PRINT_SETUP 0xE106 #define ID_FILE_PRINT 0xE107 #define ID_FILE_PRINT_DIRECT 0xE108 #define ID_FILE_PRINT_PREVIEW 0xE109 #define ID_FILE_UPDATE 0xE10A #define ID_FILE_SAVE_COPY_AS 0xE10B #define ID_FILE_SEND_MAIL 0xE10C #define ID_FILE_NEW_FRAME 0xE10D #define ID_FILE_MRU_FIRST 0xE110 #define ID_FILE_MRU_FILE1 0xE110 #define ID_FILE_MRU_FILE2 0xE111 #define ID_FILE_MRU_FILE3 0xE112 #define ID_FILE_MRU_FILE4 0xE113 #define ID_FILE_MRU_FILE5 0xE114 #define ID_FILE_MRU_FILE6 0xE115 #define ID_FILE_MRU_FILE7 0xE116 #define ID_FILE_MRU_FILE8 0xE117 #define ID_FILE_MRU_FILE9 0xE118 #define ID_FILE_MRU_FILE10 0xE119 #define ID_FILE_MRU_FILE11 0xE11A #define ID_FILE_MRU_FILE12 0xE11B #define ID_FILE_MRU_FILE13 0xE11C #define ID_FILE_MRU_FILE14 0xE11D #define ID_FILE_MRU_FILE15 0xE11E #define ID_FILE_MRU_FILE16 0xE11F #define ID_FILE_MRU_LAST 0xE11F #define ID_EDIT_CLEAR 0xE120 #define ID_EDIT_CLEAR_ALL 0xE121 #define ID_EDIT_COPY 0xE122 #define ID_EDIT_CUT 0xE123 #define ID_EDIT_FIND 0xE124 #define ID_EDIT_PASTE 0xE125 #define ID_EDIT_PASTE_LINK 0xE126 #define ID_EDIT_PASTE_SPECIAL 0xE127 #define ID_EDIT_REPEAT 0xE128 #define ID_EDIT_REPLACE 0xE129 #define ID_EDIT_SELECT_ALL 0xE12A #define ID_EDIT_UNDO 0xE12B #define ID_EDIT_REDO 0xE12C #define ID_WINDOW_NEW 0xE130 #define ID_WINDOW_ARRANGE 0xE131 #define ID_WINDOW_CASCADE 0xE132 #define ID_WINDOW_TILE_HORZ 0xE133 #define ID_WINDOW_TILE_VERT 0xE134 #define ID_WINDOW_SPLIT 0xE135 #define ID_APP_ABOUT 0xE140 #define ID_APP_EXIT 0xE141 #define ID_HELP_INDEX 0xE142 #define ID_HELP_FINDER 0xE143 #define ID_HELP_USING 0xE144 #define ID_CONTEXT_HELP 0xE145 #define ID_HELP 0xE146 #define ID_DEFAULT_HELP 0xE147 #define ID_NEXT_PANE 0xE150 #define ID_PREV_PANE 0xE151 #define ID_FORMAT_FONT 0xE160 #define ID_OLE_INSERT_NEW 0xE200 #define ID_OLE_EDIT_LINKS 0xE201 #define ID_OLE_EDIT_CONVERT 0xE202 #define ID_OLE_EDIT_CHANGE_ICON 0xE203 #define ID_OLE_EDIT_PROPERTIES 0xE204 #define ID_OLE_VERB_FIRST 0xE210 #define AFX_ID_PREVIEW_CLOSE 0xE300 #define AFX_ID_PREVIEW_NUMPAGE 0xE301 #define AFX_ID_PREVIEW_NEXT 0xE302 #define AFX_ID_PREVIEW_PREV 0xE303 #define AFX_ID_PREVIEW_PRINT 0xE304 #define AFX_ID_PREVIEW_ZOOMIN 0xE305 #define AFX_ID_PREVIEW_ZOOMOUT 0xE306 #define ID_INDICATOR_EXT 0xE700 #define ID_INDICATOR_CAPS 0xE701 #define ID_INDICATOR_NUM 0xE702 #define ID_INDICATOR_SCRL 0xE703 #define ID_INDICATOR_OVR 0xE704 #define ID_INDICATOR_REC 0xE705 #define ID_INDICATOR_KANA 0xE706 #define ID_VIEW_TOOLBAR 0xE800 #define ID_VIEW_STATUS_BAR 0xE801 #define ID_VIEW_REBAR 0xE804 #define ID_VIEW_AUTOARRANGE 0xE805 #define ID_VIEW_SMALLICON 0xE810 #define ID_VIEW_LARGEICON 0xE811 #define ID_VIEW_LIST 0xE812 #define ID_VIEW_DETAILS 0xE813 #define ID_VIEW_LINEUP 0xE814 #define ID_VIEW_BYNAME 0xE815 #define ID_RECORD_FIRST 0xE900 #define ID_RECORD_LAST 0xE901 #define ID_RECORD_NEXT 0xE902 #define ID_RECORD_PREV 0xE903 #define AFX_IDS_SCSIZE 0xEF00 #define AFX_IDS_SCMOVE 0xEF01 #define AFX_IDS_SCMINIMIZE 0xEF02 #define AFX_IDS_SCMAXIMIZE 0xEF03 #define AFX_IDS_SCNEXTWINDOW 0xEF04 #define AFX_IDS_SCPREVWINDOW 0xEF05 #define AFX_IDS_SCCLOSE 0xEF06 #define AFX_IDS_SCRESTORE 0xEF12 #define AFX_IDS_SCTASKLIST 0xEF13 #define AFX_IDS_MDICHILD 0xEF1F #define AFX_IDS_DESKACCESSORY 0xEFDA #define AFX_IDS_OPENFILE 0xF000 #define AFX_IDS_SAVEFILE 0xF001 #define AFX_IDS_ALLFILTER 0xF002 #define AFX_IDS_UNTITLED 0xF003 #define AFX_IDS_SAVEFILECOPY 0xF004 #define AFX_IDS_PREVIEW_CLOSE 0xF005 #define AFX_IDS_UNNAMED_FILE 0xF006 #define AFX_IDS_HIDE 0xF011 #define AFX_IDP_NO_ERROR_AVAILABLE 0xF020 #define AFX_IDS_NOT_SUPPORTED_EXCEPTION 0xF021 #define AFX_IDS_RESOURCE_EXCEPTION 0xF022 #define AFX_IDS_MEMORY_EXCEPTION 0xF023 #define AFX_IDS_USER_EXCEPTION 0xF024 #define AFX_IDS_INVALID_ARG_EXCEPTION 0xF025 #define AFX_IDS_PRINTONPORT 0xF040 #define AFX_IDS_ONEPAGE 0xF041 #define AFX_IDS_TWOPAGE 0xF042 #define AFX_IDS_PRINTPAGENUM 0xF043 #define AFX_IDS_PREVIEWPAGEDESC 0xF044 #define AFX_IDS_PRINTDEFAULTEXT 0xF045 #define AFX_IDS_PRINTDEFAULT 0xF046 #define AFX_IDS_PRINTFILTER 0xF047 #define AFX_IDS_PRINTCAPTION 0xF048 #define AFX_IDS_PRINTTOFILE 0xF049 #define AFX_IDS_OBJECT_MENUITEM 0xF080 #define AFX_IDS_EDIT_VERB 0xF081 #define AFX_IDS_ACTIVATE_VERB 0xF082 #define AFX_IDS_CHANGE_LINK 0xF083 #define AFX_IDS_AUTO 0xF084 #define AFX_IDS_MANUAL 0xF085 #define AFX_IDS_FROZEN 0xF086 #define AFX_IDS_ALL_FILES 0xF087 #define AFX_IDS_SAVE_MENU 0xF088 #define AFX_IDS_UPDATE_MENU 0xF089 #define AFX_IDS_SAVE_AS_MENU 0xF08A #define AFX_IDS_SAVE_COPY_AS_MENU 0xF08B #define AFX_IDS_EXIT_MENU 0xF08C #define AFX_IDS_UPDATING_ITEMS 0xF08D #define AFX_IDS_METAFILE_FORMAT 0xF08E #define AFX_IDS_DIB_FORMAT 0xF08F #define AFX_IDS_BITMAP_FORMAT 0xF090 #define AFX_IDS_LINKSOURCE_FORMAT 0xF091 #define AFX_IDS_EMBED_FORMAT 0xF092 #define AFX_IDS_PASTELINKEDTYPE 0xF094 #define AFX_IDS_UNKNOWNTYPE 0xF095 #define AFX_IDS_RTF_FORMAT 0xF096 #define AFX_IDS_TEXT_FORMAT 0xF097 #define AFX_IDS_INVALID_CURRENCY 0xF098 #define AFX_IDS_INVALID_DATETIME 0xF099 #define AFX_IDS_INVALID_DATETIMESPAN 0xF09A #define AFX_IDP_INVALID_FILENAME 0xF100 #define AFX_IDP_FAILED_TO_OPEN_DOC 0xF101 #define AFX_IDP_FAILED_TO_SAVE_DOC 0xF102 #define AFX_IDP_ASK_TO_SAVE 0xF103 #define AFX_IDP_FAILED_TO_CREATE_DOC 0xF104 #define AFX_IDP_FILE_TOO_LARGE 0xF105 #define AFX_IDP_FAILED_TO_START_PRINT 0xF106 #define AFX_IDP_FAILED_TO_LAUNCH_HELP 0xF107 #define AFX_IDP_INTERNAL_FAILURE 0xF108 #define AFX_IDP_COMMAND_FAILURE 0xF109 #define AFX_IDP_FAILED_MEMORY_ALLOC 0xF10A #define AFX_IDP_UNREG_DONE 0xF10B #define AFX_IDP_UNREG_FAILURE 0xF10C #define AFX_IDP_DLL_LOAD_FAILED 0xF10D #define AFX_IDP_DLL_BAD_VERSION 0xF10E #define AFX_IDP_PARSE_INT 0xF110 #define AFX_IDP_PARSE_REAL 0xF111 #define AFX_IDP_PARSE_INT_RANGE 0xF112 #define AFX_IDP_PARSE_REAL_RANGE 0xF113 #define AFX_IDP_PARSE_STRING_SIZE 0xF114 #define AFX_IDP_PARSE_RADIO_BUTTON 0xF115 #define AFX_IDP_PARSE_BYTE 0xF116 #define AFX_IDP_PARSE_UINT 0xF117 #define AFX_IDP_PARSE_DATETIME 0xF118 #define AFX_IDP_PARSE_CURRENCY 0xF119 #define AFX_IDP_PARSE_GUID 0xF11A #define AFX_IDP_PARSE_TIME 0xF11B #define AFX_IDP_PARSE_DATE 0xF11C #define AFX_IDP_FAILED_INVALID_FORMAT 0xF120 #define AFX_IDP_FAILED_INVALID_PATH 0xF121 #define AFX_IDP_FAILED_DISK_FULL 0xF122 #define AFX_IDP_FAILED_ACCESS_READ 0xF123 #define AFX_IDP_FAILED_ACCESS_WRITE 0xF124 #define AFX_IDP_FAILED_IO_ERROR_READ 0xF125 #define AFX_IDP_FAILED_IO_ERROR_WRITE 0xF126 #define AFX_IDP_SCRIPT_ERROR 0xF130 #define AFX_IDP_SCRIPT_DISPATCH_EXCEPTION 0xF131 #define AFX_IDP_STATIC_OBJECT 0xF180 #define AFX_IDP_FAILED_TO_CONNECT 0xF181 #define AFX_IDP_SERVER_BUSY 0xF182 #define AFX_IDP_BAD_VERB 0xF183 #define AFX_IDS_NOT_DOCOBJECT 0xF184 #define AFX_IDP_FAILED_TO_NOTIFY 0xF185 #define AFX_IDP_FAILED_TO_LAUNCH 0xF186 #define AFX_IDP_ASK_TO_UPDATE 0xF187 #define AFX_IDP_FAILED_TO_UPDATE 0xF188 #define AFX_IDP_FAILED_TO_REGISTER 0xF189 #define AFX_IDP_FAILED_TO_AUTO_REGISTER 0xF18A #define AFX_IDP_FAILED_TO_CONVERT 0xF18B #define AFX_IDP_GET_NOT_SUPPORTED 0xF18C #define AFX_IDP_SET_NOT_SUPPORTED 0xF18D #define AFX_IDP_ASK_TO_DISCARD 0xF18E #define AFX_IDP_FAILED_TO_CREATE 0xF18F #define AFX_IDP_FAILED_MAPI_LOAD 0xF190 #define AFX_IDP_INVALID_MAPI_DLL 0xF191 #define AFX_IDP_FAILED_MAPI_SEND 0xF192 #define AFX_IDP_FILE_NONE 0xF1A0 #define AFX_IDP_FILE_GENERIC 0xF1A1 #define AFX_IDP_FILE_NOT_FOUND 0xF1A2 #define AFX_IDP_FILE_BAD_PATH 0xF1A3 #define AFX_IDP_FILE_TOO_MANY_OPEN 0xF1A4 #define AFX_IDP_FILE_ACCESS_DENIED 0xF1A5 #define AFX_IDP_FILE_INVALID_FILE 0xF1A6 #define AFX_IDP_FILE_REMOVE_CURRENT 0xF1A7 #define AFX_IDP_FILE_DIR_FULL 0xF1A8 #define AFX_IDP_FILE_BAD_SEEK 0xF1A9 #define AFX_IDP_FILE_HARD_IO 0xF1AA #define AFX_IDP_FILE_SHARING 0xF1AB #define AFX_IDP_FILE_LOCKING 0xF1AC #define AFX_IDP_FILE_DISKFULL 0xF1AD #define AFX_IDP_FILE_EOF 0xF1AE #define AFX_IDP_ARCH_NONE 0xF1B0 #define AFX_IDP_ARCH_GENERIC 0xF1B1 #define AFX_IDP_ARCH_READONLY 0xF1B2 #define AFX_IDP_ARCH_ENDOFFILE 0xF1B3 #define AFX_IDP_ARCH_WRITEONLY 0xF1B4 #define AFX_IDP_ARCH_BADINDEX 0xF1B5 #define AFX_IDP_ARCH_BADCLASS 0xF1B6 #define AFX_IDP_ARCH_BADSCHEMA 0xF1B7 #define AFX_IDS_OCC_SCALEUNITS_PIXELS 0xF1C0 #define AFX_IDS_STATUS_FONT 0xF230 #define AFX_IDS_TOOLTIP_FONT 0xF231 #define AFX_IDS_UNICODE_FONT 0xF232 #define AFX_IDS_MINI_FONT 0xF233 #define AFX_IDP_SQL_CONNECT_FAIL 0xF281 #define AFX_IDP_SQL_RECORDSET_FORWARD_ONLY 0xF282 #define AFX_IDP_SQL_EMPTY_COLUMN_LIST 0xF283 #define AFX_IDP_SQL_FIELD_SCHEMA_MISMATCH 0xF284 #define AFX_IDP_SQL_ILLEGAL_MODE 0xF285 #define AFX_IDP_SQL_MULTIPLE_ROWS_AFFECTED 0xF286 #define AFX_IDP_SQL_NO_CURRENT_RECORD 0xF287 #define AFX_IDP_SQL_NO_ROWS_AFFECTED 0xF288 #define AFX_IDP_SQL_RECORDSET_READONLY 0xF289 #define AFX_IDP_SQL_SQL_NO_TOTAL 0xF28A #define AFX_IDP_SQL_ODBC_LOAD_FAILED 0xF28B #define AFX_IDP_SQL_DYNASET_NOT_SUPPORTED 0xF28C #define AFX_IDP_SQL_SNAPSHOT_NOT_SUPPORTED 0xF28D #define AFX_IDP_SQL_API_CONFORMANCE 0xF28E #define AFX_IDP_SQL_SQL_CONFORMANCE 0xF28F #define AFX_IDP_SQL_NO_DATA_FOUND 0xF290 #define AFX_IDP_SQL_ROW_UPDATE_NOT_SUPPORTED 0xF291 #define AFX_IDP_SQL_ODBC_V2_REQUIRED 0xF292 #define AFX_IDP_SQL_NO_POSITIONED_UPDATES 0xF293 #define AFX_IDP_SQL_LOCK_MODE_NOT_SUPPORTED 0xF294 #define AFX_IDP_SQL_DATA_TRUNCATED 0xF295 #define AFX_IDP_SQL_ROW_FETCH 0xF296 #define AFX_IDP_SQL_INCORRECT_ODBC 0xF297 #define AFX_IDP_SQL_UPDATE_DELETE_FAILED 0xF298 #define AFX_IDP_SQL_DYNAMIC_CURSOR_NOT_SUPPORTED 0xF299 #define AFX_IDP_SQL_FIELD_NOT_FOUND 0xF29A #define AFX_IDP_SQL_BOOKMARKS_NOT_SUPPORTED 0xF29B #define AFX_IDP_SQL_BOOKMARKS_NOT_ENABLED 0xF29C #define AFX_IDS_DELETED 0xF29D #define AFX_IDP_DAO_ENGINE_INITIALIZATION 0xF2B0 #define AFX_IDP_DAO_DFX_BIND 0xF2B1 #define AFX_IDP_DAO_OBJECT_NOT_OPEN 0xF2B2 #define AFX_IDP_DAO_ROWTOOSHORT 0xF2B3 #define AFX_IDP_DAO_BADBINDINFO 0xF2B4 #define AFX_IDP_DAO_COLUMNUNAVAILABLE 0xF2B5 #define AFX_IDS_HTTP_TITLE 0xF2D1 #define AFX_IDS_HTTP_NO_TEXT 0xF2D2 #define AFX_IDS_HTTP_BAD_REQUEST 0xF2D3 #define AFX_IDS_HTTP_AUTH_REQUIRED 0xF2D4 #define AFX_IDS_HTTP_FORBIDDEN 0xF2D5 #define AFX_IDS_HTTP_NOT_FOUND 0xF2D6 #define AFX_IDS_HTTP_SERVER_ERROR 0xF2D7 #define AFX_IDS_HTTP_NOT_IMPLEMENTED 0xF2D8 #define AFX_IDS_CHECKLISTBOX_UNCHECK 0xF2E1 #define AFX_IDS_CHECKLISTBOX_CHECK 0xF2E2 #define AFX_IDS_CHECKLISTBOX_MIXED 0xF2E3 #define AFX_IDS_PROPPAGE_UNKNOWN 0xFE01 #define AFX_IDS_COLOR_DESKTOP 0xFE04 #define AFX_IDS_COLOR_APPWORKSPACE 0xFE05 #define AFX_IDS_COLOR_WNDBACKGND 0xFE06 #define AFX_IDS_COLOR_WNDTEXT 0xFE07 #define AFX_IDS_COLOR_MENUBAR 0xFE08 #define AFX_IDS_COLOR_MENUTEXT 0xFE09 #define AFX_IDS_COLOR_ACTIVEBAR 0xFE0A #define AFX_IDS_COLOR_INACTIVEBAR 0xFE0B #define AFX_IDS_COLOR_ACTIVETEXT 0xFE0C #define AFX_IDS_COLOR_INACTIVETEXT 0xFE0D #define AFX_IDS_COLOR_ACTIVEBORDER 0xFE0E #define AFX_IDS_COLOR_INACTIVEBORDER 0xFE0F #define AFX_IDS_COLOR_WNDFRAME 0xFE10 #define AFX_IDS_COLOR_SCROLLBARS 0xFE11 #define AFX_IDS_COLOR_BTNFACE 0xFE12 #define AFX_IDS_COLOR_BTNSHADOW 0xFE13 #define AFX_IDS_COLOR_BTNTEXT 0xFE14 #define AFX_IDS_COLOR_BTNHIGHLIGHT 0xFE15 #define AFX_IDS_COLOR_DISABLEDTEXT 0xFE16 #define AFX_IDS_COLOR_HIGHLIGHT 0xFE17 #define AFX_IDS_COLOR_HIGHLIGHTTEXT 0xFE18 #define AFX_IDS_REGULAR 0xFE19 #define AFX_IDS_BOLD 0xFE1A #define AFX_IDS_ITALIC 0xFE1B #define AFX_IDS_BOLDITALIC 0xFE1C #define AFX_IDS_SAMPLETEXT 0xFE1D #define AFX_IDS_DISPLAYSTRING_FONT 0xFE1E #define AFX_IDS_DISPLAYSTRING_COLOR 0xFE1F #define AFX_IDS_DISPLAYSTRING_PICTURE 0xFE20 #define AFX_IDS_PICTUREFILTER 0xFE21 #define AFX_IDS_PICTYPE_UNKNOWN 0xFE22 #define AFX_IDS_PICTYPE_NONE 0xFE23 #define AFX_IDS_PICTYPE_BITMAP 0xFE24 #define AFX_IDS_PICTYPE_METAFILE 0xFE25 #define AFX_IDS_PICTYPE_ICON 0xFE26 #define AFX_IDS_COLOR_PPG 0xFE28 #define AFX_IDS_COLOR_PPG_CAPTION 0xFE29 #define AFX_IDS_FONT_PPG 0xFE2A #define AFX_IDS_FONT_PPG_CAPTION 0xFE2B #define AFX_IDS_PICTURE_PPG 0xFE2C #define AFX_IDS_PICTURE_PPG_CAPTION 0xFE2D #define AFX_IDS_PICTUREBROWSETITLE 0xFE30 #define AFX_IDS_BORDERSTYLE_0 0xFE31 #define AFX_IDS_BORDERSTYLE_1 0xFE32 #define AFX_IDS_VERB_EDIT 0xFE40 #define AFX_IDS_VERB_PROPERTIES 0xFE41 #define AFX_IDP_PICTURECANTOPEN 0xFE83 #define AFX_IDP_PICTURECANTLOAD 0xFE84 #define AFX_IDP_PICTURETOOLARGE 0xFE85 #define AFX_IDP_PICTUREREADFAILED 0xFE86 #define AFX_IDP_E_ILLEGALFUNCTIONCALL 0xFEA0 #define AFX_IDP_E_OVERFLOW 0xFEA1 #define AFX_IDP_E_OUTOFMEMORY 0xFEA2 #define AFX_IDP_E_DIVISIONBYZERO 0xFEA3 #define AFX_IDP_E_OUTOFSTRINGSPACE 0xFEA4 #define AFX_IDP_E_OUTOFSTACKSPACE 0xFEA5 #define AFX_IDP_E_BADFILENAMEORNUMBER 0xFEA6 #define AFX_IDP_E_FILENOTFOUND 0xFEA7 #define AFX_IDP_E_BADFILEMODE 0xFEA8 #define AFX_IDP_E_FILEALREADYOPEN 0xFEA9 #define AFX_IDP_E_DEVICEIOERROR 0xFEAA #define AFX_IDP_E_FILEALREADYEXISTS 0xFEAB #define AFX_IDP_E_BADRECORDLENGTH 0xFEAC #define AFX_IDP_E_DISKFULL 0xFEAD #define AFX_IDP_E_BADRECORDNUMBER 0xFEAE #define AFX_IDP_E_BADFILENAME 0xFEAF #define AFX_IDP_E_TOOMANYFILES 0xFEB0 #define AFX_IDP_E_DEVICEUNAVAILABLE 0xFEB1 #define AFX_IDP_E_PERMISSIONDENIED 0xFEB2 #define AFX_IDP_E_DISKNOTREADY 0xFEB3 #define AFX_IDP_E_PATHFILEACCESSERROR 0xFEB4 #define AFX_IDP_E_PATHNOTFOUND 0xFEB5 #define AFX_IDP_E_INVALIDPATTERNSTRING 0xFEB6 #define AFX_IDP_E_INVALIDUSEOFNULL 0xFEB7 #define AFX_IDP_E_INVALIDFILEFORMAT 0xFEB8 #define AFX_IDP_E_INVALIDPROPERTYVALUE 0xFEB9 #define AFX_IDP_E_INVALIDPROPERTYARRAYINDEX 0xFEBA #define AFX_IDP_E_SETNOTSUPPORTEDATRUNTIME 0xFEBB #define AFX_IDP_E_SETNOTSUPPORTED 0xFEBC #define AFX_IDP_E_NEEDPROPERTYARRAYINDEX 0xFEBD #define AFX_IDP_E_SETNOTPERMITTED 0xFEBE #define AFX_IDP_E_GETNOTSUPPORTEDATRUNTIME 0xFEBF #define AFX_IDP_E_GETNOTSUPPORTED 0xFEC0 #define AFX_IDP_E_PROPERTYNOTFOUND 0xFEC1 #define AFX_IDP_E_INVALIDCLIPBOARDFORMAT 0xFEC2 #define AFX_IDP_E_INVALIDPICTURE 0xFEC3 #define AFX_IDP_E_PRINTERERROR 0xFEC4 #define AFX_IDP_E_CANTSAVEFILETOTEMP 0xFEC5 #define AFX_IDP_E_SEARCHTEXTNOTFOUND 0xFEC6 #define AFX_IDP_E_REPLACEMENTSTOOLONG 0xFEC7 #define SPVERSION_MASK 0x0000FF00 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 130 #define _APS_NEXT_COMMAND_VALUE 32771 #define _APS_NEXT_CONTROL_VALUE 1000 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif ace-8.0.4+dfsg.orig/tests/Thread_Manager_Test.cpp0000644000175000017500000003322515027201773020702 0ustar sudipsudip //============================================================================= /** * @file Thread_Manager_Test.cpp * * This program tests the group management mechanisms provided by * the , including the group signal handling, * group suspension and resumption, and cooperative thread * cancellation mechanisms. * * @author Prashant Jain and Douglas C. Schmidt */ //============================================================================= #include "test_config.h" #include "ace/Thread_Manager.h" #include "ace/Signal.h" #include "ace/Task.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_sys_time.h" #if defined (ACE_HAS_THREADS) #include "ace/Barrier.h" // Each thread keeps track of whether it has been signalled by using a // global array. It must be dynamically allocated to allow sizing at // runtime, based on the number of threads. static ACE_thread_t *signalled = 0; static size_t n_threads = ACE_MAX_THREADS; // Helper function that looks for an existing entry in the signalled // array. Also finds the position of the first unused entry in the // array, and updates if requested with the t_id. extern "C" int been_signalled (const ACE_thread_t t_id, const u_int update = 0) { u_int unused_slot = n_threads; for (u_int i = 0; i < n_threads; ++i) { if (ACE_OS::thr_equal (signalled[i], t_id)) // Already signalled. return 1; if (update && unused_slot == n_threads && ACE_OS::thr_equal (signalled[i], ACE_OS::NULL_thread)) unused_slot = i; } if (update && unused_slot < n_threads) // Update the array using the first unused_slot. signalled[unused_slot] = t_id; return 0; } // Synchronize starts of threads, so that they all start before the // main thread cancels them. To avoid creating a static object, it is // dynamically allocated, before spawning any threads. static ACE_Barrier *thread_start = 0; extern "C" void handler (int /* signum */) { if (signalled) { // No printout here, to be safe. Signal handlers must not // acquire locks, etc. const ACE_thread_t t_id = ACE_OS::thr_self (); // Update the signalled indication. (void) been_signalled (t_id, 1u /* update */); } } static void * worker (int iterations) { #if !defined (ACE_LACKS_UNIX_SIGNALS) // Cache this thread's ID. const ACE_thread_t t_id = ACE_OS::thr_self (); #endif /* ! ACE_LACKS_UNIX_SIGNAL */ ACE_Thread_Manager *thr_mgr = ACE_Thread_Manager::instance (); // After setting up the signal catcher, block on the start barrier. thread_start->wait (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) worker starting loop\n"))); for (int i = 0; i < iterations; i++) { if ((i % 1000) == 0) { #if !defined (ACE_LACKS_UNIX_SIGNALS) if (been_signalled (t_id)) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) had received signal\n"))); // Only test for cancellation after we've been signaled, // to avoid race conditions for suspend() and resume(). if (thr_mgr->testcancel (ACE_Thread::self ()) != 0) { char thr_id[BUFSIZ]; // Test out the ACE_OS::thr_id() method. ACE_OS::thr_id (thr_id, sizeof thr_id); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%C) has been cancelled ") ACE_TEXT ("before iteration %d!\n"), thr_id, i)); break; } } #else if (thr_mgr->testcancel (ACE_Thread::self ()) != 0) { char thr_id[BUFSIZ]; // Test out the ACE_OS::thr_id() method. ACE_OS::thr_id (thr_id, sizeof thr_id); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%C) has been cancelled ") ACE_TEXT ("before iteration %d!\n"), thr_id, i)); break; } #endif /* ! ACE_LACKS_UNIX_SIGNAL */ ACE_OS::sleep (1); } } // Destructor removes thread from Thread_Manager. return 0; } static const int DEFAULT_ITERATIONS = 10000; // Define a ACE_Task that will serve in the tests related to tasks. class ThrMgr_Task : public ACE_Task_Base { public: ThrMgr_Task (ACE_Thread_Manager *); int svc () override; static int errors; }; int ThrMgr_Task::errors = 0; // Just be sure to set the ACE_Thread_Manager correctly. ThrMgr_Task::ThrMgr_Task (ACE_Thread_Manager *mgr) : ACE_Task_Base (mgr) { } // svc just waits til it's been cancelled, then exits. int ThrMgr_Task::svc () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Task 0x%x, thread %t waiting to be cancelled\n"), this)); ACE_thread_t me = ACE_Thread::self (); for (int i = 0; i < 30 && !this->thr_mgr ()->testcancel (me); ++i) ACE_OS::sleep (1); if (this->thr_mgr ()->testcancel (me)) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Task 0x%x, thread %t cancelled; exiting\n"), this)); } else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Task 0x%x, thread %t was not cancelled\n"), this)); ++ThrMgr_Task::errors; } return 0; } // This function tests the task-based record keeping functions. static int test_task_record_keeping (ACE_Thread_Manager *mgr) { int status = 0; ThrMgr_Task t1 (mgr), t2 (mgr); int t1_grp (20), t2_grp (30); // Start two tasks, with multiple threads per task. Make sure that // task_all_list() works. if (-1 == t1.activate (THR_JOINABLE, 2, 0, ACE_DEFAULT_THREAD_PRIORITY, t1_grp)) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("activate")), 1); if (-1 == t2.activate (THR_JOINABLE, 3, 0, ACE_DEFAULT_THREAD_PRIORITY, t2_grp)) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("activate")), 1); ACE_Task_Base *task_list[10]; int num_tasks = mgr->task_all_list (task_list, 10); if (2 != num_tasks) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Expected 2 tasks; got %d\n"), num_tasks)); status = 1; } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Got %d tasks - correct\n"), num_tasks)); if (((task_list[0] == &t1 && task_list[1] == &t2) || (task_list[1] == &t1 && task_list[0] == &t2)) && task_list[0] != task_list[1]) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("The Task IDs are correct\n"))); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("But Task ID values are wrong!\n"))); } ACE_DEBUG ((LM_DEBUG, "Canceling grp %d\n", t1_grp)); if (-1 == mgr->cancel_grp (t1_grp)) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("cancel_grp")), 1); ACE_DEBUG ((LM_DEBUG, "Canceling grp %d\n", t2_grp)); if (-1 == mgr->cancel_grp (t2_grp)) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("cancel_grp")), 1); mgr->wait (); if (ThrMgr_Task::errors > 0 && status == 0) status = 1; return status; } #endif /* ACE_HAS_THREADS */ int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Thread_Manager_Test")); int status = 0; #if defined (ACE_HAS_THREADS) size_t n_iterations = DEFAULT_ITERATIONS; u_int i; // Dynamically allocate signalled so that we can control when it // gets deleted. Specifically, we need to delete it before the main // thread's TSS is cleaned up. ACE_NEW_RETURN (signalled, ACE_thread_t[n_threads], 1); // Initialize each ACE_thread_t to avoid Purify UMR's. for (i = 0; i < n_threads; ++i) signalled[i] = ACE_OS::NULL_thread; // And similarly, dynamically allocate the thread_start barrier. ACE_NEW_RETURN (thread_start, ACE_Barrier (n_threads + 1), -1); // Register a signal handler. ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT); ACE_UNUSED_ARG (sa); ACE_Thread_Manager *thr_mgr = ACE_Thread_Manager::instance (); #if 0 // Assign thread (VxWorks task) names to test that feature. ACE_hthread_t *thread_name = 0; ACE_NEW_RETURN (thread_name, ACE_hthread_t[n_threads], -1); // And test the ability to specify stack size. size_t *stack_size = 0; ACE_NEW_RETURN (stack_size, size_t[n_threads], -1); for (i = 0; i < n_threads; ++i) { if (i < n_threads - 1) { ACE_NEW_RETURN (thread_name[i], char[32], -1); ACE_OS::snprintf (thread_name[i], 32, ACE_TEXT ("thread%u"), i); } else // Pass an ACE_thread_t pointer of 0 for the last thread name. thread_name[n_threads - 1] = 0; stack_size[i] = 40000; } #endif /* ACE_HAS_VXTHREADS */ int grp_id = thr_mgr->spawn_n ( n_threads, (ACE_THR_FUNC) worker, reinterpret_cast (n_iterations), THR_BOUND , ACE_DEFAULT_THREAD_PRIORITY , -1 #if 0 , 0 , thread_name , 0 , stack_size #endif /* ACE_HAS_VXTHREADS */ ); ACE_TEST_ASSERT (grp_id != -1); thread_start->wait (); // Wait for 1 second and then suspend every thread in the group. ACE_OS::sleep (1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) suspending group\n"))); if (thr_mgr->suspend_grp (grp_id) == -1) { // Pthreads w/o UNIX 98 extensions doesn't support suspend/resume, // so it's allowed to ENOTSUP as long as the config indicates this. if (errno == ENOTSUP) { #if defined (ACE_HAS_PTHREADS) && (defined (ACE_HAS_PTHREAD_SUSPEND) || \ defined (ACE_HAS_PTHREAD_SUSPEND_NP)) ACE_ERROR ((LM_ERROR, ACE_TEXT ("suspend_grp: ENOTSUP but config ") ACE_TEXT ("says it should work.\n"))); #else ACE_DEBUG((LM_DEBUG, ACE_TEXT (" OK: suspend_grp isn't supported with ") ACE_TEXT ("Pthreads\n"))); #endif /* ACE_HAS_PTHREADS && should be able to suspend */ } else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("suspend_grp"))); } } // Wait for 1 more second and then resume every thread in the // group. ACE_OS::sleep (ACE_Time_Value (1)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) resuming group\n"))); if (thr_mgr->resume_grp (grp_id) == -1) { // Pthreads w/o UNIX 98 extensions doesn't support suspend/resume, // so it's allowed to ENOTSUP as long as the config indicates this. if (errno == ENOTSUP) { #if defined (ACE_HAS_PTHREADS) && (defined (ACE_HAS_PTHREAD_CONTINUE) || \ defined (ACE_HAS_PTHREAD_CONTINUE_NP) || \ defined (ACE_HAS_PTHREAD_RESUME_NP)) ACE_ERROR ((LM_ERROR, ACE_TEXT ("resume_grp: ENOTSUP but config ") ACE_TEXT ("says it should work.\n"))); #else ACE_DEBUG((LM_DEBUG, ACE_TEXT (" OK: resume_grp isn't supported with ") ACE_TEXT ("Pthreads\n"))); #endif /* ACE_HAS_PTHREADS && should be able to continue/resume */ } else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("resume_grp"))); } } // Wait for 1 more second and then send a SIGINT to every thread in // the group. ACE_OS::sleep (ACE_Time_Value (1)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) signaling group\n"))); #if defined (ACE_HAS_WTHREADS) thr_mgr->kill_grp (grp_id, SIGINT); #elif !defined (ACE_HAS_PTHREADS_DRAFT4) && !defined(ACE_LACKS_PTHREAD_KILL) ACE_TEST_ASSERT (thr_mgr->kill_grp (grp_id, SIGINT) != -1); #else if (thr_mgr->kill_grp (grp_id, SIGINT) == -1) ACE_TEST_ASSERT (errno == ENOTSUP); #endif /* ACE_HAS_WTHREADS */ // Wait and then cancel all the threads. ACE_OS::sleep (ACE_Time_Value (1)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) cancelling group\n"))); ACE_TEST_ASSERT (thr_mgr->cancel_grp (grp_id) != -1); // Perform a barrier wait until all the threads have shut down. // But, wait for a limited time, just in case. ACE_Time_Value const max_wait (600); ACE_Time_Value const wait_time (ACE_OS::gettimeofday () + max_wait); if (thr_mgr->wait (&wait_time) == -1) { if (errno == ETIME) ACE_ERROR ((LM_ERROR, ACE_TEXT ("maximum wait time of %d msec exceeded\n"), max_wait.msec ())); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("wait"))); status = -1; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) main thread finished\n"))); #if 0 for (i = 0; i < n_threads - 1; ++i) { delete [] thread_name[i]; // Don't delete the last thread_name, because it points to the // name in the TCB. It was initially 0. } delete [] thread_name; delete [] stack_size; #endif /* ACE_HAS_VXTHREADS */ delete thread_start; thread_start = 0; delete [] signalled; signalled = 0; // Now test task record keeping if (test_task_record_keeping (thr_mgr) != 0) status = -1; #else ACE_ERROR ((LM_INFO, ACE_TEXT ("threads not supported on this platform\n"))); #endif /* ACE_HAS_THREADS */ ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/Compiler_Features_10_Test.cpp0000644000175000017500000001461015027201773021746 0ustar sudipsudip/** * @file * * This program checks if the compiler / platform supports exceptions, * in particular, if raising exceptions in constructors work. The * motivation for this test was a discussion on the development * mailing list, and the documentation was captured in: * * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=3715 */ #include "test_config.h" // The first part of the test is to compile this line. If the program // does not compile the platform is just too broken. #include // ... using exceptions with C++ also implies using the standard // exceptions ... #include // For extra challenge, we use the anonymous namespace namespace { int constructors = 0; int destructors = 0; int allocs = 0; int deallocs = 0; bool had_failure = false; void check_constructor_count(int expected, char const * filename, int lineno); void check_destructor_count(int expected, char const * filename, int lineno); void check_alloc_count(int expected, char const * filename, int lineno); void reset_counts(); void never_reached(char const * filename, int lineno); int status(); /** * @class Base */ class Base { public: Base() { ++constructors; } Base(Base const & ) { ++constructors; } ~Base() { ++destructors; } void * operator new(size_t n) { ++allocs; return ::operator new(n); } void operator delete(void * x) { ++deallocs; return ::operator delete(x); } }; /** * @class May_Pop * * Create a class that can raise exceptions in its constructor * */ class May_Pop : public Base { public: explicit May_Pop(bool do_raise) // Even if an exception is raised, the base object is fully // constructed and must be fully destructed ... : Base() { if (do_raise) { throw std::runtime_error("requested exception"); } // ... if an exception is raised this object is never // initialized and no constructor / destructor calls should take // place ... Base tmp; } }; /** * @class Aggregate */ class Aggregate : public Base { private: May_Pop m1; May_Pop m2; May_Pop m3; public: /** * Constructor. Element m1 is fully initialized, its constructors * and destructors should run, m2 is partially initialized, its * destructor never runs, m3 is never initialized, neither its * constructor nor destructor runs. */ Aggregate() : Base() , m1(false) , m2(true) , m3(false) {} }; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT("Compiler_Features_10_Test")); try { // ... start the test fresh ... reset_counts(); // Let's try to build a simple object and destroy it, without any // exceptions raised ... May_Pop m1(false); // ... two instances of the base class should be created ... check_constructor_count(2, __FILE__, __LINE__); // ... but only one instance is destroyed at this point ... check_destructor_count(1, __FILE__, __LINE__); } catch (...) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error: Unexpected exception caught\n"))); } // ... now both instances are gone ... check_destructor_count(2, __FILE__, __LINE__); try { // ... start the test fresh ... reset_counts(); // ... now raise an exception ... May_Pop m1(true); never_reached(__FILE__, __LINE__); } catch(...) { // ... only one instance gets created ... check_constructor_count(1, __FILE__, __LINE__); // ... and it is gone ... check_destructor_count(1, __FILE__, __LINE__); } try { // ... start the test fresh ... reset_counts(); // ... now build a complex object with a failure in the middle ... Aggregate a; never_reached(__FILE__, __LINE__); } catch(...) { // ... check the expectations ... check_constructor_count(4, __FILE__, __LINE__); check_destructor_count(4, __FILE__, __LINE__); } try { // ... start the test fresh ... reset_counts(); std::unique_ptr b(new Aggregate); never_reached(__FILE__, __LINE__); } catch(...) { // ... check the expectations ... check_constructor_count(4, __FILE__, __LINE__); check_destructor_count(4, __FILE__, __LINE__); check_alloc_count(1, __FILE__, __LINE__); } ACE_END_TEST; return status(); } namespace { void check_constructor_count(int expected, char const * filename, int lineno) { if (constructors == expected) { return; } had_failure = true; ACE_ERROR ((LM_ERROR, ACE_TEXT("Expected %d constructor calls, had %d -- (%s:%d)\n"), expected, constructors, filename, lineno)); } void check_destructor_count(int expected, char const * filename, int lineno) { if (destructors == expected) { return; } had_failure = true; ACE_ERROR ((LM_ERROR, ACE_TEXT("Expected %d destructor calls, had %d -- (%s:%d)\n"), expected, destructors, filename, lineno)); } void check_alloc_count(int expected, char const * filename, int lineno) { if (allocs == expected && deallocs == expected) { return; } had_failure = true; if (allocs != expected) { ACE_ERROR ((LM_ERROR, ACE_TEXT("Expected %d alloc calls, had %d -- (%s:%d)\n"), expected, allocs, filename, lineno)); } if (deallocs != expected) { ACE_ERROR ((LM_ERROR, ACE_TEXT("Expected %d dealloc calls, had %d -- (%s:%d)\n"), expected, deallocs, filename, lineno)); } } void never_reached(char const * filename, int lineno) { had_failure = true; ACE_ERROR ((LM_ERROR, ACE_TEXT("Code should not have reached (%s:%d)\n"), filename, lineno)); } void reset_counts() { constructors = 0; destructors = 0; allocs = 0; deallocs = 0; } int status() { if (had_failure) { return 1; } return 0; } } ace-8.0.4+dfsg.orig/tests/Config_Test.h0000644000175000017500000000450515027201773016712 0ustar sudipsudip //============================================================================= /** * @file Config_Test.h * * This is a test that makes sure the of * class works correctly. * * @author Michael Searles and Jerry D. Odenwelder Jr. */ //============================================================================= #ifndef __CONFIG_TEST_H #define __CONFIG_TEST_H #include "ace/Configuration.h" const int TEST_MAX_STRING = 256; class Config_Test { public: Config_Test () : equality_tested_ (0) { } ~Config_Test () { } // Used to test the equality and inequality operations. int testEquality (); // Used to test INI Import Export class int testIniFormat (); // Used to test Regiastry Import Export class // 1. Creates an ACE_Configuration_Heap object // 2. Calls buildConfigObject to populate // 3. Exports // 5. Creates a new ACE_Configuration_Heap object // 6. Imports // 7. Compares to origional. // 8. Clean-up int testRegFormat (); private: // change a value for value change test int change_one (ACE_Configuration &l, u_int a = 101); void get_section_string (ACE_Configuration& config, ACE_Configuration_Section_Key& SectionKey, const ACE_TCHAR* pszName, ACE_TCHAR* pszVariable, int nMaxLength); void get_section_integer (ACE_Configuration& config, ACE_Configuration_Section_Key& SectionKey, const ACE_TCHAR* pszName, int* nVariable, int nMinValue, int nMaxValue); void get_section_boolean (ACE_Configuration& config, ACE_Configuration_Section_Key& SectionKey, const ACE_TCHAR* pszName, int* pVariable); private: int equality_tested_; // make sure the equality operator works before proceeding. }; #endif /* __CONFIG_TEST_H */ ace-8.0.4+dfsg.orig/tests/Thread_Pool_Reactor_Resume_Test.h0000644000175000017500000000235115027201773022701 0ustar sudipsudip //============================================================================= /** * @file Thread_Pool_Reactor_Resume_Test.h * * It is only used by Thread_Pool_Reactor_Test.cpp. * * @author Irfan Pyarali Nanbor Wang */ //============================================================================= #ifndef ACE_TESTS_THREAD_POOL_REACTOR_RESUME_TEST_H #define ACE_TESTS_THREAD_POOL_REACTOR_RESUME_TEST_H #include "ace/SOCK_Stream.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Svc_Handler.h" /** * @class Request_Handler * * @brief This class is the Svc_Handler used by . */ class Request_Handler : public ACE_Svc_Handler { public: /// The default constructor makes sure the right reactor is used. Request_Handler (ACE_Thread_Manager *tm = 0); /// Dtor.. ~Request_Handler (); virtual int open (void * = 0); protected: virtual int handle_input (ACE_HANDLE fd = ACE_INVALID_HANDLE); virtual int handle_close (ACE_HANDLE fd, ACE_Reactor_Mask = 0); virtual int resume_handler (); private: size_t nr_msgs_rcvd_; }; #endif /* ACE_TESTS_THREAD_POOL_REACTOR_RESUME_TEST_H */ ace-8.0.4+dfsg.orig/tests/Reactor_Timer_Test.cpp0000644000175000017500000001746715027201773020612 0ustar sudipsudip//============================================================================= /** * @file Reactor_Timer_Test.cpp * * This is a simple test that illustrates the timer mechanism of * the reactor. Scheduling timers, resetting timer intervals, * handling expired timers and cancelling scheduled timers are * all exercised in this test. * * @author Prashant Jain and Douglas C. Schmidt */ //============================================================================= #include "test_config.h" #include "ace/Timer_Queue.h" #include "ace/Reactor.h" #include "ace/High_Res_Timer.h" #include "ace/Trace.h" #include "ace/Recursive_Thread_Mutex.h" #include "ace/Log_Msg.h" #include "ace/Timer_Heap.h" #include static int done = 0; static int the_count = 0; static int odd = 0; class Time_Handler : public ACE_Event_Handler { public: /// Default constructor Time_Handler (); /// Handle the timeout. int handle_timeout (const ACE_Time_Value &tv, const void *arg) override; /// Called when is removed. int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask) override; /// Return our timer id. long timer_id () const; /// Set our timer id; void timer_id (long); private: /// Stores the id of this timer. long timer_id_; }; Time_Handler::Time_Handler () : timer_id_ (-1) { // Nothing } int Time_Handler::handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("[%x] handle = %d, close_mask = %d, timer id = %d\n"), this, handle, close_mask, this->timer_id ())); return 0; } int Time_Handler::handle_timeout (const ACE_Time_Value &tv, const void *arg) { long current_count = static_cast (reinterpret_cast (arg)); if (current_count >= 0) ACE_TEST_ASSERT (current_count == the_count); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("[%x] Timer id %d with count #%d|%d timed out at %d!\n"), this, this->timer_id (), the_count, current_count, tv.sec ())); if (current_count == long (ACE_MAX_TIMERS - 1)) done = 1; else if (the_count == long (ACE_MAX_TIMERS - 1)) { done = 1; return -1; } else if (current_count == -1) { int result = ACE_Reactor::instance ()->reset_timer_interval (this->timer_id (), std::chrono::seconds {the_count + 1}); if (result == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error resetting timer interval\n"))); } the_count += (1 + odd); return 0; } long Time_Handler::timer_id () const { return this->timer_id_; } void Time_Handler::timer_id (long t) { this->timer_id_ = t; } static void test_registering_all_handlers () { ACE_Trace t (ACE_TEXT ("test_registering_all_handler"), __LINE__, ACE_TEXT_CHAR_TO_TCHAR (__FILE__)); Time_Handler rt[ACE_MAX_TIMERS]; long t_id[ACE_MAX_TIMERS]; for (size_t i = 0; i < ACE_MAX_TIMERS; i++) { t_id[i] = ACE_Reactor::instance ()->schedule_timer (&rt[i], (const void *) i, std::chrono::seconds {2 * i + 1}); ACE_TEST_ASSERT (t_id[i] != -1); rt[i].timer_id (t_id[i]); } while (!done) ACE_Reactor::instance ()->handle_events (); } static void test_registering_one_handler () { ACE_Trace t (ACE_TEXT ("test_registering_one_handler"), __LINE__, ACE_TEXT_CHAR_TO_TCHAR (__FILE__)); Time_Handler rt[ACE_MAX_TIMERS]; long t_id[ACE_MAX_TIMERS]; done = 0; the_count = 0; for (size_t i = 0; i < ACE_MAX_TIMERS; i++) { t_id[i] = ACE_Reactor::instance ()->schedule_timer (&rt[0], (const void *) i, ACE_Time_Value (2 * i + 1)); ACE_TEST_ASSERT (t_id[i] != -1); } while (!done) ACE_Reactor::instance ()->handle_events (); } static void test_canceling_odd_timers () { ACE_Trace t (ACE_TEXT ("test_canceling_odd_timers"), __LINE__, ACE_TEXT_CHAR_TO_TCHAR (__FILE__)); Time_Handler rt[ACE_MAX_TIMERS]; long t_id[ACE_MAX_TIMERS]; done = 0; the_count = 1; odd = 1; for (size_t i = 0; i < ACE_MAX_TIMERS; i++) { t_id[i] = ACE_Reactor::instance ()->schedule_timer (&rt[i], (const void *) i, ACE_Time_Value (2 * i + 1)); ACE_TEST_ASSERT (t_id[i] != -1); rt[i].timer_id (t_id[i]); } for (size_t j = 0; (u_long) j < ACE_MAX_TIMERS; j++) // Cancel handlers with odd numbered timer ids. if (ACE_ODD (rt[j].timer_id ())) { int result = ACE_Reactor::instance ()->cancel_timer (rt[j].timer_id ()); if (result == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error cancelling timer\n"))); } while (!done) ACE_Reactor::instance ()->handle_events (); } static void test_resetting_timer_intervals () { ACE_Trace t (ACE_TEXT ("test_resetting_timer_intervals"), __LINE__, ACE_TEXT_CHAR_TO_TCHAR (__FILE__)); Time_Handler rt; long t_id; done = 0; the_count = 0; odd = 0; t_id = ACE_Reactor::instance ()->schedule_timer (&rt, (const void *) -1, ACE_Time_Value (1), // Start off by making this an interval timer. ACE_Time_Value (1)); ACE_TEST_ASSERT (t_id != -1); rt.timer_id (t_id); while (!done) ACE_Reactor::instance ()->handle_events (); } // If any command line arg is given, run the test with high res timer // queue. Else run it normally. int run_main (int argc, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Reactor_Timer_Test")); if (argc > 1) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Running with high-res timer queue\n"))); ACE_Reactor *r = ACE_Reactor::instance (); (void) ACE_High_Res_Timer::global_scale_factor (); // Change the source of time in the Reactor to the // high-resolution timer. Why does this test require such // precision for a 1 second timer is beyond me ... I think it // is a cut&paste error. // // The use of auto_ptr<> is optional, ACE uses dangerous memory // management idioms everywhere, I thought I could demonstrate how // to do it right in at least one test. Notice the lack of // ACE_NEW_RETURN, that monstrosity has no business in proper C++ // code ... std::unique_ptr tq( new ACE_Timer_Heap_Variable_Time_Source); // ... notice how the policy is in the derived timer queue type. // The abstract timer queue does not have a time policy ... tq->set_time_policy(&ACE_High_Res_Timer::gettimeofday_hr); // ... and then the timer queue is replaced. Strangely, the // Reactor does *not* copy the timers, it just deletes the // existing timer queue .... r->timer_queue(tq.get()); // ... the Reactor has assumed ownership, release the // auto_ptr<> ... tq.release(); } // Register all different handlers, i.e., one per timer. test_registering_all_handlers (); // Now try multiple timers for ONE event handler (should produce the // same result). test_registering_one_handler (); // Try canceling handlers with odd numbered timer ids. test_canceling_odd_timers (); // Make sure works. test_resetting_timer_intervals (); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Log_Thread_Inheritance_Test.cpp0000644000175000017500000000615215027201773022361 0ustar sudipsudip#include "test_config.h" #include "ace/Log_Msg.h" #include "ace/Task.h" #include #ifdef ACE_HAS_PTHREADS # include #endif /* ACE_HAS_PTHREADS */ #if !defined (ACE_HAS_THREADS) || defined (ACE_LACKS_IOSTREAM_TOTALLY) int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Log_Thread_Inheritance_Test")); ACE_END_TEST; return 0; } #else #ifdef ACE_HAS_PTHREADS struct Inheritor : ACE_Task_Base { int svc () override { ACE_DEBUG ((LM_DEBUG, "(%P|%t) - this test might crash ACE if it does not " "have the fix for the second bug in #3480.\n")); return 0; } }; extern "C" void* spawn_ace_task (void*) { Inheritor inheritor; inheritor.activate (); inheritor.wait (); return 0; } bool test_inherited_attributes () { // This test verifies ACE_OS_Log_Msg_Attributes correctly initializes // when an ACE thread is created from a non-ACE thread (i.e. pthreads) // and is then used for logging. // // This test will cause occasional SEGVs on failure. // stallions 2009/02/05 pthread_t parent; if (pthread_create (&parent, 0, spawn_ace_task, 0) != 0) { return false; } pthread_join (parent, 0); return true; } #endif /* ACE_HAS_PTHREADS */ struct MyThread : ACE_Task_Base { enum { THREAD_DEFAULTS = THR_NEW_LWP|THR_JOINABLE|THR_INHERIT_SCHED }; explicit MyThread (bool openfile = false) : openfile_ (openfile) {} bool openfile_; static MyThread childthread_; int svc () override { if (openfile_) { ACE_LOG_MSG->msg_ostream ( new std::ofstream ( ACE_TEXT_ALWAYS_CHAR ( ACE_LOG_DIRECTORY ACE_TEXT ("Log_Thread_Inheritance_Ostream") ACE_LOG_FILE_EXT_NAME ) ), true); ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM); ACE_LOG_MSG->clr_flags (ACE_Log_Msg::STDERR | ACE_Log_Msg::LOGGER); MyThread ends_first_thread; ends_first_thread.activate (THREAD_DEFAULTS, 10); ends_first_thread.wait (); childthread_.activate (THREAD_DEFAULTS, 10); } ACE_DEBUG ((LM_DEBUG, "(%P|%t) - in svc() openfile_ is %C\n", (openfile_ ? "true" : "false"))); if (!openfile_) { for (int i = 0; i < 100; ++i) { ACE_DEBUG ((LM_DEBUG, "(%P|%t) - loop %d\n", i)); if (!(i % 10)) ACE_OS::thr_yield (); } } return 0; } }; MyThread MyThread::childthread_; int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Log_Thread_Inheritance_Test")); ACE_DEBUG ((LM_DEBUG, "(%P|%t) - in run_main()\n")); ACE_DEBUG ((LM_DEBUG, "(%P|%t) - this test will crash ACE if it does not " "have the fix for bug #3480.\n")); ACE_OSTREAM_TYPE *initial_stream = ACE_LOG_MSG->msg_ostream (); MyThread mt (true); mt.activate (); mt.wait (); MyThread::childthread_.wait (); ACE_LOG_MSG->msg_ostream (initial_stream, 0); #ifdef ACE_HAS_PTHREADS if (!test_inherited_attributes ()) return -1; #endif /* ACE_HAS_PTHREADS */ ACE_DEBUG ((LM_DEBUG, "(%P|%t) - Test passed.\n")); ACE_END_TEST; return 0; } #endif ace-8.0.4+dfsg.orig/tests/Wild_Match_Test.cpp0000644000175000017500000000401515027201773020047 0ustar sudipsudip#include "ace/ACE.h" #include "ace/Log_Msg.h" #include "test_config.h" bool match (const char *str, const char *pat, bool cs = true, bool cc = false) { bool const result = ACE::wild_match (str, pat, cs, cc); ACE_DEBUG ((LM_DEBUG, "string {%C} %C pattern {%C}\t%C\t%C\n", str, (result ? "matches" : "does not match"), pat, (cs ? "" : "case-insensitive"), (cc ? "char classes" : ""))); return result; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Wild_Match_Test")); bool ok = true; ok &= match ("foo_baz_bar", "foo*bar"); ok &= match ("lksfj;laskf;jbaz", "*baz"); ok &= !match ("abc", "abc?"); ok &= match ("simple", "simple"); ok &= !match ("not so simple", "simple"); ok &= match ("AbC", "abc", false); ok &= match ("*\\", "\\*\\\\"); ok &= match ("Nonwild[foo]", "*[foo]"); ok &= match ("Apple][", "[zxya]p*[]125]\\[", false, true); ok &= match ("[!]", "[][!][][!][][!]", true, true); ok &= match ("ace", "[a-e][a-e][a-e]", true, true); ok &= match ("--x", "[-1][2-][!-]", true, true); ok &= !match ("C2", "[!C]?", true, true); ok &= match ("D1", "[!C]?", true, true); ok &= match ("D2", "[!C]?", true, true); ok &= !match ("C2", "?[!2]", true, true); ok &= match ("C1", "?[!2]", true, true); ok &= !match (0, "[!C]?", true, true); // invalid classes: results are undefined but we shouldn't crash match ("foo", "f[o-a]o", true, true); match ("bar", "[f-", true, true); match ("bar", "[z", true, true); match ("bar", "[]x", true, true); match ("foo", "[f-f]oo", true, true); if (!ok) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: Wild_Match_Test failed\n"))); } ACE_END_TEST; return ok ? 0 : 1; } ace-8.0.4+dfsg.orig/tests/Compiler_Features_27_Test.cpp0000644000175000017500000000065315027201773021760 0ustar sudipsudip/** * This program checks if the compiler doesn't have a certain bug * that we encountered when testing C++11 features */ #include "test_config.h" #include class Foo { public: Foo () = default; }; void operator <<= (Foo&, std::string &&) { } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT("Compiler_Features_27_Test")); Foo any; any <<= std::move("abc"); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Dev_Poll_Reactor_Echo_Test.cpp0000644000175000017500000003662515027201773022171 0ustar sudipsudip//============================================================================= /** * @file Dev_Poll_Reactor_Echo_Test.cpp * * This test implements a simple echo server using the * Dev_Poll_Reactor. This forces the reactor to behave like a * reactor would in a typical client/server application, i.e., * receive a message then send a messages. * @author Justin Wilson */ //============================================================================= #include "test_config.h" #if defined (ACE_HAS_DEV_POLL) || defined (ACE_HAS_EVENT_POLL) #include "ace/OS_NS_signal.h" #include "ace/Reactor.h" #include "ace/Dev_Poll_Reactor.h" #include "ace/Acceptor.h" #include "ace/Connector.h" #include "ace/SOCK_Acceptor.h" #include "ace/SOCK_Connector.h" #include "ace/SOCK_Stream.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_netdb.h" #include using SVC_HANDLER = ACE_Svc_Handler; // ---------------------------------------------------- class Client : public SVC_HANDLER { public: Client (); //FUZZ: disable check_for_lack_ACE_OS int open (void * = 0) override; //FUZZ: enable check_for_lack_ACE_OS int handle_output (ACE_HANDLE handle) override; int handle_input (ACE_HANDLE handle) override; int handle_timeout (const ACE_Time_Value ¤t_time, const void *act) override; int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask mask) override; std::string sent; std::string received; private: unsigned int call_count_; }; class Server : public SVC_HANDLER { public: Server (); int handle_input (ACE_HANDLE handle) override; int handle_output (ACE_HANDLE handle) override; int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask mask) override; private: int send_i (const char* buffer, size_t size); std::queue buffer_list_; size_t offset_; }; // ---------------------------------------------------- Client::Client () : call_count_ (0) { } int Client::open (void *) { // Trigger writes on a timer. ACE_Time_Value delay (1, 0); ACE_Time_Value restart (1, 0); if (this->reactor ()->schedule_timer (this, 0, delay, restart) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Unable to schedule client side ") ACE_TEXT ("timer in ACE_Dev_Poll_Reactor")), -1); } if (this->reactor ()->register_handler (this, ACE_Event_Handler::READ_MASK) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Unable to register for reading ") ACE_TEXT ("in ACE_Dev_Poll_Reactor")), -1); } return 0; } int Client::handle_output (ACE_HANDLE handle) { std::string buffer = "Hello, world!"; ssize_t bytes_sent = this->peer ().send (buffer.data (), buffer.size ()); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Client::handle_output; handle = %d") ACE_TEXT (" bytes sent %d\n"), handle, bytes_sent)); if (bytes_sent == -1) { if (errno == EWOULDBLOCK) return 0; // Flow control kicked in. else if (errno == EPIPE || errno == ECONNRESET) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Client::handle_output; server ") ACE_TEXT ("closed handle %d\n"), this->peer ().get_handle ())); return -1; } else ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Client::handle_output")), -1); } else if (bytes_sent == 0) return -1; else this->sent.append (buffer.substr (0, bytes_sent)); return -1; } int Client::handle_input (ACE_HANDLE handle) { for (;;) { char buffer[BUFSIZ]; ssize_t bytes_read = this->peer ().recv (buffer, BUFSIZ); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Client::handle_input handle = %d bytes_read = %d\n"), handle, bytes_read)); if (bytes_read == -1 && errno == EWOULDBLOCK) { return 0; } else if (bytes_read <= 0) { // Closed. return -1; } else { this->received.append (buffer, bytes_read); } } } int Client::handle_timeout (const ACE_Time_Value &, const void *) { ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%t) Expected client timeout occurred at: %T\n"))); if (this->call_count_ != 10) { // Register for write. if (this->reactor ()->register_handler (this, ACE_Event_Handler::WRITE_MASK) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Unable to register for writing ") ACE_TEXT ("in ACE_Dev_Poll_Reactor")), -1); } this->call_count_++; return 0; } else { // Shutdown. if (this->reactor ()->end_reactor_event_loop () == 0) ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%t) Successful client reactor shutdown.\n"))); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Failed client reactor shutdown"))); // Force this service handler to be closed in either case. return -1; } } int Client::handle_close (ACE_HANDLE handle, ACE_Reactor_Mask mask) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Client::handle_close handle = %d mask = %xd\n"), handle, mask)); return 0; //return SVC_HANDLER::handle_close (handle, mask); } // ---------------------------------------------------- Server::Server () : offset_ (0) { } int Server::handle_input (ACE_HANDLE handle) { for (;;) { char buffer[BUFSIZ]; ssize_t bytes_read = this->peer ().recv (buffer, BUFSIZ); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Server::handle_input handle = %d bytes_read = %d\n"), handle, bytes_read)); if (bytes_read == -1 && errno == EWOULDBLOCK) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Server::handle_input handle = %d EWOULDBLOCK\n"), handle)); return 0; } else if (bytes_read == 0) { // Closed. ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Server::handle_input handle = %d CLOSED\n"), handle)); return -1; } else { if (send_i (buffer, bytes_read) == -1) return -1; } } } int Server::send_i (const char* buffer, size_t size) { if (size == 0) { return 0; } if (buffer_list_.empty ()) { // Register for write. if (this->reactor ()->register_handler (this, ACE_Event_Handler::WRITE_MASK) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Unable to register for writing ") ACE_TEXT ("in ACE_Dev_Poll_Reactor")), -1); } } buffer_list_.push (new std::string (buffer, size)); return 0; } int Server::handle_output (ACE_HANDLE handle) { while (!buffer_list_.empty ()) { size_t bytes_to_send = buffer_list_.front ()->size () - offset_; ssize_t bytes_sent = this->peer ().send (buffer_list_.front ()->data () + offset_, bytes_to_send); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Server::handle_output; handle = %d") ACE_TEXT (" bytes sent %d\n"), handle, bytes_sent)); if (bytes_sent == -1) { if (errno == EWOULDBLOCK) return 0; else if (errno == EPIPE || errno == ECONNRESET) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Client::handle_output; server ") ACE_TEXT ("closed handle %d\n"), this->peer ().get_handle ())); return -1; } else ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Client::handle_output")), -1); } else if (bytes_sent == 0) return -1; else { if (bytes_sent == static_cast (bytes_to_send)) { delete buffer_list_.front (); buffer_list_.pop (); offset_ = 0; } else { offset_ += bytes_sent; } } } return -1; } int Server::handle_close (ACE_HANDLE handle, ACE_Reactor_Mask mask) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Server::handle_close handle = %d mask = %xd\n"), handle, mask)); return 0; //return SVC_HANDLER::handle_close (handle, mask); } // ---------------------------------------------------- using ACCEPTOR = ACE_Acceptor; using CONNECTOR = ACE_Connector; // ---------------------------------------------------- class TestAcceptor : public ACCEPTOR { public: int accept_svc_handler (Server * handler) override { int result = this->ACCEPTOR::accept_svc_handler (handler); if (result != 0) { if (errno != EWOULDBLOCK) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Unable to accept connection"))); return result; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Accepted connection. ") ACE_TEXT ("Stream handle: <%d>\n"), handler->get_handle ())); return result; } }; // ---------------------------------------------------- class TestConnector : public CONNECTOR { public: int connect_svc_handler ( CONNECTOR::handler_type *& handler, const CONNECTOR::addr_type &remote_addr, ACE_Time_Value *timeout, const CONNECTOR::addr_type &local_addr, int reuse_addr, int flags, int perms) override { const int result = this->CONNECTOR::connect_svc_handler (handler, remote_addr, timeout, local_addr, reuse_addr, flags, perms); if (result != 0) return result; ACE_TCHAR hostname[MAXHOSTNAMELEN]; if (remote_addr.get_host_name (hostname, sizeof (hostname)) != 0) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Unable to retrieve hostname")), -1); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Connected to <%s:%d>.\n"), hostname, (int) remote_addr.get_port_number ())); return result; } int connect_svc_handler ( CONNECTOR::handler_type *& handler, CONNECTOR::handler_type *& sh_copy, const CONNECTOR::addr_type &remote_addr, ACE_Time_Value *timeout, const CONNECTOR::addr_type &local_addr, int reuse_addr, int flags, int perms) override { sh_copy = handler; return this->connect_svc_handler (handler, remote_addr, timeout, local_addr, reuse_addr, flags, perms); } }; // ---------------------------------------------------- static int disable_signal (int sigmin, int sigmax) { #if !defined (ACE_LACKS_UNIX_SIGNALS) sigset_t signal_set; if (ACE_OS::sigemptyset (&signal_set) == - 1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error: (%P|%t):%p\n"), ACE_TEXT ("sigemptyset failed"))); for (int i = sigmin; i <= sigmax; i++) ACE_OS::sigaddset (&signal_set, i); // Put the . # if defined (ACE_LACKS_PTHREAD_THR_SIGSETMASK) // In multi-threaded application this is not POSIX compliant // but let's leave it just in case. if (ACE_OS::sigprocmask (SIG_BLOCK, &signal_set, 0) != 0) # else if (ACE_OS::thr_sigsetmask (SIG_BLOCK, &signal_set, 0) != 0) # endif /* ACE_LACKS_PTHREAD_THR_SIGSETMASK */ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Error: (%P|%t): %p\n"), ACE_TEXT ("SIG_BLOCK failed")), -1); #else ACE_UNUSED_ARG (sigmin); ACE_UNUSED_ARG (sigmax); #endif /* ACE_LACKS_UNIX_SIGNALS */ return 0; } // ---------------------------------------------------- int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Dev_Poll_Reactor_Echo_Test")); // Make sure we ignore SIGPIPE disable_signal (SIGPIPE, SIGPIPE); ACE_Dev_Poll_Reactor dp_reactor; dp_reactor.restart (1); // Restart on EINTR ACE_Reactor reactor (&dp_reactor); TestConnector client; int flags = 0; ACE_SET_BITS (flags, ACE_NONBLOCK); // Enable non-blocking in the // Svc_Handlers. if (client.open (&reactor, flags) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Unable to open client service handler")), -1); unsigned short port = 54678; ACE_INET_Addr addr; if (addr.set (port, INADDR_LOOPBACK) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("server_worker - ACE_INET_Addr::set")), -1); TestAcceptor server; if (server.open (addr, &reactor, flags) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Unable to open server service handler")), -1); Client *client_handler = 0; if (client.connect (client_handler, addr) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Unable to connect to server")), -1); if (reactor.run_reactor_event_loop () != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Error when running client ") ACE_TEXT ("reactor event loop")), -1); ACE_DEBUG((LM_DEBUG, "sent: %C\n", client_handler->sent.c_str ())); ACE_DEBUG((LM_DEBUG, "received: %C\n", client_handler->received.c_str ())); ACE_TEST_ASSERT (client_handler->sent == client_handler->received); ACE_END_TEST; return 0; } #else int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Dev_Poll_Reactor_Echo_Test")); ACE_ERROR ((LM_INFO, ACE_TEXT ("Dev Poll and Event Poll are not supported ") ACE_TEXT ("on this platform\n"))); ACE_END_TEST; return 0; } #endif /* ACE_HAS_DEV_POLL || ACE_HAS_EVENT_POLL */ ace-8.0.4+dfsg.orig/tests/pharlap/0000755000175000017500000000000015046037655015767 5ustar sudipsudipace-8.0.4+dfsg.orig/tests/pharlap/run_pharlap_tests.bat0000755000175000017500000000623615027201773022217 0ustar sudipsudip@echo off rem This file runs all the tests on PharLap ETS. rem To use this either give it no arguments to run all the tests or rem pass it the test name (without the extention) to run only one rem test setlocal set arg=%1 if not "%1" == "" goto runtest :runall rem call %0 ACE_Init_Test call %0 Atomic_Op_Test call %0 Barrier_Test call %0 Basic_Types_Test call %0 Buffer_Stream_Test call %0 CDR_Test call %0 Collection_Test call %0 Conn_Test call %0 Cached_Conn_Test call %0 Cached_Accept_Conn_Test call %0 DLL_Test call %0 DLList_Test call %0 Enum_Interfaces_Test call %0 Env_Value_Test call %0 Future_Test call %0 Handle_Set_Test call %0 Hash_Map_Manager_Test call %0 Lazy_Map_Manager_Test call %0 Hash_Map_Bucket_Iterator_Test call %0 High_Res_Timer_Test call %0 IOStream_Test call %0 Map_Manager_Test call %0 Cache_Map_Manager_Test call %0 Map_Test rem call %0 Mem_Map_Test not supported call %0 Message_Block_Test call %0 Message_Queue_Notifications_Test call %0 Message_Queue_Test call %0 MT_Reactor_Timer_Test rem call %0 MM_Shared_Memory_Test not supported call %0 MT_SOCK_Test call %0 Naming_Test call %0 New_Fail_Test call %0 Notify_Performance_Test call %0 Object_Manager_Test call %0 OrdMultiSet_Test call %0 Pipe_Test call %0 Priority_Buffer_Test call %0 Dynamic_Priority_Test call %0 Priority_Reactor_Test call %0 Priority_Task_Test call %0 Process_Mutex_Test call %0 Process_Strategy_Test call %0 RB_Tree_Test call %0 Reactors_Test call %0 Reactor_Exceptions_Test call %0 Reactor_Notify_Test call %0 Reactor_Performance_Test call %0 Reactor_Timer_Test call %0 Reader_Writer_Test call %0 Thread_Pool_Reactor_Test call %0 Recursive_Mutex_Test call %0 Reverse_Lock_Test call %0 Semaphore_Test call %0 Service_Config_Test call %0 Sigset_Ops_Test call %0 Simple_Message_Block_Test call %0 Svc_Handler_Test call %0 SOCK_Test call %0 SOCK_Connector_Test call %0 SOCK_Send_Recv_Test rem call %0 SPIPE_Test not supported call %0 SString_Test call %0 SV_Shared_Memory_Test call %0 Task_Test call %0 Thread_Manager_Test call %0 Thread_Mutex_Test call %0 Thread_Pool_Test call %0 Timer_Queue_Test call %0 Timeprobe_Test if exist ..\netsvcs\servers\main.exe call %0 Time_Service_Test call %0 Time_Value_Test call %0 Tokens_Test call %0 TSS_Test call %0 UPIPE_SAP_Test call %0 Upgradable_RW_Test goto done :runtest echo Running %arg% if not exist %arg%_ETS.exe goto nofile RUNEMB -LOGHOST -NODIALOG %arg%_ETS.exe > log\%arg%.log if errorlevel 0 goto fine echo. echo %arg% has FAILED!!! echo. type log\%arg%.log | find /I "Abnormal program termination" type log/%arg%.log | find /I "target halted" type log/%arg%.log | find /I "Fatal error" type log\%arg%.log | find /I "assertion failed" type log\%arg%.log | find /I "not supported" type log\%arg%.log | find /I "no such file or directory" type log\%arg%.log | find /I "invalid argument" type log\%arg%.log | find /I "timeout" type log\%arg%.log | find /I "bad file number" type log\%arg%.log | find /I "Win32 structured exception" echo. goto done :nofile echo %arg%.exe not found goto done :fine rem We should check the log files here to make sure the test ended correctly rem type log\%arg%.log | find "Ending" :done endlocal ace-8.0.4+dfsg.orig/tests/Bug_2368_Regression_Test.cpp0000644000175000017500000000467115027201773021443 0ustar sudipsudip/** * @file Bug_2368_Regression_Test.cpp * * Reproduces the problems reported in bug 2368: * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=2368 * * @author Johnny Willemsen */ #include "test_config.h" #include "ace/Service_Config.h" #include "ace/Reactor.h" #include "ace/Log_Msg.h" #include "ace/Signal.h" static bool handleA_close_called = false; static bool handleB_close_called = false; class My_HandlerA : public ACE_Event_Handler { public: int handle_close (ACE_HANDLE, ACE_Reactor_Mask) override { ACE_DEBUG ((LM_DEBUG, "Handle close called\n")); handleA_close_called = true; return 0; } int handle_signal (int, siginfo_t *, ucontext_t *) override { ACE_DEBUG ((LM_DEBUG, "Handle signal called\n")); return 0; } }; class My_HandlerB : public ACE_Event_Handler { public: int handle_close (ACE_HANDLE, ACE_Reactor_Mask) override { ACE_DEBUG ((LM_DEBUG, "Handle close called\n")); handleB_close_called = true; return 0; } int handle_signal (int, siginfo_t *, ucontext_t *) override { ACE_DEBUG ((LM_DEBUG, "Handle signal called\n")); return 0; } }; int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Bug_2368_Regression_Test")); My_HandlerA my_handlerA; My_HandlerB my_handlerB; // Set up an ACE signal handler. if (ACE_Reactor::instance ()->register_handler (SIGINT, &my_handlerA) == -1) ACE_ERROR ((LM_DEBUG, ACE_TEXT ("%p\n"), ACE_TEXT ("register_handlerA"))); if (ACE_Reactor::instance ()->register_handler (SIGTERM, &my_handlerB) == -1) ACE_ERROR ((LM_DEBUG, ACE_TEXT ("%p\n"), ACE_TEXT ("register_handlerB"))); ACE_Sig_Action *new_disp = 0; if (ACE_Reactor::instance ()->remove_handler (SIGINT, new_disp) == -1) ACE_ERROR ((LM_DEBUG, ACE_TEXT ("%p\n"), ACE_TEXT ("remove_handlerB"))); if (ACE_Reactor::instance ()->close () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("close"))); if (!handleA_close_called) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Handle close hasn't been called for A.\n"))); if (!handleB_close_called) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Handle close hasn't been called for B.\n"))); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/ACE_Test.cpp0000644000175000017500000000560715027201773016434 0ustar sudipsudip// ============================================================================ // // = LIBRARY // tests // // = DESCRIPTION // This simple test exercises and illustrates use of ACE value-added // functions. // // = AUTHOR // Steve Huston // // ============================================================================ #include "test_config.h" #include "ace/ACE.h" #include "ace/OS_NS_stdlib.h" int log2_test () { u_long values[] = {1, 2, 4, 8, 1048576}; u_long results[] = {0, 1, 2, 3, 20}; u_long result = 0; int error_count = 0; for (size_t i = 0 ; i < sizeof (values) / sizeof (u_long) ; i++) { result = ACE::log2(values [i]); if (result != results [i]) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Log2 error: input %d, output %d, expected %d\n"), values [i], result, results [i])); error_count++; } } return error_count; } int ace_debug_test () { int test_status = 0; // Check if ACE::debug() is by default false when no ACE_DEBUG environment variable // is there const char* debug = ACE_OS::getenv ("ACE_DEBUG"); if (debug == 0) { if (ACE::debug()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE::debug() returns true.\n"))); } else { if (!ACE::debug()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE::debug() returns false.\n"))); } return test_status; } // Test ACE::execname to be sure it finds .exe without regard to case. int execname_test () { int error_count = 0; // This test is only interesting on Win32 #if defined (ACE_WIN32) const ACE_TCHAR *newname; const ACE_TCHAR *prog1 = ACE_TEXT ("myprog.exe"); const ACE_TCHAR *prog2 = ACE_TEXT ("myprog.EXE"); const ACE_TCHAR *prog3 = ACE_TEXT ("myprog"); newname = ACE::execname (prog1); if (newname != prog1) // Didn't find .exe correctly { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Name %s, not %s\n"), newname, prog1)); delete [] const_cast (newname); ++error_count; } newname = ACE::execname (prog2); if (newname != prog2) // Didn't find .exe correctly { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Name %s, not %s\n"), newname, prog2)); delete [] const_cast (newname); ++error_count; } newname = ACE::execname (prog3); if (newname == prog3) // Thought the name didn't need .exe { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Says .exe not needed for %s\n"), newname)); ++error_count; } else delete [] const_cast (newname); #endif /* ACE_WIN32 */ return error_count; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("ACE_Test")); int status = 0; int result; if ((result = execname_test ()) != 0) status = result; if ((result = log2_test ()) != 0) status = result; if ((result = ace_debug_test ()) != 0) status = result; ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/Reactor_Registration_Test.cpp0000644000175000017500000001141015027201773022162 0ustar sudipsudip //============================================================================= /** * @file Reactor_Registration_Test.cpp * * This is a test of registering handlers with the Reactor. * * @author Irfan Pyarali */ //============================================================================= #include "test_config.h" #include "ace/Pipe.h" #include "ace/Reactor.h" #include "ace/Select_Reactor.h" #include "ace/TP_Reactor.h" #include "ace/WFMO_Reactor.h" #include "ace/ACE.h" static const char message[] = "abcdefghijklmnopqrstuvwxyz"; static const size_t message_size = 26; static int iteration = 1; class Event_Handler : public ACE_Event_Handler { public: Event_Handler (ACE_Reactor &reactor, ACE_HANDLE read, ACE_HANDLE write); ~Event_Handler () override; int handle_input (ACE_HANDLE fd = ACE_INVALID_HANDLE) override; int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask) override; ACE_Pipe pipe_; bool ok_; }; Event_Handler::Event_Handler (ACE_Reactor &reactor, ACE_HANDLE read, ACE_HANDLE write) : ACE_Event_Handler (&reactor), pipe_ (read, write), ok_ (false) { if (read == ACE_INVALID_HANDLE) { if (0 != this->pipe_.open ()) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Event_Handler pipe"))); return; } } if (0 != this->reactor ()->register_handler (this->pipe_.read_handle (), this, ACE_Event_Handler::READ_MASK)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Event_Handler register_handler"))); return; } ssize_t result = ACE::send_n (this->pipe_.write_handle (), message, message_size); if (result != ssize_t (message_size)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Event_Handler sent %b bytes; should be %B\n"), result, message_size)); if (result <= 0) return; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Event_Handler::Event_Handler for %@\n"), this)); this->ok_ = true; } Event_Handler::~Event_Handler () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Event_Handler::~Event_Handler for %@\n"), this)); } int Event_Handler::handle_input (ACE_HANDLE handle) { char buf[message_size + 1]; ssize_t result = ACE::recv_n (handle, buf, sizeof buf - 1); if (result != static_cast (message_size)) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Handler recv'd %b bytes; expected %B\n"), result, message_size)); buf[result > 0 ? result : 0] = '\0'; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Message %C received for %@\n"), buf, this)); return -1; } int Event_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask) { switch (iteration) { case 1: new Event_Handler (*this->reactor (), ACE_INVALID_HANDLE, ACE_INVALID_HANDLE); break; case 2: new Event_Handler (*this->reactor (), this->pipe_.read_handle (), this->pipe_.write_handle ()); break; case 3: this->reactor ()->end_reactor_event_loop (); break; } iteration++; delete this; return 0; } void test (ACE_Reactor_Impl &reactor_impl, const char *reactor_type) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nTesting with %C\n\n"), reactor_type)); ACE_Reactor reactor (&reactor_impl, 0); Event_Handler *e = new Event_Handler (reactor, ACE_INVALID_HANDLE, ACE_INVALID_HANDLE); if (!e->ok_) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error initializing test; aborting.\n"))); delete e; return; } reactor.run_reactor_event_loop (); } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Reactor_Registration_Test")); iteration = 1; ACE_Select_Reactor select_reactor; test (select_reactor, "ACE_Select_Reactor"); iteration = 1; ACE_TP_Reactor tp_reactor; test (tp_reactor, "ACE_TP_Reactor"); // The ACE_WFMO_Reactor stuff needs Winsock2 #if defined (ACE_WIN32) && \ (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) iteration = 1; ACE_WFMO_Reactor wfmo_reactor; test (wfmo_reactor, "ACE_WFMO_Reactor"); #endif /* ACE_WIN32 && ACE_HAS_WINSOCK2 */ ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Notification_Queue_Unit_Test.cpp0000644000175000017500000002544615027201773022640 0ustar sudipsudip/** * @file Notification_Queue_Unit_Test.cpp * * A unit test for the ACE_Notification_Queue class. * * @author Carlos O'Ryan */ #include "test_config.h" #include "ace/Notification_Queue.h" #define TEST_LIST \ ACTION(null_test) \ ACTION(pop_returns_element_pushed) \ ACTION(purge_empty_queue) \ ACTION(purge_with_no_matches) \ ACTION(purge_with_single_match) \ ACTION(purge_with_multiple_matches) \ ACTION(reset_empty_queue) \ ACTION(reset_non_empty_queue) \ // Declare all the tests #define ACTION(TEST_NAME) void TEST_NAME (char const * test_name); TEST_LIST #undef ACTION int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Notification_Queue_Unit_Test")); // Call all the tests #define ACTION(TEST_NAME) TEST_NAME (#TEST_NAME); TEST_LIST #undef ACTION ACE_END_TEST; return 0; } // There are far more elegant ways to do this. Ideally one would use // an existing framework (Boost.Test, TUT, CppTest). But this will // do for our purposes void test_equal(int x, int y, char const * x_msg, char const * y_msg, char const * error_message, char const * test_name, char const * filename, int lineno); void test_equal(void * x, void * y, char const * x_msg, char const * y_msg, char const * error_message, char const * test_name, char const * filename, int lineno); void test_not_equal(int x, int y, char const * x_msg, char const * y_msg, char const * error_message, char const * test_name, char const * filename, int lineno); void test_assert(bool predicate, char const * predicate_msg, char const * error_message, char const * test_name, char const * filename, int lineno); #define TEST_EQUAL(X, Y, MSG) \ test_equal((X), (Y), #X, #Y, MSG, test_name, __FILE__, __LINE__) #define TEST_NOT_EQUAL(X, Y, MSG) \ test_not_equal((X), (Y), #X, #Y, MSG, test_name, __FILE__, __LINE__) #define TEST_ASSERT(PREDICATE, MESSAGE) \ test_assert((PREDICATE), #PREDICATE, MESSAGE, test_name, __FILE__, __LINE__) void null_test(char const * test_name) { ACE_Notification_Queue queue; TEST_EQUAL(0, 0, "Test framework failure"); TEST_NOT_EQUAL(1, 0, "Test framework failure"); TEST_ASSERT(true, "True is still true"); } class Event_Handler : public ACE_Event_Handler { public: Event_Handler(int event_handler_id) : ACE_Event_Handler() , id (event_handler_id) { } int id; }; void pop_returns_element_pushed(char const * test_name) { ACE_Notification_Queue queue; Event_Handler eh1(1); Event_Handler eh2(2); Event_Handler eh3(2); int result = queue.push_new_notification( ACE_Notification_Buffer(&eh1, ACE_Event_Handler::READ_MASK)); TEST_ASSERT(result == 1, "push[1] should return 1"); result = queue.push_new_notification( ACE_Notification_Buffer(&eh2, ACE_Event_Handler::WRITE_MASK)); TEST_ASSERT(result == 0, "push[2] should return 0"); result = queue.push_new_notification( ACE_Notification_Buffer(&eh3, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK)); TEST_ASSERT(result == 0, "push[3] should return 0"); ACE_Notification_Buffer current; bool more_messages_queued; ACE_Notification_Buffer next; result = queue.pop_next_notification(current, more_messages_queued, next); TEST_ASSERT(result == 1, "pop[0] should return 1"); TEST_ASSERT(more_messages_queued, "pop[0] should have more messages"); TEST_EQUAL(current.eh_, &eh1, "Wrong handler extracted"); TEST_EQUAL(current.mask_, ACE_Event_Handler::READ_MASK, "Wrong mask extracted"); result = queue.pop_next_notification(current, more_messages_queued, next); TEST_ASSERT(result == 1, "pop[1] should return 1"); TEST_ASSERT(more_messages_queued, "pop[1] should have more messages"); TEST_EQUAL(current.eh_, &eh2, "Wrong handler extracted"); TEST_EQUAL(current.mask_, ACE_Event_Handler::WRITE_MASK, "Wrong mask extracted"); result = queue.pop_next_notification(current, more_messages_queued, next); TEST_ASSERT(result == 1, "pop[2] should return 1"); TEST_ASSERT(!more_messages_queued, "pop[2] should not have more messages"); TEST_EQUAL(current.eh_, &eh3, "Wrong handler extracted"); TEST_EQUAL(current.mask_, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK, "Wrong mask extracted"); more_messages_queued = true; result = queue.pop_next_notification(current, more_messages_queued, next); TEST_ASSERT(result == 0, "pop[3] should return 0"); TEST_ASSERT(!more_messages_queued, "pop[3] should not have more messages"); } void purge_empty_queue(char const * test_name) { ACE_Notification_Queue queue; Event_Handler eh1(1); int result = queue.purge_pending_notifications(&eh1, ACE_Event_Handler::READ_MASK); TEST_ASSERT(result == 0, "purge of empty queue should return 0"); } void purge_with_no_matches(char const * test_name) { ACE_Notification_Queue queue; Event_Handler eh1(1); Event_Handler eh2(2); int result = queue.push_new_notification( ACE_Notification_Buffer(&eh1, ACE_Event_Handler::READ_MASK)); result = queue.purge_pending_notifications(&eh2, ACE_Event_Handler::READ_MASK); TEST_ASSERT(result == 0, "purge of eh2 should return 0"); result = queue.purge_pending_notifications(&eh1, ACE_Event_Handler::WRITE_MASK); TEST_ASSERT(result == 0, "purge of eh1/WRITE should return 0"); } void purge_with_single_match(char const * test_name) { ACE_Notification_Queue queue; Event_Handler eh1(1); Event_Handler eh2(2); int result = queue.push_new_notification( ACE_Notification_Buffer(&eh1, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK)); result = queue.push_new_notification( ACE_Notification_Buffer(&eh1, ACE_Event_Handler::WRITE_MASK)); result = queue.push_new_notification( ACE_Notification_Buffer(&eh2, ACE_Event_Handler::READ_MASK)); result = queue.push_new_notification( ACE_Notification_Buffer(&eh2, ACE_Event_Handler::WRITE_MASK)); result = queue.push_new_notification( ACE_Notification_Buffer(&eh2, ACE_Event_Handler::WRITE_MASK)); result = queue.push_new_notification( ACE_Notification_Buffer(&eh2, ACE_Event_Handler::WRITE_MASK)); result = queue.purge_pending_notifications(&eh2, ACE_Event_Handler::READ_MASK); TEST_EQUAL(result, 1, "purge of eh2/READ should return 1"); result = queue.purge_pending_notifications(&eh1, ACE_Event_Handler::READ_MASK); TEST_EQUAL(result, 0, "purge of eh1/READ should return 0"); } void purge_with_multiple_matches(char const * test_name) { ACE_Notification_Queue queue; Event_Handler eh1(1); Event_Handler eh2(2); int result = queue.push_new_notification( ACE_Notification_Buffer(&eh1, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK)); result = queue.push_new_notification( ACE_Notification_Buffer(&eh1, ACE_Event_Handler::WRITE_MASK)); result = queue.push_new_notification( ACE_Notification_Buffer(&eh2, ACE_Event_Handler::READ_MASK)); result = queue.push_new_notification( ACE_Notification_Buffer(&eh2, ACE_Event_Handler::WRITE_MASK)); result = queue.push_new_notification( ACE_Notification_Buffer(&eh2, ACE_Event_Handler::WRITE_MASK)); result = queue.push_new_notification( ACE_Notification_Buffer(&eh2, ACE_Event_Handler::WRITE_MASK)); result = queue.purge_pending_notifications(&eh2, ACE_Event_Handler::WRITE_MASK); TEST_EQUAL(result, 3, "purge of eh2/WRITE should return 3"); result = queue.purge_pending_notifications(&eh1, ACE_Event_Handler::WRITE_MASK); TEST_EQUAL(result, 1, "purge of eh1/WRITE should return 1"); } void reset_empty_queue(char const * /* test_name */) { ACE_Notification_Queue queue; queue.reset(); } void reset_non_empty_queue(char const * /* test_name */) { ACE_Notification_Queue queue; Event_Handler eh1(1); Event_Handler eh2(2); queue.push_new_notification( ACE_Notification_Buffer(0, ACE_Event_Handler::READ_MASK)); queue.push_new_notification( ACE_Notification_Buffer(&eh1, ACE_Event_Handler::READ_MASK)); queue.push_new_notification( ACE_Notification_Buffer(&eh2, ACE_Event_Handler::WRITE_MASK)); queue.push_new_notification( ACE_Notification_Buffer(0, ACE_Event_Handler::WRITE_MASK)); queue.reset(); } void test_equal(int x, int y, char const * x_msg, char const * y_msg, char const * error_message, char const * test_name, char const * filename, int lineno) { if (x == y) return; ACE_ERROR ((LM_ERROR, ACE_TEXT("%C in (%C %C:%d) %C (%d) != %C (%d)\n"), error_message, test_name, filename, lineno, x_msg, x, y_msg, y)); } void test_equal(void * x, void * y, char const * x_msg, char const * y_msg, char const * error_message, char const * test_name, char const * filename, int lineno) { if (x == y) return; ACE_ERROR ((LM_ERROR, ACE_TEXT("%C in (%C %C:%d) %C (%@) != %C (%@)\n"), error_message, test_name, filename, lineno, x_msg, x, y_msg, y)); } void test_not_equal(int x, int y, char const * x_msg, char const * y_msg, char const * error_message, char const * test_name, char const * filename, int lineno) { if (x != y) return; ACE_ERROR ((LM_ERROR, ACE_TEXT("%C in (%C %C:%d) %C (%d) != %C (%d)\n"), error_message, test_name, filename, lineno, x_msg, x, y_msg, y)); } void test_assert(bool predicate, char const * predicate_msg, char const * error_message, char const * test_name, char const * filename, int lineno) { if (predicate) return; ACE_ERROR ((LM_ERROR, ACE_TEXT("Assertion in (%C %C:%d) %C %C\n"), test_name, filename, lineno, predicate_msg, error_message)); } ace-8.0.4+dfsg.orig/tests/Conn_Test.h0000644000175000017500000000212315027201773016374 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Conn_Test.h * * @author Irfan Pyarali */ //============================================================================= #include "ace/Service_Config.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Null_Condition.h" #include "ace/Svc_Handler.h" #include "ace/SOCK_Stream.h" /** * @class Svc_Handler * * @brief This class is the product created by both * and objects. */ class Svc_Handler : public ACE_Svc_Handler { public: /// Do-nothing constructor. Svc_Handler (ACE_Thread_Manager * = 0); /// Initialization hook. virtual int open (void *); /// Prepare for recycling. virtual int recycle (void * = 0); /// Send data to server. void send_data (); /// Recv data from client. void recv_data (); /// Shutdown the . int close (u_long = 0); /// Set to idle. int idle (u_long flags); }; ace-8.0.4+dfsg.orig/tests/Bug_3912_Regression_Test.cpp0000644000175000017500000001170515027201773021433 0ustar sudipsudip// ============================================================================ // // = LIBRARY // tests // // = DESCRIPTION // This test asserts that close is called on Modules during // ACE_Service_Repository shutdown // // = AUTHOR // Chad Beaulac // // ============================================================================ #include "test_config.h" #include "ace/Log_Msg.h" #include "ace/Service_Config.h" #include "ace/Service_Repository.h" #include "ace/Service_Object.h" #include "ace/Service_Types.h" #include "ace/Task.h" #include "ace/Module.h" using MT_Task = ACE_Task; using MT_Module = ACE_Module; /** * We use this Task to track if close was called. */ class Close_Handler : public virtual MT_Task { public: Close_Handler(bool* close_called_arg) : close_called_ (close_called_arg) { } int close(u_long ) override; private: bool* close_called_; }; int Close_Handler::close(u_long ) { ACE_DEBUG ((LM_DEBUG,"Close_Handler::close \n")); *close_called_ = true; return 0; } int run_test (int argc, ACE_TCHAR *argv[]) { int status = 0; bool close_called = false; Close_Handler* close_handler = 0; ACE_NEW_RETURN(close_handler, Close_Handler (&close_called), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Opening service config\n"))); status = ACE_Service_Config::open (argc, argv, ACE_DEFAULT_LOGGER_KEY, true, true /*ignore def svc.conf*/); if (status != 0) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("run_test, %p\n") ACE_TEXT ("ACE_Service_Config::open")), status); } else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Service config opened\n"))); ACE_Service_Repository *asr = ACE_Service_Repository::instance (); if (asr == 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("run_test, no service repository\n")), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Finding close test module\n"))); const ACE_Service_Type* st = 0; status = asr->find (ACE_TEXT ("Close_Test_Module"), &st); if (status != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("run_test, %p on Close_Test_Module\n") ACE_TEXT ("ACE_Service_Repository::find")), status); // // Put our Close_Handler Task into the Module // MT_Module* close_test_module = static_cast (st->type()->object ()); if (close_test_module == 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("run_test, no close test module\n")), -1); close_test_module->reader (close_handler); // // Remove the Module from the Stream. // This is what happens during ACE_Service_Repository::fini // We want to make sure that close is called on Modules and their Tasks // at this time to ensure proper cleanup during the shutdown sequence // by getting the close methods called so user shutdown hooks can fire. // const ACE_Module_Type* module_type = static_cast< const ACE_Module_Type*>(st->type ()); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Finding close test stream\n"))); status = asr->find (ACE_TEXT ("Close_Test_Stream"), &st); if (status != 0) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("run_test, %p on Close_Test_Stream\n") ACE_TEXT ("ACE_Service_Repository::find")), status); } const ACE_Stream_Type* close_test_stream = static_cast (st->type ()); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Removing module\n"))); ACE_Stream_Type *nc_stream = const_cast(close_test_stream); ACE_Module_Type *nc_module = const_cast(module_type); nc_stream->remove (nc_module); if (!close_called) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("close not called\n"))); ++status; } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" SUCCESS: close called\n"))); } return status; } int run_main(int, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Bug_3912_Regression_Test")); ACE_TCHAR conf_file_name [MAXPATHLEN]; #if defined (TEST_DIR) ACE_OS::strcpy (conf_file_name, TEST_DIR); ACE_OS::strcat (conf_file_name, ACE_DIRECTORY_SEPARATOR_STR); ACE_OS::strcat (conf_file_name, ACE_TEXT ("Bug_3912_Regression_Test.conf")); #else ACE_OS::strcpy (conf_file_name, ACE_TEXT ("Bug_3912_Regression_Test.conf")); #endif ACE_TCHAR * _argv[3] = {argv[0], const_cast (ACE_TEXT ("-f")), const_cast (conf_file_name)}; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Starting test\n"))); int status = run_test (3,_argv); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Closing service config\n"))); ACE_Service_Config::fini_svcs (); ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/Compiler_Features_34_Test.cpp0000644000175000017500000000067715027201773021764 0ustar sudipsudip/** * This program checks if the compiler doesn't have a certain bug * that we encountered when testing C++11 features */ #include "test_config.h" class B { public: private: B& operator= (B&& x) = delete; }; int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT("Compiler_Features_34_Test")); B a; ACE_UNUSED_ARG (a); ACE_DEBUG ((LM_INFO, ACE_TEXT ("C++11 support ok\n"))); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Compiler_Features_20_DLL.cpp0000644000175000017500000000004715027201773021442 0ustar sudipsudip#include "Compiler_Features_20_DLL.h" ace-8.0.4+dfsg.orig/tests/SString_Test.cpp0000644000175000017500000003675115027201773017441 0ustar sudipsudip//============================================================================= /** * @file SString_Test.cpp * * This is a simple test that illustrates the use of ACE_CString * and ACE_WString. No command line arguments are needed to run * the test. * * @author Prashant Jain */ //============================================================================= #include "test_config.h" #include "ace/OS_NS_string.h" #include #include "ace/SString.h" static int testConcatenation() { #ifdef ACE_HAS_WCHAR ACE_WString s1; s1 += L'H'; if (s1 != ACE_WString(L"H")) { ACE_ERROR((LM_ERROR, "Concat wchar_t\n")); return 1; } s1 = ACE_WString(L"Hello"); s1 += L" World"; if (s1 != ACE_WString(L"Hello World")) { ACE_ERROR((LM_ERROR, "Concat wchar_t*\n")); return 1; } s1 = L"Hello"; s1 += ACE_WString(L" World"); if (s1 != ACE_WString(L"Hello World")) { ACE_ERROR((LM_ERROR, "Concat wstring\n")); return 1; } s1 = L"Hello"; s1.append(L" World", 6); if (s1 != ACE_WString(L"Hello World")) { ACE_ERROR((LM_ERROR, "Concat wchar_t* 2\n")); return 1; } s1 += L'.'; if (s1 != ACE_WString(L"Hello World.")) { ACE_ERROR((LM_ERROR, "Concat wchar_t\n")); return 1; } ACE_WString s2(L"Hello World"); s2 += L'.'; if (s2 != ACE_WString(L"Hello World.")) { ACE_ERROR((LM_ERROR, "Concat wchar_t 2\n")); return 1; } #endif /* ACE_HAS_WCHAR */ return 0; } int testIterator() { ACE_CString s1 ("Hello, World"); // Use the advance () method to count number of characters. size_t count = 0; for (ACE_CString::ITERATOR iter (s1); !iter.done (); iter.advance ()) ++ count; if (count != s1.length ()) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("advance () failed")), 1); // Use the prefix operator to count number of characters. count = 0; for (ACE_CString::ITERATOR iter (s1); !iter.done (); ++ iter) ++ count; if (count != s1.length ()) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("++ operator failed")), 1); count = 0; for (ACE_CString::iterator iter = s1.begin (), iter_end = s1.end (); iter != iter_end; iter ++) { ++ count; } if (count != s1.length ()) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("end () failed")), 1); ACE_CString::iterator iter1 (s1); if (*iter1 != s1[0]) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("dereference operator failed")), 1); return 0; } int testConstIterator() { const ACE_CString s1 ("Hello, World"); // Use the advance () method to count number of characters. size_t count = 0; for (ACE_CString::CONST_ITERATOR iter (s1); !iter.done (); iter.advance ()) ++count; if (count != s1.length ()) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("advance () failed")), 1); // Use the prefix operator to count number of characters. count = 0; for (ACE_CString::CONST_ITERATOR iter (s1); !iter.done (); ++ iter) ++ count; if (count != s1.length ()) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("++ operator failed")), 1); count = 0; for (ACE_CString::const_iterator iter = s1.begin (), iter_end = s1.end (); iter != iter_end; iter ++) { ++ count; } if (count != s1.length ()) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("end () failed")), 1); ACE_CString::const_iterator iter1 (s1); if (*iter1 != s1[0]) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("dereference operator failed")), 1); return 0; } int testAutoStringFree() { char* s = ACE_OS::strdup("Hello, World"); ACE_Auto_String_Free const s1(s); if (s1) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Auto_String_Free::operator bool for s1 correct\n"))); } else { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("ACE_Auto_String_Free::operator bool for s1 return false")), 1); } if (!s1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("!ACE_Auto_String_Free::operator bool s1 return true")), 1); } ACE_Auto_String_Free const s2; if (s2) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("ACE_Auto_String_Free s2 is not empty")), 1); } return 0; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("SString_Test")); { /* Set #1 */ ACE_CString s0 ("hello"); ACE_CString s1 ("hello"); ACE_CString s2 ("world"); ACE_CString s3 ("ll"); ACE_CString s4 ("ello"); ACE_CString s5 = s1 + " " + s2; char single_character = 'z'; ACE_CString single_character_string (single_character); ACE_CString empty_string; ACE_CString zero_size_string (s1.c_str (), 0, 0, 1); if (ACE_CString::npos == 0) ACE_ERROR((LM_ERROR,"Set #1: npos is incorrect.\n")); // Not equal comparisons. Error if they are equal if (s1 == s2){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} if (s1 == s5){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} // Equal comparisons. Error if they are not equal if (s1 != s1){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} if (s1 != s0){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} // Substring match. Error if they are not equal if (s1.strstr (s2) != ACE_CString::npos){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} if (s1.strstr (s3) != 2){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} if (s3.strstr (s1) != ACE_CString::npos){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} if (s1.strstr (s4) != 1){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} // Substring creation. Error if they are not equal if (s1.substring (0) != s1){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} if (s1.substring (1) != s4){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} if (s1.substring (2, 2) != s3){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} if (s1.substring (0, 0) != empty_string){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} if (s1.substring (4, 10).length () != 1){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} // Forward search. Error if they are not equal if (s1.find (s3) != 2){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} if (s3.find (s1) != ACE_CString::npos){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} if (s1.find (s3, 2) != 2){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} if (s3.find (s1, 1) != ACE_CString::npos){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} if (s1.find (s2) != ACE_CString::npos){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} if (s1.find ('o') != 4){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} // Reverse search. Error if they are not equal if (s1.rfind ('l') != 3){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} if (s1.rfind ('l', 3) != 2){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} // Assignment. Error if they are not equal ACE_CString s6; s6 = s0; if (s6 != s0){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} s6 = s4; if (s4 != s6){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} s6 = s5; if (s6 != s5){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;} } { /* Set #2 */ ACE_CString s0 = "hello"; ACE_CString s1 ("hello", 0, false); ACE_CString s2 ("world", 0, false); ACE_CString s3 ("ll", 0, false); ACE_CString s4 ("ello", 0, false); ACE_CString s5 = s1 + " " + s2; char single_character = 'z'; ACE_CString single_character_string (single_character); ACE_CString empty_string (0, 0, false); ACE_CString zero_size_string (s1.c_str (), 0, 0, false); // Not equal comparisons. Error if they are equal if (s1 == s2){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} if (s1 == s5){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} // Equal comparisons. Error if they are not equal if (s1 != s1){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} if (s1 != s0){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} // Substring match. Error if they are not equal if (s1.strstr (s2) != ACE_CString::npos){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} if (s1.strstr (s3) != 2){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} if (s3.strstr (s1) != ACE_CString::npos){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} if (s1.strstr (s4) != 1){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} // Substring creation. Error if they are not equal if (s1.substring (0) != s1){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} if (s1.substring (1) != s4){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} if (s1.substring (2, 2) != s3){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} if (s1.substring (0, 0) != empty_string){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} // Forward search. Error if they are not equal if (s1.find (s3) != 2){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} if (s3.find (s1) != ACE_CString::npos){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} if (s1.find (s3, 2) != 2){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} if (s3.find (s1, 1) != ACE_CString::npos){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} if (s1.find (s2) != ACE_CString::npos){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} if (s1.find ('o') != 4){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} // Reverse search. Error if they are not equal if (s1.rfind ('l') != 3){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} if (s1.rfind ('l', 3) != 2){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} // Assignment. Error if they are not equal ACE_CString s6; s6 = s0; if (s6 != s0){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} s6 = s4; if (s4 != s6){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} s6 = s5; if (s6 != s5){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} // Clear. Error if they are not equal s0.clear(); if (s0.length() != 0){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} // Rep. Error if they are not equal std::unique_ptr s (s1.rep ()); if (ACE_OS::strlen (s.get ()) != s1.length ()) { ACE_ERROR((LM_ERROR,"Auto_ptr s:\n")); }; ACE_CString s7 (s.get ()); if (s1 != s7){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;} } { /* Set #3 */ ACE_NS_WString s0 ("hello"); ACE_NS_WString s1 ("hello"); ACE_NS_WString s2 ("world"); ACE_NS_WString s3 ("ll"); ACE_NS_WString s4 ("ello"); ACE_NS_WString s5 = s1 + " " + s2; ACE_NS_WString s6 = ("hella"); // Same length as s1, off by one char. ACE_WCHAR_T single_character = 'z'; ACE_NS_WString single_character_string (single_character); ACE_NS_WString empty_string; ACE_NS_WString zero_size_string (s1.c_str (), 0, 0); // Not equal comparisons. Error if they are equal if (s1 == s2){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} if (s1 == s5){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} if (s1 == s6){ACE_ERROR((LM_ERROR,"Set #3: off-by-one failed\n"));return 1;} // Equal comparisons. Error if they are not equal if (s1 != s1){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} if (s1 != s0){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} // Substring match. Error if they are not equal if (s1.strstr (s2) != ACE_NS_WString::npos){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} if (s1.strstr (s3) != 2){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} if (s3.strstr (s1) != ACE_NS_WString::npos){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} if (s1.strstr (s4) != 1){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} // Substring creation. Error if they are not equal if (s1.substring (0) != s1){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} if (s1.substring (1) != s4){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} if (s1.substring (2, 2) != s3){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} if (s1.substring (0, 0) != empty_string){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} // Forward search. Error if they are not equal if (s1.find (s3) != 2){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} if (s3.find (s1) != ACE_NS_WString::npos){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} if (s1.find (s3, 2) != 2){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} if (s3.find (s1, 1) != ACE_NS_WString::npos){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} if (s1.find (s2) != ACE_NS_WString::npos){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} if (s1.find ('o') != 4){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} // Reverse search. Error if they are not equal if (s1.rfind ('l') != 3){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} if (s1.rfind ('l', 3) != 2){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} // Assignment. Error if they are not equal ACE_NS_WString s7; s7 = s0; if (s7 != s0){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} s7 = s4; if (s4 != s7){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} s7 = s5; if (s7 != s5){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} // Clear. Error if they are not equal s0.clear(); if (s0.length() != 0){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;} } { /* Set #4 */ ACE_CString s1("dog"); ACE_CString s2("d"); if (s1 == s2){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;} if (!(s1 > s2)){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;} if (s1 < s2){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;} ACE_CString s3 ("dog"); ACE_CString s4 ("dogbert"); if (s3 == s4){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;} if (!(s3 < s4)){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;} if (s3 > s4){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;} ACE_CString s5 ("dogbert",3); ACE_CString s6 ("dogbert",5); if(s5 == s6){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;} if(!(s5 < s6)){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;} if(s5 > s6){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;} ACE_CString s7 ("dogbert",4); ACE_CString s8 ("dogbert",2); if(s7 == s8){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;} if(!(s7 > s8)){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;} if(s7 < s8){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;} ACE_CString s9 ("dogbert",3); ACE_CString s10 ("dogbert"); if(s9 == s10){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;} if(!(s9 < s10)){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;} if(s9 > s10){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;} ACE_CString s11 ("dogbert",5); ACE_CString s12 ("dog"); if(s11 == s12){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;} if(!(s11 > s12)){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;} if(s11 < s12){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;} s11.fast_clear (); if (s11.length () != 0) ACE_ERROR ((LM_ERROR, ACE_TEXT ("fast_clear didn't yield 0 length\n"))); } { // Set 1 for ACE_SString, which is not tested ACE_SString sstr; const char *old = sstr.rep (); const char *str = "What_a_day_it_has_been"; sstr.rep (const_cast(str)); ACE_SString tmp = sstr.substring (2, 300); if (tmp.length () == 300) ACE_ERROR ((LM_ERROR, "SString substring\n")); // Constring an ACE_SString without a character pointer or from an // existing ACE_SString causes memory to be allocated that will not // be delete (apparently by design). ACE_Allocator::instance ()->free (const_cast (old)); ACE_Allocator::instance ()->free (const_cast (tmp.rep ())); } int err = testConcatenation (); err += testIterator (); err += testConstIterator (); err += testAutoStringFree (); ACE_END_TEST; return err; } ace-8.0.4+dfsg.orig/tests/Framework_Component_Test.cpp0000644000175000017500000001005315027201773022012 0ustar sudipsudip// ============================================================================ // // = LIBRARY // tests // // = DESCRIPTION // This program tests both the ACE_Framework_Compondent and ACE_Repository. // Since Framework Components are singletons that can live in dlls loaded // via the Service Configurator framework, this test uses that framework // to load services from a dll that has a singleton based on ACE_DLL_Singleton. // When the dll is finally ready to be unloaded, the singleton will be // automatically cleaned up just-in-time. // // = AUTHOR // Don Hinton // // ============================================================================ #include "test_config.h" #include "ace/Service_Config.h" #include "ace/ARGV.h" #include "ace/DLL_Manager.h" // Define a few macros--because they're so much fun, and keep the // code below a little cleaner... #if (ACE_USES_CLASSIC_SVC_CONF == 1) # define ADD_SERVICE(X) \ ACE_TEXT ("dynamic Server_") ACE_TEXT(#X) \ ACE_TEXT (" Service_Object * ") \ ACE_TEXT ("Framework_Component_DLL:_make_Server_") ACE_TEXT(#X) \ ACE_TEXT ("() ''") # define REMOVE_SERVICE(X) \ ACE_TEXT ("remove Server_") ACE_TEXT(#X) #else /* ACE_USES_CLASSIC_SVC_CONF */ # define ADD_SERVICE(X) \ ACE_TEXT (" ") # define REMOVE_SERVICE(X) \ ACE_TEXT ( " ") #endif /* ACE_USES_CLASSIC_SVC_CONF */ int run_test (u_long unload_mask = 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Running test with mask = %s|%s\n"), ACE_BIT_ENABLED(unload_mask, ACE_DLL_UNLOAD_POLICY_PER_DLL) == 0 ? ACE_TEXT ("PER_PROCESS") : ACE_TEXT ("PER_DLL"), ACE_BIT_ENABLED(unload_mask, ACE_DLL_UNLOAD_POLICY_LAZY) == 0 ? ACE_TEXT ("EAGER") : ACE_TEXT ("LAZY"))); ACE_DLL_Manager::instance ()->unload_policy (unload_mask); // Now, let the ACE Service Configurator framework load our service from a // dll, which contains a singleton. ACE_Service_Config::open (ACE_TEXT ("Framework_Component_Test"), ACE_DEFAULT_LOGGER_KEY, 1, 1, 1); // Now add server 1. ACE_Service_Config::process_directive (ADD_SERVICE(1)); // And unload the first one, could unload the dll. ACE_Service_Config::process_directive (REMOVE_SERVICE(1)); // Now readd server 1. ACE_Service_Config::process_directive (ADD_SERVICE(1)); // And load another service from the same library. ACE_Service_Config::process_directive (ADD_SERVICE(2)); // Unload the first one again, should *not* unload the dll this time. ACE_Service_Config::process_directive (REMOVE_SERVICE(1)); // And unload the second service. Since the ACE_DLL_Handle will no longer // have any references, the ACE_DLL_Manager will apply it's current unloading // strategy and either call ACE_OS::dlclose() immediately, schedule a timeout // the the reactor to call dlclose() some time in the future, or keep the // dll loaded until program termination. ACE_Service_Config::process_directive (REMOVE_SERVICE(2)); // Force unloading so we'll be ready for the next test. ACE_DLL_Manager::instance ()->unload_policy (ACE_DLL_UNLOAD_POLICY_DEFAULT); ACE_Service_Config::close (); return 0; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT("Framework_Component_Test")); int retval = 0; // Use defaults, i.e., per process, eager unloading. retval += run_test (ACE_DLL_UNLOAD_POLICY_DEFAULT); // Per process, lazy unloading retval += run_test (ACE_DLL_UNLOAD_POLICY_LAZY); // Per dll, eager unloading retval += run_test (ACE_DLL_UNLOAD_POLICY_PER_DLL); // Per dll, lazy unloading. retval += run_test (ACE_DLL_UNLOAD_POLICY_PER_DLL | ACE_DLL_UNLOAD_POLICY_LAZY); ACE_END_TEST; return retval == 0 ? 0 : -1; } ace-8.0.4+dfsg.orig/tests/Reactors_Test.cpp0000644000175000017500000001416615027201773017626 0ustar sudipsudip //============================================================================= /** * @file Reactors_Test.cpp * * This is a test that performs a torture test of multiple * and in the same process. * * @author Prashant Jain * @author Detlef Becker * @author and Douglas C. Schmidt */ //============================================================================= #include "test_config.h" #include "ace/Task.h" #include "ace/Reactor.h" #include "ace/Atomic_Op.h" #include "ace/Recursive_Thread_Mutex.h" #if defined (ACE_HAS_THREADS) ACE_Thread_Manager *thr_mgr; static const int MAX_TASKS = 20; /** * @class Test_Task * * @brief Exercise the tasks. */ class Test_Task : public ACE_Task { public: Test_Task (); ~Test_Task () override; //FUZZ: disable check_for_lack_ACE_OS // = Task hooks. ///FUZZ: enable check_for_lack_ACE_OS int open (void *args = 0) override; int close (u_long flags = 0) override; int svc () override; // = Event Handler hooks. int handle_input (ACE_HANDLE handle) override; int handle_close (ACE_HANDLE fd, ACE_Reactor_Mask close_mask) override; private: /// Number of iterations handled. size_t handled_; /// Number of tasks running. static int task_count_; }; // Static data member initialization. int Test_Task::task_count_ = 0; static ACE_Atomic_Op done_count = MAX_TASKS * 2; static ACE_Recursive_Thread_Mutex recursive_lock; Test_Task::Test_Task () : handled_ (0) { ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, recursive_lock); Test_Task::task_count_++; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) TT+ Test_Task::task_count_ = %d\n"), Test_Task::task_count_)); } Test_Task::~Test_Task () { ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, recursive_lock); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) TT- Test_Task::task_count_ = %d\n"), Test_Task::task_count_)); ACE_TEST_ASSERT (Test_Task::task_count_ == 0); } int Test_Task::open (void *args) { this->reactor (reinterpret_cast (args)); return this->activate (THR_NEW_LWP); } int Test_Task::close (u_long) { ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, recursive_lock, -1); Test_Task::task_count_--; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) close Test_Task::task_count_ = %d\n"), Test_Task::task_count_)); ACE_TEST_ASSERT (Test_Task::task_count_ >= 0); return 0; } int Test_Task::svc () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) svc\n"))); for (size_t i = 0; i < ACE_MAX_ITERATIONS; i++) { ACE_OS::thr_yield (); // Only wait up to 10 milliseconds to notify the Reactor. ACE_Time_Value timeout (0, 10 * 1000); if (this->reactor ()->notify (this, ACE_Event_Handler::READ_MASK, &timeout) == -1) { if (errno == ETIME) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("notify() timed out"))); else ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("notify")), -1); } } return 0; } int Test_Task::handle_close (ACE_HANDLE, ACE_Reactor_Mask) { return 0; } int Test_Task::handle_input (ACE_HANDLE) { this->handled_++; if (this->handled_ == ACE_MAX_ITERATIONS) { done_count--; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) handle_input, handled_ = %d, done_count = %d\n"), this->handled_, done_count.value ())); } ACE_OS::thr_yield (); return -1; } static void * worker (void *args) { ACE_Reactor *reactor = reinterpret_cast (args); // Make this thread the owner of the Reactor's event loop. reactor->owner (ACE_Thread::self ()); // Use a timeout to inform the Reactor when to shutdown. ACE_Time_Value timeout (4); for (;;) switch (reactor->handle_events (timeout)) { case -1: ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("reactor")), 0); /* NOTREACHED */ case 0: ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Reactor shutdown\n"))); return 0; } ACE_NOTREACHED (return 0); } #endif /* ACE_HAS_THREADS */ int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Reactors_Test")); #if defined (ACE_HAS_THREADS) ACE_TEST_ASSERT (ACE_LOG_MSG->op_status () != -1); thr_mgr = ACE_Thread_Manager::instance (); ACE_Reactor reactor; ACE_TEST_ASSERT (ACE_LOG_MSG->op_status () != -1); Test_Task tt1[MAX_TASKS]; Test_Task tt2[MAX_TASKS]; // Activate all of the Tasks. for (int i = 0; i < MAX_TASKS; i++) { tt1[i].open (ACE_Reactor::instance ()); tt2[i].open (&reactor); } // Spawn two threads each running a different reactor. if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (worker), (void *) ACE_Reactor::instance (), THR_BOUND | THR_DETACHED) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("spawn")), -1); else if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (worker), (void *) &reactor, THR_BOUND | THR_DETACHED) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("spawn")), -1); if (ACE_Thread_Manager::instance ()->wait () == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("wait")), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) all threads are finished\n"))); #else ACE_ERROR ((LM_INFO, ACE_TEXT ("threads not supported on this platform\n"))); #endif /* ACE_HAS_THREADS */ ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Compiler_Features_04_Test.cpp0000644000175000017500000000340415027201773021750 0ustar sudipsudip/** * @file * * This program checks if the compiler / platform supports the * std::set container. The motivation for this test was a discussion * on the development mailing list, and the documentation was captured * in: * * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=3715 */ #include "test_config.h" // The first part of the test is to compile this line. If the program // does not compile the platform is just too broken. #include int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT("Compiler_Features_04_Test")); // As usual, the exit status from the test is 0 on success, 1 on // failure int status = 0; // Create a simple list ... using collection = std::set; collection c; // ... insert some elements ... c.insert(5); c.insert(4); c.insert(3); c.insert(2); c.insert(1); // ... inserting twice returns a pair ... std::pair r = c.insert(collection::value_type(5)); // ... the iterator points to the element ... if (*r.first != 5) { status = 1; ACE_ERROR ((LM_ERROR, ACE_TEXT("Expected to find 5 already in set"))); } // ... and the booleans says that it is already in the set ... if (r.second == true) { status = 1; ACE_ERROR ((LM_ERROR, ACE_TEXT("Expected duplicate insert to fail"))); } // ... add all the numbers to validate that they are there ... int sum = 0; for(collection::iterator i = c.begin(), end = c.end(); i != end; ++i) { sum += *i; } // ... remember Euler ... int const expected = 5*(5+1)/2; if (sum != expected) { status = 1; ACE_ERROR ((LM_ERROR, ACE_TEXT("Expected %d got %d\n"), expected, sum)); } ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/Recursive_Condition_Test.cpp0000644000175000017500000002174315027201773022020 0ustar sudipsudip //============================================================================= /** * @file Recursive_Condition_Test.cpp * * This test program validates the functionality of the * ACE_Condition template * specialization. * * @author Stephen Howard and Douglas C. Schmidt */ //============================================================================= #include "test_config.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_sys_time.h" #include "ace/Event_Handler.h" #include "ace/Log_Msg.h" #include "ace/Thread_Manager.h" #include "ace/Timer_Heap.h" #include "ace/Timer_Queue_Adapters.h" #if defined (ACE_HAS_THREADS) using Thread_Timer_Queue = ACE_Thread_Timer_Queue_Adapter; class Test_Handler : public ACE_Event_Handler { public: Test_Handler () : nr_expirations_ (0) {} int nr_expirations () { return this->nr_expirations_; } int handle_timeout (const ACE_Time_Value &, const void *arg) override { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Test_Handler::handle_timeout\n"))); ++this->nr_expirations_; void *nc_arg = const_cast (arg); Thread_Timer_Queue *timer_queue = reinterpret_cast (nc_arg); ACE_Time_Value timeout = ACE_OS::gettimeofday () + ACE_Time_Value (1, 0); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) scheduling new timer 1 sec from now\n"))); if (timer_queue->schedule (this, timer_queue, timeout) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("schedule failed"))); return 0; } private: int nr_expirations_; }; // These are for the basic functionality tests. ACE_SYNCH_RECURSIVE_MUTEX mutex_; ACE_Condition condition_ (mutex_); // Test driver sets this to non-zero before spawning and to zero for // waiter. int protected_int = 0; static ACE_THR_FUNC_RETURN waiter (void *) { if (mutex_.acquire () != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("acquire")), 0); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) waiting for cv signal...\n"))); if (condition_.wait () == 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) woken up!!!\n"))); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("wait"))); int const copy_int = protected_int; // Copy it in case it's erroneously changing if (copy_int != 0) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) waiter found protected_int %d\n"), copy_int)); if (mutex_.release () != 0) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("release"))); return 0; } static int test_1 () { protected_int = 1; if (ACE_Thread_Manager::instance()->spawn (waiter) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("test 1 spawn")), 1); ACE_OS::sleep (2); if (mutex_.acquire () == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("test 1 mutex acquire")), 1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) signaling condition...\n"))); protected_int = 0; if (condition_.signal () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("test 1 signal"))); if (mutex_.release () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("test 1 release"))); ACE_Thread_Manager::instance ()->wait (); return 0; } static int test_2 () { protected_int = 1; if (ACE_Thread_Manager::instance()->spawn (waiter) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("test 2 spawn")), 1); ACE_OS::sleep (2); if (mutex_.acquire () == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("test 2 mutex acquire")), 1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) signaling condition...\n"))); if (condition_.signal () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("test 2 signal"))); // Wait to clear protected_int to be sure cv properly reacquires the // mutex before returning control to caller. ACE_OS::sleep(2); protected_int = 0; if (mutex_.release () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("test 2 release"))); ACE_Thread_Manager::instance ()->wait (); return 0; } static int test_3 () { protected_int = 1; if (ACE_Thread_Manager::instance()->spawn_n (4, waiter) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("test 3 spawn")), 1); ACE_OS::sleep (2); if (mutex_.acquire () == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("test 3 mutex acquire")), 1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) broadcasting condition...\n"))); if (condition_.broadcast () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("test 3 broadcast"))); protected_int = 0; if (mutex_.release () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("test 3 release"))); ACE_Thread_Manager::instance ()->wait (); return 0; } static int test_4 () { const int recurse_count = 3; protected_int = recurse_count; if (ACE_Thread_Manager::instance()->spawn (waiter) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("spawn")), 1); ACE_OS::sleep (2); int i; for (i = 0; i < recurse_count; ++i) if (mutex_.acquire () == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("pass %d, %p\n"), i + 1, ACE_TEXT ("recursive acquire")), 1); // Don't report a failure if the mutex doesn't offer a view of the // recursion count. int nesting_level = mutex_.get_nesting_level (); if (!(nesting_level == -1 && errno == ENOTSUP) && nesting_level != i) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT("test 4 nesting level %d;") ACE_TEXT (" should be %d\n"), nesting_level, i), 1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) signaling condition...\n"))); if (condition_.signal () == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("test 4 signal")), 1); for (i = 0; i < recurse_count; ++i) { // Only decrement - be sure all the waiting threads are not released // before we release the mutex the correct number of times. --protected_int; mutex_.release (); } // The waiter thread will acquire the mutex as a result of the releases // above... don't check the nesting level until waiter() has had a chance // to wake up, acquire, and release the mutex. ACE_Thread_Manager::instance ()->wait (); nesting_level = mutex_.get_nesting_level (); if (!(nesting_level == -1 && errno == ENOTSUP) && nesting_level != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT("(%t) nesting level %d; should be 0\n"), nesting_level), 1); return 0; } #endif /* ACE_HAS_THREADS */ int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Recursive_Condition_Test")); #if defined (ACE_HAS_THREADS) int status = 0; /* Test 1 - Simple test */ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Test 1...\n"))); if (test_1 () != 0) ++status; /* Test #2 - Sleep 2 seconds before releasing mutex */ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Test 2...\n"))); if (test_2 () != 0) ++status; /* Test #3 - One main thread - 4 subthreads */ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Test 3...\n"))); if (test_3 () != 0) ++status; /* Test #4 - Multiple calls to mutex_.acquire and mutex_.release */ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Test 4...\n"))); if (test_4 () != 0) ++status; // Timer queue usage. Thread_Timer_Queue timer_queue; Test_Handler handler; if (0 != timer_queue.activate ()) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("activate"))); ++status; } ACE_Time_Value timeout = ACE_OS::gettimeofday() + ACE_Time_Value (1, 0); if (-1 == timer_queue.schedule (&handler, &timer_queue, timeout)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("schedule"))); ++status; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Starting to sleep\n"))); ACE_OS::sleep (10); timer_queue.deactivate (); timer_queue.wait (); // Scheduling every second, waiting 10 seconds, should get at least 9 int expirations = handler.nr_expirations (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Caught %d timer expirations\n"), expirations)); if (expirations < 9) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Should have caught at least 9\n"))); #else ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE doesn't support recursive condition variables on this platform\n"))); #endif /* ACE_HAS_THREADS */ ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Process_Env_Test.cpp0000644000175000017500000000721415027201773020266 0ustar sudipsudip //============================================================================= /** * @file Process_Env_Test.cpp * * This program tests the limits of the Windows CreateProcess * environment buffer. * * @author Chad Elliott */ //============================================================================= #include "test_config.h" #include "ace/Process.h" #include "ace/SString.h" #if defined (ACE_WIN32) && !defined (ACE_USES_WCHAR) using setenvfn_t = void (*)(const ACE_TCHAR *, const ACE_TCHAR *, void *); void create_large_env (setenvfn_t setenv, void *ctx) { static const size_t varsize = 1600; for (int i = 0; i < 26; i++) { char name[2] = { 'A', '\0' }; name[0] += i; char value[varsize]; ACE_OS::memset (value, 'R', varsize); value[varsize - 1] = '\0'; setenv (ACE_TEXT_CHAR_TO_TCHAR (name), ACE_TEXT_CHAR_TO_TCHAR (value), ctx); } } void apo_setenv (const ACE_TCHAR *name, const ACE_TCHAR *value, void *ctx) { ACE_Process_Options *apo = static_cast (ctx); apo->setenv (name, value); } void thisproc_setenv (const ACE_TCHAR *name, const ACE_TCHAR *value, void *) { ACE_TString putstr (name); putstr += ACE_TEXT ('='); putstr += value; ACE_OS::putenv (putstr.c_str ()); } #endif int run_main (int, ACE_TCHAR*[]) { int test_status = 0; ACE_START_TEST (ACE_TEXT ("Process_Env_Test")); #if defined (ACE_WIN32) && !defined (ACE_USES_WCHAR) ACE_Process_Options options ( 0, ACE_Process_Options::DEFAULT_COMMAND_LINE_BUF_LEN, 32 * 1024); options.command_line (ACE_TEXT ("attrib.exe /?")); create_large_env (apo_setenv, &options); ACE_OS::fclose(stdout); ACE_Process process; if (process.spawn (options) != -1) { /* * In Windows versions < Vista the ENTIRE environment block could be a * maximum of 32,767 bytes long * * In Windows versions > Vista it's 32,767 bytes per environment variable */ #if (_WIN32_WINNT < 0x0600) ACE_ERROR ((LM_ERROR, "ERROR: This should have failed due to the large " "environment buffer\n")); test_status = 1; #else ACE_DEBUG ((LM_DEBUG, "Using large environment buffer works as expected " "on Windows vista or newer\n")); #endif /* _WIN32_WINNT < 0x0600 */ } options.enable_unicode_environment (); if (process.spawn (options) == -1) { ACE_ERROR ((LM_ERROR, "ERROR: This should have succeeded\n")); test_status = 1; } // Test inheriting a large env block with enable_unicode_environment ACE_Process_Options opts2 (1, ACE_Process_Options::DEFAULT_COMMAND_LINE_BUF_LEN, 128 * 1024); create_large_env (thisproc_setenv, 0); opts2.enable_unicode_environment (); opts2.setenv (ACE_TEXT ("Z"), ACE_TEXT ("1")); opts2.command_line (ACE_TEXT ("cmd.exe /d /c ") ACE_TEXT ("\"if defined Z (exit 1) else (exit 2)\"")); ACE_Process process2; if (process2.spawn (opts2) == -1) { ACE_ERROR ((LM_ERROR, "ERROR: Failed to spawn process2.\n")); test_status = 1; } ACE_exitcode status; process2.wait (&status); if (status != 1) { ACE_ERROR ((LM_ERROR, "ERROR: process2 did not inherit env var Z, wait returned %d.\n", status)); test_status = 1; } #else ACE_DEBUG ((LM_INFO, "This test is for Win32 without ACE_USES_WCHAR\n")); #endif /* ACE_WIN32 && !ACE_USES_WCHAR */ ACE_END_TEST; return test_status; } ace-8.0.4+dfsg.orig/tests/randomize.h0000644000175000017500000000674215027201773016503 0ustar sudipsudip// -*- C++ -*- // ============================================================================ /** * @file randomize.h * * Randomize the contents of an array. * * @author Ossama Othman * * @note Based on code originally found in test_config.h and Test_Output.cpp */ // ============================================================================ #ifndef ACE_TESTS_RANDOMIZE_H #define ACE_TESTS_RANDOMIZE_H #include "ace/OS_NS_stdlib.h" #include #include namespace { /** * @class randomize_index * * @brief Functor that randomly swaps the order of two array * elements. * * @internal Do not directly use this class. Use the @c randomize() * function template found below instead. * * This functor generates random array index using high-order bits (e.g., * MAX_VAL * rand() / (RAND_MAX + 1.0)) rather than low-order ones * (e.g. rand() % MAX_VAL) to improve randomness. The array element * reference by that index is then swapped with the array element * provided to the functor. * * @note The improved randomness may be overkill for this functor's * intended use cases, but it is a good thing to practice/have * nonetheless. * * @see Numerical Recipes in C: The Art of Scientific Computing * (William H. Press, Brian P. Flannery, Saul A. Teukolsky, * William T. Vetterling; New York: Cambridge University Press, * 1992 (2nd ed., p. 277). */ template class randomize_element { public: typedef T &argument_type; typedef void result_type; randomize_element (T * array, size_t size, unsigned int seed) : array_ (array) , coefficient_ (static_cast (size) / (RAND_MAX + 1.0f)) , seed_ (seed) { } void operator() (T & value) // We need this to be a reference! { size_t const index = static_cast ( this->coefficient_ * ACE_OS::rand_r (&this->seed_)); // Swap rather than assign so that we don't lose the original // value. std::swap (value, this->array_[index]); } private: // The array. T * const array_; // Factor out the constant coefficient. double const coefficient_; // Random number generator seed value. unsigned int seed_; }; /** * @fn randomize * * @brief Randomize the order of elements in an array. * * @param array The array whose elements will be reordered * randomly. * @param size The number of elements in the array. * @param seed The random number generator seed value. A default * value is provided so that the generated random number order may be "repeatable" if so desired. * * This function template randomizes the order of elements in an * array of any type. It is also reentrant (unless the array itself * is accessed by multiple threads). * @par * Sample usage: * @par * \verbatim static size_t const NUM_TIMES = 100; ACE_Time_Value times[NUM_TIMES] = { ... }; randomize (times, NUM_TIMES, static_cast (ACE_OS::time (0L))); \endverbatim */ template void randomize (T * array, size_t size, unsigned int seed = 0) { // Randomize all elements of the array. std::for_each (array, array + size, randomize_element (array, size, seed)); } } #endif /* !ACE_TESTS_RANDOMIZE_H */ ace-8.0.4+dfsg.orig/tests/DLL_Test_Parent.h0000644000175000017500000000226215027201773017427 0ustar sudipsudip// -*- C++ -*- // ================================================================ /** * @file DLL_Test_Parent.h * * @author Kirthika Parameswaran * @author Ossama Othman */ // ================================================================ #ifndef ACE_TESTS_DLL_TEST_PARENT_H #define ACE_TESTS_DLL_TEST_PARENT_H #include "DLL_Test_Parent_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include class DLL_Test_Parent_Export Parent { public: virtual ~Parent (); virtual void test (); }; class DLL_Test_Parent_Export Data { public: Data () = default; Data (const Data&) = default; Data (Data&&) = default; Data& operator= (const Data&) = default; Data& operator= (Data&&) = default; virtual ~Data(); private: int8_t i {}; }; class DLL_Test_Parent_Export Base { public: virtual void _raise () const; Base (); virtual ~Base() = default; }; class DLL_Test_Parent_Export Derived : public Base { public: Derived (); static Base* _alloc (); void _raise () const override; ~Derived () override = default; }; #endif /* ACE_TESTS_DLL_TEST_PARENT_H */ ace-8.0.4+dfsg.orig/tests/Map_Manager_Test.cpp0000644000175000017500000006116615027201773020215 0ustar sudipsudip //============================================================================= /** * @file Map_Manager_Test.cpp * * This is a simple test of the and * that illustrates how to use the forward * and reverse iterators. * * @author Irfan Pyarali * @author Douglas C. Schmidt * @author and Kirthika Parameswaran */ //============================================================================= #include "test_config.h" #include "ace/Map_Manager.h" #include "ace/Hash_Map_Manager.h" #include "ace/Active_Map_Manager.h" #include "ace/Profile_Timer.h" #include "ace/Hash_Cache_Map_Manager_T.h" #include "ace/Caching_Strategies_T.h" using MUTEX = ACE_Null_Mutex; using TYPE = ACE_UINT32; using ACTIVE_KEY = ACE_Active_Map_Manager_Key; using HASH_KEY = ACE_Hash; using COMPARE_KEYS = ACE_Equal_To; using MAP_MANAGER = ACE_Map_Manager; using ITERATOR = ACE_Map_Iterator; using REVERSE_ITERATOR = ACE_Map_Reverse_Iterator; using MAP_ENTRY = ACE_Map_Entry; using HASH_MAP_MANAGER = ACE_Hash_Map_Manager_Ex; using HASH_ITERATOR = ACE_Hash_Map_Iterator_Ex; using HASH_REVERSE_ITERATOR = ACE_Hash_Map_Reverse_Iterator_Ex; using HASH_ENTRY = ACE_Hash_Map_Entry; using ACTIVE_MAP_MANAGER = ACE_Active_Map_Manager; using CACHE_MAP_IMPL = ACE_Hash_Map_Manager_Ex, HASH_KEY, COMPARE_KEYS, MUTEX>; using CACHE_ITER_IMPL = ACE_Hash_Map_Iterator_Ex, HASH_KEY, COMPARE_KEYS, MUTEX>; using CACHE_REV_ITER_IMPL = ACE_Hash_Map_Reverse_Iterator_Ex, HASH_KEY, COMPARE_KEYS, MUTEX>; using ATTR = int; using NULL_CLEANUP = ANCLE; using NULL_UTILITY = ACE_Null_Caching_Utility; using NULL_CACHING_STRATEGY = ANULL; using CACHE_MAP_MANAGER = ACMM; using HASH_CACHE_MAP_MANAGER = ACE_Hash_Cache_Map_Manager; static int test_cache_map_manager (size_t table_size, size_t iterations, int test_iterators) { NULL_CACHING_STRATEGY null_caching_strategy; CACHE_MAP_MANAGER map (null_caching_strategy, table_size); TYPE i; TYPE j = TYPE (); ssize_t k; for (i = 0; i < iterations; i++) ACE_TEST_ASSERT (map.bind (i, i) != -1); if (test_iterators) { { i = 0; CACHE_MAP_MANAGER::ITERATOR end = map.end (); for (CACHE_MAP_MANAGER::ITERATOR iter = map.begin (); iter != end; ++iter) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), i, (*iter).first (), (*iter).second ())); ++i; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (i == iterations); } { k = iterations - 1; CACHE_MAP_MANAGER::REVERSE_ITERATOR rend = map.rend (); for (CACHE_MAP_MANAGER::REVERSE_ITERATOR iter = map.rbegin (); iter != rend; ++iter) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), k, (*iter).first (), (*iter).second ())); k--; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (k == -1); } { i = 0; CACHE_MAP_MANAGER::iterator end = map.end (); for (CACHE_MAP_MANAGER::iterator iter = map.begin (); iter != end; ++iter) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), i, (*iter).first (), (*iter).second ())); ++i; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (i == iterations); } { k = iterations - 1; CACHE_MAP_MANAGER::reverse_iterator rend = map.rend (); for (CACHE_MAP_MANAGER::reverse_iterator iter = map.rbegin (); iter != rend; ++iter) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), k, (*iter).first (), (*iter).second ())); k--; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (k == -1); } } for (i = 0; i < iterations; ++i) { ACE_TEST_ASSERT (map.find (i, j) != -1); ACE_TEST_ASSERT (i == j); } size_t remaining_entries = iterations; for (i = 0; i < iterations; ++i) { ACE_TEST_ASSERT (map.unbind (i) != -1); --remaining_entries; ACE_TEST_ASSERT (map.current_size () == remaining_entries); } return 0; } static int test_hash_cache_map_manager (size_t table_size, size_t iterations, int test_iterators) { NULL_CACHING_STRATEGY null_caching_strategy; HASH_CACHE_MAP_MANAGER map (null_caching_strategy, table_size); TYPE i; TYPE j = 0; ssize_t k; for (i = 0; i < iterations; i++) ACE_TEST_ASSERT (map.bind (i, i) != -1); if (test_iterators) { { i = 0; HASH_CACHE_MAP_MANAGER::ITERATOR end = map.end (); for (HASH_CACHE_MAP_MANAGER::ITERATOR iter = map.begin (); iter != end; ++iter) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), i, (*iter).first (), (*iter).second ())); ++i; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (i == iterations); } { k = iterations - 1; HASH_CACHE_MAP_MANAGER::REVERSE_ITERATOR rend = map.rend (); for (HASH_CACHE_MAP_MANAGER::REVERSE_ITERATOR iter = map.rbegin (); iter != rend; ++iter) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), k, (*iter).first (), (*iter).second ())); k--; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (k == -1); } { i = 0; HASH_CACHE_MAP_MANAGER::iterator end = map.end (); for (HASH_CACHE_MAP_MANAGER::iterator iter = map.begin (); iter != end; ++iter) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), i, (*iter).first (), (*iter).second ())); ++i; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (i == iterations); } { k = iterations - 1; HASH_CACHE_MAP_MANAGER::reverse_iterator rend = map.rend (); for (HASH_CACHE_MAP_MANAGER::reverse_iterator iter = map.rbegin (); iter != rend; ++iter) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), k, (*iter).first (), (*iter).second ())); k--; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (k == -1); } } for (i = 0; i < iterations; ++i) { ACE_TEST_ASSERT (map.find (i, j) != -1); ACE_TEST_ASSERT (i == j); } size_t remaining_entries = iterations; for (i = 0; i < iterations; ++i) { ACE_TEST_ASSERT (map.unbind (i) != -1); --remaining_entries; ACE_TEST_ASSERT (map.current_size () == remaining_entries); } return 0; } static int test_active_map_manager (size_t table_size, size_t iterations, int test_iterators) { ACTIVE_MAP_MANAGER map (table_size); TYPE i; TYPE j = 0; ssize_t k; ACTIVE_MAP_MANAGER::key_type *active_keys; ACE_NEW_RETURN (active_keys, ACTIVE_MAP_MANAGER::key_type[iterations], 1); for (i = 0; i < iterations; i++) ACE_TEST_ASSERT (map.bind (i, active_keys[i]) != -1); if (test_iterators) { { i = 0; ACTIVE_MAP_MANAGER::iterator end = map.end (); for (ACTIVE_MAP_MANAGER::iterator iter = map.begin (); iter != end; ++iter) { ACTIVE_MAP_MANAGER::ENTRY &entry = *iter; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d-%d|%d)"), i, entry.ext_id_.slot_index (), entry.ext_id_.slot_generation (), entry.int_id_)); ++i; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (i == iterations); } { k = iterations - 1; ACTIVE_MAP_MANAGER::reverse_iterator rend = map.rend (); for (ACTIVE_MAP_MANAGER::reverse_iterator iter = map.rbegin (); iter != rend; ++iter) { ACTIVE_MAP_MANAGER::ENTRY &entry = *iter; ACE_UNUSED_ARG (entry); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d-%d|%d)"), k, entry.ext_id_.slot_index (), entry.ext_id_.slot_generation (), entry.int_id_)); k--; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (k == -1); } } for (i = 0; i < iterations; ++i) { ACE_TEST_ASSERT (map.find (active_keys[i], j) != -1); ACE_TEST_ASSERT (i == j); } size_t remaining_entries = iterations; for (i = 0; i < iterations; ++i) { ACE_TEST_ASSERT (map.unbind (active_keys[i]) != -1); --remaining_entries; ACE_TEST_ASSERT (map.current_size () == remaining_entries); } delete [] active_keys; return 0; } static int test_hash_map_manager (size_t table_size, size_t iterations, int test_iterators) { HASH_MAP_MANAGER map (table_size); TYPE i; TYPE j = 0; ssize_t k; for (i = 0; i < iterations; i++) ACE_TEST_ASSERT (map.bind (i, i) != -1); if (test_iterators) { { i = 0; HASH_ITERATOR end = map.end (); for (HASH_ITERATOR iter = map.begin (); iter != end; ++iter) { HASH_ENTRY &entry = *iter; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), i, entry.ext_id_, entry.int_id_)); ++i; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (i == iterations); } { i = 0; HASH_ENTRY *entry = 0; for (HASH_ITERATOR iterator (map); iterator.next (entry) != 0; iterator.advance ()) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), i, entry->ext_id_, entry->int_id_)); ++i; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (i == iterations); } { k = iterations - 1; HASH_REVERSE_ITERATOR rend = map.rend (); for (HASH_REVERSE_ITERATOR iter = map.rbegin (); iter != rend; ++iter) { HASH_ENTRY &entry = *iter; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), k, entry.ext_id_, entry.int_id_)); k--; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (k == -1); } { k = iterations - 1; HASH_ENTRY *entry = 0; for (HASH_REVERSE_ITERATOR iterator (map); iterator.next (entry) != 0; iterator.advance ()) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), k, entry->ext_id_, entry->int_id_)); k--; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (k == -1); } { i = 0; HASH_MAP_MANAGER::iterator end = map.end (); for (HASH_MAP_MANAGER::iterator iter = map.begin (); iter != end; ++iter) { HASH_MAP_MANAGER::ENTRY &entry = *iter; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), i, entry.ext_id_, entry.int_id_)); ++i; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (i == iterations); } { i = 0; HASH_MAP_MANAGER::ENTRY *entry = 0; for (HASH_MAP_MANAGER::ITERATOR iterator (map); iterator.next (entry) != 0; iterator.advance ()) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), i, entry->ext_id_, entry->int_id_)); ++i; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (i == iterations); } { k = iterations - 1; HASH_MAP_MANAGER::reverse_iterator rend = map.rend (); for (HASH_MAP_MANAGER::reverse_iterator iter = map.rbegin (); iter != rend; ++iter) { HASH_MAP_MANAGER::ENTRY &entry = *iter; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), k, entry.ext_id_, entry.int_id_)); k--; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (k == -1); } { k = iterations - 1; HASH_MAP_MANAGER::ENTRY *entry = 0; for (HASH_MAP_MANAGER::REVERSE_ITERATOR iterator (map); iterator.next (entry) != 0; iterator.advance ()) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), k, entry->ext_id_, entry->int_id_)); k--; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (k == -1); } } for (i = 0; i < iterations; ++i) { ACE_TEST_ASSERT (map.find (i, j) != -1); ACE_TEST_ASSERT (i == j); } size_t remaining_entries = iterations; for (i = 0; i < iterations; ++i) { ACE_TEST_ASSERT (map.unbind (i) != -1); --remaining_entries; ACE_TEST_ASSERT (map.current_size () == remaining_entries); } return 0; } static int test_map_manager (size_t table_size, size_t iterations, int test_iterators) { MAP_MANAGER map (table_size); TYPE i; TYPE j = 0; ssize_t k; for (i = 0; i < iterations; ++i) ACE_TEST_ASSERT (map.bind (i, i) != -1); if (test_iterators) { { i = 0; ITERATOR end = map.end (); for (ITERATOR iter = map.begin (); iter != end; ++iter) { MAP_ENTRY &entry = *iter; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), i, entry.ext_id_, entry.int_id_)); ++i; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (i == iterations); } { i = 0; MAP_ENTRY *entry = 0; for (ITERATOR iterator (map); iterator.next (entry) != 0; iterator.advance ()) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), i, entry->ext_id_, entry->int_id_)); ++i; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (i == iterations); } { k = iterations - 1; REVERSE_ITERATOR rend = map.rend (); for (REVERSE_ITERATOR iter = map.rbegin (); iter != rend; ++iter) { MAP_ENTRY &entry = *iter; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), k, entry.ext_id_, entry.int_id_)); k--; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (k == -1); } { k = iterations - 1; MAP_ENTRY *entry = 0; for (REVERSE_ITERATOR iterator (map); iterator.next (entry) != 0; iterator.advance ()) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), k, entry->ext_id_, entry->int_id_)); k--; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (k == -1); } { i = 0; MAP_MANAGER::iterator end = map.end (); for (MAP_MANAGER::iterator iter = map.begin (); iter != end; ++iter) { MAP_MANAGER::ENTRY &entry = *iter; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), i, entry.ext_id_, entry.int_id_)); ++i; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (i == iterations); } { i = 0; MAP_MANAGER::ENTRY *entry = 0; for (MAP_MANAGER::ITERATOR iterator (map); iterator.next (entry) != 0; iterator.advance ()) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), i, entry->ext_id_, entry->int_id_)); ++i; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (i == iterations); } { k = iterations - 1; MAP_MANAGER::reverse_iterator rend = map.rend (); for (MAP_MANAGER::reverse_iterator iter = map.rbegin (); iter != rend; ++iter) { MAP_ENTRY &entry = *iter; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), k, entry.ext_id_, entry.int_id_)); k--; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (k == -1); } { k = iterations - 1; MAP_MANAGER::ENTRY *entry = 0; for (MAP_MANAGER::REVERSE_ITERATOR iterator (map); iterator.next (entry) != 0; iterator.advance ()) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), k, entry->ext_id_, entry->int_id_)); k--; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (k == -1); } } for (i = 0; i < iterations; ++i) { ACE_TEST_ASSERT (map.find (i, j) != -1); ACE_TEST_ASSERT (i == j); } size_t remaining_entries = iterations; for (i = 0; i < iterations; ++i) { ACE_TEST_ASSERT (map.unbind (i) != -1); --remaining_entries; ACE_TEST_ASSERT (map.current_size () == remaining_entries); } // // This is extra for the map manager. // for (i = 0; i < iterations; ++i) ACE_TEST_ASSERT (map.bind (i, i) != -1); // Unbind in one swoop. map.unbind_all (); ACE_TEST_ASSERT (map.current_size () == 0); for (i = 0; i < iterations; ++i) ACE_TEST_ASSERT (map.bind (i, i) != -1); // Unbind one at a time. MAP_MANAGER::iterator end = map.end (); while (1) { MAP_MANAGER::iterator iter = map.begin (); if (iter == end) break; ACE_TEST_ASSERT (map.unbind ((*iter).ext_id_) != -1); } ACE_TEST_ASSERT (map.current_size () == 0); return 0; } static int run_test (int (*ptf) (size_t, size_t, int), size_t table_size, size_t iterations, int test_iterators, const ACE_TCHAR *test_name) { ACE_Profile_Timer timer; timer.start (); (*ptf) (table_size, iterations, test_iterators); timer.stop (); ACE_Profile_Timer::ACE_Elapsed_Time et; timer.elapsed_time (et); ACE_TCHAR *test_iterators_string = 0; if (test_iterators) test_iterators_string = const_cast (ACE_TEXT ( "includes executing iterators")); else test_iterators_string = const_cast (ACE_TEXT ("doesn't include executing iterators")); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("time to test a map of size %d for %d iterations using %s (%s)\n"), table_size, iterations, test_name, test_iterators_string)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("real time = %f secs, user time = %f secs, system time = %f secs\n"), et.real_time, et.user_time, et.system_time)); ACE_timer_t time_result = 0.0; if (iterations != 0) time_result = (et.real_time / ACE_timer_t (iterations)) * 1000000; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("time per call = %f usecs\n"), time_result)); return 0; } int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Map_Manager_Test")); ACE_LOG_MSG->clr_flags (ACE_Log_Msg::VERBOSE_LITE); int result = 0; size_t table_size = ACE_MAX_ITERATIONS / 2; size_t iterations = ACE_MAX_ITERATIONS; int test_iterators = 1; if (argc > 1) table_size = ACE_OS::atoi (argv[1]); if (argc > 2) iterations = ACE_OS::atoi (argv[2]); if (argc > 3) test_iterators = ACE_OS::atoi (argv[3]); if (table_size == 0) { ACE_ERROR ((LM_ERROR, "LM_ERROR@Table size is 0\n")); ++result; } else { // Test the . result += run_test (&test_map_manager, table_size, iterations, test_iterators, ACE_TEXT ("Map_Manager")); // Test the . result += run_test (&test_hash_map_manager, table_size, iterations, test_iterators, ACE_TEXT ("Hash_Map_Manager")); // Test the . result += run_test (&test_active_map_manager, table_size, iterations, test_iterators, ACE_TEXT ("Active_Map_Manager")); // Test the . result += run_test (&test_cache_map_manager, table_size, iterations, test_iterators, ACE_TEXT ("Cache_Map_Manager")); // Test the . result += run_test (&test_hash_cache_map_manager, table_size, iterations, test_iterators, ACE_TEXT ("Hash_Cache_Map_Manager")); } ACE_LOG_MSG->set_flags (ACE_Log_Msg::VERBOSE_LITE); ACE_END_TEST; return result; } ace-8.0.4+dfsg.orig/tests/Reactor_Performance_Test.h0000644000175000017500000000273215027201773021425 0ustar sudipsudip //============================================================================= /** * @file Reactor_Performance_Test.h * * This file includes template class definitions for the * Reactor_Performance_Test.cpp program. * * @author Irfan Pyarali and Steve Huston */ //============================================================================= #ifndef ACE_TESTS_REACTOR_PERFORMANCE_TEST_H #define ACE_TESTS_REACTOR_PERFORMANCE_TEST_H #include "ace/SOCK_Stream.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Svc_Handler.h" /** * @class Read_Handler * * @brief Simple class for reading in the data */ class Read_Handler : public ACE_Svc_Handler { public: static void set_countdown (int nconnections); /// The Svc_Handler callbacks. virtual int open (void *); virtual int handle_input (ACE_HANDLE h); virtual int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask); private: /// How many connections are we waiting for. static int waiting_; }; /** * @class Write_Handler * * @brief This Svc_Handler simply connects to a server and sends some * output to it. Its purpose is to feed the test. */ class Write_Handler : public ACE_Svc_Handler { public: virtual int open (void *); virtual int send_data (); }; #endif /* ACE_TESTS_REACTOR_PERFORMANCE_TEST_H */ ace-8.0.4+dfsg.orig/tests/Reactor_Fairness_Test.h0000644000175000017500000000205115027201773020730 0ustar sudipsudip //============================================================================= /** * @file Reactor_Fairness_Test.h * * This file includes template class definitions for the * Reactor_Fairness_Test.cpp program. * * @author Steve Huston */ //============================================================================= #ifndef ACE_TESTS_REACTOR_FAIRNESS_TEST_H #define ACE_TESTS_REACTOR_FAIRNESS_TEST_H #include "ace/SOCK_Stream.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Svc_Handler.h" /** * @class Read_Handler * * @brief Simple class for reading in the data */ class Read_Handler : public ACE_Svc_Handler { public: Read_Handler () : chunks_in (0) {} /// The Svc_Handler callbacks. virtual int handle_input (ACE_HANDLE h); virtual int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask); private: unsigned int chunks_in; }; #endif /* ACE_TESTS_REACTOR_FAIRNESS_TEST_H */ ace-8.0.4+dfsg.orig/tests/Bug_3911_Regression_Test.cpp0000644000175000017500000001010315027201773021421 0ustar sudipsudip/** * @file Bug_3911_Regression_Test.cpp * * Reproduces the problem reported in bug 3911 * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=3911 */ #include "test_config.h" #include #include #include #include #include #define MMAP_FILENAME ACE_TEXT ("shared_memory") static void init_test () { // Cleanup the MMAP file so we won't trip over the leftover mmap // file from the previous crash. ACE_MMAP_Memory_Pool_Options options (ACE_DEFAULT_BASE_ADDR); //FUZZ: disable check_for_lack_ACE_OS ACE_MMAP_Memory_Pool mmap (MMAP_FILENAME, &options); //FUZZ: enable check_for_lack_ACE_OS size_t rbyte = 0; int ft = 0; mmap.init_acquire (1024, rbyte, ft); mmap.release (); } class ShmemMan { private: // Used to implement the singleton pattern: static ShmemMan* c_instance; // The memory pool managing all the shared memory: ACE_Malloc_T* c_memory_pool; protected: ShmemMan(bool no_crash) { if (no_crash) { ACE_MMAP_Memory_Pool_Options options (ACE_DEFAULT_BASE_ADDR); c_memory_pool = new ACE_Malloc_T(MMAP_FILENAME , ACE_TEXT(""), &options ); } else { c_memory_pool = new ACE_Malloc_T(MMAP_FILENAME); } }; public: ~ShmemMan() { c_memory_pool->release(); delete c_memory_pool; }; static ShmemMan* getInstance(bool no_crash) { if (c_instance == 0) { c_instance = new ShmemMan(no_crash); } return c_instance; }; int clean() { c_memory_pool->release(); c_memory_pool->remove(); return 0; }; void* getMemoryBlock(const char* block_name, unsigned int block_size) { void* shared = 0; ACE_DEBUG((LM_INFO, ACE_TEXT("errno = %d. Looking for a Shared Memory block named %C\n"), ACE_OS::last_error(), block_name)); if (c_memory_pool->find(block_name, shared) == 0) { // An existing block was found, so take that: ACE_DEBUG((LM_INFO, ACE_TEXT("Shared Memory block %C was found."), block_name)); } else { // Allocate the memory and bind it to a name: ACE_DEBUG((LM_INFO, ACE_TEXT("Shared Memory block %C was not found. errno = %d. Trying to allocate new block\n"), block_name, ACE_OS::last_error())); shared = c_memory_pool->malloc(block_size); // reinterpret_cast due to some compilers warning against ordering pointers with integers if (ptrdiff_t (shared) < 0) { ACE_DEBUG((LM_INFO, ACE_TEXT("New Shared Memory block could not be allocated. errno = %d.\n"), ACE_OS::last_error())); return (void*)(-1); } ACE_DEBUG((LM_INFO, ACE_TEXT("New Shared Memory block was allocated, trying to bind it to the name %C\n"), block_name)); if (c_memory_pool->bind(block_name, shared) < 0) { ACE_DEBUG((LM_INFO, ACE_TEXT("New Shared Memory block could not be bound to the name %C. errno = %d.\n"), block_name, ACE_OS::last_error())); return (void*)(-1); } } return shared; }; }; ShmemMan* ShmemMan::c_instance = 0; const char* block_name = "block_1"; // Main function. int run_main (int argc, ACE_TCHAR * argv[]) { ACE_START_TEST (ACE_TEXT ("Bug_3911_Regression_Test")); init_test (); bool no_crash = (argc>1 && argv[1][0]=='1'); ShmemMan* smm = ShmemMan::getInstance (no_crash); void* buf = smm->getMemoryBlock (block_name, 10 * 4096); ACE_DEBUG((LM_INFO, ACE_TEXT("allocated shmem block at %@\n"), buf)); smm->clean (); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/TSS_Leak_Test.cpp0000644000175000017500000000214115027201773017437 0ustar sudipsudip#include "test_config.h" #include "ace/TSS_T.h" #include "ace/Task.h" #include "ace/Barrier.h" struct X { static int count_; X() { ++count_; } ~X() { --count_; } X (const X &) = delete; X (X &&) = delete; X &operator= (const X &) = delete; X &operator= (X &&) = delete; }; int X::count_; ACE_Barrier barrier (2); struct Task : ACE_Task_Base { explicit Task (ACE_TSS *tss) : tss_(tss) {} int svc () override { X *x = *tss_; ACE_UNUSED_ARG (x); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%d X objects created\n"), X::count_)); barrier.wait (); // tss deleted here barrier.wait (); return 0; } ACE_TSS *const tss_; }; int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("TSS_Leak_Test")); ACE_TSS *const tss = new ACE_TSS; X *x = *tss; ACE_UNUSED_ARG (x); Task task (tss); task.activate (); barrier.wait (); delete tss; barrier.wait (); task.wait (); if (X::count_) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: %d X objects (should be 0)\n"), X::count_)); } ACE_END_TEST; return X::count_; } ace-8.0.4+dfsg.orig/tests/DLL_Test.cpp0000644000175000017500000001164415027201773016455 0ustar sudipsudip //============================================================================= /** * @file DLL_Test.cpp * * This test illustrates the use of wrapper class. * * @author Kirthika Parameswaran */ //============================================================================= #include "test_config.h" #include "ace/DLL.h" #include #include "ace/ACE.h" #include "ace/DLL_Manager.h" #include "ace/SString.h" #include "ace/OS_NS_dlfcn.h" #include "DLL_Test.h" #include #if defined (ACE_LD_DECORATOR_STR) # define OBJ_SUFFIX ACE_LD_DECORATOR_STR ACE_DLL_SUFFIX #else # define OBJ_SUFFIX ACE_DLL_SUFFIX #endif /* ACE_LD_DECORATOR_STR */ #if defined (ACE_WIN32) # define OBJ_PREFIX ACE_DLL_PREFIX #else # define OBJ_PREFIX ACE_TEXT("./") ACE_DLL_PREFIX #endif /* ACE_WIN32 */ // Declare the type of the symbol: using Hello_Factory = Hello *(*)(); using PFN = int (*)(Parent *); int handle_test (ACE_DLL &dll) { // Test the get/set_handle methods. ACE_DLL local_dll; ACE_SHLIB_HANDLE handle = dll.get_handle (1); if (handle != ACE_SHLIB_INVALID_HANDLE) { if (local_dll.set_handle (handle) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Error setting handle.\n")), -1); return 0; } ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Error getting handle.\n")), -1); } int basic_test (ACE_DLL &dll) { ACE_TString dll_file; const char *subdir_env = ACE_OS::getenv ("ACE_EXE_SUB_DIR"); if (subdir_env) { dll_file = ACE_TEXT_CHAR_TO_TCHAR (subdir_env); dll_file += ACE_DIRECTORY_SEPARATOR_STR; } dll_file += OBJ_PREFIX ACE_TEXT ("DLL_Test_Lib") OBJ_SUFFIX; int retval = dll.open (dll_file.c_str()); if (retval != 0) { ACE_TCHAR *dll_error = dll.error (); ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Error in DLL Open of <%s>: %s\n"), OBJ_PREFIX ACE_TEXT ("DLL_Test_Lib") OBJ_SUFFIX, dll_error ? dll_error : ACE_TEXT ("unknown error")), -1); } // Just because the ANSI C++ spec says you can no longer cast a // void* to a function pointer. Doesn't allow: // TC f = (Hello_Factory) dll.symbol ("get_hello"); void *foo = dll.symbol (ACE_TEXT ("get_hello")); // Cast the void* to long first. ptrdiff_t tmp = reinterpret_cast (foo); Hello_Factory factory = reinterpret_cast (tmp); if (factory == 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), dll.error ()), -1); std::unique_ptr my_hello (factory ()); // Make the method calls, as the object pointer is available. my_hello->say_hello (); my_hello->say_next (); // Allocate and delete a string allocated via new in a different dll. ACE_TCHAR *new_str = my_hello->new_info (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Result for new_info(): %s\n"), new_str)); ACE::strdelete (new_str); // Allocate and free a string allocated via malloc in a different dll. ACE_TCHAR *malloc_str = my_hello->malloc_info (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Result for malloc_info(): %s\n"), malloc_str)); ACE_OS::free (malloc_str); return 0; } int dynamic_cast_test (ACE_DLL &dll) { Child child; child.test(); Parent *parent = &child; void * foo = dll.symbol (ACE_TEXT ("dynamic_cast_test")); // Cast the void* to long first. ptrdiff_t tmp = reinterpret_cast (foo); PFN pfnAcquire = reinterpret_cast (tmp); if (pfnAcquire == 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), dll.error ()), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("before %@ %@\n"), &child, dynamic_cast (parent))); if (pfnAcquire (&child) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("dynamic_cast failed.\n")), -1); return 0; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("DLL_Test")); int retval = 0; // Protection against this test being run on platforms not supporting Dlls. #if defined(ACE_HAS_DYNAMIC_LINKING) ACE_DLL dll; retval += basic_test (dll); retval += dynamic_cast_test (dll); retval += handle_test (dll); // Call close here so that any errors make it into the log. dll.close (); #else ACE_ERROR ((LM_INFO, ACE_TEXT ("Dynamically Linkable Libraries not supported on this platform\n"))); #endif /* ACE_HAS_DYNAMIC_LINKING */ void* invalid_handle = ACE_OS::dlsym (ACE_SHLIB_INVALID_HANDLE, ACE_TEXT ("open")); if (invalid_handle != nullptr) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_OS::dlsym using invalid handle should be nullptr and not %@\n"))); ++retval; } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("dlsym on invalid handle returned nullptr\n"))); } ACE_END_TEST; return retval == 0 ? 0 : 1; } ace-8.0.4+dfsg.orig/tests/Service_Config_Stream_DLL.cpp0000644000175000017500000000754715027201773021745 0ustar sudipsudip#include "Service_Config_Stream_DLL.h" #include "ace/Service_Repository.h" #include "ace/Service_Types.h" int Test_Task::open (void *) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("opening %s\n"), this->name () ? this->name () : ACE_TEXT ("task"))); return 0; } int Test_Task::close (u_long) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("closing %s\n"), this->name () ? this->name () : ACE_TEXT ("task"))); return 0; } int Test_Task::init (int, ACE_TCHAR *[]) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("initializing %s\n"), this->name () ? this->name () : ACE_TEXT ("task"))); return 0; } int Test_Task::fini () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("finalizing %s\n"), this->name () ? this->name () : ACE_TEXT ("task"))); return 0; } // Factories used to control configuration. ACE_FACTORY_DECLARE (Service_Config_Stream_DLL, Test_Task) ACE_FACTORY_DEFINE (Service_Config_Stream_DLL, Test_Task) // Dynamically linked functions used to control configuration. extern "C" Service_Config_Stream_DLL_Export MT_Stream *make_stream (); extern "C" Service_Config_Stream_DLL_Export MT_Module *make_da (); extern "C" Service_Config_Stream_DLL_Export MT_Module *make_ea (); extern "C" Service_Config_Stream_DLL_Export MT_Module *make_mr (); extern "C" Service_Config_Stream_DLL_Export MT_Module *make_close (); MT_Stream * make_stream () { return new MT_Stream; } MT_Module * make_da () { return new MT_Module (ACE_TEXT ("Device_Adapter"), new Test_Task, new Test_Task); } MT_Module * make_ea () { return new MT_Module (ACE_TEXT ("Event_Analyzer"), new Test_Task, new Test_Task); } MT_Module * make_mr () { return new MT_Module (ACE_TEXT ("Multicast_Router"), new Test_Task, new Test_Task); } MT_Module * make_close () { return new MT_Module (ACE_TEXT ("Close_Test_Module"), new Test_Task, new Test_Task); } // Task to verify the order and operation of the stream assembly // Command line args give the stream name (to look it up) and the names // of the tasks that should be there, from head to tail. ACE_FACTORY_DECLARE (Service_Config_Stream_DLL, Stream_Order_Test) ACE_FACTORY_DEFINE (Service_Config_Stream_DLL, Stream_Order_Test) int Stream_Order_Test::init (int argc, ACE_TCHAR *argv[]) { if (argc < 1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Stream_Order_Test needs at least 1 arg\n")), -1); const ACE_Service_Type *st = 0; if (ACE_Service_Repository::instance ()->find (argv[0], &st, false) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Cannot find %s\n"), argv[0]), -1); const ACE_Service_Type_Impl *st_impl = st->type (); MT_Stream *str = reinterpret_cast(st_impl->object ()); MT_Module *m = 0; if (-1 == str->top (m)) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Cannot get module %p\n"), ACE_TEXT ("top")), -1); // Walk down the stream and compare module names. Note we start from the // top, i.e., the last module pushed. bool error = false; for (int i = 1; i < argc; ++i) { if (m == 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Ran out of modules at layer %d\n"), i)); continue; } if (ACE_OS::strcmp (argv[i], m->name ()) != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Layer %d: expected module %s, found %s\n"), i, argv[i], m->name ())); error = true; } else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Layer %d: found module %s, correct\n"), i, m->name ())); m = m->next (); } return error ? -1 : 0; } ace-8.0.4+dfsg.orig/tests/Bug_2980_Regression_Dll.cpp0000644000175000017500000000151515027201773021231 0ustar sudipsudip#include "ace/Init_ACE.h" #include "ace/Log_Msg.h" #include "test_config.h" extern "C" { ACE_Proper_Export_Flag int capi_init() { int ret = ACE::init(); ACE_START_TEST (ACE_TEXT ("Bug_2980_Regression_Test")); ACE_DEBUG ((LM_INFO, ACE_TEXT ("ACE::init ()\n"))); ACE_END_TEST; return ret; } ACE_Proper_Export_Flag int capi_fini() { ACE_START_TEST (ACE_TEXT ("Bug_2980_Regression_Test")); ACE_DEBUG ((LM_INFO, ACE_TEXT ("ACE::fini ()\n"))); ACE_END_TEST; return ACE::fini(); } ACE_Proper_Export_Flag int capi_dosomething() { ACE_START_TEST (ACE_TEXT ("Bug_2980_Regression_Test")); ACE_DEBUG(( LM_DEBUG, ACE_TEXT ("(%P|%t) capi_dosomething - entered\n") )); ACE_DEBUG(( LM_DEBUG, ACE_TEXT ("(%P|%t) capi_dosomething - leaving\n") )); ACE_END_TEST; return 0; } } ace-8.0.4+dfsg.orig/tests/Refcounted_Event_Handler_Test_DevPoll.cpp0000644000175000017500000001640015027201773024356 0ustar sudipsudip //============================================================================= /** * @file Refcounted_Event_Handler_Test_DevPoll.cpp * * This is a simple test that checks the order of dispatching of * ACE Reactors. Order should be: timeout, output, and then input. * * @author Irfan Pyarali */ //============================================================================= #include "test_config.h" #include "ace/OS_NS_string.h" #include "ace/Reactor.h" #include "ace/Select_Reactor.h" #include "ace/WFMO_Reactor.h" #include "ace/Dev_Poll_Reactor.h" #include "ace/Pipe.h" #include "ace/ACE.h" #if defined (ACE_HAS_DEV_POLL) || defined (ACE_HAS_EVENT_POLL) static const char *message = "Hello there! Hope you get this message"; class Handler : public ACE_Event_Handler { public: Handler (ACE_Reactor &reactor); ~Handler() override; int handle_timeout (const ACE_Time_Value &tv, const void *arg) override; int handle_input (ACE_HANDLE fd) override; int handle_output (ACE_HANDLE fd) override; ACE_HANDLE get_handle () const override; // We need to add MSG_OOB data transfer to this test to check the // order of when gets called. I tried with // Windows 2000 but only one byte of the message came across as // urgent data. The rest of the data was treated as normal! There // was some explanation of Microsoft's TCP/IP deals with out-of-band // data in "Out-of-Band Data and Push Bit in TCP/IP" in the MSDN // library. However, I did not comprehend that well enough. If // someone can make this work, please check the order of // getting called. // int handle_exception (ACE_HANDLE fd); ACE_Pipe pipe_; int dispatch_order_; bool ok_; // Constructed and initialized ok }; Handler::Handler (ACE_Reactor &reactor) : ACE_Event_Handler (&reactor), dispatch_order_ (1), ok_ (false) { // Create the pipe. if (0 != this->pipe_.open ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("pipe"))); else { // Register for all events. if (0 != this->reactor ()->register_handler (this->pipe_.read_handle (), this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK)) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("register"))); else this->ok_ = true; } } Handler::~Handler () { this->pipe_.close (); } ACE_HANDLE Handler::get_handle () const { return this->pipe_.read_handle (); } int Handler::handle_timeout (const ACE_Time_Value &, const void *) { int me = this->dispatch_order_++; if (me != 1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("handle_timeout should be #1; it's %d\n"), me)); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Handler::handle_timeout\n"))); return 0; } int Handler::handle_output (ACE_HANDLE) { int me = this->dispatch_order_++; if (me != 2) ACE_ERROR ((LM_ERROR, ACE_TEXT ("handle_output should be #2; it's %d\n"), me)); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Handler::handle_output\n"))); // Don't want to continually see writeable; only verify its relative order. this->reactor ()->mask_ops (this->pipe_.read_handle (), ACE_Event_Handler::WRITE_MASK, ACE_Reactor::CLR_MASK); return 0; } int Handler::handle_input (ACE_HANDLE fd) { int me = this->dispatch_order_++; if (me != 3) ACE_ERROR ((LM_ERROR, ACE_TEXT ("handle_input should be #3; it's %d\n"), me)); char buffer[BUFSIZ]; ssize_t result = ACE::recv (fd, buffer, sizeof buffer); if (result != ssize_t (ACE_OS::strlen (message))) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Handler recv'd %b bytes; expected %B\n"), result, ACE_OS::strlen (message))); buffer[result] = '\0'; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Handler::handle_input: %C\n"), buffer)); if (ACE_OS::strcmp (buffer, message) != 0) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Handler text mismatch; received \"%C\"; ") ACE_TEXT ("expected \"%C\"\n"), buffer, message)); this->reactor ()->end_reactor_event_loop (); return 0; } static bool test_reactor_dispatch_order (ACE_Reactor &reactor) { Handler handler (reactor); if (!handler.ok_) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error initializing test; abort.\n"))); return false; } bool ok_to_go = true; // This should trigger a call to . ssize_t result = ACE::send_n (handler.pipe_.write_handle (), message, ACE_OS::strlen (message)); if (result != ssize_t (ACE_OS::strlen (message))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Handler sent %b bytes; should be %B\n"), result, ACE_OS::strlen (message))); ok_to_go = false; } // This should trigger a call to . if (-1 == reactor.schedule_timer (&handler, 0, ACE_Time_Value (0))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("schedule_timer"))); ok_to_go = false; } // Suspend the handlers - only the timer should be dispatched ACE_Time_Value tv (1); reactor.suspend_handlers (); reactor.run_reactor_event_loop (tv); // only the timer should have fired if (handler.dispatch_order_ != 2) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Incorrect number fired %d\n"), handler.dispatch_order_)); ok_to_go = false; } // Reset the dispatch_order_ count and schedule another timer handler.dispatch_order_ = 1; if (-1 == reactor.schedule_timer (&handler, 0, ACE_Time_Value (0))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("schedule_timer"))); ok_to_go = false; } // Resume the handlers - things should work now reactor.resume_handlers (); if (ok_to_go) { reactor.run_reactor_event_loop (tv); } if (0 != reactor.remove_handler (handler.pipe_.read_handle (), ACE_Event_Handler::ALL_EVENTS_MASK | ACE_Event_Handler::DONT_CALL)) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("remover_handler pipe"))); if (handler.dispatch_order_ != 4) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Incorrect number fired %d\n"), handler.dispatch_order_)); ok_to_go = false; } return ok_to_go; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Refcounted_Event_Handler_Test_DevPoll")); int result = 0; ACE_Dev_Poll_Reactor dev_poll_reactor_impl; ACE_Reactor dev_poll_reactor (&dev_poll_reactor_impl); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing Dev Poll Reactor\n"))); if (!test_reactor_dispatch_order (dev_poll_reactor)) ++result; ACE_END_TEST; return result; } #else int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Refcounted_Event_Handler_Test_DevPoll")); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Dev_Poll_Reactor is UNSUPPORTED on this platform\n"))); ACE_END_TEST; return 0; } #endif /* ACE_HAS_DEV_POLL || ACE_HAS_EVENT_POLL */ ace-8.0.4+dfsg.orig/tests/Thread_Creation_Threshold_Test.cpp0000644000175000017500000001344215027201773023107 0ustar sudipsudip //============================================================================= /** * @file Thread_Creation_Threshold_Test.cpp * * This test program stresses how many threads can be * consecutively (not simultaneously) created on a platform. * Rather than testing exhaustively, it establishes a * semi-arbitrary upper limit (MAX_THREAD)of threads. * * @author Chris Cleeland */ //============================================================================= #include "test_config.h" #include "ace/Task.h" #if defined (ACE_HAS_THREADS) #include "ace/Lock_Adapter_T.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" // Number of iterations to run the test. #if defined (ACE_VXWORKS) const unsigned long MAX_THREAD = 500; #else # ifdef ACE_FACE_SAFETY_BASE const unsigned long MAX_THREAD = 10000; # else const unsigned long MAX_THREAD = 100000; # endif #endif namespace { // Change this to 'true' if you want lots of debugging messages in the log const bool PRINT_DEBUG_MSGS = true; } /** * @class Thread_Pool * * @brief Defines a thread pool abstraction based on the . */ class Thread_Pool : public ACE_Task { public: /// Create the thread pool containing . Thread_Pool (int n_threads); /// Destructor... ~Thread_Pool () override; /// Iterate time printing off a message and "waiting" /// for all other threads to complete this iteration. int svc () override; /// Start the threads in the pool. void start(); unsigned long total_threads() { return this->total_activated_threads_.value(); } /// Number of threads to spawn. int n_threads_; /// Returns true iff failed_ == false. bool operator! (); private: //FUZZ: disable check_for_lack_ACE_OS /// Spawn the threads in the pool. int open (void * = 0) override; /// Close hook. ///FUZZ: enable check_for_lack_ACE_OS int close (u_long) override; /// Total number of threads activated through this thread pool ever. ACE_Atomic_Op total_activated_threads_; /// Flag set only in worker threads to indicate whether they should print /// debug messages. bool doprint_; /// Flag indicating that start() failed. bool failed_; }; bool Thread_Pool::operator!() { return ! this->failed_; } Thread_Pool::~Thread_Pool () { } int Thread_Pool::close (u_long) { if (this->doprint_) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) worker thread closing down\n"))); return 0; } Thread_Pool::Thread_Pool (int n_threads) : n_threads_ (n_threads) , total_activated_threads_ (0) , doprint_ (false) , failed_ (false) { } void Thread_Pool::start () { this->failed_ = false; if (this->open () == -1) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) thread activation ") ACE_TEXT ("failed after %u threads\n"), this->total_threads())); this->failed_ = true; } } int Thread_Pool::svc () { unsigned long t = ++this->total_activated_threads_; if (PRINT_DEBUG_MSGS) // change this to 'true' for debugging this->doprint_ = (t > 65530); if (this->doprint_) ACE_DEBUG ((LM_DEBUG, ACE_TEXT(" (%P|%t) thread started.\n"))); // Note that the method automatically removes us // from the when the thread exits. return 0; } namespace { void no_op() { } } int Thread_Pool::open (void *) { if (PRINT_DEBUG_MSGS) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) pool start %d threads...\n"), this->n_threads_)); if (this->total_activated_threads_ >= (65534 - this->n_threads_)) no_op (); // Create a pool of worker threads. if (this->activate (THR_NEW_LWP, this->n_threads_) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("activate failed")), -1); return 0; } #endif /* ACE_HAS_THREADS */ int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Thread_Creation_Threshold_Test")); #if defined (ACE_HAS_THREADS) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) will try to start and kill up") ACE_TEXT (" to %u threads sequentially\n"), MAX_THREAD)); int initial_pool_size = 50; // Create the worker tasks. Thread_Pool thread_pool (initial_pool_size); while (!thread_pool && thread_pool.total_threads() < MAX_THREAD) { // Activate the task's thread pool, produce the messages that are, // produce the messages that are consumed by the threads in the // thread pool, and demonstrate how to shutdown by enqueueing // "empty" messages into the queue. thread_pool.start (); // Wait for all the threads to reach their exit point, at which // point the barrier in the destructor of the portion of // will return. if (thread_pool.wait () == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("wait")), 1); } if (PRINT_DEBUG_MSGS) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%u total threads\n"), thread_pool.total_threads())); int& n_threads = thread_pool.n_threads_; const unsigned long THREAD_THRESHOLD = 63336; if (thread_pool.total_threads() >= (THREAD_THRESHOLD - n_threads)) n_threads = 1; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%u total threads successfully started and died;") ACE_TEXT (" expected %u.\n"), thread_pool.total_threads (), MAX_THREAD)); #else ACE_ERROR ((LM_INFO, ACE_TEXT ("threads not supported on this platform\n"))); #endif /* ACE_HAS_THREADS */ ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/ACE_Init_TestDlg.h0000644000175000017500000000226015027201773017503 0ustar sudipsudip// ACE_Init_TestDlg.h : header file #if !defined(AFX_ACE_INIT_TESTDLG_H__64FDCA00_F7F9_11D2_89B6_00A024CC68DB__INCLUDED_) #define AFX_ACE_INIT_TESTDLG_H__64FDCA00_F7F9_11D2_89B6_00A024CC68DB__INCLUDED_ // CACE_Init_TestDlg dialog class CACE_Init_TestDlg : public CDialog { // Construction public: CACE_Init_TestDlg(CWnd* pParent = 0); // standard constructor // Dialog Data //{{AFX_DATA(CACE_Init_TestDlg) enum { IDD = IDD_ACE_INIT_TEST_DIALOG }; // NOTE: the ClassWizard will add data members here //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CACE_Init_TestDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: HICON m_hIcon; // Generated message map functions //{{AFX_MSG(CACE_Init_TestDlg) virtual BOOL OnInitDialog(); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; //{{AFX_INSERT_LOCATION}} // Microsoft Developer Studio will insert additional declarations immediately before the previous line. #endif /* !defined(AFX_ACE_INIT_TESTDLG_H__64FDCA00_F7F9_11D2_89B6_00A024CC68DB__INCLUDED_) */ ace-8.0.4+dfsg.orig/tests/RW_Process_Mutex_Test.cpp0000644000175000017500000004566315027201773021262 0ustar sudipsudip//============================================================================= /** * @file RW_Process_Mutex_Test.cpp * * Tests an shared between multiple child processes. * * @author Steve Huston */ //============================================================================= #include "test_config.h" #include "ace/Process.h" #include "ace/RW_Process_Mutex.h" #include "ace/SString.h" #include "ace/Get_Opt.h" #include "ace/ACE.h" #include "ace/INET_Addr.h" #include "ace/SOCK_Dgram.h" #include "ace/Time_Value.h" #include "ace/OS_NS_sys_time.h" #include "ace/OS_NS_unistd.h" // The parent process is number -1. Writer is 0; Readers are 1-3. static int child_nr = -1; static u_short reporting_port = 0; static const int Nr_Processes = 4; static ACE_TString mutex_name; static ACE_TCHAR mutex_check[MAXPATHLEN+1]; // The child processes spawned will report times that they hold the lock. // The Child class gets records of the timestamps when the lock is acquired // and released. When the children are done, the time ranges are checked to // be sure that the writer and readers aren't overlapping and that multiple // readers can acquire the lock simultaneously. class Time_Range { public: Time_Range () : start_ (0), stop_ (0) {} void set (const Time_Range &range); void set (const ACE_Time_Value &start, const ACE_Time_Value &stop); bool overlaps (const Time_Range &other) const; private: ACE_Time_Value start_; ACE_Time_Value stop_; }; // Children send range reports to the waiting parent using Range_Report. struct Range_Report { int child_; Time_Range range_; }; void Time_Range::set (const Time_Range &range) { this->start_ = range.start_; this->stop_ = range.stop_; } void Time_Range::set (const ACE_Time_Value &start, const ACE_Time_Value &stop) { this->start_ = start; this->stop_ = stop; } bool Time_Range::overlaps (const Time_Range &other) const { // Be careful because timestamps can appear to be the same when a // process unlocks and a waiter immediately locks. if ((this->start_ >= other.start_ && this->start_ < other.stop_) || (this->stop_ > other.start_ && this->stop_ < other.stop_)) return true; return false; } class Child : public ACE_Process { public: Child () : range_count_ (0) {} void add_range (const Time_Range &range); bool any_overlaps (const Child &other) const; private: enum { Max_Ranges = 5 }; int range_count_; Time_Range ranges_[Max_Ranges]; }; void Child::add_range (const Time_Range &range) { if (this->range_count_ == Max_Ranges) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Child process %d adds too many ranges\n"), (int)(this->getpid ()))); return; } this->ranges_[this->range_count_].set (range); ++this->range_count_; } bool Child::any_overlaps (const Child &other) const { bool overlap = false; for (int i = 0; i < this->range_count_ && !overlap; ++i) { for (int j = 0; j < other.range_count_ && !overlap; ++j) { if (this->ranges_[i].overlaps (other.ranges_[j])) overlap = true; } } return overlap; } // Explain usage and exit. static void print_usage_and_die () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("usage: %n [-c n (child number) -p n (port number)] [-n mutex name]\n"))); ACE_OS::exit (1); } // Parse the command-line arguments and set options. static void parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("c:n:p:")); mutex_name.set (ACE_TEXT ("RW_Process_Mutex_Test.lock")); // Default name int c; while ((c = get_opt ()) != -1) switch (c) { case 'c': child_nr = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'n': mutex_name.set (get_opt.opt_arg ()); break; case 'p': reporting_port = (u_short)ACE_OS::atoi (get_opt.opt_arg ()); break; default: print_usage_and_die (); break; } // Now that the mutex name is known, set up the checker file name. ACE_OS::strncpy (mutex_check, mutex_name.c_str (), MAXPATHLEN); ACE_OS::strncat (mutex_check, ACE_TEXT ("_checker"), MAXPATHLEN); } /* * The set of readers and the writer will operate in a staggered sequence * of acquiring and releasing the lock. The sequence is designed to exercise * waiting behavior of both readers and writer, as well as allowing multiple * readers in, without getting tripped up by any differences in ordering * on different platforms which may favor writers, or vice-versa. * In this timeline, time on seconds is on the left, time holding the lock * is solid, time waiting is dots, acquire/release point is a dash, and * time without the lock is blank. * * TIME WRITER READER1 READER2 READER3 * 0 | * | * 1 | . * | . * 2 - - - * | | * 3 | | - * | | | * 4 - | | * | | * 5 - | * | * 6 - - * | * 7 | . . . * | . . . * 8 - - - - * | | | * 9 | | | * * A file is used to test the sequencing. When the writer first gets the * lock, it will ensure the file is not present. At the end of its time * holding the lock the first time, it will write a "writer 1" string to * the file. When it gets the lock the second time, it will write a * different string to the file, and just before releasing the second time * write a "writer 2" string to the file. The readers all check to be sure * that the file is present and says "writer 1" at the start and end of * their periods of holding the reader lock and, similarly, check for * "writer 2" the second time they hold the lock. */ static void reader (int num) { // Let the writer get there first. ACE_OS::sleep (1); ACE_SOCK_Dgram sock; ACE_INET_Addr parent; parent.set (reporting_port, ACE_LOCALHOST, 1, AF_INET); ACE_TCHAR me_str[80]; parent.addr_to_string (me_str, 80); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Sending reports to %s\n"), me_str)); if (sock.open (ACE_Addr::sap_any, PF_INET) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("UDP open"))); Range_Report report; report.child_ = num; ACE_Time_Value start (ACE_Time_Value::zero), stop (ACE_Time_Value::zero); ACE_RW_Process_Mutex mutex (mutex_name.c_str ()); // Make sure the constructor succeeded if (ACE_LOG_MSG->op_status () != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Reader %d, mutex %s %p\n"), num, mutex_name.c_str (), ACE_TEXT ("ctor"))); return; } ACE_OS::sleep (num); // Grab the lock if (-1 == mutex.acquire_read ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Reader %d %p\n"), num, ACE_TEXT ("first acquire_read"))); else { start = ACE_OS::gettimeofday (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Reader %d acquired first time\n"), num)); } // Wait a bit, then release and report the range held. ACE_OS::sleep (num); // Release the lock then wait; in the interim, the writer should change // the file. stop = ACE_OS::gettimeofday (); if (-1 == mutex.release ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Reader %d %p\n"), num, ACE_TEXT ("first release"))); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Reader %d released first time\n"), num)); report.range_.set (start, stop); ssize_t bytes = sock.send (&report, sizeof (report), parent); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Reader %d sent %b byte report\n"), num, bytes)); ACE_OS::sleep (4 - num); start = stop = ACE_Time_Value::zero; if (-1 == mutex.acquire_read ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Reader %d %p\n"), num, ACE_TEXT ("second acquire_read"))); else { start = ACE_OS::gettimeofday (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Reader %d acquired second time\n"), num)); } // Done; small delay, release, report, and return. ACE_OS::sleep (1); stop = ACE_OS::gettimeofday (); if (-1 == mutex.release ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Reader %d %p\n"), num, ACE_TEXT ("second release"))); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Reader %d released second time; done\n"), num)); report.range_.set (start, stop); bytes = sock.send (&report, sizeof (report), parent); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Reader %d sent %b byte report\n"), num, bytes)); sock.close (); return; } static void writer () { ACE_RW_Process_Mutex mutex (mutex_name.c_str ()); // Make sure the constructor succeeded if (ACE_LOG_MSG->op_status () != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Writer, mutex %s %p\n"), mutex_name.c_str (), ACE_TEXT ("ctor"))); return; } ACE_SOCK_Dgram sock; ACE_INET_Addr parent; parent.set (reporting_port, ACE_LOCALHOST, 1, AF_INET); ACE_TCHAR me_str[80]; parent.addr_to_string (me_str, 80); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Sending reports to %s\n"), me_str)); if (sock.open (ACE_Addr::sap_any, PF_INET) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("UDP open"))); Range_Report report; report.child_ = 0; // We're the writer ACE_Time_Value start (ACE_Time_Value::zero), stop (ACE_Time_Value::zero); // Grab the lock if (-1 == mutex.acquire_write ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Writer first %p\n"), ACE_TEXT ("acquire_write"))); else { start = ACE_OS::gettimeofday (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Writer acquired first time\n"))); } // Now sleep, making the readers wait for the lock. Then release the lock, // sleep, and reacquire the lock. ACE_OS::sleep (2); stop = ACE_OS::gettimeofday (); if (-1 == mutex.release ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Writer %p\n"), ACE_TEXT ("first release"))); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Writer released first time\n"))); report.range_.set (start, stop); ssize_t bytes = sock.send (&report, sizeof (report), parent); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Writer sent %b byte report\n"), bytes)); ACE_OS::sleep (1); // Ensure we don't immediately grab the lock back start = stop = ACE_Time_Value::zero; if (-1 == mutex.acquire_write ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Writer second %p\n"), ACE_TEXT ("acquire_write"))); else { start = ACE_OS::gettimeofday (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Writer acquired second time\n"))); } ACE_OS::sleep (2); stop = ACE_OS::gettimeofday (); if (-1 == mutex.release ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Writer %p\n"), ACE_TEXT ("second release"))); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Writer released second time\n"))); report.range_.set (start, stop); bytes = sock.send (&report, sizeof (report), parent); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Writer sent %b byte report\n"), bytes)); sock.close (); return; } int run_main (int argc, ACE_TCHAR *argv[]) { parse_args (argc, argv); // Child process code. if (child_nr >= 0) { ACE_TCHAR lognm[MAXPATHLEN]; int mypid (ACE_OS::getpid ()); ACE_OS::snprintf (lognm, MAXPATHLEN, ACE_TEXT ("RW_Process_Mutex_Test-child-%d"), mypid); ACE_START_TEST (lognm); if (child_nr == 0) writer (); else reader (child_nr); ACE_END_LOG; } else { ACE_START_TEST (ACE_TEXT ("RW_Process_Mutex_Test")); #if defined ACE_HAS_PROCESS_SPAWN && !defined ACE_LACKS_FILELOCKS // Although it should be safe for each process to construct and // destruct the rw lock, this can disturb other process still // using the lock. This is not really correct, and should be // looked at, but it gets things moving. // Also see Process_Mutex_Test.cpp for similar issue. ACE_RW_Process_Mutex mutex (mutex_name.c_str ()); // Make sure the constructor succeeded if (ACE_LOG_MSG->op_status () != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Parent, mutex %s %p\n"), mutex_name.c_str (), ACE_TEXT ("ctor"))); } // The parent process reads time ranges sent from the children via // UDP. Grab an unused UDP port to tell the children to send to. ACE_INET_Addr me; ACE_SOCK_Dgram sock; if (sock.open (ACE_Addr::sap_any, PF_INET) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Socket %p\n"), ACE_TEXT ("open")), -1); sock.get_local_addr (me); ACE_TCHAR me_str[80]; me.addr_to_string (me_str, 80); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Receiving on %s\n"), me_str)); // Spawn 1 writer and 3 reader processes that will contend for the // lock. Child writer; Child readers[Nr_Processes - 1]; int i; for (i = 0; i < Nr_Processes; i++) { Child *child = (i == 0 ? &writer : &readers[i-1]); ACE_Process_Options options; #ifndef ACE_LACKS_VA_FUNCTIONS options.command_line (ACE_TEXT ("%") ACE_TEXT_PRIs ACE_TEXT (" -c %d -p %u -n %") ACE_TEXT_PRIs, argc > 0 ? argv[0] : ACE_TEXT ("RW_Process_Mutex_Test"), i, (unsigned int)me.get_port_number (), mutex_name.c_str ()); #endif if (child->spawn (options) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("spawn of child %d %p\n"), i, ACE_TEXT ("failed")), -1); } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Child process %d has pid = %d.\n"), i, (int)(child->getpid ()))); } } // Keep reading time ranges reported from the children until all the // children have exited. Alternate between checking for a range and // checking for exits. int processes = Nr_Processes; Child *children[Nr_Processes]; for (i = 0; i < Nr_Processes; i++) children[i] = (i == 0 ? &writer : &readers[i-1]); Range_Report report; ACE_Time_Value poll (0); ACE_INET_Addr from; ssize_t bytes; while (processes > 0) { ACE_Time_Value limit (10); bytes = sock.recv (&report, sizeof (report), from, 0, &limit); if (bytes > 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Report from child %d; %b bytes\n"), report.child_, bytes)); if (report.child_ == 0) writer.add_range (report.range_); else { if (report.child_ >= 1 && report.child_ < Nr_Processes) readers[report.child_ - 1].add_range (report.range_); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("Report from out-of-range child #%d\n"), report.child_)); } } else { if (errno == ETIME) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("UDP time out; check child exits\n"))); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("UDP recv"))); } for (i = 0; i < Nr_Processes; i++) { if (children[i] == 0) continue; ACE_exitcode child_status; // See if the child has exited. int wait_result = children[i]->wait (poll, &child_status); if (wait_result == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Wait for child %d, %p\n"), i, ACE_TEXT ("error"))); else if (wait_result != 0) { if (child_status == 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Child %d finished ok\n"), (int)(children[i]->getpid ()))); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("Child %d finished with status %d\n"), (int)(children[i]->getpid ()), child_status)); children[i] = 0; --processes; } } } sock.close (); if (0 != mutex.remove ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("mutex remove"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Comparing time ranges...\n"))); // The writer should never overlap any readers bool writer_overlap = false; for (i = 0; i < Nr_Processes - 1; ++i) { if (writer.any_overlaps (readers[i])) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Writer overlaps reader %d\n"), i+1)); writer_overlap = true; } } if (!writer_overlap) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Writer does not overlap with readers; Ok\n"))); // And there should be some overlap between readers. bool reader_overlap = false; for (i = 0; i < Nr_Processes - 1; ++i) { // Just compare to those higher, else it compares the same ones, // only in reverse. for (int j = i + 1; j < Nr_Processes - 1; ++j) { if (readers[i].any_overlaps (readers[j])) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Reader %d overlaps reader %d; Ok\n"), i + 1, j + 1)); reader_overlap = true; } } } if (!reader_overlap) ACE_ERROR ((LM_ERROR, ACE_TEXT ("No readers overlapped!\n"))); #endif // ACE_HAS_PROCESS_SPAWN ACE_END_TEST; } return 0; } ace-8.0.4+dfsg.orig/tests/Notify_Performance_Test.cpp0000644000175000017500000001442415027201773021632 0ustar sudipsudip//============================================================================= /** * @file Notify_Performance_Test.cpp * * This test is used to time the notification mechanisms of the * ACE_Reactors. Both the WFMO_Reactor and Select_Reactor can be * tested. The notify() mechanism can also be tested with or * without data. * * @author Irfan Pyarali */ //============================================================================= #include #include "test_config.h" #include "ace/Profile_Timer.h" #include "ace/Get_Opt.h" #include "ace/Thread_Manager.h" #include "ace/Reactor.h" #include "ace/WFMO_Reactor.h" #include "ace/Select_Reactor.h" #include "ace/Dev_Poll_Reactor.h" #include #include "ace/Atomic_Op.h" #if defined (ACE_HAS_THREADS) // Number of client (user) threads static long opt_nthreads = 1; // Number of notify calls static int opt_nloops = 20000; // Use the WFMO_Reactor static int opt_wfmo_reactor = 0; // Use the Select_Reactor static int opt_select_reactor = 0; // Use the Dev_Poll_Reactor static int opt_dev_poll_reactor = 0; // Pass data through the notify call static int opt_pass_notify_data = 0; // Simple no-op handler class Handler : public ACE_Event_Handler { public: /// The Handler callbacks. int handle_exception (ACE_HANDLE fd = ACE_INVALID_HANDLE) override; }; int Handler::handle_exception (ACE_HANDLE handle) { ACE_UNUSED_ARG (handle); return 0; } // Execute the client tests. static void * client (void *arg) { // Number of client (user) threads static ACE_Atomic_Op thread_counter; thread_counter = opt_nthreads; // To pass or not to pass is the question Handler *handler = 0; if (!opt_pass_notify_data) handler = 0; else handler = (Handler *) arg; for (int i = 0; i < opt_nloops; i++) ACE_Reactor::instance ()->notify (handler); if (--thread_counter == 0) ACE_Reactor::instance()->end_reactor_event_loop (); return 0; } // Sets up the correct reactor (based on platform and options) static void create_reactor () { ACE_Reactor_Impl *impl = 0; if (opt_wfmo_reactor) { #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 == 1) ACE_NEW (impl, ACE_WFMO_Reactor); #endif /* ACE_HAS_WINSOCK2 == 1 */ } else if (opt_select_reactor) { ACE_NEW (impl, ACE_Select_Reactor); } else if (opt_dev_poll_reactor) { #if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) ACE_NEW (impl, ACE_Dev_Poll_Reactor); #endif /* ACE_HAS_EVENT_POLL || ACE_HAS_DEV_POLL */ } ACE_Reactor *reactor = 0; ACE_NEW (reactor, ACE_Reactor (impl)); ACE_Reactor::instance (reactor); } static void print_results (ACE_Profile_Timer::ACE_Elapsed_Time &et) { const ACE_TCHAR *reactor_type = 0; if (opt_wfmo_reactor) reactor_type = ACE_TEXT ("WFMO_Reactor"); else if (opt_select_reactor) reactor_type = ACE_TEXT ("Select_Reactor"); else if (opt_dev_poll_reactor) reactor_type = ACE_TEXT ("Dev_Poll_Reactor"); else reactor_type = ACE_TEXT ("Platform's default Reactor"); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nNotify_Performance Test statistics:\n\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\tReactor Type: %s\n"), reactor_type)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\tWorker threads (calling notify()): %d\n"), opt_nthreads)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\tIteration per thread: %d\n"), opt_nloops)); if (opt_pass_notify_data) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\tData was passed in the notify() call\n"))); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\tNo data was passed in the notify() call\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n\tTiming results notify() call:\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\t\treal time = %f secs \n\t\tuser time = %f secs \n\t\tsystem time = %f secs\n\n"), et.real_time, et.user_time, et.system_time)); } int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Notify_Performance_Test")); //FUZZ: disable check_for_lack_ACE_OS ACE_Get_Opt getopt (argc, argv, ACE_TEXT ("pswdc:l:")); for (int c; (c = getopt ()) != -1; ) switch (c) { //FUZZ: enable check_for_lack_ACE_OS case 'p': opt_dev_poll_reactor = 1; break; case 's': opt_select_reactor = 1; break; case 'w': opt_wfmo_reactor = 1; break; case 'c': opt_nthreads = ACE_OS::atoi (getopt.opt_arg ()); break; case 'l': opt_nloops = ACE_OS::atoi (getopt.opt_arg ()); break; case 'd': opt_pass_notify_data = 1; break; } // Sets up the correct reactor (based on platform and options) create_reactor (); // Manage memory automagically. std::unique_ptr reactor (ACE_Reactor::instance ()); std::unique_ptr impl; // If we are using other that the default implementation, we must // clean up. if (opt_select_reactor || opt_wfmo_reactor || opt_dev_poll_reactor) { std::unique_ptr auto_impl (ACE_Reactor::instance ()->implementation ()); impl = std::move(auto_impl); } // Callback object Handler handler; // Spawn worker threads if (ACE_Thread_Manager::instance ()->spawn_n (opt_nthreads, ACE_THR_FUNC (client), (void *) &handler, THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), ACE_TEXT ("thread create failed"))); // Timer business ACE_Profile_Timer timer; timer.start (); // Run event loop ACE_Reactor::instance()->run_reactor_event_loop (); timer.stop (); ACE_Profile_Timer::ACE_Elapsed_Time et; timer.elapsed_time (et); // Print results print_results (et); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) waiting for the worker threads...\n"))); // Wait for all worker to get done. ACE_Thread_Manager::instance ()->wait (); ACE_END_TEST; return 0; } #else int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Notify_Performance_Test")); ACE_ERROR ((LM_INFO, ACE_TEXT ("threads not supported on this platform\n"))); ACE_END_TEST; return 0; } #endif /* ACE_HAS_THREADS */ ace-8.0.4+dfsg.orig/tests/UNIXclerk.conf0000644000175000017500000000046315027201773017007 0ustar sudipsudip# # Note: hostname and port number need to be concatenated separated by ":" dynamic Logging_Strategy Service_Object * ACE:_make_ACE_Logging_Strategy() "-s log/Time_Service_Test_Clerk.log -f OSTREAM" dynamic Time_Server_Test Service_Object * netsvcs:_make_ACE_TS_Clerk_Processor () "-h localhost:10222 -t 4" ace-8.0.4+dfsg.orig/tests/Compiler_Features_16_Test.cpp0000644000175000017500000000204615027201773021754 0ustar sudipsudip/** * This program checks if the compiler / platform supports strongly * typed enums */ #include "test_config.h" #include #include #include static constexpr uint32_t bound = std::numeric_limits::max(); namespace CORBA { // First forward declare TCKind, this is legal with C++11 enum class TCKind : uint32_t; enum class TCKind : uint32_t { tk_null, tk_void, tk_event };// TCKind // And another forward declared TCKind, after it has been // declared enum class TCKind : uint32_t; }; std::ostream& operator<< (std::ostream& strm,CORBA::TCKind _enumerator) { switch (_enumerator) { case CORBA::TCKind::tk_null: return strm << "CORBA::TCKind::tk_null"; break; case CORBA::TCKind::tk_void: return strm << "CORBA::TCKind::tk_void"; break; default: return strm; } } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT("Compiler_Features_16_Test")); ACE_DEBUG ((LM_INFO, ACE_TEXT ("Strongly typed enums work.\n"))); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Compiler_Features_20_DLL_Export.h0000644000175000017500000000466715027201773022464 0ustar sudipsudip // -*- C++ -*- // Definition for Win32 Export directives. // This file is generated automatically by generate_export_file.pl COMPILER_FEATURES_20_DLL // ------------------------------ #ifndef COMPILER_FEATURES_20_DLL_EXPORT_H #define COMPILER_FEATURES_20_DLL_EXPORT_H #include "ace/config-all.h" #if defined (ACE_AS_STATIC_LIBS) && !defined (COMPILER_FEATURES_20_DLL_HAS_DLL) # define COMPILER_FEATURES_20_DLL_HAS_DLL 0 #endif /* ACE_AS_STATIC_LIBS && ! TEST_HAS_DLL */ #if !defined (COMPILER_FEATURES_20_DLL_HAS_DLL) # define COMPILER_FEATURES_20_DLL_HAS_DLL 1 #endif /* ! COMPILER_FEATURES_20_DLL_HAS_DLL */ #if defined (COMPILER_FEATURES_20_DLL_HAS_DLL) && (COMPILER_FEATURES_20_DLL_HAS_DLL == 1) # if defined (COMPILER_FEATURES_20_DLL_BUILD_DLL) # define COMPILER_FEATURES_20_DLL_Export ACE_Proper_Export_Flag # define COMPILER_FEATURES_20_DLL_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) # define COMPILER_FEATURES_20_DLL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) # else /* COMPILER_FEATURES_20_DLL_BUILD_DLL */ # define COMPILER_FEATURES_20_DLL_Export ACE_Proper_Import_Flag # define COMPILER_FEATURES_20_DLL_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) # define COMPILER_FEATURES_20_DLL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) # endif /* COMPILER_FEATURES_20_DLL_BUILD_DLL */ #else /* COMPILER_FEATURES_20_DLL_HAS_DLL == 1 */ # define COMPILER_FEATURES_20_DLL_Export # define COMPILER_FEATURES_20_DLL_SINGLETON_DECLARATION(T) # define COMPILER_FEATURES_20_DLL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) #endif /* COMPILER_FEATURES_20_DLL_HAS_DLL == 1 */ // Set COMPILER_FEATURES_20_DLL_NTRACE = 0 to turn on library specific tracing even if // tracing is turned off for ACE. #if !defined (COMPILER_FEATURES_20_DLL_NTRACE) # if (ACE_NTRACE == 1) # define COMPILER_FEATURES_20_DLL_NTRACE 1 # else /* (ACE_NTRACE == 1) */ # define COMPILER_FEATURES_20_DLL_NTRACE 0 # endif /* (ACE_NTRACE == 1) */ #endif /* !COMPILER_FEATURES_20_DLL_NTRACE */ #if (COMPILER_FEATURES_20_DLL_NTRACE == 1) # define COMPILER_FEATURES_20_DLL_TRACE(X) #else /* (COMPILER_FEATURES_20_DLL_NTRACE == 1) */ # define COMPILER_FEATURES_20_DLL_TRACE(X) ACE_TRACE_IMPL(X) #endif /* (COMPILER_FEATURES_20_DLL_NTRACE == 1) */ #endif /* COMPILER_FEATURES_20_DLL_EXPORT_H */ // End of auto generated file. ace-8.0.4+dfsg.orig/tests/Service_Config_Stream_Test.cpp0000644000175000017500000000757315027201773022250 0ustar sudipsudip// ============================================================================ // // = LIBRARY // tests // // = DESCRIPTION // This test exercises ACE_Service_Config assembling a stream. // // = AUTHOR // Steve Huston // // ============================================================================ #include "test_config.h" #include "ace/Log_Msg.h" #include "ace/Module.h" #include "ace/Service_Config.h" #include "ace/Task.h" /* * The Decrypter service is static and is configured into a stream * dynamically. * * NOTE! This code is here, and it will trip up while being loaded. If * "static Decrypter" is inserted into the .conf file's module list, this * test will barf. This is arguably a weird test, but I don't know any * reason it should not work; however, this behavior has never been tested * and may not have ever worked... but if someone is feeling ambitious, * please go ahead and make this work. I'm out of time and energy. * -Steve Huston */ class Static_Task : public ACE_Task { public: int open (void *) override { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("opening %s\n"), this->name () ? this->name () : ACE_TEXT ("Static_Task"))); return 0; } int close (u_long) override { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("closing %s\n"), this->name () ? this->name () : ACE_TEXT ("Static_Task"))); return 0; } int init (int, ACE_TCHAR *[]) override { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("initializing %s\n"), this->name () ? this->name () : ACE_TEXT ("Static_Task"))); return 0; } int fini () override { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("finalizing %s\n"), this->name () ? this->name () : ACE_TEXT ("Static_Task"))); return 0; } }; class Decrypter : public ACE_Service_Object, public ACE_Module { public: Decrypter () : ACE_Module ( ACE_TEXT ("Decrypter"), &writer_, &reader_, 0, M_DELETE_NONE) // Tasks are members; don't delete {} ACE_ALLOC_HOOK_DECLARE; private: Static_Task writer_; Static_Task reader_; }; ACE_FACTORY_DEFINE (ACE_Local_Service, Decrypter) ACE_STATIC_SVC_DEFINE (Decrypter_Descriptor, ACE_TEXT ("Decrypter"), ACE_MODULE_T, &ACE_SVC_NAME (Decrypter), (ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ), 1) ACE_STATIC_SVC_REQUIRE (Decrypter_Descriptor) ACE_ALLOC_HOOK_DEFINE(Decrypter); int run_main (int, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Service_Config_Stream_Test")); ACE_STATIC_SVC_REGISTER (Decrypter); // If you want to try the static module in the stream test (comments at // the top of this file) it needs the -y in the argv list which enables // static services. Otherwise it's not really needed. Same with the // 'false' 4th arg to open() below - it allows static services. ACE_TCHAR *_argv[5] = { argv[0], const_cast (ACE_TEXT ("-d")), const_cast (ACE_TEXT ("-y")), const_cast (ACE_TEXT ("-f")), const_cast (ACE_TEXT ("Service_Config_Stream_Test.conf")) }; int status; if ((status = ACE_Service_Config::open (5, _argv, ACE_DEFAULT_LOGGER_KEY, false, true /*ignore def svc.conf*/)) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open"), 1)); ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/Sigset_Ops_Test.cpp0000644000175000017500000000752615027201773020125 0ustar sudipsudip //============================================================================= /** * @file Sigset_Ops_Test.cpp * * This program tests the correctness of following functions. * sigfillset(), sigemptyset(), sigaddset(), sigdelset(), * sigismember(). * * @author Nanbor Wang */ //============================================================================= #include "test_config.h" #include "ace/OS_NS_signal.h" #include "ace/OS_NS_errno.h" void siglistset (sigset_t x, int *sigset, int can_miss = 0) { bool empty = true; int result = 0; for (int i = 1; i < ACE_NSIG; i++) { result = ACE_OS::sigismember (&x, i); if (result > 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" %d\n"), i)) ; empty = false; } else if (can_miss) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Be careful... Signal %d is not valid\n"), i)); result = 1; } ACE_TEST_ASSERT ((sigset [i] ? result > 0 : result <= 0)) ; } if (empty) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Empty!!\n\n"))) ; else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n\n"))) ; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Sigset_Ops_Test")); #if defined (ACE_LACKS_SIGSET) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%n uses ACE implementation of sigset* () functions.\n\n"))) ; #else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%n uses platform's native sigset* () functions.\n\n"))) ; #endif sigset_t x ; // examined sigset int sigset [ACE_NSIG] ; // a comparison sigset int i ; int status = 0; // 0 is success, else fail code // Two test signal numbers. I choose these low value signals to // avoid exceeding the ACE_NSIG range. const int tsig1 = 5 ; const int tsig2 = 8 ; // Testing sigfillset ACE_OS::sigfillset (&x) ; // fill the comparison set for (i = 0 ; i < ACE_NSIG ; i++) sigset [i] = 1 ; // There's no guarantee that the valid signals are sequential without // missed spots. For example, Red Hat Enterprise Linux 3 (any version // with NPTL) does not include signal 32 in sigfillset() since it's // reserved for kernel/nptl use. So, allow a miss in this check, but // be prepared to check the log file for misses if signal capability seems // odd if the test passes. siglistset (x, sigset, 1) ; // testing sigemptyset ACE_OS::sigemptyset (&x) ; // empty the comparison set for (i = 0 ; i < ACE_NSIG ; i++) sigset [i] = 0 ; siglistset (x, sigset) ; // add the first signal into set ACE_OS::sigaddset (&x, tsig1) ; sigset [tsig1] = 1 ; siglistset (x, sigset) ; // add the second signal into set ACE_OS::sigaddset (&x, tsig2) ; sigset [tsig2] = 1 ; siglistset (x, sigset) ; // then remove it ACE_OS::sigdelset (&x, tsig1) ; sigset [tsig1] = 0 ; siglistset (x, sigset) ; // remove the second one ACE_OS::sigdelset (&x, tsig2) ; sigset [tsig2] = 0 ; siglistset (x, sigset) ; // Now testing out of bound signal if (ACE_OS::sigismember (&x, ACE_NSIG) >= 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Platform doesn't check for valid signal number.\n"))); status = 1; } else if (ACE_OS::last_error () != EINVAL) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p.\n"), ACE_TEXT ("Expected status EINVAL; got"))); status = 1; } /* Skip this test at this moment // Test if platform can catch invalid sigset error Currently, I can // only think of passing a NULL ptr If you know other situations // that fall into this catagory, please let me know. Thanks. ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Now testing invalid sigset. If your platform gets a \nsegmentation fault, then it doesn't check the error properly.\n"))) ; ACE_TEST_ASSERT (ACE_OS::sigfillset (0) < 0 && ACE_OS::last_error () == EFAULT) ; */ ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/Max_Default_Port_Test_IPV6.cpp0000644000175000017500000001526115027201773022042 0ustar sudipsudip// ============================================================================ /** * @file Max_Default_Port_Test_IPV6.cpp * * @brief This is a test for ACE_MAX_DEFAULT_PORT value. * * The test tests the highest value of the port number at which an * event handler can be registered and a Connector can be connected * to. * * Some weird behaviour has been reported on Windows NT (sp 3) when * the port number exceeds 65279 resulting ACE_MAX_DEFAULT_PORT to set * to zero on that platform. * * In this test, the event handler is started at the port value * USHRT_MAX and decremented for 300 port values and tested if the * highest port number used agrees with ACE_MAX_DEFAULT_PORT value. * * @author Chanaka Liyanaarachchi * Brian Buesker */ // ============================================================================ #include "test_config.h" #include "ace/Reactor.h" #include "ace/SOCK_Connector.h" #include "ace/Thread_Manager.h" #include "Max_Default_Port_Test.h" My_Accept_Handler::My_Accept_Handler (ACE_INET_Addr &addr) : addr_ (addr) { if (addr.get_port_number() != 0) this->open (addr); } My_Accept_Handler::~My_Accept_Handler () { this->peer_acceptor_.close (); // Prevent handle leaks } int My_Accept_Handler::open (ACE_INET_Addr &addr) { if (this->peer_acceptor_.open (addr, 1) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("My_Accept_Handler open"))); ACE_OS::exit (1); } return 0; } ACE_HANDLE My_Accept_Handler::get_handle () const { return this->peer_acceptor_.get_handle (); } int My_Accept_Handler::handle_input (ACE_HANDLE) { if (this->peer_acceptor_.accept(this->stream_, 0) == -1) { ACE_ERROR((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("peer_acceptor.accept"))); ACE_OS::exit(1); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("My_Accept_Handler::handle_input\n"))); // Close the opened stream, else it'll leak a handle. Don't close // the acceptor here, though, because get_handle() needs it to // correctly allow removal from the reactor later. It gets closed // in the destructor. this->stream_.close (); return 0; } u_short My_Accept_Handler::port () { return this->addr_.get_port_number(); } long max_connected_port = 0; #if defined (ACE_HAS_IPV6) static void * client (void *arg) { ACE_INET_Addr *remote_addr = reinterpret_cast (arg); ACE_INET_Addr server_addr (remote_addr->get_port_number (), "::1"); ACE_SOCK_Stream cli_stream; ACE_SOCK_Connector con; ACE_Time_Value timeout (ACE_DEFAULT_TIMEOUT); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Connecting to port %d\n"), server_addr.get_port_number())); // Initiate connection with server; don't wait forever if (con.connect (cli_stream, server_addr, &timeout) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("connection failed"))); return 0; } // if connect succesful, what is the max port number we connected // up to now. int connected_port = server_addr.get_port_number (); if (connected_port > max_connected_port) max_connected_port = connected_port; cli_stream.close (); return 0; } #endif /*ACE_HAS_IPV6*/ int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Max_Default_Port_Test_IPV6")); ACE_UNUSED_ARG (argc); ACE_UNUSED_ARG (argv); #if defined (ACE_HAS_IPV6) u_short max_listened_port = 0; //Ports beyond 65279 were said to bad on NT sp 3. for (u_short idx = USHRT_MAX; idx != USHRT_MAX - 300; --idx) { ACE_INET_Addr addr (idx, "::"); My_Accept_Handler *eh = new My_Accept_Handler (addr); if ( ACE_Reactor::instance()->register_handler ( eh, ACE_Event_Handler::ACCEPT_MASK) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Failed to register event handler")), 1); } ACE_DEBUG ((LM_DEBUG, "Registered event handler at %d\n", idx)); ACE_Time_Value tv (1); #if defined (ACE_HAS_THREADS) if (ACE_Thread_Manager::instance ()->spawn_n (1, ACE_THR_FUNC (client), reinterpret_cast (&addr), THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("thread create failed")), 1); ACE_Thread_Manager::instance ()->wait (); #else ACE_UNUSED_ARG (client); ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) only one thread may be run in a process on this platform\n%a"), 1)); #endif //ACE_HAS_THREADS if (ACE_Reactor::instance()->handle_events (tv) == -1 ) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Reactor::handle_events")), 1); } // see if I can register a reactor at this port. if (eh->port () == idx) { if (idx > max_listened_port) max_listened_port = idx; } else { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Test Fail, listening port %d\n"), eh->port()), 1); } ACE_Reactor::instance()->remove_handler ( eh, ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); delete eh; } ACE_DEBUG ((LM_DEBUG, "Value of ACE_MAX_DEFAULT_PORT %d\n", ACE_MAX_DEFAULT_PORT)); ACE_DEBUG ((LM_DEBUG, "Highest port value I can listen at %d\n", max_listened_port)); ACE_DEBUG ((LM_DEBUG, "Highest port value I can connect to %d\n", max_connected_port)); if ((max_listened_port == ACE_MAX_DEFAULT_PORT) && (max_connected_port == ACE_MAX_DEFAULT_PORT)) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Valid ACE_MAX_DEFAULT_PORT value: %d\n"), max_listened_port)); } else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invalid ACE_MAX_DEFAULT_PORT ") ACE_TEXT ("or %d port may be busy; got to %d\n"), ACE_MAX_DEFAULT_PORT, max_listened_port)); } #endif /* ACE_HAS_IPV6 */ ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Thread_Pool_Reactor_Test.cpp0000644000175000017500000002272415027201773021722 0ustar sudipsudip //============================================================================= /** * @file Thread_Pool_Reactor_Test.cpp * * This program is a torture test of thread pool reactors. It * starts by spawning several server threads waiting to handle * events. Several other client threads are spawned right after * to initiate connections to server threads. Each connection * adds a new Svc_Handler into the TP_Reactor and sends out * several "requests" to the server thread. After the connection * is closed, the Svc_Handler is removed from the TP_Reactor. * Each message is treated as a separate request by the server so * two consecutive requests might be serviced by two different * threads. * * Usage: Thread_Pool_Reactor_Test [-r ] * [-s ] [-c ] [-d ] * [-i ] [-n ] * * Default value: * : ACE_DEFAULT_RENDEZVOUS * : ACE_MAX_THREADS * : ACE_MAX_ITERATIONS * : ACE_MAX_ITERATIONS * : ACE_MAX_THREADS * : 50 usec * * @author Irfan Pyarali and Nanbor Wang */ //============================================================================= #include "test_config.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #include "ace/Get_Opt.h" #include "ace/SOCK_Connector.h" #include "ace/SOCK_Acceptor.h" #include "ace/Acceptor.h" #include "ace/Thread_Manager.h" #include "ace/TP_Reactor.h" #if defined (ACE_HAS_THREADS) && !defined ACE_LACKS_ACCEPT #include "Thread_Pool_Reactor_Test.h" using ACCEPTOR = ACE_Strategy_Acceptor; // Accepting end point. This is actually "localhost:10010", but some // platform couldn't resolve the name so we use the IP address // directly here. static const ACE_TCHAR *rendezvous = ACE_TEXT ("127.0.0.1:10010"); // Total number of server threads. static size_t svr_thrno = ACE_MAX_THREADS; // Default network parameters (MAX_BINDS and system buffers) are too small // for full test on some platforms; add platforms that can't handle too many // connection simultaneously here. #if defined (ACE_VXWORKS) #define ACE_LOAD_FACTOR /2 #else #define ACE_LOAD_FACTOR #endif // Total number of client threads. static size_t cli_thrno = ACE_MAX_THREADS ACE_LOAD_FACTOR; // Total connection attempts of a client thread. static size_t cli_conn_no = ACE_MAX_ITERATIONS ACE_LOAD_FACTOR; // Total requests a client thread sends. static size_t cli_req_no = ACE_MAX_THREADS ACE_LOAD_FACTOR; // Delay before a thread sending the next request (in msec.) static int req_delay = 50; static void parse_arg (int argc, ACE_TCHAR *argv[]) { //FUZZ: disable check_for_lack_ACE_OS ACE_Get_Opt getopt (argc, argv, ACE_TEXT ("r:s:c:d:i:n:")); int c; while ((c = getopt ()) != -1) { //FUZZ: enable check_for_lack_ACE_OS switch (c) { case 'r': // hostname:port rendezvous = getopt.opt_arg (); break; case 's': svr_thrno = ACE_OS::atoi (getopt.opt_arg ()); break; case 'c': cli_thrno = ACE_OS::atoi (getopt.opt_arg ()); break; case 'd': req_delay = ACE_OS::atoi (getopt.opt_arg ()); break; case 'i': cli_conn_no = ACE_OS::atoi (getopt.opt_arg ()); break; case 'n': cli_req_no = ACE_OS::atoi (getopt.opt_arg ()); break; default: ACE_ERROR ((LM_ERROR, "Usage: Thread_Pool_Reactor_Test [-r ]" "\t[-s ] [-c ] [-d ]" "\t[-i ]" "[-n ]\n")); break; } } } Request_Handler::Request_Handler (ACE_Thread_Manager *thr_mgr) : ACE_Svc_Handler (thr_mgr), nr_msgs_rcvd_(0) { // Make sure we use TP_Reactor with this class (that's the whole // point, right?) this->reactor (ACE_Reactor::instance ()); } int Request_Handler::handle_input (ACE_HANDLE fd) { ACE_TCHAR buffer[BUFSIZ]; ACE_TCHAR len = 0; ssize_t result = this->peer ().recv (&len, sizeof (ACE_TCHAR)); if (result > 0 && this->peer ().recv_n (buffer, len * sizeof (ACE_TCHAR)) == static_cast (len * sizeof (ACE_TCHAR))) { ++this->nr_msgs_rcvd_; ACE_DEBUG ((LM_DEBUG, "(%t) svr input; fd: 0x%x; input: %s\n", fd, buffer)); if (ACE_OS::strcmp (buffer, ACE_TEXT ("shutdown")) == 0) ACE_Reactor::instance()->end_reactor_event_loop (); return 0; } else ACE_DEBUG ((LM_DEBUG, "(%t) Request_Handler: 0x%x peer closed (0x%x)\n", this, fd)); return -1; } int Request_Handler::handle_close (ACE_HANDLE fd, ACE_Reactor_Mask) { ACE_DEBUG ((LM_DEBUG, "(%t) svr close; fd: 0x%x, rcvd %d msgs\n", fd, this->nr_msgs_rcvd_)); if (this->nr_msgs_rcvd_ != cli_req_no) ACE_ERROR((LM_ERROR, "(%t) Handler 0x%x: Expected %d messages; got %d\n", this, cli_req_no, this->nr_msgs_rcvd_)); this->destroy (); return 0; } static int reactor_event_hook (ACE_Reactor *) { ACE_DEBUG ((LM_DEBUG, "(%t) handling events ....\n")); return 0; } static ACE_THR_FUNC_RETURN svr_worker (void *) { // Server thread function. int result = ACE_Reactor::instance ()->run_reactor_event_loop (&reactor_event_hook); if (result == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "Error handling events"), 0); ACE_DEBUG ((LM_DEBUG, "(%t) I am done handling events. Bye, bye\n")); return 0; } static ACE_THR_FUNC_RETURN cli_worker (void *arg) { // Client thread function. ACE_INET_Addr addr (rendezvous); ACE_SOCK_Stream stream; ACE_SOCK_Connector connect; ACE_Time_Value delay (0, req_delay); size_t len = * reinterpret_cast (arg); for (size_t i = 0 ; i < cli_conn_no; i++) { if (connect.connect (stream, addr) < 0) { ACE_ERROR ((LM_ERROR, "(%t) %p\n", "connect")); continue; } for (size_t j = 0; j < cli_req_no; j++) { ACE_DEBUG ((LM_DEBUG, "(%t) conn_worker handle 0x%x, req %d\n", stream.get_handle (), j+1)); if (stream.send_n (arg, (len + 1) * sizeof (ACE_TCHAR)) == -1) { ACE_ERROR ((LM_ERROR, "(%t) %p\n", "send_n")); continue; } ACE_OS::sleep (delay); } stream.close (); } return 0; } static ACE_THR_FUNC_RETURN worker (void *) { ACE_OS::sleep (3); const ACE_TCHAR *msg = ACE_TEXT ("Message from Connection worker"); ACE_TCHAR buf [BUFSIZ]; buf[0] = static_cast ((ACE_OS::strlen (msg) + 1)); ACE_OS::strcpy (&buf[1], msg); ACE_INET_Addr addr (rendezvous); ACE_DEBUG((LM_DEBUG, "(%t) Spawning %d client threads...\n", cli_thrno)); int grp = ACE_Thread_Manager::instance ()->spawn_n (cli_thrno, &cli_worker, buf); ACE_TEST_ASSERT (grp != -1); ACE_Thread_Manager::instance ()->wait_grp (grp); ACE_DEBUG ((LM_DEBUG, "(%t) Client threads done; shutting down...\n")); ACE_SOCK_Stream stream; ACE_SOCK_Connector connect; if (connect.connect (stream, addr) == -1) ACE_ERROR ((LM_ERROR, "(%t) %p Error while connecting\n", "connect")); const ACE_TCHAR *sbuf = ACE_TEXT ("\011shutdown"); ACE_DEBUG ((LM_DEBUG, "shutdown stream handle = %x\n", stream.get_handle ())); if (stream.send_n (sbuf, (ACE_OS::strlen (sbuf) + 1) * sizeof (ACE_TCHAR)) == -1) ACE_ERROR ((LM_ERROR, "(%t) %p\n", "send_n")); stream.close (); return 0; } int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Thread_Pool_Reactor_Test")); parse_arg (argc, argv); // Changed the default ACE_TP_Reactor sr; ACE_Reactor new_reactor (&sr); ACE_Reactor::instance (&new_reactor); ACCEPTOR acceptor; ACE_INET_Addr accept_addr (rendezvous); if (acceptor.open (accept_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), 1); ACE_DEBUG((LM_DEBUG, ACE_TEXT ("(%t) Spawning %d server threads...\n"), svr_thrno)); ACE_Thread_Manager::instance ()->spawn_n (svr_thrno, svr_worker); ACE_Thread_Manager::instance ()->spawn (worker); ACE_Thread_Manager::instance ()->wait (); ACE_END_TEST; return 0; } #else int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Thread_Pool_Reactor_Test")); ACE_ERROR ((LM_INFO, "threads/accept not supported on this platform\n")); ACE_END_TEST; return 0; } #endif /* ACE_HAS_THREADS */ ace-8.0.4+dfsg.orig/tests/Malloc_Test.cpp0000644000175000017500000003047315027201773017252 0ustar sudipsudip //============================================================================= /** * @file Malloc_Test.cpp * * This is a test of the position-independent memory * manager using the and . * * @author Douglas C. Schmidt */ //============================================================================= #include "test_config.h" #include "Malloc_Test.h" #include "ace/Malloc_T.h" #include "ace/MMAP_Memory_Pool.h" #include "ace/Process.h" #include #include "ace/Process_Mutex.h" #include "ace/PI_Malloc.h" #include "ace/RW_Thread_Mutex.h" #include "ace/Time_Value.h" #include "ace/OS_NS_unistd.h" #if defined (ACE_HAS_PROCESS_SPAWN) #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1) using MALLOC = ACE_Malloc_T; #else typedef ACE_Malloc MALLOC; #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */ #define MMAP_FILENAME ACE_TEXT ("test_file") #define MUTEX_NAME ACE_TEXT ("test_lock") #if !defined (ACE_LINUX) \ && !defined (ACE_ANDROID) \ && !(defined (ACE_WIN32) \ && (defined (ghs) || defined (__MINGW32__) )) \ && !(defined (__OpenBSD__) && defined (ACE_HAS_PTHREADS)) #define ACE_TEST_REMAP_ON_FAULT // Linux seems to have problem when calling mmap from the signal handler. // The Green Hills Native x86 compiler does not support structural exceptions. // Mingw's gcc does not support structural exceptions. // Win9x doesn't support remaps. // OpenBSD causes this test to hang in the child when pthreads are enabled. // On these platforms, we make sure the remapping will never occur. #endif /* ACE_LINUX && Win32 GHS*/ #if defined (ACE_WIN32) // When looking for the file to execute a process on Win32, the directory from // containing the parent process file is searched first. Since certain Win32 // configurations (e.g. Borland C++Builder) put the output files in a different // directory we will use this feature rather than specifying '.\'. # define EXE_LOCATION ACE_TEXT ("") #else # define EXE_LOCATION ACE_TEXT (".") ACE_DIRECTORY_SEPARATOR_STR #endif /*ACE_WIN32*/ // Parents base address in shared memory. static const void *PARENT_BASE_ADDR = ACE_DEFAULT_BASE_ADDR; // If the platform supports position-independent malloc, choose // another base address that's 1M higher so that will be // mapped into a different address in the child's virtual memory. // Note that on HP-UX on PA-RISC hardware, a single range of a file // cannot be mapped into multiple virtual address ranges, even across // processes. So, though the whole PI pointer thing is tested here, // it isn't actually using multiple address ranges. #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1) # define CHILD_ADDR_DELTA (1024*1024) #else # define CHILD_ADDR_DELTA 0 #endif /* CHILD_ADDR_DELTA */ static const void *CHILD_BASE_ADDR = (const void *)(CHILD_ADDR_DELTA + ACE_DEFAULT_BASE_ADDR); // Shared memory allocator. Hide the allocator inside this function // so that it doesn't get constructed until after the // gets constructed, even with // . static MALLOC * myallocator (const void *base_addr = 0) { static std::unique_ptr static_allocator; if (static_allocator.get () == 0) { ACE_MMAP_Memory_Pool_Options options (base_addr); #if !defined (ACE_TEST_REMAP_ON_FAULT) options.minimum_bytes_ = 512 * 1024; #endif /* ACE_TEST_REMAP_ON_FAULT */ MALLOC *ptr = new MALLOC (MMAP_FILENAME, MUTEX_NAME, &options); static_allocator.reset (ptr); } return static_allocator.get (); } static void init_test (const void *base_addr = 0) { // Cleanup the MMAP file so we won't trip over the leftover mmap // file from the previous crash. ACE_MMAP_Memory_Pool_Options options (base_addr); //FUZZ: disable check_for_lack_ACE_OS ACE_MMAP_Memory_Pool mmap (MMAP_FILENAME, &options); //FUZZ: enable check_for_lack_ACE_OS size_t rbyte = 0; int ft = 0; mmap.init_acquire (1024, rbyte, ft); mmap.release (); } static Test_Data * initialize (MALLOC *allocator) { double *temp = 0; ACE_ALLOCATOR_RETURN (temp, (double *) allocator->malloc (sizeof (double)), 0); // Make sure that doubles work! *temp = 5.0; allocator->free (temp); void *ptr = 0; ACE_ALLOCATOR_RETURN (ptr, allocator->malloc (sizeof (Test_Data)), 0); Test_Data *data1 = new (ptr) Test_Data; data1->i1_ = 111; data1->i2_ = 222; data1->i3_ = 333; data1->d1_ = 87.5; void *gap = 0; ACE_ALLOCATOR_RETURN (gap, allocator->malloc (sizeof (256)), 0); allocator->free (gap); ACE_ALLOCATOR_RETURN (ptr, allocator->malloc (sizeof (Test_Data)), 0); Test_Data *data2 = new (ptr) Test_Data; data1->next_ = 0; data2->next_ = data1; data2->i1_ = -111; data2->i2_ = -222; data2->i3_ = -333; data2->d1_ = 77.34; // Test in shared memory using long (array/pointer) ACE_ALLOCATOR_RETURN (ptr, allocator->malloc (sizeof (Long_Test)), 0); Long_Test *lt = new (ptr) Long_Test; lt->array_[0] = 1000; lt->array_[1] = 1001; lt->array_[2] = 1002; lt->array_[3] = 1003; lt->array_[4] = 1004; lt->bpl_ = lt->array_; data1->long_test_= lt; long long_cont_1 = *lt->bpl_; long long_cont_2 = lt->bpl_[3]; ACE_TEST_ASSERT (long_cont_1 == 1000); ACE_TEST_ASSERT (long_cont_2 == 1003); ACE_ALLOCATOR_RETURN (ptr, allocator->malloc (sizeof (Long_Test)), 0); lt = new (ptr) Long_Test; lt->array_[0] = 2000; lt->array_[1] = 2001; lt->array_[2] = 2002; lt->array_[3] = 2003; lt->array_[4] = 2004; lt->bpl_ = lt->array_; data2->long_test_= lt; long long_cont_3 = *lt->bpl_; long long_cont_4 = lt->bpl_[4]; ACE_TEST_ASSERT (long_cont_3 == 2000); ACE_TEST_ASSERT (long_cont_4 == 2004); return data2; } static void print (const char *process_name, Test_Data *data) { for (Test_Data *t = data; t != 0; t = t->next_) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("<<<< (%P) %C\ni1_ = %d, i2_ = %d, i3_ = %d, d1_ = %f\n"), process_name, t->i1_, t->i2_, t->i3_, t->d1_)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("*t->bpl_ = %d, t->long_test_->array_[0] = ") ACE_TEXT ("%d\n>>>>\n"), *t->long_test_->bpl_, t->long_test_->array_[0])); } } static int parent (Test_Data *data) { MALLOC *myalloc = myallocator (); { ACE_GUARD_RETURN (ACE_Process_Mutex, guard, myalloc->mutex (), -1); print ("parent", data); } // Sleep for a 200 msecs so that the child will have a chance to spin! ACE_OS::sleep (ACE_Time_Value (0, 200 * 1000)); #if defined (ACE_TEST_REMAP_ON_FAULT) char *small_buf[1024]; int cntr; for (cntr = 0 ; cntr < 1024; ++cntr) small_buf[cntr] = (char *) myalloc->malloc (1); char *big_buf = (char *) myalloc->malloc (1024 * 4069); #endif /* ACE_TEST_REMAP_ON_FAULT */ int result = myalloc->bind ("bar", data); #if defined (ACE_TEST_REMAP_ON_FAULT) myalloc->free (big_buf); for (cntr = 0 ; cntr < 1024; ++cntr) myalloc->free (small_buf[cntr]); #endif /* ACE_TEST_REMAP_ON_FAULT */ ACE_TEST_ASSERT (result != -1); return 0; } static int child () { void *bar = 0; // Perform "busy waiting" here until the parent stores data under a // new name called "bar" in . This isn't a good design // -- it's just to test that synchronization is working across // processes via . for (ACE_Time_Value timeout (0, 1000 * 10); myallocator ()->find ("bar", bar) == -1; ) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) sleeping for 10 milliseconds!\n"))); ACE_OS::sleep (timeout); } print ("child", reinterpret_cast (bar)); return 0; } #if defined (ACE_HAS_WIN32_GETVERSION) // On Win9x/Me, a shared address needs to be on the shared arena, // between the second and third megabyte in the virtual address space // of the process. Also, a mapped view of a file is shared on the same // virtual address on every 32 bit process. On WinNT/2k, memory above // 2Gb is reserved for the system. So, we need to check at runtime // (we want an ACE_HAS_WINNT4 == 0 ace to run on either). // To catch any odd case arising from Pharlap, do the // run time check and run the NT4-or-better code unless we're on // CE or something other than NT4 (Pharlap reports itself as NT 3.51). static void get_base_addrs () { # if defined(__clang__) # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wdeprecated-declarations" # endif /* __clang__ */ OSVERSIONINFO vinfo; vinfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); if (::GetVersionEx(&vinfo) == 0) return; # if defined(__clang__) # pragma clang diagnostic pop # endif /* __clang__ */ if (vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT && vinfo.dwMajorVersion >= 4) PARENT_BASE_ADDR = (char*) (64 * 1024*1024); else PARENT_BASE_ADDR = (char*) ((2048UL + 512UL)*(1024UL*1024UL)); CHILD_BASE_ADDR = CHILD_ADDR_DELTA + (char*) PARENT_BASE_ADDR; } #endif /* defined (ACE_HAS_WIN32_GETVERSION) */ int run_main (int argc, ACE_TCHAR *argv[]) { #if defined (ACE_HAS_WIN32_GETVERSION) get_base_addrs(); #endif if (argc == 1) { ACE_START_TEST (ACE_TEXT ("Malloc_Test")); ACE_INIT_LOG (ACE_TEXT ("Malloc_Test-child")); init_test (PARENT_BASE_ADDR); ACE_Control_Block::print_alignment_info (); # if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1) ACE_PI_Control_Block::print_alignment_info (); # endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */ // No arguments means we're the parent process. ACE_Process_Options options (1); options.command_line (ACE_TEXT ("%") ACE_TEXT_PRIs ACE_TEXT ("%") ACE_TEXT_PRIs ACE_TEXT ("%") ACE_TEXT_PRIs, EXE_LOCATION, argc > 0 ? argv[0] : ACE_TEXT ("Malloc_Test"), ACE_TEXT (" run_as_test")); MALLOC *myalloc = myallocator (PARENT_BASE_ADDR); Test_Data *data = initialize (myalloc); ACE_TEST_ASSERT (data != 0); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) PARENT allocator at = %@, ") ACE_TEXT ("data allocated at %@\n"), myalloc, data)); myalloc->dump (); int result = myalloc->bind ("foo", data); ACE_TEST_ASSERT (result != -1); ACE_Process p; pid_t pid = p.spawn (options); if (pid == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("spawn")), 1); parent (data); // Synchronize on the exit of the child. result = p.wait (); if (result == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("wait")), 1); ACE_TEST_ASSERT (myalloc->ref_counter () == 1); myalloc->remove (); ACE_Process_Mutex::unlink (MUTEX_NAME); ACE_END_TEST; return 0; } else { // In this case we're the child process. ACE_APPEND_LOG (ACE_TEXT ("Malloc_Test-child")); void *data = 0; MALLOC *myalloc = myallocator (CHILD_BASE_ADDR); int result = myalloc->find ("foo", data); ACE_TEST_ASSERT (result != -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) CHILD allocator at = %@, ") ACE_TEXT ("data allocated at %@\n"), myalloc, data)); myalloc->dump (); child (); myalloc->release (); ACE_END_LOG; return 0; } } #else int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Malloc_Test")); ACE_ERROR ((LM_INFO, ACE_TEXT ("process creation is not supported on this ") ACE_TEXT ("platform\n"))); ACE_END_TEST; return 0; } #endif /* ACE_HAS_PROCESS_SPAWN */ ace-8.0.4+dfsg.orig/tests/Reactor_Dispatch_Order_Test.cpp0000644000175000017500000002000615027201773022403 0ustar sudipsudip //============================================================================= /** * @file Reactor_Dispatch_Order_Test.cpp * * This is a simple test that checks the order of dispatching of * ACE Reactors. Order should be: timeout, output, and then input. * * @author Irfan Pyarali */ //============================================================================= #include "test_config.h" #include "ace/OS_NS_string.h" #include "ace/Reactor.h" #include "ace/Select_Reactor.h" #include "ace/WFMO_Reactor.h" #include "ace/Dev_Poll_Reactor.h" #include "ace/Pipe.h" #include "ace/ACE.h" static const char *message = "Hello there! Hope you get this message"; class Handler : public ACE_Event_Handler { public: Handler (ACE_Reactor &reactor); ~Handler() override; int handle_timeout (const ACE_Time_Value &tv, const void *arg) override; int handle_input (ACE_HANDLE fd) override; int handle_output (ACE_HANDLE fd) override; ACE_HANDLE get_handle () const override; // We need to add MSG_OOB data transfer to this test to check the // order of when gets called. I tried with // Windows 2000 but only one byte of the message came across as // urgent data. The rest of the data was treated as normal! There // was some explanation of Microsoft's TCP/IP deals with out-of-band // data in "Out-of-Band Data and Push Bit in TCP/IP" in the MSDN // library. However, I did not comprehend that well enough. If // someone can make this work, please check the order of // getting called. // int handle_exception (ACE_HANDLE fd); ACE_Pipe pipe_; int dispatch_order_; bool ok_; // Constructed and initialized ok }; Handler::Handler (ACE_Reactor &reactor) : ACE_Event_Handler (&reactor), dispatch_order_ (1), ok_ (false) { // Create the pipe. if (0 != this->pipe_.open ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("pipe"))); else { // Register for all events. if (0 != this->reactor ()->register_handler (this->pipe_.read_handle (), this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK)) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("register"))); else this->ok_ = true; } } Handler::~Handler () { this->pipe_.close (); } ACE_HANDLE Handler::get_handle () const { return this->pipe_.read_handle (); } int Handler::handle_timeout (const ACE_Time_Value &, const void *) { int const me = this->dispatch_order_++; if (me != 1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("handle_timeout should be #1; it's %d\n"), me)); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Handler::handle_timeout\n"))); return 0; } int Handler::handle_output (ACE_HANDLE) { int const me = this->dispatch_order_++; if (me != 2) ACE_ERROR ((LM_ERROR, ACE_TEXT ("handle_output should be #2; it's %d\n"), me)); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Handler::handle_output\n"))); #if defined (__OpenBSD__) || defined (ACE_VXWORKS) // All that we need written has been written, so don't // call handle_output again. this->reactor ()->mask_ops (this->pipe_.read_handle (), ACE_Event_Handler::WRITE_MASK, ACE_Reactor::CLR_MASK); #endif /* __OpenBSD__ || ACE_VXWORKS */ return 0; } int Handler::handle_input (ACE_HANDLE fd) { int const me = this->dispatch_order_++; if (me != 3) ACE_ERROR ((LM_ERROR, ACE_TEXT ("handle_input should be #3; it's %d\n"), me)); char buffer[BUFSIZ]; ssize_t result = ACE::recv (fd, buffer, sizeof buffer); if (result != ssize_t (ACE_OS::strlen (message))) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Handler recv'd %b bytes; expected %B\n"), result, ACE_OS::strlen (message))); buffer[result] = '\0'; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Handler::handle_input: %C\n"), buffer)); if (ACE_OS::strcmp (buffer, message) != 0) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Handler text mismatch; received \"%C\"; ") ACE_TEXT ("expected \"%C\"\n"), buffer, message)); this->reactor ()->end_reactor_event_loop (); return 0; } static bool test_reactor_dispatch_order (ACE_Reactor &reactor) { Handler handler (reactor); if (!handler.ok_) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error initializing test; abort.\n"))); return false; } bool ok_to_go = true; // This should trigger a call to . ssize_t result = ACE::send_n (handler.pipe_.write_handle (), message, ACE_OS::strlen (message)); if (result != ssize_t (ACE_OS::strlen (message))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Handler sent %b bytes; should be %B\n"), result, ACE_OS::strlen (message))); ok_to_go = false; } // This should trigger a call to . if (-1 == reactor.schedule_timer (&handler, 0, ACE_Time_Value (0))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("schedule_timer"))); ok_to_go = false; } // Suspend the handlers - only the timer should be dispatched ACE_Time_Value tv (1); reactor.suspend_handlers (); if (0 != reactor.run_reactor_event_loop (tv)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("run_reactor_event_loop"))); ok_to_go = false; } // only the timer should have fired if (handler.dispatch_order_ != 2) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Incorrect number fired %d; expected 2\n"), handler.dispatch_order_)); ok_to_go = false; } // Reset the dispatch_order_ count and schedule another timer handler.dispatch_order_ = 1; if (-1 == reactor.schedule_timer (&handler, 0, ACE_Time_Value (0))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("schedule_timer"))); ok_to_go = false; } // Resume the handlers - things should work now reactor.resume_handlers (); if (ok_to_go) { if (0 != reactor.run_reactor_event_loop (tv)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("run_reactor_event_loop 2"))); ok_to_go = false; } } if (0 != reactor.remove_handler (handler.pipe_.read_handle (), ACE_Event_Handler::ALL_EVENTS_MASK | ACE_Event_Handler::DONT_CALL)) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("remover_handler pipe"))); if (handler.dispatch_order_ != 4) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Incorrect number fired %d; expected 4\n"), handler.dispatch_order_)); ok_to_go = false; } int nr_cancelled = reactor.cancel_timer (&handler); if (nr_cancelled > 0) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Finishing test with %d timers still scheduled\n"), nr_cancelled)); return ok_to_go; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Reactor_Dispatch_Order_Test")); int result = 0; ACE_Select_Reactor select_reactor_impl; ACE_Reactor select_reactor (&select_reactor_impl); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing ACE_Select_Reactor\n"))); if (!test_reactor_dispatch_order (select_reactor)) ++result; // Winsock 2 things are needed for WFMO_Reactor. #if defined (ACE_WIN32) && \ (defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) ACE_WFMO_Reactor wfmo_reactor_impl; ACE_Reactor wfmo_reactor (&wfmo_reactor_impl); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing ACE_WFMO_Reactor\n"))); if (!test_reactor_dispatch_order (wfmo_reactor)) ++result; #endif /* ACE_WIN32 && ACE_HAS_WINSOCK2 */ ACE_END_TEST; return result; } ace-8.0.4+dfsg.orig/tests/Reactor_Dispatch_Order_Test_Dev_Poll.cpp0000644000175000017500000001637315027201773024203 0ustar sudipsudip //============================================================================= /** * @file Reactor_Dispatch_Order_Test_Dev_Poll.cpp * * This is a simple test that checks the order of dispatching of * ACE Reactors. Order should be: timeout, output, and then input. * * @author Irfan Pyarali */ //============================================================================= #include "test_config.h" #include "ace/OS_NS_string.h" #include "ace/Reactor.h" #include "ace/Select_Reactor.h" #include "ace/WFMO_Reactor.h" #include "ace/Dev_Poll_Reactor.h" #include "ace/Pipe.h" #include "ace/ACE.h" #if defined (ACE_HAS_DEV_POLL) || defined (ACE_HAS_EVENT_POLL) static const char *message = "Hello there! Hope you get this message"; class Handler : public ACE_Event_Handler { public: Handler (ACE_Reactor &reactor); ~Handler() override; int handle_timeout (const ACE_Time_Value &tv, const void *arg) override; int handle_input (ACE_HANDLE fd) override; int handle_output (ACE_HANDLE fd) override; ACE_HANDLE get_handle () const override; // We need to add MSG_OOB data transfer to this test to check the // order of when gets called. I tried with // Windows 2000 but only one byte of the message came across as // urgent data. The rest of the data was treated as normal! There // was some explanation of Microsoft's TCP/IP deals with out-of-band // data in "Out-of-Band Data and Push Bit in TCP/IP" in the MSDN // library. However, I did not comprehend that well enough. If // someone can make this work, please check the order of // getting called. // int handle_exception (ACE_HANDLE fd); ACE_Pipe pipe_; int dispatch_order_; bool ok_; // Constructed and initialized ok }; Handler::Handler (ACE_Reactor &reactor) : ACE_Event_Handler (&reactor), dispatch_order_ (1), ok_ (false) { // Create the pipe. if (0 != this->pipe_.open ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("pipe"))); else { // Register for all events. if (0 != this->reactor ()->register_handler (this->pipe_.read_handle (), this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK)) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("register"))); else this->ok_ = true; } } Handler::~Handler () { this->pipe_.close (); } ACE_HANDLE Handler::get_handle () const { return this->pipe_.read_handle (); } int Handler::handle_timeout (const ACE_Time_Value &, const void *) { int me = this->dispatch_order_++; if (me != 1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("handle_timeout should be #1; it's %d\n"), me)); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Handler::handle_timeout\n"))); return 0; } int Handler::handle_output (ACE_HANDLE) { int me = this->dispatch_order_++; if (me != 2) ACE_ERROR ((LM_ERROR, ACE_TEXT ("handle_output should be #2; it's %d\n"), me)); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Handler::handle_output\n"))); // Don't want to continually see writeable; only verify its relative order. this->reactor ()->mask_ops (this->pipe_.read_handle (), ACE_Event_Handler::WRITE_MASK, ACE_Reactor::CLR_MASK); return 0; } int Handler::handle_input (ACE_HANDLE fd) { int me = this->dispatch_order_++; if (me != 3) ACE_ERROR ((LM_ERROR, ACE_TEXT ("handle_input should be #3; it's %d\n"), me)); char buffer[BUFSIZ]; ssize_t result = ACE::recv (fd, buffer, sizeof buffer); if (result != ssize_t (ACE_OS::strlen (message))) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Handler recv'd %b bytes; expected %B\n"), result, ACE_OS::strlen (message))); buffer[result] = '\0'; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Handler::handle_input: %C\n"), buffer)); if (ACE_OS::strcmp (buffer, message) != 0) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Handler text mismatch; received \"%C\"; ") ACE_TEXT ("expected \"%C\"\n"), buffer, message)); this->reactor ()->end_reactor_event_loop (); return 0; } static bool test_reactor_dispatch_order (ACE_Reactor &reactor) { Handler handler (reactor); if (!handler.ok_) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error initializing test; abort.\n"))); return false; } bool ok_to_go = true; // This should trigger a call to . ssize_t result = ACE::send_n (handler.pipe_.write_handle (), message, ACE_OS::strlen (message)); if (result != ssize_t (ACE_OS::strlen (message))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Handler sent %b bytes; should be %B\n"), result, ACE_OS::strlen (message))); ok_to_go = false; } // This should trigger a call to . if (-1 == reactor.schedule_timer (&handler, 0, ACE_Time_Value (0))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("schedule_timer"))); ok_to_go = false; } // Suspend the handlers - only the timer should be dispatched ACE_Time_Value tv (1); reactor.suspend_handlers (); reactor.run_reactor_event_loop (tv); // only the timer should have fired if (handler.dispatch_order_ != 2) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Incorrect number fired %d\n"), handler.dispatch_order_)); ok_to_go = false; } // Reset the dispatch_order_ count and schedule another timer handler.dispatch_order_ = 1; if (-1 == reactor.schedule_timer (&handler, 0, ACE_Time_Value (0))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("schedule_timer"))); ok_to_go = false; } // Resume the handlers - things should work now reactor.resume_handlers (); if (ok_to_go) { reactor.run_reactor_event_loop (tv); } if (0 != reactor.remove_handler (handler.pipe_.read_handle (), ACE_Event_Handler::ALL_EVENTS_MASK | ACE_Event_Handler::DONT_CALL)) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("remover_handler pipe"))); if (handler.dispatch_order_ != 4) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Incorrect number fired %d\n"), handler.dispatch_order_)); ok_to_go = false; } return ok_to_go; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Reactor_Dispatch_Order_Test_Dev_Poll")); int result = 0; ACE_Dev_Poll_Reactor dev_poll_reactor_impl; ACE_Reactor dev_poll_reactor (&dev_poll_reactor_impl); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing Dev Poll Reactor\n"))); if (!test_reactor_dispatch_order (dev_poll_reactor)) ++result; ACE_END_TEST; return result; } #else int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Reactor_Dispatch_Order_Test_Dev_Poll")); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Dev_Poll_Reactor is UNSUPPORTED on this platform\n"))); ACE_END_TEST; return 0; } #endif /* ACE_HAS_DEV_POLL || ACE_HAS_EVENT_POLL */ ace-8.0.4+dfsg.orig/tests/Compiler_Features_15_Test.cpp0000644000175000017500000000072115027201773021751 0ustar sudipsudip/** * This program checks if the compiler / platform supports default * constructor and assignment operators */ #include "test_config.h" class A { public: A (); A (A&&) = default; A& operator= (A&&) = default; }; int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT("Compiler_Features_15_Test")); ACE_DEBUG ((LM_INFO, ACE_TEXT ("Defaulted move constructor and assignment operators work.\n"))); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/NonBlocking_Conn_Test.h0000644000175000017500000000241615027201773020664 0ustar sudipsudip //============================================================================= /** * @file NonBlocking_Conn_Test.h * * This test checks for the proper working of the following: * - blocking connections * - blocking connections with timeouts * - non-blocking connections * - non-blocking connections without waiting for completions * - non-blocking connections with timeouts * * @author Irfan Pyarali */ //============================================================================= #ifndef NONBLOCKING_CONN_TEST_H #define NONBLOCKING_CONN_TEST_H #include "ace/Svc_Handler.h" #include "ace/SOCK_Stream.h" class Svc_Handler : public ACE_Svc_Handler { public: enum Connection_Status { Conn_SUCCEEDED, Conn_FAILED }; enum Completion_Status { Comp_YES, Comp_NO, Comp_IGNORE }; Svc_Handler (bool is_ref_counted = false); void connection_status (Connection_Status &status, int &completion_counter); int open (void *); int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask mask); Connection_Status *status_; int *completion_counter_; bool const is_ref_counted_; }; #endif /* NONBLOCKING_CONN_TEST_H */ ace-8.0.4+dfsg.orig/tests/Test_Output_Export.h0000644000175000017500000000376515027201773020355 0ustar sudipsudip // -*- C++ -*- // Definition for Win32 Export directives. // This file is generated automatically by generate_export_file.pl Test_Output // ------------------------------ #ifndef TEST_OUTPUT_EXPORT_H #define TEST_OUTPUT_EXPORT_H #include "ace/config-all.h" #if defined (ACE_AS_STATIC_LIBS) && !defined (TEST_OUTPUT_HAS_DLL) # define TEST_OUTPUT_HAS_DLL 0 #endif /* ACE_AS_STATIC_LIBS && TEST_OUTPUT_HAS_DLL */ #if !defined (TEST_OUTPUT_HAS_DLL) # define TEST_OUTPUT_HAS_DLL 1 #endif /* ! TEST_OUTPUT_HAS_DLL */ #if defined (TEST_OUTPUT_HAS_DLL) && (TEST_OUTPUT_HAS_DLL == 1) # if defined (TEST_OUTPUT_BUILD_DLL) # define Test_Output_Export ACE_Proper_Export_Flag # define TEST_OUTPUT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) # define TEST_OUTPUT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) # else /* TEST_OUTPUT_BUILD_DLL */ # define Test_Output_Export ACE_Proper_Import_Flag # define TEST_OUTPUT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) # define TEST_OUTPUT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) # endif /* TEST_OUTPUT_BUILD_DLL */ #else /* TEST_OUTPUT_HAS_DLL == 1 */ # define Test_Output_Export # define TEST_OUTPUT_SINGLETON_DECLARATION(T) # define TEST_OUTPUT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) #endif /* TEST_OUTPUT_HAS_DLL == 1 */ // Set TEST_OUTPUT_NTRACE = 0 to turn on library specific tracing even if // tracing is turned off for ACE. #if !defined (TEST_OUTPUT_NTRACE) # if (ACE_NTRACE == 1) # define TEST_OUTPUT_NTRACE 1 # else /* (ACE_NTRACE == 1) */ # define TEST_OUTPUT_NTRACE 0 # endif /* (ACE_NTRACE == 1) */ #endif /* !TEST_OUTPUT_NTRACE */ #if (TEST_OUTPUT_NTRACE == 1) # define TEST_OUTPUT_TRACE(X) #else /* (TEST_OUTPUT_NTRACE == 1) */ # define TEST_OUTPUT_TRACE(X) ACE_TRACE_IMPL(X) #endif /* (TEST_OUTPUT_NTRACE == 1) */ #endif /* TEST_OUTPUT_EXPORT_H */ // End of auto generated file. ace-8.0.4+dfsg.orig/tests/STL_algorithm_Test_T.h0000644000175000017500000000107615027201773020500 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file STL_algorithm_Test_T.h * * Test ACE containers compatibility with STL header. * * @author James H. Hill */ //============================================================================= #ifndef ACE_TESTS_STL_ALGORITHM_TEST_T_H #define ACE_TESTS_STL_ALGORITHM_TEST_T_H template int test_STL_algorithm (T & container); #include "STL_algorithm_Test_T.cpp" #endif /* ACE_TESTS_STL_ALGORITHM_TEST_T_H */ ace-8.0.4+dfsg.orig/tests/Time_Service_Test.cpp0000644000175000017500000000745115027201773020421 0ustar sudipsudip //============================================================================= /** * @file Time_Service_Test.cpp * * This example tests the Time Service server and clerk * components. The test forks and execs two processes to run both * the clerk and the time server. The clerk and the server * communicate for a short duration after which the main process * kills both the processes. No command line arguments are needed * to run the test. * * @author Prashant Jain */ //============================================================================= #include "test_config.h" #include "ace/Process.h" #include "ace/Lib_Find.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #define APPLICATION \ ACE_TEXT ("..") ACE_DIRECTORY_SEPARATOR_STR \ ACE_TEXT ("netsvcs") ACE_DIRECTORY_SEPARATOR_STR \ ACE_TEXT ("servers") ACE_DIRECTORY_SEPARATOR_STR \ ACE_TEXT ("main") ACE_PLATFORM_EXE_SUFFIX \ ACE_TEXT (" -f ") ACE_PLATFORM int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Time_Service_Test")); // Make sure that the backing store is not there. We need to make // sure because this test kills the Time Clerk and on some platforms // the Clerk is not allowed to do a graceful shutdown. By cleaning // the backing store here, we are sure that we get a fresh start and // no garbage data from a possible aborted run ACE_TCHAR backing_store[MAXPATHLEN + 1]; #if defined (ACE_DEFAULT_BACKING_STORE) // Create a temporary file. ACE_OS::strcpy (backing_store, ACE_DEFAULT_BACKING_STORE); #else /* ACE_DEFAULT_BACKING_STORE */ if (ACE::get_temp_dir (backing_store, MAXPATHLEN - 17) == -1) // -17 for ace-malloc-XXXXXX { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Temporary path too long, ") ACE_TEXT ("defaulting to current directory\n"))); backing_store[0] = 0; } // Add the filename to the end ACE_OS::strcat (backing_store, ACE_TEXT ("ace-malloc-XXXXXX")); #endif /* ACE_DEFAULT_BACKING_STORE */ ACE_OS::unlink (backing_store); const ACE_TCHAR *server_cl = APPLICATION ACE_TEXT ("server.conf"); ACE_Process_Options server_options; #ifndef ACE_LACKS_VA_FUNCTIONS server_options.command_line (ACE_TEXT ("%") ACE_TEXT_PRIs, server_cl); #endif ACE_Process server; if (server.spawn (server_options) == -1) ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT ("%n; %p (%s).\n"), ACE_TEXT ("Server fork failed"), server_cl), -1); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Server forked with pid = %d.\n"), server.getpid ())); ACE_OS::sleep (3); const ACE_TCHAR *clerk_cl = APPLICATION ACE_TEXT ("clerk.conf"); ACE_Process_Options clerk_options; #ifndef ACE_LACKS_VA_FUNCTIONS clerk_options.command_line (ACE_TEXT ("%") ACE_TEXT_PRIs, clerk_cl); #endif ACE_Process clerk; if (clerk.spawn (clerk_options) == -1) ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT ("%n; %p: (%s).\n"), ACE_TEXT ("Clerk fork failed"), clerk_cl), -1); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Clerk forked with pid = %d.\n"), clerk.getpid ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Sleeping...\n"))); ACE_OS::sleep (10); if (clerk.terminate () == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Terminate failed for clerk.\n")), -1); if (server.terminate () == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Terminate failed for server.\n")), -1); // Because we kill the clerk process, on Win32 it may not do a // graceful shutdown and the backing store file is left behind. if (clerk.wait () != 0) ACE_OS::unlink (backing_store); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Bug_2540_Regression_Test.cpp0000644000175000017500000001642315027201773021431 0ustar sudipsudip/** * @file Bug_2540_Regression_Test.cpp * * Reproduces the problems reported in bug 2540 * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=2540 * * @author Carlos O'Ryan * Based on Bug_1890_Regression_Test */ #include "test_config.h" #include "ace/Pipe.h" #include "ace/Event_Handler.h" #include "ace/Reactor.h" #include "ace/Select_Reactor.h" #include int const nhandlers = 3; /** * This class is used to create real I/O in the test. To keep the I/O under * control and keep the test to a single process we use ACE_Pipe. This class * is known to work with the Reactor, in fact, that is its main function. * * Handler counts how many calls to handle_input() has the reactor performed. * When bug 2540 is triggered the Reactor continues to call the timers, but it * stops calling select() and the handle_input() functions. */ class Handler : public ACE_Event_Handler { public: Handler(); //FUZZ: disable check_for_lack_ACE_OS /// Initialize the pipe and register with the reactor int open(ACE_Reactor * reactor); //FUZZ: enable check_for_lack_ACE_OS /// Return the current count size_t handle_input_count() const; /// Write some data void send_dummy_data(); /// Removes itself from the reactor on the next call to handle_input() void simulate_socket_closure(); /// Reactor callback ACE_HANDLE get_handle() const override; int handle_input(ACE_HANDLE) override; private: bool auto_remove_flag_; size_t handle_input_count_; ACE_Pipe the_pipe_; ACE_HANDLE handles_[2]; }; /** * This is the main driver for the test. This timer is called by the reactor * in a repeating interval. On the first @c initial_iterations the Timer * writes data through all of its handlers. On iteration @c initial_iteration * it triggers bug 2540 by removing two handlers from the reactor. */ class Timer : public ACE_Event_Handler { public: Timer(); //FUZZ: disable check_for_lack_ACE_OS int open(ACE_Reactor * reactor); void close(); //FUZZ: enable check_for_lack_ACE_OS bool check_expected_results() const; int handle_timeout(ACE_Time_Value const &, void const*) override; private: void send_data_through_handlers(); void remove_some_handlers(); Handler & special_handler(); Handler const & special_handler() const; private: Handler handler_[nhandlers]; int iteration_; size_t recorded_count_; }; int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Bug_2540_Regression_Test")); // Bug 2540 is all about ACE_Select_Reactor, so run it on that reactor // regardless of platform. In particular, this test relies on a handler // that doesn't consume ready-to-read data being called back - this won't // happen with ACE_WFMO_Reactor. ACE_Select_Reactor *impl_ptr = 0; ACE_NEW_RETURN (impl_ptr, ACE_Select_Reactor, -1); std::unique_ptr auto_impl (impl_ptr); ACE_Reactor reactor (impl_ptr); // Create the timer, this is the main driver for the test Timer * timer = new Timer; // Initialize the timer and register with the reactor if (-1 == timer->open (&reactor)) { ACE_ERROR_RETURN ((LM_ERROR, "Cannot initialize timer\n"), -1); } reactor.run_reactor_event_loop (); // Verify that the results are what we expect if (!timer->check_expected_results ()) { ACE_ERROR_RETURN ((LM_ERROR, "Test failed\n"), -1); } // Cleanup timer->close (); delete timer; ACE_END_TEST; return 0; } Handler::Handler() : auto_remove_flag_(false) , handle_input_count_(0) , the_pipe_() { } int Handler::open(ACE_Reactor * r) { if(-1 == the_pipe_.open(handles_)) { return -1; } if(-1 == r->register_handler(this, ACE_Event_Handler::READ_MASK)) { return -1; } return 0; } size_t Handler::handle_input_count() const { return handle_input_count_; } void Handler::send_dummy_data() { char buf[] = "dummy"; (void) the_pipe_.send(buf, sizeof(buf)); } void Handler::simulate_socket_closure() { auto_remove_flag_ = true; } ACE_HANDLE Handler::get_handle() const { return the_pipe_.read_handle(); } int Handler::handle_input(ACE_HANDLE /* h */) { ++handle_input_count_; // ACE_DEBUG((LM_DEBUG, "Handler::handle_input called for %d\n", h)); if(auto_remove_flag_) { auto_remove_flag_ = false; return -1; } return 0; } int const initial_iterations = 5; int const total_iterations = 10; int const special_handler_index = nhandlers - 1; Timer::Timer() : iteration_(0) , recorded_count_(0) { } int Timer::open(ACE_Reactor * r) { this->reactor(r); // Initialize both handles and register them with the reactor for reading. for(int i = 0; i != nhandlers; ++i) { if (-1 == handler_[i].open(r)) { ACE_ERROR_RETURN ((LM_ERROR, "Could not open dummy handler %d\n", i), -1); } } ACE_Time_Value const interval(0, ACE_ONE_SECOND_IN_USECS / 10); ACE_Time_Value const startup (0, ACE_ONE_SECOND_IN_USECS / 20); if ( -1 == r->schedule_timer(this, 0, startup, interval)) { ACE_ERROR_RETURN((LM_ERROR, "Could not schedule timer\n"), -1); } return 0; } void Timer::close() { for(int i = 0; i != nhandlers; ++i) { reactor()->remove_handler(&handler_[i], ACE_Event_Handler::ALL_EVENTS_MASK); } reactor()->cancel_timer(this); } bool Timer::check_expected_results() const { // We expect at least one more call after the other handlers are removed. if(recorded_count_ + 1 < special_handler().handle_input_count() ) { return true; } return false; } int Timer::handle_timeout(ACE_Time_Value const &, void const *) { if (iteration_ == 0) { // Sending data on the first iteration makes the handles always // "ready" for reading because the Handler::handle_input() function // never consumes the data. send_data_through_handlers(); } ++iteration_; if (iteration_ < initial_iterations) { // The first iterations are there just to prime things. return 0; } if (iteration_ == initial_iterations) { // We expect the special_handler() to work normally after this // iteration, i.e., more calls to handle_input() should be delivered // to it. recorded_count_ = special_handler().handle_input_count(); // Remove the handlers the next time the loop runs remove_some_handlers(); // Run the event loop, this causes the handlers to be removed from the // reactor, except for special_handler() ACE_Time_Value interval(0, ACE_ONE_SECOND_IN_USECS / 50); reactor()->handle_events(&interval); return 0; } if (iteration_ < total_iterations) { // Run a while more to make sure the special_handler() is used. return 0; } reactor()->end_reactor_event_loop(); return 0; } void Timer::send_data_through_handlers() { for(int i = 0; i != nhandlers; ++i) { handler_[i].send_dummy_data(); } } void Timer::remove_some_handlers() { for(int i = 0; i != nhandlers - 1; ++i) { handler_[i].simulate_socket_closure(); } } Handler & Timer::special_handler() { return handler_[special_handler_index]; } Handler const & Timer::special_handler() const { return handler_[special_handler_index]; } ace-8.0.4+dfsg.orig/tests/MT_SOCK_Test.cpp0000644000175000017500000003330015027201773017172 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file MT_SOCK_Test.cpp * * This is a multi-threaded torture test of the * and classes. The test * forks 30 processes or spawns 30 threads (depending upon the * platform) and then executes client and server allowing them to * connect and exchange data. Note that most of the connections * will fail since we're overrunning the size of the listen queue * for the acceptor-mode socket. * * @author Doug Schmidt */ //============================================================================= #include "test_config.h" #include "ace/OS_NS_sys_wait.h" #include "ace/OS_NS_unistd.h" #include "ace/Thread.h" #include "ace/Thread_Manager.h" #include "ace/SOCK_Connector.h" #include "ace/SOCK_Acceptor.h" #include "ace/Handle_Set.h" #include "ace/Time_Value.h" static const char ACE_ALPHABET[] = "abcdefghijklmnopqrstuvwxyz"; // Normally the test will have BACKLOG < NUM_CLIENTS to force some // of the connections to fail. // Do NOT use ACE_DEFAULT_BACKLOG here, because that will likely // be set to some other value. (i.e. Win32 = SOMAXCONN) static const int BACKLOG = 5; static const int NUM_CLIENTS = 30; #if !defined (ACE_LACKS_FORK) || defined (ACE_HAS_THREADS) void * client (void *arg) { ACE_INET_Addr *remote_addr = (ACE_INET_Addr *) arg; ACE_INET_Addr server_addr (remote_addr->get_port_number (), ACE_DEFAULT_SERVER_HOST); ACE_INET_Addr client_addr; ACE_SOCK_Stream cli_stream; ACE_SOCK_Connector con; ACE_Time_Value tv (ACE_DEFAULT_TIMEOUT); ACE_Time_Value *timeout = &tv; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) client: Connecting...\n"))); // Initiate timed connection with server. // Attempt a timed connect to the server. if (con.connect (cli_stream, server_addr, timeout) == -1) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("client: Connection timed out."))); return 0; } if (cli_stream.get_local_addr (client_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("client: get_local_addr")), 0); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) client: Connected at %d\n"), client_addr.get_port_number ())); if (cli_stream.disable (ACE_NONBLOCK) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("client: disable"))); // Send data to server (correctly handles "incomplete writes"). ACE_DEBUG ((LM_DEBUG, "(%P|%t) client: Sending data...\n")); for (const char *c = ACE_ALPHABET; *c != '\0'; c++) if (cli_stream.send_n (c, 1) == -1) { // This is, I believe, more of an issue with WinXP-64 _server_ // side, but we can trap it here since we know we're connecting // to localhost. Some Windows versions will appear to accept // connections at the TCP level past the listen backlog but if // data arrives before the actual application-level accept() occurs, // the connection is reset. This is caused when we trip the Windows // SYN attack prevention (http://technet2.microsoft.com/WindowsServer/ // en/library/910c8482-e5e5-4e2c-9ea4-11301ddfc4661033.mspx?mfr=true) // So, if we get a reset on the first send, don't flag the error - // just note it and act like the connection was refused. if (c == ACE_ALPHABET && errno == ECONNRESET) // First byte sent { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) client: Connection refused (delayed)\n"))); cli_stream.close (); return 0; } ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) (errno %d) %p\n"), ACE_ERRNO_GET, ACE_TEXT ("client: send_n"))); ACE_ERROR ((LM_ERROR, "client: Closing stream.\n")); cli_stream.close(); return 0; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) client: Closing writer...\n"))); // Explicitly close the writer-side of the connection. if (cli_stream.close_writer () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("client: close_writer"))); char buf[1]; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) client: Waiting for server handshake...\n"))); // Wait for handshake with server. if (cli_stream.recv_n (buf, 1) != 1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("client: recv_n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) client: Handshake received. Closing stream.\n"))); // Close the connection completely. if (cli_stream.close () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("client: close"))); return 0; } void * server (void *arg) { ACE_SOCK_Acceptor *peer_acceptor = static_cast (arg); if (peer_acceptor->enable (ACE_NONBLOCK) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("server: enable acceptor"))); // Keep these objects out here to prevent excessive constructor // calls... ACE_SOCK_Stream new_stream; ACE_INET_Addr cli_addr; const ACE_Time_Value def_timeout (ACE_DEFAULT_TIMEOUT); ACE_Time_Value tv (def_timeout); // We want some of the clients to get connection failures, but on // a really fast machine with a good network card and multiple // processors this may never happen. // Add a sleep() to allow the client threads to complete. ACE_OS::sleep(def_timeout); int num_clients_connected = 0; // Performs the iterative server activities. for (;;) { char buf[BUFSIZ]; ACE_DEBUG((LM_DEBUG, "(%P|%t) server: Waiting for connection...\n")); int result = ACE::handle_read_ready (peer_acceptor->get_handle (), &tv); ACE_TEST_ASSERT (tv == def_timeout); if (result == -1) { if (errno == ETIME) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) server: Test finished.\n"))); // The meaning of the backlog parameter for listen() varies by // platform. For some reason lost to history, the specified value // is typically backlog * 1.5, backlog * 1.5 + 1, or even taken // literally as on Windows. We'll accept any number less than // backlog * 2 as valid. if (num_clients_connected > BACKLOG * 2) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) server: Incorrect # client ") ACE_TEXT ("connections. Expected:%d-%d Actual:%d\n"), BACKLOG, BACKLOG * 2, num_clients_connected)); return 0; } ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("server: handle_read_ready acceptor")), 0); } // Create a new ACE_SOCK_Stream endpoint (note automatic restart // if errno == EINTR). while ((result = peer_acceptor->accept (new_stream, &cli_addr)) != -1) { const char *t = ACE_ALPHABET; ++num_clients_connected; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) server: Client %C connected from %d\n"), cli_addr.get_host_name (), cli_addr.get_port_number ())); // Enable non-blocking I/O. if (new_stream.enable (ACE_NONBLOCK) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("server: enable non blocking i/o")), 0); // Read data from client (terminate on error). ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) server: Waiting for data...\n"))); for (ssize_t r_bytes; ;) { if (ACE::handle_read_ready (new_stream.get_handle (), 0) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("stream handle_read_ready")), 0); ACE_DEBUG ((LM_DEBUG, "(%P|%t) server: Receiving data...\n")); while ((r_bytes = new_stream.recv (buf, 1)) > 0) { ACE_TEST_ASSERT (*t == buf[0]); t++; } ACE_DEBUG((LM_DEBUG, "(%P|%t) server: Received data.\n")); if (r_bytes == 0) { // Handshake back with client. ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) server: Connection closed by client.\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) server: Sending handshake.\n"))); if (new_stream.send_n ("", 1) != 1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("server: send_n"))); ACE_DEBUG ((LM_DEBUG, "(%P|%t) server: Closing stream.\n")); // Close endpoint. if (new_stream.close () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("server: close"))); break; } else if (r_bytes == -1) { if (errno == EWOULDBLOCK || errno == EAGAIN) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) server: (EWOULDBLOCK) Waiting for more data...\n"))); else ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("server: recv_n")), 0); } } } if (result == -1) { if (errno == EWOULDBLOCK) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) server: No more connections pending.\n"))); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("server: accept"))); } } ACE_NOTREACHED (return 0); } #endif /* !ACE_LACKS_FORK || ACE_HAS_THREADS */ void spawn (int num_clients) { // Acceptor ACE_SOCK_Acceptor peer_acceptor; // Create a server address. ACE_INET_Addr server_addr; // Bind listener to any port and then find out what the port was. if (peer_acceptor.open (ACE_Addr::sap_any, 0, PF_UNSPEC, BACKLOG) == -1 || peer_acceptor.get_local_addr (server_addr) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("spawn: open"))); else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) starting server at port %d\n"), server_addr.get_port_number ())); #if !defined (ACE_LACKS_FORK) for (int i = 0; i < num_clients; i++) { switch (ACE_OS::fork (ACE_TEXT ("child"))) { case -1: ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), "spawn: fork failed")); i = num_clients; // Break out of 'for' loop. break; case 0: ACE_LOG_MSG->sync (ACE_TEXT ("MT_SOCK_Test-child")); client (&server_addr); ACE_OS::exit (0); /* NOTREACHED */ default: break; } } server ((void *) &peer_acceptor); peer_acceptor.close(); // Reap the child pids. for (pid_t pid; (pid = ACE_OS::waitpid (0, 0, 0)) != -1; ) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) spawn: reaping pid %d\n"), pid)); #elif defined (ACE_HAS_THREADS) ACE_DEBUG((LM_DEBUG, "Spawning server...\n")); if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (server), (void *) &peer_acceptor, THR_BOUND | THR_DETACHED) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), ACE_TEXT ("spawn: failed"), 1)); ACE_DEBUG((LM_DEBUG, "Spawning %d clients...\n", num_clients)); if (ACE_Thread_Manager::instance ()->spawn_n (num_clients, ACE_THR_FUNC (client), (void *) &server_addr, THR_BOUND | THR_DETACHED) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), ACE_TEXT ("spawn: failed 2"), 1)); ACE_DEBUG((LM_DEBUG, "Waiting for threads to finish...\n")); // Wait for the threads to exit. ACE_Thread_Manager::instance ()->wait (); #else ACE_ERROR ((LM_INFO, ACE_TEXT ("(%P|%t) ") ACE_TEXT ("spawn: only one thread may be run") ACE_TEXT (" in a process on this platform\n"))); #endif /* !ACE_LACKS_FORK */ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Threads complete. Closing Acceptor.\n"))); peer_acceptor.close (); } } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("MT_SOCK_Test")); #ifndef ACE_LACKS_ACCEPT spawn (NUM_CLIENTS); #endif ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/ACE_Init_TestDlg.cpp0000644000175000017500000000712215027201773020040 0ustar sudipsudip// ============================================================================ // // = LIBRARY // tests // // = DESCRIPTION // This is a Win32-only test for verifying that the ACE dll // initializes itself without having a nonstatic object manager // present by way of a console app's main function. It's a MFC dialog // app - it pops up a dialog and spawns a thread - this source file is // the code for implementing the dialog box. // // This test program was initially generated from MSVC AppWizard, then // some files were renamed and moved around to fit in with the ACE // test directory structure. // // = AUTHOR // Steve Huston // // ============================================================================ #if defined(ACE_HAS_MFC) #include "ACE_Init_Test_StdAfx.h" #include "ACE_Init_Test.h" #include "ACE_Init_TestDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CACE_Init_TestDlg dialog CACE_Init_TestDlg::CACE_Init_TestDlg(CWnd* pParent /*=NULL*/) : CDialog(CACE_Init_TestDlg::IDD, pParent) { //{{AFX_DATA_INIT(CACE_Init_TestDlg) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CACE_Init_TestDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CACE_Init_TestDlg) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CACE_Init_TestDlg, CDialog) //{{AFX_MSG_MAP(CACE_Init_TestDlg) ON_WM_PAINT() ON_WM_QUERYDRAGICON() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CACE_Init_TestDlg message handlers BOOL CACE_Init_TestDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // TODO: Add extra initialization here return TRUE; // return TRUE unless you set the focus to a control } // If you add a minimize button to your dialog, you will need the code below // to draw the icon. For MFC applications using the document/view model, // this is automatically done for you by the framework. void CACE_Init_TestDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); // Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon dc.DrawIcon(x, y, m_hIcon); } else { CDialog::OnPaint(); } } // The system calls this to obtain the cursor to display while the user drags // the minimized window. HCURSOR CACE_Init_TestDlg::OnQueryDragIcon() { return (HCURSOR) m_hIcon; } #endif /* ACE_HAS_MFC */ ace-8.0.4+dfsg.orig/tests/Compiler_Features_12_Test.cpp0000644000175000017500000000172615027201773021754 0ustar sudipsudip/** * @file * * This program checks if the compiler / platform supports template * template parameters. The motivation for this test was a discussion * on the development mailing list, and the documentation was captured * in: * * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=3715 */ #include "test_config.h" // Similar to Bug_3709_Regression_Test.cpp... template struct Pair { T x1; T x2; }; template struct Triple { T t1; T t2; T t3; }; template class Tuple> struct Array { Tuple array[5]; }; int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT("Compiler_Features_12_Test")); // As usual, the exit status from the test is 0 on success, 1 on // failure int status = 0; Array pairs; pairs.array[0].x1 = 0; ACE_UNUSED_ARG (pairs); Array triples; triples.array[1].t3 = 0; ACE_UNUSED_ARG (triples); ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/Bug_2610_Regression_Test.cpp0000644000175000017500000001270515027201773021426 0ustar sudipsudip/** * @file Bug_2610_Regression_Test.cpp * * Reproduces the problems reported in bug 2610: * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=2610 * * @author Milan Cvetkovic */ #include "test_config.h" #include "ace/INET_Addr.h" #include "ace/SOCK_Stream.h" #include "ace/SOCK_Acceptor.h" #include "ace/SOCK_Connector.h" #include "ace/Svc_Handler.h" #include "ace/Acceptor.h" #include "ace/Connector.h" #include "ace/Trace.h" #include "ace/Thread_Semaphore.h" #if defined (ACE_HAS_THREADS) # define TEST_TRACE(X) ACE_Trace ____ (ACE_TEXT (X), __LINE__, ACE_TEXT (__FILE__)) int g_svc_handlers_leaked = 0; // use semaphore for synchronization // ACE_Thread_Semaphore g_semaphore (0); class My_Svc_Handler : public ACE_Svc_Handler { public: using super = ACE_Svc_Handler; My_Svc_Handler() { TEST_TRACE ("My_Svc_Handler:My_Svc_Handler"); ++g_svc_handlers_leaked; reference_counting_policy().value( Reference_Counting_Policy::ENABLED); } ~My_Svc_Handler() override { TEST_TRACE ("My_Svc_Handler::~My_Svc_Handler"); --g_svc_handlers_leaked; } int handle_close (ACE_HANDLE /*fd*/, ACE_Reactor_Mask /*mask*/) override { TEST_TRACE ("handle_close"); g_semaphore.release(); return 0; } }; bool g_acceptor_accept_fails; class My_Acceptor : public ACE_Acceptor { public: using super = ACE_Acceptor; My_Acceptor () : super (ACE_INET_Addr(9000)) {} protected: int accept_svc_handler (My_Svc_Handler *svc_handler) override { TEST_TRACE ("accept_svc_handler"); int rv = super::accept_svc_handler(svc_handler); if (g_acceptor_accept_fails) { g_semaphore.release(); return -1; } return rv; } int activate_svc_handler (My_Svc_Handler* /*svc_handler*/) override { TEST_TRACE ("My_Acceptor::activate_svc_handler"); g_semaphore.release(); return -1; } }; class My_Connector : public ACE_Connector { public: using super = ACE_Connector; protected: int activate_svc_handler (My_Svc_Handler* /*svc_handler*/) override { TEST_TRACE ("My_Connector::activate_svc_handler"); g_semaphore.release(); return -1; } }; struct My_Task : public ACE_Task_Base { int svc() override { TEST_TRACE ("My_Task::svc"); ACE_Reactor::instance()->owner(ACE_OS::thr_self()); int rv = ACE_Reactor::instance()->run_reactor_event_loop(); if (rv < 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Cannot run reactor event loop"))); } return 0; } }; // event handler used to signal when the reactor started struct Timer_Handler : public ACE_Event_Handler { int handle_timeout (const ACE_Time_Value&, const void*) override { g_semaphore.release(); // signal reactor started return 0; } }; #endif int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Bug_2610_Regression_Test")); #if defined (ACE_HAS_THREADS) My_Acceptor acceptor; Timer_Handler timer_handler; ACE_Reactor::instance()->schedule_timer( &timer_handler, 0, ACE_Time_Value(0)); My_Task task; int activated = task.activate(); if (activated < 0) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Could not activate task")), -1); } // Don't assume addr family of the listener - check and adapt when needed. ACE_INET_Addr listen_addr; acceptor.acceptor ().get_local_addr (listen_addr); #if defined (ACE_HAS_IPV6) const ACE_TCHAR *me = listen_addr.get_type () == PF_INET ? ACE_LOCALHOST : ACE_IPV6_LOCALHOST; #else const ACE_TCHAR *me = ACE_LOCALHOST; #endif /* ACE_HAS_IPV6 */ ACE_INET_Addr a1 (listen_addr.get_port_number (), me, listen_addr.get_type ()); ACE_SOCK_Connector c1; g_semaphore.acquire();// wait for reactor to start { g_acceptor_accept_fails = true; ACE_SOCK_Stream s1; if (-1 == c1.connect (s1, a1)) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Could not connect")), -1); } g_semaphore.acquire(); // wait for accept_svc_handler() to start } { g_acceptor_accept_fails = false; ACE_SOCK_Stream s1; if (-1 == c1.connect (s1, a1)) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Could not connect")), -1); } g_semaphore.acquire(); // wait for activate_svc_handler to complete } { My_Svc_Handler* handler=0; My_Connector connector; connector.connect (handler, a1); ACE_Event_Handler_var safe_handler (handler); g_semaphore.acquire(); // wait for connect to complete } ACE_Reactor::end_event_loop(); task.wait(); if (g_svc_handlers_leaked != 0) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Svc_Handler leakage detected, ") ACE_TEXT ("%d objects remain\n"), g_svc_handlers_leaked), 1); } #else ACE_ERROR ((LM_INFO, ACE_TEXT ("threads not supported on this platform\n"))); #endif ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/RB_Tree_Test.h0000644000175000017500000000550715027201773016772 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file RB_Tree_Test.h * * Header file for a test to verify and illustrate the use of the * ACE_RB_Tree ACE_RB_Tree_Iterator, and * ACE_RB_Tree_Reverse_Iterator classes. * iterator over each. * * @author Chris Gill */ //============================================================================= /** * @class ACE_RB_Tree_Test * * @brief Implements a templatized test class for the RB_Tree ADT and its * iterators. */ template class ACE_RB_Tree_Test { // To run the test class on a particular type instantiation of the // RB_Tree, simply instantiate the test class template with the // same type parameters, and invoke the run_test method. public: // = Traits typedef ACE_RB_Tree TREE; typedef ACE_RB_Tree_Iterator ITERATOR; typedef ACE_RB_Tree_Reverse_Iterator REVERSE_ITERATOR; /// Constructor. ACE_RB_Tree_Test (int entry_count, EXT_ID key_array [], INT_ID item_array [], int order_index []); /// Destructor. ~ACE_RB_Tree_Test (); /// Run the individual interface and iteration tests in order. void run_test (); private: /// Tests stable and deprecated insertion interfaces. void test_tree_insertion (); /// Tests forward and reverse iteration after insertion in both /// trees. void test_post_insertion_iteration (); ///Tests forward and reverse partial iteration void test_partial_iteration(); /// Tests stable and deprecated deletion interfaces. void test_tree_deletion (); /// Tests forward and reverse iteration after deletions in both /// trees. void test_post_deletion_iteration (); /// Tree for testing stable interface. TREE stable_tree_; /// Forward iterator for tree for testing stable interface. ITERATOR stable_fwd_iter_; ITERATOR part_fwd_iter_; REVERSE_ITERATOR part_rev_iter_; /// Forward iterator for tree for testing stable interface. REVERSE_ITERATOR stable_rev_iter_; /// Tree for testing deprecated interface. TREE deprecated_tree_; /// Forward iterator for tree for testing deprecated interface. ITERATOR deprecated_fwd_iter_; /// Forward iterator for tree for testing deprecated interface. REVERSE_ITERATOR deprecated_rev_iter_; /// Number of entries in the key, item, and index arrays. int entry_count_; /// Array of EXT_IDs (keys) with which to test. EXT_ID *key_array_; /// Array of INT_IDs (items) with which to test. INT_ID *item_array_; /// Order of indices in the key and item arrays. int *order_index_; }; ace-8.0.4+dfsg.orig/tests/Collection_Test.h0000644000175000017500000000120215027201773017567 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Collection_Test.h * * Define class needed for generating templates. * * @author Irfan Pyarali */ //============================================================================= #ifndef ACE_TESTS_COLLECTION_TEST_H #define ACE_TESTS_COLLECTION_TEST_H typedef void (*deletion_func)(void* p); struct UglyThing { void *alloc_; deletion_func dfunc_; UglyThing (void* alloc = 0, deletion_func dfunc = 0); bool operator== (const UglyThing& r) const; }; #endif /* ACE_TESTS_COLLECTION_TEST_H */ ace-8.0.4+dfsg.orig/tests/SV_Shared_Memory_Test.cpp0000644000175000017500000001303615027201773021205 0ustar sudipsudip //============================================================================= /** * @file SV_Shared_Memory_Test.cpp * * This is a simple test of and * using the . The test * forks two processes and then executes client and server * allowing them to exchange data using shared memory. No user * input is required as far as command line arguments are * concerned. * * @author Prashant Jain and Douglas C. Schmidt */ //============================================================================= #include "test_config.h" #include "ace/Malloc_T.h" #include "ace/Shared_Memory_Pool.h" #include "ace/SV_Semaphore_Simple.h" #include "ace/SV_Semaphore_Complex.h" #include "ace/OS_NS_unistd.h" #if defined (ACE_HAS_SYSV_IPC) && !defined(ACE_LACKS_SYSV_SHMEM) // The shared memory allocator, which uses up the ACE_DEFAULT_SEM_KEY. // We hide the allocator inside this function so that it doesn't get // constructed until after the ACE_Object_Manager gets constructed, // even with ACE_HAS_NONSTATIC_OBJECT_MANAGER. static ACE_Malloc & myallocator () { static ACE_Malloc myallocator; return myallocator; } // Create some more keys that are different from the // ACE_DEFAULT_SEM_KEY used by the allocator. static const int SEM_KEY_1 = ACE_DEFAULT_SEM_KEY + 1; static const int SEM_KEY_2 = ACE_DEFAULT_SEM_KEY + 2; static const int SHMSZ = 27; static const char SHMDATA[SHMSZ] = "abcdefghijklmnopqrstuvwxyz"; static ACE_SV_Semaphore_Complex *parent_mutex = 0; static ACE_SV_Semaphore_Complex *parent_synch = 0; static int parent (char *shm) { // This for loop executes in a critical section proteced by // . for (int i = 0; i < SHMSZ; i++) shm[i] = SHMDATA[i]; int result; result = parent_mutex->release (); ACE_TEST_ASSERT (result != -1); result = parent_synch->acquire (); ACE_TEST_ASSERT (result != -1); result = myallocator ().remove (); ACE_TEST_ASSERT (result != -1); result = parent_mutex->remove (); ACE_TEST_ASSERT (result != -1); result = parent_synch->remove (); ACE_TEST_ASSERT (result != -1); return 0; } static int child (char *shm) { int result; ACE_SV_Semaphore_Complex mutex; // This semaphore is initially created with a count of 0, i.e., it // is "locked." result = mutex.open (SEM_KEY_1, ACE_SV_Semaphore_Complex::ACE_CREATE, 0); ACE_TEST_ASSERT (result != -1); ACE_SV_Semaphore_Complex synch; // This semaphore is initially created with a count of 0, i.e., it // is "locked." result = synch.open (SEM_KEY_2, ACE_SV_Semaphore_Complex::ACE_CREATE, 0); ACE_TEST_ASSERT (result != -1); // Perform "busy waiting" here until we acquire the semaphore. This // isn't really a good design -- it's just to illustrate that you // can do non-blocking acquire() calls with the ACE System V // semaphore wrappers. while ((result = mutex.tryacquire ()) == -1) if (errno == EAGAIN) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) spinning in child!\n"))); else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P) child mutex.tryacquire"))); ACE_TEST_ASSERT (result != -1); } for (int i = 0; i < SHMSZ; i++) ACE_TEST_ASSERT (SHMDATA[i] == shm[i]); result = synch.release (); ACE_TEST_ASSERT (result != -1); return 0; } #endif /* ACE_HAS_SYSV_IPC */ int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("SV_Shared_Memory_Test")); #if defined (ACE_HAS_SYSV_IPC) && !defined (ACE_LACKS_FORK) && \ !defined(ACE_LACKS_SYSV_SHMEM) // Check whether allocator was initialized. if (myallocator ().bad ()) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Unable to initialize allocator\n")), -1); } char *shm = reinterpret_cast (myallocator ().malloc (SHMSZ)); // Create the mutex and synch before spawning the child process, to // avoid race condition between their creation in the parent and use // in the child. ACE_NEW_RETURN (parent_mutex, ACE_SV_Semaphore_Complex, -1); ACE_NEW_RETURN (parent_synch, ACE_SV_Semaphore_Complex, -1); // This semaphore is initially created with a count of 0, i.e., it // is "locked." int result = parent_mutex->open (SEM_KEY_1, ACE_SV_Semaphore_Complex::ACE_CREATE, 0); ACE_TEST_ASSERT (result != -1); // This semaphore is initially created with a count of 0, i.e., it // is "locked." result = parent_synch->open (SEM_KEY_2, ACE_SV_Semaphore_Complex::ACE_CREATE, 0); ACE_TEST_ASSERT (result != -1); switch (ACE_OS::fork (ACE_TEXT ("SV_Shared_Memory_Test.cpp"))) { case -1: ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P) fork failed\n")), -1); /* NOTREACHED */ case 0: child (shm); break; default: parent (shm); delete parent_mutex; delete parent_synch; break; } #else ACE_ERROR ((LM_INFO, ACE_TEXT ("SYSV IPC, SYSV SHMEM, or fork ") ACE_TEXT ("are not supported on this platform\n"))); #endif /* ACE_HAS_SYSV_IPC */ ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/CDR_Fixed_Test.cpp0000644000175000017500000001765115027201773017575 0ustar sudipsudip#include "test_config.h" #include "ace/CDR_Base.h" #include "ace/OS_NS_string.h" #ifndef ACE_LACKS_IOSTREAM_TOTALLY #include #endif #define TEST_EQUAL(LHS, RHS) if (!((LHS) == (RHS))) { \ failed = true; \ ACE_ERROR ((LM_ERROR, "Test assertion FAILED " #LHS " != " #RHS \ " at line %l\n")); } namespace { bool failed = false; void log (ACE_OSTREAM_TYPE *os, const char *label, const char *expected, const ACE_CDR::Fixed &f) { #ifdef ACE_LACKS_IOSTREAM_TOTALLY ACE_OS::fprintf (os, "%s: expected %s got ", label, expected); #else *os << label << ": expected " << expected << " got "; #endif *os << f; #ifdef ACE_LACKS_IOSTREAM_TOTALLY ACE_OS::fputc ('\n', os); #else *os << '\n'; #endif } } #define EXPECT(STR, OBJ) \ { \ char buffer[Fixed::MAX_STRING_SIZE]; \ OBJ.to_string (buffer, sizeof buffer); \ if (ACE_OS::strcmp (STR, buffer)) { \ failed = true; \ ACE_ERROR ((LM_ERROR, "FAILED conversion to string at line %l\n")); \ log (os, #OBJ, STR, OBJ); \ } \ } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("CDR_Fixed_Test")); using Fixed = ACE_CDR::Fixed; using LongLong = ACE_CDR::LongLong; using ULongLong = ACE_CDR::ULongLong; using LongDouble = ACE_CDR::LongDouble; const Fixed f1 = Fixed::from_integer (LongLong (-1234567890l)), f2 = Fixed::from_integer (ULongLong (987654321ul)), f3 = Fixed::from_string ("612578912487901265.90125789"); TEST_EQUAL (LongLong (-1234567890l), LongLong (f1)); TEST_EQUAL (LongLong (987654321), LongLong (f2)); TEST_EQUAL (LongLong (612578912487901265ull), LongLong (f3)); TEST_EQUAL (0, f1.fixed_scale ()); TEST_EQUAL (10, f1.fixed_digits ()); TEST_EQUAL (0, f2.fixed_scale ()); TEST_EQUAL (9, f2.fixed_digits ()); TEST_EQUAL (8, f3.fixed_scale ()); TEST_EQUAL (26, f3.fixed_digits ()); ACE_OSTREAM_TYPE *const os = ace_file_stream::instance ()->output_file (); EXPECT ("-1234567890", f1); EXPECT ("987654321", f2); EXPECT ("612578912487901265.90125789", f3); Fixed f1_scaled = f1 / Fixed::from_integer (LongLong (100)); const Fixed f4 = Fixed::from_string ("-12345678.9"); TEST_EQUAL (f1_scaled, f4); EXPECT ("-12345678.9", f4); const Fixed f5 = Fixed::from_string ("0.00000000"), f6 = Fixed::from_string ("0.000000000"); EXPECT ("0.00000000", f5); EXPECT ("0.000000000", f6); TEST_EQUAL (8, f5.fixed_scale ()); // these are not "normalized" since the TEST_EQUAL (9, f6.fixed_scale ()); // caller explicitly requested this scale Fixed f7 = Fixed::from_string ("0.1"); EXPECT ("0", f7.round (0)); EXPECT ("0", f7.truncate (0)); f7 = Fixed::from_string ("0.05"); EXPECT ("0.1", f7.round (1)); EXPECT ("0.0", f7.truncate (1)); f7 = Fixed::from_string ("-0.005"); EXPECT ("-0.01", f7.round (2)); EXPECT ("0.00", f7.truncate (2)); LongDouble ld1; ACE_CDR_LONG_DOUBLE_ASSIGNMENT (ld1, 1234.45); const Fixed f8 = Fixed::from_floating (ld1); TEST_EQUAL (LongLong (1234), LongLong (f8)); LongDouble ld2; ACE_CDR_LONG_DOUBLE_ASSIGNMENT (ld2, -0.3125); const Fixed f9 = Fixed::from_floating (ld2); EXPECT ("-0.3125", f9); LongDouble ld3; ACE_CDR_LONG_DOUBLE_ASSIGNMENT (ld3, 0.125); const Fixed f10 = Fixed::from_floating (ld3); EXPECT ("0.125", f10); LongDouble ldzero = ACE_CDR_LONG_DOUBLE_INITIALIZER; const Fixed fzero = Fixed::from_floating (ldzero); EXPECT ("0", fzero); ACE_CDR_LONG_DOUBLE_ASSIGNMENT(ldzero, 0); const Fixed fzero2 = Fixed::from_floating(ldzero); EXPECT("0", fzero2); Fixed f11 = Fixed::from_integer (LongLong (-1l)); TEST_EQUAL (LongLong (-1), LongLong (f11)); TEST_EQUAL (false, !f11); ++f11; TEST_EQUAL (true, !f11); TEST_EQUAL (LongLong (0), LongLong (f11)); TEST_EQUAL (Fixed::from_integer (), f11); f11 += Fixed::from_string ("0.124357891"); ++f11; TEST_EQUAL (Fixed::from_string ("1.124357891"), f11); --f11; --f11; TEST_EQUAL (Fixed::from_string ("-0.875642109"), f11); TEST_EQUAL (true, Fixed::from_integer (LongLong (-4)) < Fixed::from_integer (LongLong (2))); TEST_EQUAL (true, Fixed::from_integer (LongLong (-4)) < Fixed::from_integer (LongLong (-2))); TEST_EQUAL (false, Fixed::from_integer (LongLong (4)) < Fixed::from_integer (LongLong (-2))); TEST_EQUAL (false, Fixed::from_integer (LongLong (4)) < Fixed::from_integer (LongLong (2))); TEST_EQUAL (true, Fixed::from_string ("2.17") < Fixed::from_string ("3.142")); TEST_EQUAL (true, Fixed::from_string ("10.1") < Fixed::from_string ("100")); TEST_EQUAL (Fixed::from_string ("0000.000"), f5); TEST_EQUAL (Fixed::from_string ("-0.00500"), f7); TEST_EQUAL (f11, f11); Fixed f12 = f11++; TEST_EQUAL (++f12, f11); Fixed f13 = f12--; TEST_EQUAL (--f13, f12); Fixed f14 = Fixed::from_integer (LongLong (9)); TEST_EQUAL (1, f14.fixed_digits ()); ++f14; TEST_EQUAL (Fixed::from_integer (LongLong (10)), f14); TEST_EQUAL (Fixed::from_string ("778.33"), Fixed::from_string ("12.9") + Fixed::from_string ("765.43")); Fixed full = Fixed::from_string ("9876543210987654321098765432109"), before = full; full += Fixed::from_string ("0.99"); TEST_EQUAL (before, full); // no rounding f14 += full; const Fixed f15 = Fixed::from_string ("9876543210987654321098765432119"); TEST_EQUAL (f15, f14); Fixed f16 = Fixed::from_string ("123.4567890123456789012345678901"); f16 += Fixed::from_integer (LongLong (9876)); const Fixed f17 = Fixed::from_string ("9999.456789012345678901234567890"); TEST_EQUAL (f17, f16); Fixed f18 = Fixed::from_string ("197854191"); f18 -= Fixed::from_string ("123546789"); EXPECT ("74307402", f18); TEST_EQUAL (8, f18.fixed_digits ()); Fixed f19 = Fixed::from_integer (LongLong (9)); f19 -= Fixed::from_integer (LongLong (10)); EXPECT ("-1", f19); Fixed f20 = Fixed::from_integer (LongLong (99)); f20 += Fixed::from_integer (LongLong (99)); EXPECT ("198", f20); // carry extra digit Fixed f21 = Fixed::from_string ("7.532"); f21 -= Fixed::from_string ("4.91"); EXPECT ("2.622", f21); Fixed f22 = Fixed::from_integer (LongLong (-99)) * Fixed::from_integer (LongLong (-9)); EXPECT ("891", f22); Fixed f23 = Fixed::from_integer (LongLong (9)) * Fixed::from_integer (LongLong (-99)); EXPECT ("-891", f23); Fixed f24 = Fixed::from_string ("-3.4") * Fixed::from_string ("5.67"); EXPECT ("-19.278", f24); Fixed f25 = Fixed::from_string ("9999999999.1234567890") // 10.10 * Fixed::from_string ("876543219087654321.9876543210");// 18.10 EXPECT ("8765432190108215212037174200.146", f25); // 28.3 // 1234567890123456789012345678901 Fixed f26 = Fixed::from_string ("0.0000000000000000000000000000001") * Fixed::from_string ("0.1"); EXPECT ( "0.0000000000000000000000000000000", f26); Fixed f27 = Fixed::from_string ("817459124"); f27 /= Fixed::from_string ("0.001"); EXPECT ("817459124000", f27); f27 /= Fixed::from_integer (LongLong (1000)); EXPECT ("817459124", f27); f27 /= Fixed::from_integer (LongLong (-2)); EXPECT ("-408729562", f27); Fixed f28 = Fixed::from_string ("200000000"); f28 /= Fixed::from_string ("500"); EXPECT ("400000", f28); TEST_EQUAL (6, f28.fixed_digits ()); Fixed f29 = Fixed::from_integer (LongLong (1)) / Fixed::from_integer (LongLong (-3)); EXPECT ("-0.333333333333333333333333333333", f29); //TODO: one more 3 Fixed f30 = Fixed::from_string("-9999752.0000") / Fixed::from_string("-4999876.00"); EXPECT ("2", f30); ACE_END_TEST; return failed; } ace-8.0.4+dfsg.orig/tests/Message_Block_Test.cpp0000644000175000017500000003504015027201773020534 0ustar sudipsudip //============================================================================= /** * @file Message_Block_Test.cpp * * This test program is a torture test that illustrates how * reference counting works in multi-threaded * code. * * @author Doug Schmidt and Nanbor Wang */ //============================================================================= #include "test_config.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/Task.h" #include "ace/Malloc_T.h" #include "ace/Profile_Timer.h" #include "ace/Free_List.h" // Number of memory allocation strategies used in this test. static const int ACE_ALLOC_STRATEGY_NO = 2; // Size of a memory block (multiple of ACE_MALLOC_ALIGN). static const int ACE_ALLOC_SIZE = 5; // Amount of memory block preallocated. static const size_t ACE_ALLOC_AMOUNT = 48; // For the user-defined data block test static bool user_data_dtor_called = false; class User_Data : public ACE_Data_Block { public: User_Data() {} ~User_Data() override { ACE_DEBUG((LM_DEBUG, ACE_TEXT ("User_Data dtor\n"))); user_data_dtor_called = true; } }; #if defined (ACE_HAS_THREADS) #include "ace/Lock_Adapter_T.h" #include "ace/Synch_Traits.h" // Number of iterations to run the test. static size_t n_iterations = ACE_MAX_ITERATIONS; static ACE_Lock_Adapter lock_adapter_; // Serialize access to reference count, which will // be decremented from multiple threads. class Worker_Task : public ACE_Task { public: /// Activate the task. Worker_Task (); /// Iterate time printing off a message and "waiting" /// for all other threads to complete this iteration. int svc () override; /// Allows the producer to pass messages to the . int put (ACE_Message_Block *mb, ACE_Time_Value *tv = 0) override; private: //FUZZ: disable check_for_lack_ACE_OS /// Close hook. ///FUZZ: enable check_for_lack_ACE_OS int close (u_long) override; }; int Worker_Task::close (u_long) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) close of worker\n"))); return 0; } // Simply enqueue the Worker_Task into the end of the queue. int Worker_Task::put (ACE_Message_Block *mb, ACE_Time_Value *tv) { return this->msg_queue ()->enqueue_prio (mb, tv); } // Iterate printing off a message and "waiting" for all // other threads to complete this iteration. int Worker_Task::svc () { // The method automatically adds us to the // process-wide when the thread begins. ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) starting svc() method\n"))); // Keep looping, reading a message out of the queue, until we get a // message with a length == 0, which signals us to quit. for (int count = 0; ; count++) { ACE_Message_Block *mb = 0; if (-1 == this->msg_queue ()->dequeue_head (mb)) ACE_ERROR_BREAK ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Worker_Task dequeue_head"))); size_t length = mb->length (); // If there's a next() Task then "logically" copy the message by // calling and send it on down the pipeline. Note // that this doesn't actually make a copy of the message // contents (i.e., the Data_Block portion), it just makes a copy // of the header and reference counts the data. if (this->next () != 0) { if (-1 == this->put_next (mb->duplicate ())) ACE_ERROR_BREAK ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Worker_Task put_next"))); } // If there's no next() Task to send to, then we'll consume the // message here. else if (length > 0) { int current_count = ACE_OS::atoi ((ACE_TCHAR *)(mb->rd_ptr ())); int i; if (count != current_count) ACE_ERROR_BREAK ((LM_ERROR, ACE_TEXT ("(%t) count from block should be %d ") ACE_TEXT ("but is %d\n"), count, current_count)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) enqueueing %d duplicates\n"), current_count)); ACE_Message_Block *dup; // Enqueue duplicates with msg_priority == 1. for (i = current_count; i > 0; i--) { ACE_ALLOCATOR_RETURN (dup, mb->duplicate (), -1); // Set the priority to be greater than "normal" // messages. Therefore, all of these messages should go // to the "front" of the queue, i.e., ahead of all the // other messages that are being enqueued by other // threads. dup->msg_priority (ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY + 1); int enqueue_prio_result = this->msg_queue ()->enqueue_prio (dup, // Don't block indefinitely if we flow control... (ACE_Time_Value *) &ACE_Time_Value::zero); if (enqueue_prio_result == -1) ACE_ERROR_BREAK ((LM_ERROR, ACE_TEXT ("(%t) Pass %d %p\n"), i, ACE_TEXT ("Worker_Task enqueue_prio"))); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) dequeueing %d duplicates\n"), current_count)); // Dequeue the same duplicates. for (i = current_count; i > 0; i--) { if (-1 == this->msg_queue ()->dequeue_head (dup)) ACE_ERROR_BREAK ((LM_ERROR, ACE_TEXT ("(%t) Dup %d, %p\n"), i, ACE_TEXT ("Worker_Task dequeue dups"))); if (count != ACE_OS::atoi ((ACE_TCHAR *)(dup->rd_ptr ()))) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) line %l, Dup %d, block's count ") ACE_TEXT ("is %d but should be %d\n"), i, ACE_OS::atoi ((ACE_TCHAR *)(dup->rd_ptr ())), count)); if (0 != ACE_OS::strcmp ((ACE_TCHAR *)mb->rd_ptr (), (ACE_TCHAR *)dup->rd_ptr ())) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) Dup %d text is %s; ") ACE_TEXT ("should be %s\n"), i, dup->rd_ptr (), mb->rd_ptr ())); if (dup->msg_priority () != ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY + 1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) Dup %d block priority is %u; ") ACE_TEXT ("should be %u\n"), i, (unsigned int)dup->msg_priority (), (unsigned int)(ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY + 1))); dup->release (); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) in iteration %d, length = %B, prio = %d, text = \"%*s\"\n"), count, length, mb->msg_priority (), (int)(length - 2), // remove the trailing "\n\0" mb->rd_ptr ())); } // We're responsible for deallocating this. mb->release (); if (length == 0) { //FUZZ: disable check_for_NULL ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) in iteration %d, queue len = %B, got NULL message, exiting\n"), count, this->msg_queue ()->message_count ())); //FUZZ: enable check_for_NULL break; } } // Note that the ACE_Task::svc_run () method automatically removes // us from the Thread_Manager when the thread exits. return 0; } Worker_Task::Worker_Task () { // Make us an Active Object. if (this->activate (THR_NEW_LWP) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("activate failed"))); } static int produce (Worker_Task &worker_task, ACE_Allocator *alloc_strategy) { ACE_Message_Block *mb = 0; int status; // Send messages through the pipeline. for (size_t count = 0; count < n_iterations; count++) { ACE_TCHAR buf[BUFSIZ]; ACE_OS::snprintf (buf, BUFSIZ, ACE_SIZE_T_FORMAT_SPECIFIER, count); size_t n = (ACE_OS::strlen (buf) + 1) * sizeof (ACE_TCHAR); // Allocate a new message. ACE_NEW_RETURN (mb, ACE_Message_Block (n, // size ACE_Message_Block::MB_DATA, // type 0, // cont 0, // data alloc_strategy, // allocator &lock_adapter_, // locking strategy ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY), // priority -1); // Try once to copy in more than the block will hold; should yield an // error with ENOSPC. if (count == 0) { status = mb->copy ((char *) buf, n + 1); if (status != -1) ACE_ERROR ((LM_ERROR, ACE_TEXT (" (%t) Copy %B bytes into %B byte block ") ACE_TEXT ("should fail but didn't\n"), n + 1, n)); else if (errno != ENOSPC) { ACE_ERROR ((LM_ERROR, ACE_TEXT (" (%t) Copy into too-small block failed ") ACE_TEXT ("but with %p; should be ENOSPC\n"), ACE_TEXT ("wrong error"))); } else ACE_DEBUG ((LM_INFO, ACE_TEXT (" (%t) Copy too-long test succeeded\n"))); } // Copy buf into the Message_Block and update the wr_ptr (). status = mb->copy ((char *) buf, n); if (status != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT (" (%t) Copy to block should be good but %p\n"), ACE_TEXT ("failed"))); } // Pass the message to the Worker_Task. if (worker_task.put (mb, // Don't block indefinitely if we flow control... (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT (" (%t) %p\n"), ACE_TEXT ("put"))); } // Send a shutdown message to the waiting threads and exit. ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%t) sending shutdown message\n"))); ACE_NEW_RETURN (mb, ACE_Message_Block (0, ACE_Message_Block::MB_DATA, 0, 0, alloc_strategy, &lock_adapter_), -1); if (worker_task.put (mb) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT (" (%t) %p\n"), ACE_TEXT ("put"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%t) end producer\n"))); return 0; } typedef ACE_TCHAR MEMORY_CHUNK[ACE_MALLOC_ALIGN * ACE_ALLOC_SIZE]; ACE_Cached_Allocator mem_allocator (ACE_ALLOC_AMOUNT); struct alloc_struct_type { ACE_Allocator *strategy_; const ACE_TCHAR *name_; ACE_Profile_Timer::ACE_Elapsed_Time et_; }; alloc_struct_type alloc_struct[ACE_ALLOC_STRATEGY_NO] = { { 0, ACE_TEXT ("Default"), {0,0,0} }, { &mem_allocator, ACE_TEXT ("Cached Memory"), {0,0,0} } }; #endif /* ACE_HAS_THREADS */ int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Message_Block_Test")); // A quick user-defined data block test, then the main event User_Data *user_data_block = 0; ACE_NEW_MALLOC_RETURN (user_data_block, static_cast( ACE_Allocator::instance()->malloc(sizeof (User_Data))), User_Data (), -1); // Create a new message block referring to the User_Data block and // ensure it is released and freed correctly. ACE_Message_Block *wrapper_mb = 0; ACE_NEW_RETURN (wrapper_mb, ACE_Message_Block (user_data_block), -1); wrapper_mb->release (); wrapper_mb = 0; if (!user_data_dtor_called) ACE_ERROR ((LM_ERROR, ACE_TEXT ("User-defined data block not freed correctly.\n"))); #if defined (ACE_HAS_THREADS) int n_threads = ACE_MAX_THREADS; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) threads = %d\n"), n_threads)); ACE_Profile_Timer ptime; int i; for (i = 0; i < ACE_ALLOC_STRATEGY_NO; i++) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Start Message_Block_Test using %s allocation strategy\n"), alloc_struct[i].name_)); // Create the worker tasks. Worker_Task worker_task[ACE_MAX_THREADS] ; // Link all the tasks together into a simple pipeline. for (size_t j = 1; j < ACE_MAX_THREADS; j++) worker_task[j - 1].next (&worker_task[j]); ptime.start (); // Generate messages and pass them through the pipeline. produce (worker_task[0], alloc_struct[i].strategy_); // Wait for all the threads to reach their exit point. ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) waiting for worker tasks to finish...\n"))); ACE_Thread_Manager::instance ()->wait (); ptime.stop (); ptime.elapsed_time (alloc_struct[i].et_); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) destroying worker tasks\n"))); } for (i = 0; i < ACE_ALLOC_STRATEGY_NO; i++) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Elapsed time using %s allocation strategy: %f sec\n"), alloc_struct[i].name_, alloc_struct[i].et_.real_time)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Exiting...\n"))); #else ACE_ERROR ((LM_INFO, ACE_TEXT ("threads not supported on this platform\n"))); #endif /* ACE_HAS_THREADS */ ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Bug_3432_Regression_Test.cpp0000644000175000017500000000353315027201773021430 0ustar sudipsudip// ============================================================================ // // = LIBRARY // tests // // = DESCRIPTION // Test ACE_OS::strptime // // = AUTHOR // Johnny Willemsen // // ============================================================================ #include "test_config.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_strings.h" #include "ace/OS_NS_stdlib.h" #include "ace/OS_NS_sys_time.h" #include "ace/OS_NS_time.h" int strptime_test () { // convert UTC time string to UTC ACE_Time_Value int error_count = 0; const char* original_time = "2008-06-21 23:45"; tm lTime; ACE_OS::strptime(original_time, "%Y-%m-%d %H:%M", &lTime); lTime.tm_isdst = 0; // do not change due to daylight saving time time_t lNewTime = ACE_OS::mktime(&lTime); ACE_Time_Value lValue(lNewTime - ACE_OS::timezone(), 0); // do not change because of timezone // convert UTC ACE_Time_Value to UTC time string char lBuffer[128]; time_t time = lValue.sec(); struct tm tm_time; if (ACE_OS::gmtime_r (&time, &tm_time) == 0 && errno == ENOTSUP) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("gmtime_r is not supported on this platform\n"))); } if (ACE_OS::strftime(lBuffer, 128, "%Y-%m-%d %H:%M", &tm_time) == 0 && errno == ENOTSUP) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("strftime is not supported on this platform\n"))); } else if (ACE_OS::strcmp (lBuffer, original_time) != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%C != %C\n"), lBuffer, original_time)); ++error_count; } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("strptime_test succeeded\n"))); } return error_count; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Bug_3432_Regression_Test")); int status = 0; int result = 0; if ((result = strptime_test ()) != 0) status = result; ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/Timeprobe_Test.cpp0000644000175000017500000000413015027201773017760 0ustar sudipsudip //============================================================================= /** * @file Timeprobe_Test.cpp * * This is a simple test of ACE Timeprobes. * * @author Irfan Pyarali */ //============================================================================= //#define ACE_ENABLE_TIMEPROBES //#define ACE_MT_TIMEPROBES //#define ACE_TSS_TIMEPROBES #include "test_config.h" #include "ace/Singleton.h" #include "ace/Synch_Traits.h" #include "ace/Recursive_Thread_Mutex.h" #include "ace/Null_Mutex.h" #include "ace/OS_NS_unistd.h" #include "ace/Timeprobe.h" #if defined (ACE_ENABLE_TIMEPROBES) static const char *events_descriptions_0[] = { "Event Zero", "Event One", "Event Two", "Event Three", "Event Four", "Event Five", "Event Six", "Event Seven", "Event Eight", "Event Nine" }; enum { EVENT_ZERO = 0, EVENT_ONE, EVENT_TWO, EVENT_THREE, EVENT_FOUR, EVENT_FIVE, EVENT_SIX, EVENT_SEVEN, EVENT_EIGHT, EVENT_NINE }; static const char *events_descriptions_1[] = { "Work start", "Work end" }; enum { WORK_START = 100, WORK_END }; ACE_TIMEPROBE_EVENT_DESCRIPTIONS (events_descriptions_1, WORK_START); ACE_TIMEPROBE_EVENT_DESCRIPTIONS (events_descriptions_0, EVENT_ZERO); #endif /* ACE_ENABLE_TIMEPROBES */ static void work (int time) { ACE_FUNCTION_TIMEPROBE (WORK_START); ACE_OS::sleep (time); } #if !defined (ACE_HAS_PURIFY) // Test creation of ACE_Singletons during static object construction. // Timeprobes can do that, when they're enabled. Purify would notice // the memory in use at program termination. static int create_singleton () { int *i = ACE_Singleton ::instance (); *i = 3; return *i; } int static_singleton_creator = create_singleton (); #endif /* ! ACE_HAS_PURIFY */ int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Timeprobe_Test")); ACE_TIMEPROBE ("Starting Test"); for (int i = 0; i < 3; i++) { work (i); ACE_TIMEPROBE (EVENT_ZERO + i); } ACE_TIMEPROBE ("Ending Test"); ACE_TIMEPROBE_PRINT; ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/SOCK_SEQPACK_SCTP_Test.cpp0000644000175000017500000002324415027201773020600 0ustar sudipsudip// // *WARRANTY DISCLAIMER: LIMITATION OF LIABILITY. THE SOFTWARE AND // CONTENT ARE PROVIDED "AS IS" WITH NO EXPRESS OR IMPLIED // REPRESENTATIONS, GUARANTEES, OR WARRANTIES, INCLUDING BUT NOT LIMITED // TO SUCH REPRESENTATION, GUARANTEES OR WARRANTIES REGARDING THE // USABILITY, SUITABILITY, CONDITION, OPERATION OR ACCURACY THEREOF. * // // *ALL OTHER WARRANTIES AND CONDITIONS (EXPRESS, IMPLIED OR STATUTORY) // ARE HEREBY DISCLAIMED, SUCH WARRANTIES AND CONDITIONS INCLUDING // WITHOUT LIMITATION, ALL WARRANTIES AND CONDITIONS OF MERCHANTABILITY, // TITLE, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, // COMPATIBILITY, AND SECURITY OR ACCURACY.* // // ============================================================================ // // = LIBRARY // tests // // = FILENAME // SOCK_SEQPACK_SCTP_Test.cpp // // = DESCRIPTION // Performs several tests on the ACE_SOCK_SEQPACK_Connector, // ACE_SOCK_SEQPACK_Acceptor, and ACE_SOCK_SEQPACK_Association classes // specifically for SCTP using the loopback interface. Attempts to // replicate behavior of SOCK_Test.cpp, but integrating IPv6 tests // directly. // // = AUTHOR // Dave Craig // #include "test_config.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_sys_select.h" #include "ace/OS_NS_sys_wait.h" #include "ace/SOCK_SEQPACK_Connector.h" #include "ace/SOCK_SEQPACK_Acceptor.h" #include "ace/Thread_Manager.h" #include "ace/Handle_Set.h" #define TTCPPORT 5001 #define BYTE_MESG 0xcd struct tdesc { ACE_Thread_Semaphore *tsemap; bool ipv6_test; }; using tdesc_t = struct tdesc; #ifdef ACE_WIN64 // This arg is ignored on Windows and causes pointer truncation // warnings on 64-bit compiled. #define SELECT_WIDTH(x) 0 #else #define SELECT_WIDTH(x) (x) #endif ACE_THR_FUNC_RETURN Server (void *arg) { ACE_SOCK_SEQPACK_Acceptor *AcceptorSocket = reinterpret_cast (arg); ACE_SOCK_SEQPACK_Association Stream; ACE_Handle_Set handle_set; const ACE_Time_Value def_timeout (ACE_DEFAULT_TIMEOUT); ACE_Time_Value tv (def_timeout); int select_width; int result; // // Make sure AcceptorSocket is in nonblocking mode so as not to // hang tests. // if (-1 == AcceptorSocket->enable (ACE_NONBLOCK)) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("AcceptorSocket.enable (ACE_NONBLOCK)"))); // // Set up select to wait for I/O events. // handle_set.reset (); handle_set.set_bit (AcceptorSocket->get_handle ()); select_width = SELECT_WIDTH(int (AcceptorSocket->get_handle ()) + 1); result = ACE_OS::select(select_width, handle_set, 0, 0, &tv); if (-1 == result) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("select")), 0); if (0 == result) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT("(%P|%t) select timed out, shutting down\n")), 0); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) waiting for client to connect\n"))); while (-1 != AcceptorSocket->accept (Stream)) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) client connected\n"))); // // Enable non-blocking I/O. // if (Stream.enable (ACE_NONBLOCK)) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("Stream.enable (ACE_NONBLOCK)")), 0); unsigned char byte = BYTE_MESG; if (-1 == Stream.send_n (&byte, 1)) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("Stream.send_n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) byte sent\n"))); // // Abruptly terminate the association. // if (-1 == Stream.abort ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("Association.abort"))); // // Negative test: make sure that we cannot send on a closed association. // if (-1 != Stream.send_n (&byte, 1)) //FUZZ: disable check_for_lack_ACE_OS ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) Negative test fail: Association") ACE_TEXT(".send_n succeeded after abort()\n"))); //FUZZ: enable check_for_lack_ACE_OS } // // Close server socket. // if (-1 == AcceptorSocket->close ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("AcceptorSocket.close"))); return 0; } ACE_THR_FUNC_RETURN Client(void *arg) { ACE_Multihomed_INET_Addr *ServerAddr = reinterpret_cast (arg); ACE_SOCK_SEQPACK_Connector Connector; ACE_SOCK_SEQPACK_Association Stream; ACE_Time_Value tv (ACE_DEFAULT_TIMEOUT); char b; size_t bytes; if (-1 == Connector.connect (Stream, *ServerAddr, &tv, ACE_Addr::sap_any, 1)) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p to %s:%d\n"), ACE_TEXT ("Connector.connect"), ServerAddr->get_host_name (), ServerAddr->get_port_number ()), 0); } if (-1 == Stream.disable (ACE_NONBLOCK)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("Association.disable (ACE_NONBLOCK)"))); } if (-1 == Stream.recv_n (&b, 1, &tv, &bytes)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("Association.recv_n"))); } if (1 == bytes) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Client received %B bytes\n"), bytes)); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) Client received %B bytes; expected 1\n"), bytes)); // // Give server a little time to abort the association. // ACE_OS::sleep(1); // abort closes the connection, so the recv should either see a closed // socket or some failure other than a timeout. ssize_t cnt = Stream.recv_n (&b, 1, &tv, &bytes); if (cnt > 0 || (cnt == -1 && errno == ETIME)) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) Negative test failed; Association") ACE_TEXT (".recv_n returned %b (w/ %m) after abort\n"), cnt)); return 0; } // // Spawn server and client threads and then wait until they complete the // test. There must be a timeout on the wait, so executable does not hang the // tests indefinitely. // int spawn_test(bool ipv6_test) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) spawn_test started ipv6 %d\n"), ipv6_test)); ACE_SOCK_SEQPACK_Acceptor AcceptorSocket; const ACE_TCHAR *addrstr = #ifdef ACE_HAS_IPV6 ipv6_test ? ACE_IPV6_LOCALHOST : ACE_LOCALHOST; #else ACE_LOCALHOST; #endif /* ACE_HAS_IPV6 */ ACE_Multihomed_INET_Addr ServerAddr (TTCPPORT, addrstr #ifdef ACE_HAS_IPV6 ,1, ipv6_test ? AF_INET6 : AF_INET #endif /* ACE_HAS_IPV6 */ ); if (-1 == AcceptorSocket.open (ServerAddr, 1)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("AcceptorSocket.open"))); } if (-1 == AcceptorSocket.get_local_addr (ServerAddr)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("AcceptorSocket.get_local_addr"))); } #ifndef ACE_LACKS_FORK switch (ACE_OS::fork (ACE_TEXT ("child"))) { case -1: ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p"), ACE_TEXT ("fork failed"))); break; case 0: ACE_LOG_MSG->sync (ACE_TEXT ("SOCK_SEQPACK_SCTP_Test")); Client (&ServerAddr); ACE_OS::exit (0); break; default: Server (reinterpret_cast (&AcceptorSocket)); ACE_OS::wait (); break; } #elif defined (ACE_HAS_THREADS) if (-1 == ACE_Thread_Manager::instance ()->spawn (Server, reinterpret_cast (&AcceptorSocket), THR_NEW_LWP | THR_DETACHED)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p%a"), ACE_TEXT ("thread create failed"))); } if (-1 == ACE_Thread_Manager::instance ()->spawn (Client, reinterpret_cast (&ServerAddr), THR_NEW_LWP | THR_DETACHED)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p%a"), ACE_TEXT ("thread create failed"))); } ACE_Thread_Manager::instance ()->wait (); #else /* ACE_LACKS_FORK && ! ACE_HAS_THREADS */ ACE_ERROR ((LM_DEBUG, ACE_TEXT ("(%P|%t)\n"), ACE_TEXT ("only one thread may be run ") ACE_TEXT ("in a process on this platform\n"))); #endif /* ACE_LACKS_FORK && ! ACE_HAS_THREADS */ return 0; } int do_test() { spawn_test(false); #ifdef ACE_HAS_IPV6 spawn_test(true); #endif return 0; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("SOCK_SEQPACK_SCTP_Test")); // // Check whether host OS has SCTP support before starting this test. // If not, just pass because there is not a hope of testing // SOCK_SEQPACK. // int status = 0; #ifdef ACE_HAS_SCTP status = do_test(); #else /* ! ACE_HAS_SCTP */ ACE_DEBUG ((LM_DEBUG, ACE_TEXT("SCTP not supported by ACE.\n") ACE_TEXT("This test will not do anything.\n"))); #endif /* ! ACE_HAS_SCTP */ ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/Naming_Test.cpp0000644000175000017500000002361315027201773017252 0ustar sudipsudip //============================================================================= /** * @file Naming_Test.cpp * * This is a test to illustrate the Naming Services. The test * does binds, rebinds, finds, and unbinds on name bindings using * the local naming context. * * @author Prashant Jain and Irfan Pyarali */ //============================================================================= #include "test_config.h" #include "randomize.h" #include "ace/Lib_Find.h" #include "ace/SString.h" #include "ace/Naming_Context.h" #include "ace/Profile_Timer.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #if !defined ACE_LACKS_FCNTL || defined ACE_WIN32 static char name[BUFSIZ]; static char value[BUFSIZ]; static char type[BUFSIZ]; static void initialize_array (int * array, int size) { for (int n = 0; n < size; ++n) array[n] = n; } static void print_time (ACE_Profile_Timer &timer, const char *test) { ACE_Profile_Timer::ACE_Elapsed_Time et; timer.stop (); timer.elapsed_time (et); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" ***** %C ***** \n"), test)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("real time = %f secs, user time = %f secs, system time = %f secs\n"), et.real_time, et.user_time, et.system_time)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("time per call = %f usecs\n"), (et.real_time / double (ACE_NS_MAX_ENTRIES)) * 1000000)); } static void test_bind (ACE_Naming_Context &ns_context) { int array [ACE_NS_MAX_ENTRIES]; initialize_array (array, sizeof (array) / sizeof (array[0])); randomize (array, sizeof (array) / sizeof (array[0])); // do the binds for (size_t i = 0; i < ACE_NS_MAX_ENTRIES; i++) { ACE_OS::snprintf (name, BUFSIZ, "%s%d", "name", array[i]); ACE_NS_WString w_name (name); ACE_OS::snprintf (value, BUFSIZ, "%s%d", "value", array[i]); ACE_NS_WString w_value (value); ACE_OS::snprintf (type, BUFSIZ, "%s%d", "type", array [i]); int bind_result = ns_context.bind (w_name, w_value, type); ACE_TEST_ASSERT (bind_result != -1); } } static void test_find_failure (ACE_Naming_Context &ns_context) { ACE_OS::snprintf (name, BUFSIZ, "%s", "foo-bar"); ACE_NS_WString w_name (name); ACE_NS_WString w_value; char *l_type = 0; // Do the finds. for (size_t i = 0; i < ACE_NS_MAX_ENTRIES; i++) { int resolve = ns_context.resolve (w_name, w_value, l_type); ACE_TEST_ASSERT (resolve == -1); } } static void test_rebind (ACE_Naming_Context &ns_context) { int array [ACE_NS_MAX_ENTRIES]; initialize_array (array, sizeof (array) / sizeof (array[0])); randomize (array, sizeof (array) / sizeof (array[0])); // do the rebinds for (size_t i = 0; i < ACE_NS_MAX_ENTRIES; i++) { ACE_OS::snprintf (name, BUFSIZ, "%s%d", "name", array[i]); ACE_NS_WString w_name (name); ACE_OS::snprintf (value, BUFSIZ, "%s%d", "value", -array[i]); ACE_NS_WString w_value (value); ACE_OS::snprintf (type, BUFSIZ, "%s%d", "type", -array[i]); int rebind = ns_context.rebind (w_name, w_value, type); ACE_TEST_ASSERT (rebind != -1); } } static void test_unbind (ACE_Naming_Context &ns_context) { int array [ACE_NS_MAX_ENTRIES]; initialize_array (array, sizeof (array) / sizeof (array[0])); randomize (array, sizeof (array) / sizeof (array[0])); // do the unbinds for (size_t i = 0; i < ACE_NS_MAX_ENTRIES; i++) { ACE_OS::snprintf (name, BUFSIZ, "%s%d", "name", array[i]); ACE_NS_WString w_name (name); int unbind = ns_context.unbind (w_name); ACE_TEST_ASSERT (unbind != -1); } } static void test_find (ACE_Naming_Context &ns_context, int sign, int result) { char temp_val[BUFSIZ]; char temp_type[BUFSIZ]; int array [ACE_NS_MAX_ENTRIES]; initialize_array (array, sizeof (array) / sizeof (array[0])); randomize (array, sizeof (array) / sizeof (array[0])); // do the finds for (size_t i = 0; i < ACE_NS_MAX_ENTRIES; i++) { if (sign == 1) { ACE_OS::snprintf (temp_val, BUFSIZ, "%s%d", "value", array[i]); ACE_OS::snprintf (temp_type, BUFSIZ, "%s%d", "type", array[i]); } else { ACE_OS::snprintf (temp_val, BUFSIZ, "%s%d", "value", -array[i]); ACE_OS::snprintf (temp_type, BUFSIZ, "%s%d", "type", -array[i]); } ACE_OS::snprintf (name, BUFSIZ, "%s%d", "name", array[i]); ACE_NS_WString w_name (name); ACE_NS_WString w_value; char *type_out = 0; ACE_NS_WString val (temp_val); int const resolve_result = ns_context.resolve (w_name, w_value, type_out); if (resolve_result != result) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error, resolve result not equal to resutlt (%d != %d)\n"), resolve_result, result)); char *l_value = w_value.char_rep (); if (l_value) { ACE_TEST_ASSERT (w_value == val); if (ns_context.name_options ()->debug ()) { if (type_out) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Name: %C\tValue: %C\tType: %C\n"), name, l_value, type_out)); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Name: %C\tValue: %C\n"), name, l_value)); } if (type_out) { ACE_TEST_ASSERT (ACE_OS::strcmp (type_out, temp_type) == 0); delete[] type_out; } } delete[] l_value; } } #endif int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Naming_Test")); #if defined ACE_LACKS_FCNTL && !defined ACE_WIN32 ACE_UNUSED_ARG (argc); ACE_UNUSED_ARG (argv); #else ACE_TCHAR temp_file [BUFSIZ]; ACE_Naming_Context *ns_context = 0; ACE_NEW_RETURN (ns_context, ACE_Naming_Context, -1); ACE_Name_Options *name_options = ns_context->name_options (); name_options->parse_args (argc, argv); /* ** NOTE! This is an experimental value and is not magic in any way. It ** works for me, on one system. It's needed because in the particular ** case here where the underlying mmap will allocate a small area and ** then try to grow it, it always moves it to a new location, which ** totally screws things up. I once tried forcing the realloc to do ** MAP_FIXED but that's not a good solution since it may overwrite other ** mapped areas of memory, like the heap, or the C library, and get very ** unexpected results. (Steve Huston, 24-August-2007) */ # if defined (ACE_LINUX) && defined (__x86_64__) name_options->base_address ((char*)0x3c00000000); # endif bool unicode = false; # if (defined (ACE_WIN32) && defined (ACE_USES_WCHAR)) unicode = true; # endif /* ACE_WIN32 && ACE_USES_WCHAR */ if (unicode && name_options->use_registry () == 1) { name_options->namespace_dir (ACE_TEXT ("Software\\ACE\\Name Service")); name_options->database (ACE_TEXT ("Version 1")); } else { const ACE_TCHAR* pname = ACE::basename (name_options->process_name (), ACE_DIRECTORY_SEPARATOR_CHAR); // Allow the user to determine where the context file will be // located just in case the current directory is not suitable for // locking. We don't just set namespace_dir () on name_options // because that is not sufficient to work around locking problems // for Tru64 when the current directory is NFS mounted from a // system that does not properly support locking. ACE_TCHAR temp_dir [MAXPATHLEN]; if (ACE::get_temp_dir (temp_dir, MAXPATHLEN) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Temporary path too long, ") ACE_TEXT ("defaulting to current directory\n")), -1); } else { ACE_OS::chdir (temp_dir); } // Set the database name using the pid. mktemp isn't always available. ACE_OS::snprintf(temp_file, BUFSIZ, ACE_TEXT ("%") ACE_TEXT_PRIs ACE_TEXT ("%d"), pname, (int)ACE_OS::getpid ()); name_options->database (temp_file); } if (ns_context->open (ACE_Naming_Context::PROC_LOCAL, 1) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("ns_context->open (PROC_LOCAL) %p\n"), ACE_TEXT ("failed")), -1); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("time to test %d iterations using %s\n"), ACE_NS_MAX_ENTRIES, name_options->use_registry () ? ACE_TEXT ("Registry") : ACE_TEXT ("ACE"))); ACE_Profile_Timer timer; timer.start (); // Add some bindings to the database test_bind (*ns_context); print_time (timer, "Binds"); timer.start (); // Should find the entries test_find (*ns_context, 1, 0); print_time (timer, "Successful Finds"); timer.start (); // Rebind with negative values test_rebind (*ns_context); print_time (timer, "Rebinds"); timer.start (); // Should find the entries test_find (*ns_context, -1, 0); print_time (timer, "Successful Finds"); timer.start (); // Should not find the entries test_find_failure (*ns_context); print_time (timer, "UnSuccessful Finds"); timer.start (); // Remove all bindings from database test_unbind (*ns_context); print_time (timer, "Unbinds"); ACE_OS::snprintf (temp_file, BUFSIZ, ACE_TEXT ("%s%s%s"), name_options->namespace_dir (), ACE_DIRECTORY_SEPARATOR_STR, name_options->database ()); delete ns_context; // Remove any existing files. No need to check return value here // since we don't care if the file doesn't exist. ACE_OS::unlink (temp_file); #endif // !defined ACE_LACKS_FCNTL || defined ACE_WIN32 ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Cached_Accept_Conn_Test.h0000644000175000017500000001070715027201773021111 0ustar sudipsudip //============================================================================= /** * @file Cached_Accept_Conn_Test.h * * Define class needed for generating templates. * * @author Kirthika Parameswaran */ //============================================================================= #ifndef ACE_TESTS_CACHED_ACCEPT_CONN_TEST_H #define ACE_TESTS_CACHED_ACCEPT_CONN_TEST_H #include "ace/SOCK_Connector.h" #include "ace/SOCK_Acceptor.h" #include "ace/SOCK_Stream.h" #include "ace/INET_Addr.h" #include "ace/Acceptor.h" #include "ace/Connector.h" #include "ace/Svc_Handler.h" #include "ace/Caching_Utility_T.h" #include "ace/Cached_Connect_Strategy_T.h" #include "ace/Handle_Gobbler.h" class Client_Svc_Handler : public ACE_Svc_Handler { public: Client_Svc_Handler (ACE_Thread_Manager *t = 0); int open (void *v = 0); int close (u_long flags = 0); }; class Server_Svc_Handler : public ACE_Svc_Handler { public: Server_Svc_Handler (ACE_Thread_Manager *t = 0); int open (void *v = 0); }; typedef size_t ATTRIBUTES; typedef std::pair CACHED_HANDLER; typedef ACE_Refcounted_Hash_Recyclable ACE_ADDR; typedef ACE_Hash H_KEY; typedef ACE_Equal_To C_KEYS; typedef ACE_Hash_Map_Manager_Ex HASH_MAP; typedef ACE_Hash_Map_Iterator_Ex HASH_MAP_ITERATOR; typedef ACE_Hash_Map_Reverse_Iterator_Ex HASH_MAP_REVERSE_ITERATOR; typedef ACE_Recyclable_Handler_Cleanup_Strategy CLEANUP_STRATEGY; typedef ACE_Recyclable_Handler_Caching_Utility CACHING_UTILITY; typedef ACE_LRU_Caching_Strategy LRU_CACHING_STRATEGY; typedef ACE_LFU_Caching_Strategy LFU_CACHING_STRATEGY; typedef ACE_FIFO_Caching_Strategy FIFO_CACHING_STRATEGY; typedef ACE_Null_Caching_Strategy NULL_CACHING_STRATEGY; typedef ACE_Caching_Strategy_Adapter LRU_CACHING_STRATEGY_ADAPTER; typedef ACE_Caching_Strategy_Adapter LFU_CACHING_STRATEGY_ADAPTER; typedef ACE_Caching_Strategy_Adapter FIFO_CACHING_STRATEGY_ADAPTER; typedef ACE_Caching_Strategy_Adapter NULL_CACHING_STRATEGY_ADAPTER; typedef ACE_Caching_Strategy CACHING_STRATEGY; typedef ACE_Strategy_Acceptor ACCEPTOR; typedef ACE_Strategy_Connector STRATEGY_CONNECTOR; typedef ACE_NOOP_Creation_Strategy NULL_CREATION_STRATEGY; typedef ACE_NOOP_Concurrency_Strategy NULL_ACTIVATION_STRATEGY; typedef ACE_Cached_Connect_Strategy_Ex CACHED_CONNECT_STRATEGY; template class Accept_Strategy : public ACE_Accept_Strategy { public: /// Constructor. Accept_Strategy (CACHED_CONNECT_STRATEGY &caching_connect_strategy); /** * Initialize the with . If the * process runs out of descriptors, the unsed svc_handlers from the * CONNECTION CACHE are removed. */ int open (const ACE_PEER_ACCEPTOR_ADDR &local_addr, bool restart = false); /** * The default behavior delegates to the method of the * PEER_ACCEPTOR. A check is made here for the process running out * of file descriptors. If so, the CONNECTION CACHE is purged of * some idle svc_handlers. */ int accept_svc_handler (SVC_HANDLER *svc_handler); protected: typedef ACE_Accept_Strategy ACCEPT_STRATEGY_BASE; /// Handler for removing cached connections. int out_of_sockets_handler (); CACHED_CONNECT_STRATEGY &caching_connect_strategy_; }; #endif /* ACE_TESTS_CACHED_ACCEPT_CONN_TEST_H */ ace-8.0.4+dfsg.orig/tests/Mem_Map_Test.cpp0000644000175000017500000002027015027201773017350 0ustar sudipsudip //============================================================================= /** * @file Mem_Map_Test.cpp * * This test illustrates the use of ACE_Mem_Map to reverse a * file. The test first creates a dummy file for testing, then * reverses the file and then reverses it again to get back the * original file. * * @author Prashant Jain */ //============================================================================= #include "test_config.h" #include "ace/Mem_Map.h" #include "ace/Lib_Find.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_fcntl.h" #include "ace/OS_Memory.h" #if !defined (ACE_LACKS_MMAP) static const char ACE_ALPHABET[] = "abcdefghijklmnopqrstuvwxyz"; static const int LINE_LENGTH = 10; static const int NUM_LINES = 15; static void reverse_file (ACE_HANDLE file_handle, char *array, size_t size) { int count = 0; // LynxOS 3.0.0/PowerPC needs the volatile qualifier, with -O2 // optimization enabled and without ACE_HAS_INLINE. volatile size_t i = size; --i; if (array[i] == '\0') array[i] = '\n'; while (i-- > 0) { if (array[i] == '\n') { ACE_OS::write (file_handle, array + i + 1, count); ACE_OS::write (file_handle, ACE_TEXT ("\n"), 1); count = 0; } else count++; } ACE_OS::write (file_handle, array, count+1); } static int create_test_file (ACE_TCHAR *filename, int line_length, int num_lines) { char *mybuf = 0; ACE_NEW_RETURN (mybuf, char[line_length + 1], -1); const char *c = ACE_ALPHABET; const char *d = c; #if defined (__QNXNTO__) || (defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x670)) // For NTO has to applied to open the file, as Mem_Map can map only shared memory ACE_Mem_Map mmap_4_open; mmap_4_open.open (filename, O_RDWR | O_CREAT | O_TRUNC, ACE_DEFAULT_FILE_PERMS); ACE_HANDLE file_handle = mmap_4_open.handle(); #else ACE_HANDLE file_handle = ACE_OS::open (filename, O_RDWR | O_CREAT | O_TRUNC, ACE_DEFAULT_FILE_PERMS); #endif if (file_handle == ACE_INVALID_HANDLE) { delete [] mybuf; ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Open failed for %s\n"), filename), -1); } for (int j = 0; j < num_lines; j++) { for (int i = 0; i < line_length; i++) { mybuf[i] = *c; c++; } mybuf[line_length] = '\0'; c = ++d; if (ACE_OS::write (file_handle, mybuf, line_length) != line_length) { delete [] mybuf; ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p (%d) <%s>\n"), ACE_TEXT ("Write to file failed:"), ACE_ERRNO_GET, filename), -1); } if (ACE_OS::write (file_handle, ACE_TEXT ("\n"), 1) != 1) { delete [] mybuf; ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("write to file %s failed\n"), filename), -1); } } #if defined (__QNXNTO__) || (defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x670)) mmap_4_open.close(); #else ACE_OS::close (file_handle); #endif delete [] mybuf; return 0; } #endif /* !ACE_LACKS_MMAP */ int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Mem_Map_Test")); #if !defined (ACE_LACKS_MMAP) #if defined (__QNXNTO__) || (defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x670)) ACE_ERROR ((LM_INFO, ACE_TEXT ("mmap on QNX Neutrino/VxWorks can map only shared memory files\n"))); #endif // = Initialize the temporary variable names ACE_TCHAR test_file[MAXPATHLEN + 1]; ACE_TCHAR temp_file1[MAXPATHLEN + 1]; ACE_TCHAR temp_file2[MAXPATHLEN + 1]; // Get the temporary directory // - 18 is for the filenames, ace_mem_map_temp_1 is the longest if (ACE::get_temp_dir (test_file, MAXPATHLEN - 18) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Temporary path too long\n")), -1); // Copy the temp directory to the other variables ACE_OS::strcpy (temp_file1, test_file); ACE_OS::strcpy (temp_file2, test_file); // Add the filenames to the end ACE_OS::strcat (test_file, ACE_TEXT ("ace_mem_map_test")); ACE_OS::strcat (temp_file1, ACE_TEXT ("ace_mem_map_temp_1")); ACE_OS::strcat (temp_file2, ACE_TEXT ("ace_mem_map_temp_2")); // First create a test file to work on if (create_test_file (test_file, LINE_LENGTH, NUM_LINES) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Create test file failed\n")), -1); ACE_Mem_Map mmap; // First memory map the test file if (mmap.map (test_file) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%n: %p %s\n%a"), ACE_TEXT ("mmap"), test_file), -1); // Now create a temporary file for intermediate processing #if defined (__QNXNTO__) || (defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x670)) ACE_Mem_Map mmap_4_open; mmap_4_open.open(temp_file1, O_RDWR | O_TRUNC | O_CREAT, ACE_DEFAULT_FILE_PERMS); ACE_HANDLE temp_file_handle = mmap_4_open.handle(); #else ACE_HANDLE temp_file_handle = ACE_OS::open (temp_file1, O_RDWR | O_TRUNC | O_CREAT, ACE_DEFAULT_FILE_PERMS); #endif if (temp_file_handle == ACE_INVALID_HANDLE) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Open failed\n")), -1); // Reverse the original file and write the output to the temporary // file. reverse_file (temp_file_handle, (char *) mmap.addr (), mmap.size ()); #if defined (__QNXNTO__) || (defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x670)) mmap_4_open.close(); #else ACE_OS::close (temp_file_handle); #endif ACE_Mem_Map temp_mmap; // Now memory map the temporary file if (temp_mmap.map (temp_file1) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%n: %p %s\n%a"), ACE_TEXT ("mmap"), temp_file1), -1); #if defined (__QNXNTO__) || (defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x670)) mmap_4_open.open(temp_file2, O_RDWR | O_TRUNC | O_CREAT, ACE_DEFAULT_FILE_PERMS); temp_file_handle = mmap_4_open.handle(); #else temp_file_handle = ACE_OS::open (temp_file2, O_RDWR | O_TRUNC | O_CREAT, ACE_DEFAULT_FILE_PERMS); #endif if ( temp_file_handle == ACE_INVALID_HANDLE) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Open failed\n")), -1); // Now reverse the temporary file and write everything to the second // temporary file. reverse_file (temp_file_handle, (char *) temp_mmap.addr (), temp_mmap.size ()); #if defined (__QNXNTO__) || (defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x670)) mmap_4_open.close(); #else ACE_OS::close (temp_file_handle); #endif // Memory map the second temporary file ACE_Mem_Map temp_mmap2; if (temp_mmap2.map (temp_file2) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%n: %p %s\n%a"), ACE_TEXT ("mmap"), temp_file2), -1); // Now do a memcmp -- the orig file and the second temporary file // should be identical. ACE_TEST_ASSERT (ACE_OS::memcmp (temp_mmap2.addr (), mmap.addr (), mmap.size ()) == 0); // Delete the test file mmap.remove (); // Delete ACE_TEMP_TEST_FILE temp_mmap.remove (); // Delete ACE_TEMP_TEST_FILE_2 temp_mmap2.remove (); #else /* !ACE_LACKS_MMAP */ ACE_ERROR ((LM_INFO, ACE_TEXT ("mmap is not supported on this platform\n"))); #endif /* !ACE_LACKS_MMAP */ ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/OS_Test.cpp0000644000175000017500000017736515027201773016400 0ustar sudipsudip// ============================================================================ // // = LIBRARY // tests // // = DESCRIPTION // This simple test exercises and illustrates use of OS wrapper functions. // // = AUTHOR // Steve Huston // // ============================================================================ #include "test_config.h" #include "ace/ACE.h" //FUZZ: disable check_for_include_OS_h #include "ace/OS.h" //FUZZ: enable check_for_include_OS_h #include "ace/OS_NS_math.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_strings.h" #include "ace/OS_NS_stdlib.h" #include "ace/OS_NS_sys_time.h" #include "ace/OS_NS_time.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_sys_stat.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_errno.h" #include "ace/OS_NS_ctype.h" #include "ace/OS_NS_netdb.h" #include #include #include #undef THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL #define THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL(X) \ ((X) \ ? static_cast(0) \ : ACE_VERSIONED_NAMESPACE_NAME::__ace_assert(__FILE__, __LINE__, ACE_TEXT_CHAR_TO_TCHAR (#X))) // Test ACE_OS::access() to be sure a file's existence is correctly noted. int access_test () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing access method\n"))); int test_status = 0; int status = ACE_OS::access (ACE_TEXT ("missing_file.txt"), F_OK); if (status == -1) { if (errno == ENOTSUP) ACE_ERROR_RETURN ((LM_INFO, ACE_TEXT ("ACE_OS::access() not supported\n")), 0); } else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Missing file noted as present.\n"))); test_status = -1; } return test_status; } // Test ACE_OS::rename to be sure the files come and go as expected. int rename_test () { #if defined (ACE_LACKS_RENAME) || defined (ACE_VXWORKS) // On VxWorks only some filesystem drivers support rename // and as we do not know which is used, skip the test here ACE_ERROR_RETURN ((LM_INFO, ACE_TEXT ("rename not supported on this platform\n")), 0); #else ACE_TCHAR old_file[MAXPATHLEN]; ACE_TCHAR new_file[MAXPATHLEN]; ACE_OS::strcpy (old_file, ACE_TEXT ("rename_test_old")); ACE_OS::strcpy (new_file, ACE_TEXT ("rename_test_new")); // Test 1. Rename old to new when new already exists. // To set up, create two files, old and new. Both get opened and truncated // in case they're left over from a previous run. The first one (old) gets // something written in it so it's non-zero length - this is how the rename // is verified. FILE *f = ACE_OS::fopen (old_file, ACE_TEXT ("w+")); if (f == 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%s: %p\n"), old_file, ACE_TEXT ("fopen")), -1); // Write something in the old_file so it has non-zero length ACE_OS::fwrite (ACE_TEXT ("this is a test\n"), sizeof (ACE_TCHAR), 15, f); ACE_OS::fclose (f); f = ACE_OS::fopen (new_file, ACE_TEXT ("w+")); if (f == 0) { ACE_OS::unlink (old_file); ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%s: %p\n"), new_file, ACE_TEXT ("fopen")), -1); } ACE_OS::fclose (f); #if defined (ACE_WIN32) && defined (ACE_LACKS_WIN32_MOVEFILEEX) // Can't rename if new_file exists already. ACE_OS::unlink (new_file); #endif if (ACE_OS::rename (old_file, new_file) != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("rename test 1"))); ACE_OS::unlink (old_file); ACE_OS::unlink (new_file); return -1; } // Verify that the old file was really renamed. ACE_stat checking; int result = 0; if (ACE_OS::stat (new_file, &checking) == -1 || checking.st_size == 0) { result = -1; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Rename test 1: new_file not correct\n"))); } if (ACE_OS::stat (old_file, &checking) == 0) { result = -1; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Rename test 1: old_file still there\n"))); } if (result == 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Rename when dest. exists: success\n"))); // Now test 2 - rename when the new file does not exist. If test 1 worked, // the old_file is now new_file and there is no old_file. if (ACE_OS::rename (new_file, old_file) != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("rename test 2"))); ACE_OS::unlink (old_file); ACE_OS::unlink (new_file); return -1; } if (ACE_OS::stat (old_file, &checking) == -1 || checking.st_size == 0) { result = -1; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Rename test 2: new_file not correct\n"))); } else if (ACE_OS::stat (new_file, &checking) == 0) { result = -1; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Rename test 2: old_file still there\n"))); } else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Rename when dest. gone: success\n"))); ACE_OS::unlink (new_file); ACE_OS::unlink (old_file); // Test 3: It should fail... there are no files. if (ACE_OS::rename (old_file, new_file) == -1) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Rename test 3 should bomb, and did.\n"))); else { result = -1; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Rename expected fail, but succeeded\n"))); } return result; #endif /* ACE_VXWORKS */ } // int string_emulation_test () { { // ======================================================================== // Test memchr ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing memchr\n"))); const char *memchr1 = "abcdefghijklmnopqrstuvwxyz"; THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::memchr (static_cast (0), 'a', 0) == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::memchr (memchr1, 'a', sizeof (memchr1)) != 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::memchr (memchr1, '1', sizeof (memchr1)) == 0); // ======================================================================== // Test strchr ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strchr\n"))); const char *strchr1 = "abcdefghijkabcdefghijk"; THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (*ACE_OS::strchr (strchr1, 'h') == 'h'); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strchr (strchr1, 'h') == strchr1 + 7); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strchr (strchr1, '1') == 0); // ======================================================================== // Test strrchr ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strrchr\n"))); const char *strrchr1 = "abcdefghijkabcdefghijk"; THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (*ACE_OS::strrchr (strrchr1, 'h') == 'h'); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strrchr (strrchr1, 'h') == strrchr1 + 18); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strrchr (strrchr1, '1') == 0); // ======================================================================== // Test strcspn ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strcspn\n"))); const char *strcspn1 = "abcdefghijkabcdefghijk"; THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcspn (strcspn1, "d") == 3); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcspn (strcspn1, "abcdefghijk") == 0); // ======================================================================== // Test strcasecmp ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strcasecmp\n"))); const char *strcasecmp1 = "stringf"; const char *strcasecmp2 = "stringfe"; // An extra character const char *strcasecmp3 = "stringg"; // The last letter is higher const char *strcasecmp4 = "STRINGF"; // Different case const char *strcasecmp5 = "stringe"; // The last letter is lower THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcasecmp (strcasecmp1, strcasecmp1) == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcasecmp (strcasecmp1, strcasecmp2) < 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcasecmp (strcasecmp1, strcasecmp3) < 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcasecmp (strcasecmp1, strcasecmp4) == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcasecmp (strcasecmp1, strcasecmp5) > 0); // ======================================================================== // Test strtok_r ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strtok_r\n"))); char strtok_r1[] = "A string of tokens"; char *strtok_r2; THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::strtok_r (strtok_r1, " ", &strtok_r2), "A") == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::strtok_r (0, " ", &strtok_r2), "string") == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::strtok_r (0, " ", &strtok_r2), "of") == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::strtok_r (0, " ", &strtok_r2), "tokens") == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strtok_r (0, " ", &strtok_r2) == 0); // ======================================================================== // Test itoa ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing itoa\n"))); char itoa1[33]; THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::itoa (42, itoa1, 2), "101010") == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::itoa (42, itoa1, 3), "1120") == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::itoa (42, itoa1, 16), "2a") == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::itoa (8, itoa1, 10), "8") == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::itoa (-8, itoa1, 10), "-8") == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::itoa (20345, itoa1, 10), "20345") == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::itoa (-20345, itoa1, 10), "-20345") == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::itoa (4566733, itoa1, 10), "4566733") == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::itoa (-4566733, itoa1, 10), "-4566733") == 0); } #if defined (ACE_HAS_WCHAR) { //FUZZ: disable check_for_lack_ACE_OS // ======================================================================== // Test itoa (wchar_t version) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing itoa (wchar_t version)\n"))); //FUZZ: enable check_for_lack_ACE_OS wchar_t itow1[33]; THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::itoa (42, itow1, 2), ACE_TEXT_WIDE ("101010")) == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::itoa (42, itow1, 3), ACE_TEXT_WIDE ("1120")) == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::itoa (42, itow1, 16), ACE_TEXT_WIDE ("2a")) == 0); //FUZZ: disable check_for_lack_ACE_OS // ======================================================================== // Test strcmp (wchar_t version) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strcmp (wchar_t version)\n"))); //FUZZ: enable check_for_lack_ACE_OS const wchar_t *strcmp1 = ACE_TEXT_WIDE ("stringf"); const wchar_t *strcmp2 = ACE_TEXT_WIDE ("stringfe"); const wchar_t *strcmp3 = ACE_TEXT_WIDE ("stringg"); const wchar_t *strcmp4 = ACE_TEXT_WIDE ("STRINGF"); const wchar_t *strcmp5 = ACE_TEXT_WIDE ("stringe"); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (strcmp1, strcmp1) == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (strcmp1, strcmp2) < 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (strcmp1, strcmp3) < 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (strcmp1, strcmp4) != 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (strcmp1, strcmp5) > 0); //FUZZ: disable check_for_lack_ACE_OS // ======================================================================== // Test strcpy (wchar_t version) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strcpy (wchar_t version)\n"))); //FUZZ: enable check_for_lack_ACE_OS const wchar_t *strcpy1 = ACE_TEXT_WIDE ("abcdefghijklmnopqrstuvwxyz"); wchar_t strcpy2[27]; THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::strcpy (strcpy2, strcpy1), strcpy1) == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (strcpy2, strcpy1) == 0); //FUZZ: disable check_for_lack_ACE_OS // ======================================================================== // Test strcat (wchar_t version) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strcat (wchar_t version)\n"))); //FUZZ: enable check_for_lack_ACE_OS const wchar_t *strcat1 = ACE_TEXT_WIDE ("abcdefghijklmnopqrstuvwxyz"); wchar_t strcat2[27] = ACE_TEXT_WIDE ("abcdefghijkl"); const wchar_t *strcat3 = ACE_TEXT_WIDE ("mnopqrstuvwxyz"); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::strcat (strcat2, strcat3), strcat1) == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (strcat2, strcat1) == 0); //FUZZ: disable check_for_lack_ACE_OS // ======================================================================== // Test strncat (wchar_t version) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strncat (wchar_t version)\n"))); //FUZZ: enable check_for_lack_ACE_OS const wchar_t *strncat1 = ACE_TEXT_WIDE ("abcdefghijklmnopqrstuvwxyz"); wchar_t strncat2[27] = ACE_TEXT_WIDE ("abcdefghijkl"); const wchar_t *strncat3 = ACE_TEXT_WIDE ("mnopqrstuvwxyzabc"); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::strncat (strncat2, strncat3, 14), strncat1) == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (strncat2, strncat1) == 0); //FUZZ: disable check_for_lack_ACE_OS // ======================================================================== // Test strspn (wchar_t version) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strspn (wchar_t version)\n"))); //FUZZ: enable check_for_lack_ACE_OS const wchar_t *strspn1 = ACE_TEXT_WIDE ("abcdefghijkabcdefghijk"); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strspn (strspn1, ACE_TEXT_WIDE ("abcdf")) == 4); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strspn (strspn1, ACE_TEXT_WIDE ("mno")) == 0); //FUZZ: disable check_for_lack_ACE_OS // ======================================================================== // Test strchr (wchar_t version) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strchr (wchar_t version)\n"))); //FUZZ: enable check_for_lack_ACE_OS const wchar_t *strchr1 = ACE_TEXT_WIDE ("abcdefghijkabcdefghijk"); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (*ACE_OS::strchr (strchr1, ACE_TEXT_WIDE ('h')) == ACE_TEXT_WIDE ('h')); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strchr (strchr1, ACE_TEXT_WIDE ('h')) == strchr1 + 7); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strchr (strchr1, ACE_TEXT_WIDE ('1')) == 0); //FUZZ: disable check_for_lack_ACE_OS // ======================================================================== // Test strstr (wchar_t version) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strstr (wchar_t version)\n"))); //FUZZ: enable check_for_lack_ACE_OS const wchar_t *strstr1 = ACE_TEXT_WIDE ("abcdefghijkabcdefghijk"); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strncmp ( ACE_OS::strstr (strstr1, ACE_TEXT_WIDE ("def")), ACE_TEXT_WIDE ("def"), 3) == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strstr (strstr1, ACE_TEXT_WIDE ("mno")) == 0); //FUZZ: disable check_for_lack_ACE_OS // ======================================================================== // Test strlen (wchar_t version) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strlen (wchar_t version)\n"))); //FUZZ: enable check_for_lack_ACE_OS const wchar_t *strlen1 = ACE_TEXT_WIDE (""); const wchar_t *strlen2 = ACE_TEXT_WIDE ("12345"); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strlen (strlen1) == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strlen (strlen2) == 5); //FUZZ: disable check_for_lack_ACE_OS // ======================================================================== // Test strpbrk (wchar_t version) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strpbrk (wchar_t version)\n"))); //FUZZ: enable check_for_lack_ACE_OS const wchar_t *strpbrk1 = ACE_TEXT_WIDE ("abcdefghijkabcdefghijk"); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strpbrk (strpbrk1, ACE_TEXT_WIDE ("ijkb")) == strpbrk1 + 1); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strpbrk (strpbrk1, ACE_TEXT_WIDE ("mno")) == 0); //FUZZ: disable check_for_lack_ACE_OS // ======================================================================== // Test strrchr (wchar_t version) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strrchr (wchar_t version)\n"))); //FUZZ: enable check_for_lack_ACE_OS const wchar_t *strrchr1 = ACE_TEXT_WIDE ("abcdefghijkabcdefghijk"); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (*ACE_OS::strrchr (strrchr1, ACE_TEXT_WIDE ('h')) == ACE_TEXT_WIDE ('h')); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strrchr (strrchr1, ACE_TEXT_WIDE ('h')) == strrchr1 + 18); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strrchr (strrchr1, ACE_TEXT_WIDE ('1')) == 0); //FUZZ: disable check_for_lack_ACE_OS // ======================================================================== // Test strcasecmp (wchar_t version) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strcasecmp (wchar_t version)\n"))); //FUZZ: enable check_for_lack_ACE_OS const wchar_t *strcasecmp1 = ACE_TEXT_WIDE ("stringf"); const wchar_t *strcasecmp2 = ACE_TEXT_WIDE ("stringfe"); const wchar_t *strcasecmp3 = ACE_TEXT_WIDE ("stringg"); const wchar_t *strcasecmp4 = ACE_TEXT_WIDE ("STRINGF"); const wchar_t *strcasecmp5 = ACE_TEXT_WIDE ("stringe"); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcasecmp (strcasecmp1, strcasecmp1) == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcasecmp (strcasecmp1, strcasecmp2) < 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcasecmp (strcasecmp1, strcasecmp3) < 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcasecmp (strcasecmp1, strcasecmp4) == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcasecmp (strcasecmp1, strcasecmp5) > 0); //FUZZ: disable check_for_lack_ACE_OS // ======================================================================== // Test strncasecmp (wchar_t version) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strncasecmp (wchar_t version)\n"))); //FUZZ: enable check_for_lack_ACE_OS const wchar_t *strncasecmp1 = ACE_TEXT_WIDE ("stringf"); const wchar_t *strncasecmp2 = ACE_TEXT_WIDE ("stringfe"); const wchar_t *strncasecmp3 = ACE_TEXT_WIDE ("stringg"); const wchar_t *strncasecmp4 = ACE_TEXT_WIDE ("STRINGF"); const wchar_t *strncasecmp5 = ACE_TEXT_WIDE ("stringe"); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strncasecmp (strncasecmp1, strncasecmp2, 7) == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strncasecmp (strncasecmp1, strncasecmp2, 8) < 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strncasecmp (strncasecmp1, strncasecmp3, 7) < 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strncasecmp (strncasecmp1, strncasecmp4, 7) == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strncasecmp (strncasecmp1, strncasecmp5, 7) > 0); //FUZZ: disable check_for_lack_ACE_OS // ======================================================================== // Test strncmp (wchar_t version) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strncmp (wchar_t version)\n"))); //FUZZ: enable check_for_lack_ACE_OS const wchar_t *strncmp1 = ACE_TEXT_WIDE ("stringf"); const wchar_t *strncmp2 = ACE_TEXT_WIDE ("stringfe"); const wchar_t *strncmp3 = ACE_TEXT_WIDE ("stringg"); const wchar_t *strncmp4 = ACE_TEXT_WIDE ("STRINGF"); const wchar_t *strncmp5 = ACE_TEXT_WIDE ("stringe"); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strncmp (strncmp1, strncmp2, 7) == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strncmp (strncmp1, strncmp2, 8) < 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strncmp (strncmp1, strncmp3, 7) < 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strncmp (strncmp1, strncmp4, 7) != 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strncmp (strncmp1, strncmp5, 7) > 0); //FUZZ: disable check_for_lack_ACE_OS // ======================================================================== // Test strncpy (wchar_t version) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strncpy (wchar_t version)\n"))); //FUZZ: enable check_for_lack_ACE_OS wchar_t strncpy1[] = ACE_TEXT_WIDE ("abcdefghijklmnopqrstuvwxyzabc"); wchar_t strncpy2[27]; THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strncmp (ACE_OS::strncpy (strncpy2, strncpy1, 26), strncpy1, 26) == 0); strncpy1[26] = 0; strncpy2[26] = 0; THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (strncpy2, strncpy1) == 0); //FUZZ: disable check_for_lack_ACE_OS // ======================================================================== // Test strtok (wchar_t version) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strtok (wchar_t version)\n"))); # ifdef ACE_LACKS_WCSTOK ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Skipped because platform lacks wcstok\n"))); # else //FUZZ: enable check_for_lack_ACE_OS wchar_t strtok_r1[] = ACE_TEXT_WIDE ("A string of tokens"); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::strtok (strtok_r1, ACE_TEXT_WIDE (" ")), ACE_TEXT_WIDE ("A")) == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::strtok (0, ACE_TEXT_WIDE (" ")), ACE_TEXT_WIDE ("string") ) == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::strtok (0, ACE_TEXT_WIDE (" ")), ACE_TEXT_WIDE ("of") ) == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::strtok (0, ACE_TEXT_WIDE (" ")), ACE_TEXT_WIDE ("tokens") ) == 0); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strtok (0, ACE_TEXT_WIDE (" ")) == 0); # endif /* ACE_LACKS_WCSTOK */ } #endif /* ACE_HAS_WCHAR */ return 0; } // Test ACE_OS::snprintf using SNPrintF_t = int (*)(char *, size_t, const char *, ...); int snprintf_test (SNPrintF_t fn) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing snprintf\n"))); int error_count = 0; const int BUFFER_SIZE = 4; char buf[2*BUFFER_SIZE]; int retval; ACE_OS::memset(buf, 0xab, 2*BUFFER_SIZE); retval = fn (buf, BUFFER_SIZE, "%d", 123); if (retval != 3) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("[1] ACE_OS::snprintf() returns %d, should be 3\n"), retval)); ++error_count; } ACE_OS::memset(buf, 0xab, 2*BUFFER_SIZE); retval = fn (buf, BUFFER_SIZE, "%d", 1234); if (retval != 4) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("[2] ACE_OS::snprintf() returns %d, should be 4\n"), retval)); ++error_count; } if (buf[3] != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("[3] ACE_OS::snprintf() doesn't terminate string correctly\n"))); ++error_count; } else if (ACE_OS::strcmp(buf, "123") != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("[4] ACE_OS::snprintf() incorrect output\n"))); ++error_count; } ACE_OS::memset(buf, 0xab, 2*BUFFER_SIZE); retval = fn (buf, BUFFER_SIZE, "%d", 12345); if (retval != 5) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("[5] ACE_OS::snprintf() returns %d, should be 5\n"), retval)); ++error_count; } else if (buf[3] != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("[6] ACE_OS::snprintf() doesn't terminate string correctly\n"))); ++error_count; } else if (ACE_OS::strcmp(buf, "123") != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("[6] ACE_OS::snprintf() incorrect output\n"))); ++error_count; } return error_count; } static int getpwnam_r_test () { int result = 0; #if !defined (ACE_LACKS_PWD_FUNCTIONS) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing getpwnam_r\n"))); struct passwd pwd; struct passwd *pwd_ptr; char buf[1024]; const char* login = getlogin (); if (login == 0) login = "root"; if (ACE_OS::getpwnam_r (login, &pwd, buf, sizeof (buf), &pwd_ptr) != 0) { result = 1; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("getpwnam_r() failed\n"))); } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" User '%s' has uid=%d and gid=%d\n"), pwd_ptr->pw_name, pwd_ptr->pw_uid, pwd_ptr->pw_gid)); } #endif return result; } static int compiler_test () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing compiler methods\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Using compiler %s with major version %d minor version %d beta version %d\n"), ACE::compiler_name(), ACE::compiler_major_version(), ACE::compiler_minor_version (), ACE::compiler_beta_version ())); return 0; } static int version_test () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing version macros\n"))); int const code = ACE_MAKE_VERSION_CODE(ACE_MAJOR_VERSION, ACE_MINOR_VERSION, ACE_MICRO_VERSION); bool const run_time_check = code == ACE_VERSION_CODE; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE release time version code: %d, runtime version code: %d, %s\n"), ACE_VERSION_CODE, code, run_time_check ? ACE_TEXT ("OK") : ACE_TEXT ("FAIL"))); // Compile time check. Check we have ACE version 6.x #if ACE_VERSION_CODE > ACE_MAKE_VERSION_CODE(5, 88, 99) bool const compile_time_check = true; #else bool compile_time_check = false; #endif ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Compile time version check, %s\n"), compile_time_check ? ACE_TEXT ("OK") : ACE_TEXT ("FAIL"))); if(run_time_check && compile_time_check) return 0; return 1; } static int ctime_r_test () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing ctime_r\n"))); int result = 0; // test 'normal' buffer ACE_TCHAR buf[27]; buf[26] = 'Z'; ACE_Time_Value cur_time = ACE_OS::gettimeofday (); time_t const secs = cur_time.sec (); if (ACE_OS::ctime_r (&secs, buf, 26) == 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ctime_r with 26 bytes"))); result = -1; } else if (buf[0] == '\0') { result = -1; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Truncated input buffer\n"))); } else if (buf[26] != 'Z') { result = -1; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Wrote past end of input buffer\n"))); } // test small buffer - should not do anything unless 3rd arg is at least 26. if (result == 0) { ACE_TCHAR bufcheck[27]; ACE_OS::strcpy (bufcheck, buf); if (ACE_OS::ctime_r (&secs, buf, 10) != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("ctime_r with short len returned %s\n"), buf)); result = -1; } else if (errno != ERANGE) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ctime_r short; wrong error"))); result = -1; } // Make sure it didn't scribble else if (ACE_OS::strcmp (buf, bufcheck) != 0) { result = -1; ACE_ERROR ((LM_ERROR, ACE_TEXT ("ctime_r short; got %s, expected %s\n"), buf, bufcheck)); } } return result; } int string_strsncpy_test () { { //FUZZ: disable check_for_lack_ACE_OS // Test strsncpy (char version) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strsncpy (char version)\n"))); //FUZZ: enable check_for_lack_ACE_OS char const strsncpy1[] = "abcdefghijklmnopqrstuvwxyzabc"; char strsncpy2[36]; // strsncpy() where the max. length doesn't matter THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::strsncpy (strsncpy2, strsncpy1, 36), strsncpy1) == 0); // strsncpy() where the max length does matter THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strncmp (ACE_OS::strsncpy (strsncpy2, strsncpy1, 26), strsncpy1, 25) == 0); // strsncpy1 and strsncpy2 are different size --> not equal THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (strsncpy2, strsncpy1) != 0); // max. length == 2 --> 1 char available THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strncmp (ACE_OS::strsncpy (strsncpy2, strsncpy1, 2), strsncpy1, 1) == 0); // max length == 1 --> empty string THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strlen (ACE_OS::strsncpy (strsncpy2, strsncpy1, 1)) == 0); // just preparation for the next assert THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::strsncpy (strsncpy2, strsncpy1, 36), strsncpy1) == 0); // A tricky one, if the max. length == 0 --> do nothing // so the strsncpy2 shouldn't change THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::strsncpy (strsncpy2, "test", 0), strsncpy1) == 0); // If src == dst --> truncate dst if needed! THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strncmp (ACE_OS::strsncpy (strsncpy2, strsncpy2, 10), strsncpy1, 9) == 0); // size should be 9 (+ '\0' char) THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL(ACE_OS::strlen(strsncpy2) == 9); } #if defined (ACE_HAS_WCHAR) { //FUZZ: disable check_for_lack_ACE_OS // Test strsncpy (wchar_t version) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strsncpy (wchar_t version)\n"))); //FUZZ: enable check_for_lack_ACE_OS wchar_t const strsncpy1[] = ACE_TEXT_WIDE ("abcdefghijklmnopqrstuvwxyzabc"); wchar_t strsncpy2[36]; // strsncpy() where the max. length doesn't matter THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::strsncpy (strsncpy2, strsncpy1, 36), strsncpy1) == 0); // strsncpy() where the max length does matter THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strncmp (ACE_OS::strsncpy (strsncpy2, strsncpy1, 26), strsncpy1, 25) == 0); // strsncpy1 and strsncpy2 are different size --> not equal THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (strsncpy2, strsncpy1) != 0); // max. length == 2 --> 1 char available THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strncmp (ACE_OS::strsncpy (strsncpy2, strsncpy1, 2), strsncpy1, 1) == 0); // max length == 1 --> empty string THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strlen (ACE_OS::strsncpy (strsncpy2, strsncpy1, 1)) == 0); // just preparation for the next assert THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::strsncpy (strsncpy2, strsncpy1, 36), strsncpy1) == 0); // A tricky one, if the max. length == 0 --> do nothing // so the strsncpy2 shouldn't change THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strcmp (ACE_OS::strsncpy (strsncpy2, ACE_TEXT_WIDE ("test"), 0), strsncpy1) == 0); // If src == dst --> truncate dst if needed! THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (ACE_OS::strncmp (ACE_OS::strsncpy (strsncpy2, strsncpy2, 10), strsncpy1, 9) == 0); // size should be 9 (+ '\0' char) THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL(ACE_OS::strlen(strsncpy2) == 9); } #endif /* ACE_HAS_WCHAR */ return 0; } // Test conversion between narrow and wide chars. int string_convert_test () { #if defined (ACE_HAS_WCHAR) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing narrow/wide string conversion\n"))); int result = 0; const char *test1_n = "abcdefg"; const wchar_t *test1_w = ACE_TEXT_WIDE ("abcdefg"); const char *test2_n = "\xe9\xe8\xe0\xf9\xea"; const wchar_t *test2_w = ACE_TEXT_WIDE ("\xe9\xe8\xe0\xf9\xea"); wchar_t str_w[10]; char str_n[10]; ACE_OS::strcpy (str_w, ACE_Ascii_To_Wide (test1_n).wchar_rep ()); if (0 != ACE_OS::strcmp (test1_w, str_w)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Simple narrow->wide failed: ") ACE_TEXT ("Expected \"%W\"; Got \"%W\"\n"), test1_w, str_w)); result = 1; } ACE_OS::strcpy (str_n, ACE_Wide_To_Ascii (test1_w).char_rep ()); if (0 != ACE_OS::strcmp (test1_n, str_n)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Simple wide->narrow failed: ") ACE_TEXT ("Expected \"%C\"; Got \"%C\"\n"), test1_n, str_n)); result = 1; } ACE_OS::strcpy (str_w, ACE_Ascii_To_Wide (test2_n).wchar_rep ()); if (0 != ACE_OS::strcmp (test2_w, str_w)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Complex narrow->wide failed: ") ACE_TEXT ("Expected \"%W\"; Got \"%W\"\n"), test2_w, str_w)); result = 1; } ACE_OS::strcpy (str_n, ACE_Wide_To_Ascii (test2_w).char_rep ()); if (0 != ACE_OS::strcmp (test2_n, str_n)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Complex wide->narrow failed: ") ACE_TEXT ("Expected \"%C\"; Got \"%C\"\n"), test2_n, str_n)); result = 1; } return result; #else return 0; #endif /* ACE_HAS_WCHAR */ } // Test ACE_OS::strsignal() int strsignal_test () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing strsignal method\n"))); int test_status = 0; const char* result = 0; for (int i=-1; i < (ACE_NSIG + 1); ++i) { result = ACE_OS::strsignal (i); if (result == 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("strsignal returned null\n"))); test_status = 1; } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Sig #%d: %C\n"), i, result)); } } return test_status; } // Test the methods for getting cpu info int cpu_info_test () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing cpu info methods\n"))); long const number_processors = ACE_OS::num_processors(); long const number_processors_online = ACE_OS::num_processors_online(); if (number_processors == -1) { ACE_ERROR ((LM_INFO, ACE_TEXT ("number of processors not supported on ") ACE_TEXT ("this platform\n"))); } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("This system has %d processors\n"), number_processors)); } if (number_processors_online == -1) { ACE_ERROR ((LM_INFO, ACE_TEXT ("number of processors online not supported on ") ACE_TEXT ("this platform\n"))); } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("This system has %d processors online\n"), number_processors_online)); } if ((number_processors_online != -1 && number_processors != -1) && number_processors_online > number_processors) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%d online processors; should be <= %d\n"), number_processors_online, number_processors), -1); return 0; } int last_error_test () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing last_error method\n"))); ACE_OS::last_error (ETIME); int const l_error = ACE_OS::last_error (); if (l_error != ETIME) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Last error returned %d instead of ETIME"), l_error)); return 1; } ACE_OS::last_error (0); return 0; } int pagesize_test () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing getpagesize method\n"))); long const pagesize = ACE_OS::getpagesize (); if (pagesize <= 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error, pagesize should return a value bigger ") ACE_TEXT ("then zero, it returned %d\n"), pagesize)); return 1; } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Pagesize returned %d\n"), pagesize)); } return 0; } int ace_ctype_test () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing ace ctype methods\n"))); int retval = 0; int result = ACE_OS::ace_isprint (ACE_TEXT('\t')); if (result != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error, ace_isprint should return 0 for tab ") ACE_TEXT ("but it returned %d\n"), result)); ++retval; } result = ACE_OS::ace_isblank (ACE_TEXT('\t')); if (result == 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error, ace_isblank should return != 0 for tab ") ACE_TEXT ("but it returned %d\n"), result)); ++retval; } result = ACE_OS::ace_isblank (ACE_TEXT(' ')); if (result == 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error, ace_isblank should return != 0 for space ") ACE_TEXT ("but it returned %d\n"), result)); ++retval; } result = ACE_OS::ace_isalpha (ACE_TEXT('\t')); if (result != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error, ace_isalpha should return 0 for tab ") ACE_TEXT ("but it returned %d\n"), result)); ++retval; } result = ACE_OS::ace_isupper (ACE_TEXT('\t')); if (result != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error, ace_isupper should return 0 for tab ") ACE_TEXT ("but it returned %d\n"), result)); ++retval; } result = ACE_OS::ace_islower (ACE_TEXT('\t')); if (result != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error, ace_islower should return 0 for tab ") ACE_TEXT ("but it returned %d\n"), result)); ++retval; } result = ACE_OS::ace_isdigit (ACE_TEXT('\t')); if (result != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error, ace_isdigit should return 0 for tab ") ACE_TEXT ("but it returned %d\n"), result)); ++retval; } result = ACE_OS::ace_isxdigit (ACE_TEXT('\t')); if (result != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error, ace_isxdigit should return 0 for tab ") ACE_TEXT ("but it returned %d\n"), result)); ++retval; } result = ACE_OS::ace_isspace (ACE_TEXT('\t')); if (result == 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error, ace_isspace should return != 0 for tab ") ACE_TEXT ("but it returned %d\n"), result)); ++retval; } result = ACE_OS::ace_ispunct (ACE_TEXT('\t')); if (result != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error, ace_ispunct should return 0 for tab ") ACE_TEXT ("but it returned %d\n"), result)); ++retval; } result = ACE_OS::ace_isalnum (ACE_TEXT('\t')); if (result != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error, ace_isalnum should return 0 for tab ") ACE_TEXT ("but it returned %d\n"), result)); ++retval; } result = ACE_OS::ace_isgraph (ACE_TEXT('\t')); if (result != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error, ace_isgraph should return 0 for tab ") ACE_TEXT ("but it returned %d\n"), result)); ++retval; } result = ACE_OS::ace_iscntrl (ACE_TEXT('\t')); if (result == 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error, ace_iscntrl should return != 0 for tab ") ACE_TEXT ("but it returned %d\n"), result)); ++retval; } result = ACE_OS::ace_isascii (ACE_TEXT('\t')); if (result == 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error, ace_isascii should return != 0 for tab ") ACE_TEXT ("but it returned %d\n"), result)); ++retval; } return 0; } int ceilf_test () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing ceilf method\n"))); float const values[] = {-2.5, -1.5, 1.5, 2.5}; float const results[] = {-2.0, -1.0, 2.0, 3.0}; float result = 0.0; int error_count = 0; for (size_t i = 0 ; i < sizeof (values) / sizeof (float) ; i++) { result = ACE_OS::ceil (values [i]); if (ACE::is_inequal(result, results[i])) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("ceilf error: input %.1F, output %1F, expected %1F\n"), values [i], result, results [i])); ++error_count; } } return error_count; } int floorf_test () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing floorf method\n"))); float const values[] = {-2.5, -1.5, 1.5, 2.5}; float const results[] = {-3.0, -2.0, 1.0, 2.0}; float result = 0.0; int error_count = 0; for (size_t i = 0 ; i < sizeof (values) / sizeof (float) ; i++) { result = ACE_OS::floor (values [i]); if (ACE::is_inequal(result, results[i])) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("floorf error: input %.1F, output %1F, expected %1F\n"), values [i], result, results [i])); ++error_count; } } return error_count; } int ceil_test () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing ceil method\n"))); double const values[] = {-2.5, -1.5, 1.5, 2.5}; double const results[] = {-2.0, -1.0, 2.0, 3.0}; double result = 0.0; int error_count = 0; for (size_t i = 0 ; i < sizeof (values) / sizeof (double) ; i++) { result = ACE_OS::ceil (values [i]); if (ACE::is_inequal(result, results[i])) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("ceil error: input %.1F, output %1F, expected %1F\n"), values [i], result, results [i])); ++error_count; } } return error_count; } int floor_test () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing floor method\n"))); double const values[] = {-2.5, -1.5, 1.5, 2.5}; double const results[] = {-3.0, -2.0, 1.0, 2.0}; double result = 0.0; int error_count = 0; for (size_t i = 0 ; i < sizeof (values) / sizeof (double) ; i++) { result = ACE_OS::floor (values [i]); if (ACE::is_inequal(result, results[i])) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("floor error: input %.1F, output %1F, expected %1F\n"), values [i], result, results [i])); ++error_count; } } return error_count; } int ceill_test () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing ceill method\n"))); long double const values[] = {-2.5, -1.5, 1.5, 2.5}; long double const results[] = {-2.0, -1.0, 2.0, 3.0}; long double result = 0.0; int error_count = 0; for (size_t i = 0 ; i < sizeof (values) / sizeof (long double) ; i++) { result = ACE_OS::ceil (values [i]); if (ACE::is_inequal(result, results[i])) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("ceil error: input %.1F, output %1F, expected %1F\n"), values [i], result, results [i])); ++error_count; } } return error_count; } int floorl_test () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing floorl method\n"))); long double const values[] = {-2.5, -1.5, 1.5, 2.5}; long double const results[] = {-3.0, -2.0, 1.0, 2.0}; long double result = 0.0; int error_count = 0; for (size_t i = 0 ; i < sizeof (values) / sizeof (long double) ; i++) { result = ACE_OS::floor (values [i]); if (ACE::is_inequal(result, results[i])) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("floor error: input %.1F, output %1F, expected %1F\n"), values [i], result, results [i])); ++error_count; } } return error_count; } int log2_test () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing log2 method\n"))); double const values[] = {1.0, 2.0, 4.0, 8.0, 1048576.0}; int const results[] = {0, 1, 2, 3, 20}; int result = 0; int error_count = 0; for (size_t i = 0 ; i < sizeof (values) / sizeof (double) ; i++) { result = static_cast (ACE_OS::log2 (values [i]) + 0.5); if (result != results [i]) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Log2 error: input %.1F, output %d, expected %d\n"), values [i], result, results [i])); ++error_count; } } return error_count; } #if defined (ACE_HAS_VSNPRINTF_EMULATION) int snprintf_emulation (char *buf, size_t maxlen, const char *format, ...) { va_list ap; va_start (ap, format); const int ret = ACE_OS::vsnprintf_emulation (buf, maxlen, format, ap); va_end (ap); return ret; } #define TEST_STR_EQUAL(LHS, RHS) \ if (ACE_OS::strcmp ((LHS), (RHS))) { \ failed = true; \ ACE_ERROR ((LM_ERROR, "Test assertion FAILED {%C} != {%C} at line %l\n", \ (LHS), (RHS))); \ } #define TEST_INT_EQUAL(LHS, RHS) \ if (!((LHS) == (RHS))) { \ failed = true; \ ACE_ERROR ((LM_ERROR, "Test assertion FAILED %d != %d at line %l\n", \ (LHS), (RHS))); \ } #define EXPECTED_RESULT(STR) \ TEST_INT_EQUAL (ACE_OS::strlen (STR), size_t (ret)) \ TEST_STR_EQUAL (STR, buf) #define EXPECTED_RESULTS(STR_A, STR_B) \ if (ACE_OS::strcmp ((STR_A), (buf)) && ACE_OS::strcmp ((STR_B), (buf))) { \ failed = true; \ ACE_ERROR ((LM_ERROR, "Test assertion FAILED {%C} != {%C} and " \ "{%C} != {%C} at line %l\n", \ (STR_A), (buf), (STR_B), (buf))); \ } #define EXPECTED_RESULT_LEN(STR, LEN) \ TEST_INT_EQUAL (LEN, ret) \ TEST_STR_EQUAL (STR, buf) #define LOG_RESULT(STR) \ ACE_DEBUG ((LM_DEBUG, "Locale-dependent snprintf could be {%C}, was {%C}" \ " at line %l\n", (STR), buf)); int snprintf_emulation_test () { bool failed = false; char buf[BUFSIZ]; int ret = snprintf_emulation (buf, sizeof buf, "[%d]", 314); EXPECTED_RESULT ("[314]"); ret = snprintf_emulation (buf, sizeof buf, "[%i] %% [%u]", -314, 314); EXPECTED_RESULT ("[-314] % [314]"); ret = snprintf_emulation (buf, sizeof buf, "%5d", 414); EXPECTED_RESULT (" 414"); ret = snprintf_emulation (buf, sizeof buf, "%05d", 414); EXPECTED_RESULT ("00414"); ret = snprintf_emulation (buf, sizeof buf, "%*d", 5, 414); EXPECTED_RESULT (" 414"); ret = snprintf_emulation (buf, sizeof buf, "%-*d", 5, 414); EXPECTED_RESULT ("414 "); ret = snprintf_emulation (buf, sizeof buf, "%5i", -414); EXPECTED_RESULT (" -414"); ret = snprintf_emulation (buf, sizeof buf, "%05i", -414); EXPECTED_RESULT ("-0414"); ret = snprintf_emulation (buf, sizeof buf, "%2d", -414); EXPECTED_RESULT ("-414"); ret = snprintf_emulation (buf, sizeof buf, "%.4d", -414); EXPECTED_RESULT ("-0414"); ret = snprintf_emulation (buf, sizeof buf, "%6.4d", -314); EXPECTED_RESULT (" -0314"); ret = snprintf_emulation (buf, sizeof buf, "%.4i", 314); EXPECTED_RESULT ("0314"); ret = snprintf_emulation (buf, sizeof buf, "%6.4u", 414); EXPECTED_RESULT (" 0414"); ret = snprintf_emulation (buf, sizeof buf, "%.d", 0); EXPECTED_RESULT (""); ret = snprintf_emulation (buf, sizeof buf, "% .0d", 0); EXPECTED_RESULT (" "); ret = snprintf_emulation (buf, sizeof buf, "%d", 0); EXPECTED_RESULT ("0"); ret = snprintf_emulation (buf, sizeof buf, "%+d", 0); EXPECTED_RESULT ("+0"); ret = snprintf_emulation (buf, sizeof buf, "% d", 0); EXPECTED_RESULT (" 0"); ret = snprintf_emulation (buf, sizeof buf, "%04o", 0755); EXPECTED_RESULT ("0755"); ret = snprintf_emulation (buf, sizeof buf, "%#o", 0644); EXPECTED_RESULT ("0644"); ret = snprintf_emulation (buf, sizeof buf, "%#.o", 0); EXPECTED_RESULT ("0"); ret = snprintf_emulation (buf, sizeof buf, "%#.5o", 0644); EXPECTED_RESULT ("00644"); ret = snprintf_emulation (buf, sizeof buf, "%x", 0x987abc); EXPECTED_RESULT ("987abc"); ret = snprintf_emulation (buf, sizeof buf, "%X", 0x987abc); EXPECTED_RESULT ("987ABC"); ret = snprintf_emulation (buf, sizeof buf, "%02x", 0); EXPECTED_RESULT ("00"); ret = snprintf_emulation (buf, sizeof buf, "%-#10x", 0x987abc); EXPECTED_RESULT ("0x987abc "); ret = snprintf_emulation (buf, sizeof buf, "%#10X", 0x987abc); EXPECTED_RESULT (" 0X987ABC"); ret = snprintf_emulation (buf, sizeof buf, "%#X", 0); EXPECTED_RESULT ("0"); ret = snprintf_emulation (buf, sizeof buf, "%#.X", 0); EXPECTED_RESULT (""); ret = snprintf_emulation (buf, sizeof buf, "%#05x", 20); EXPECTED_RESULT ("0x014"); ret = snprintf_emulation (buf, sizeof buf, "%#.3X", 20); EXPECTED_RESULT ("0X014"); ret = snprintf_emulation (buf, sizeof buf, "%#6.3X", 20); EXPECTED_RESULT (" 0X014"); ret = snprintf_emulation (buf, sizeof buf, "%#-6.3X", 20); EXPECTED_RESULT ("0X014 "); ret = snprintf_emulation (buf, sizeof buf, "%c", 'a'); EXPECTED_RESULT ("a"); ret = snprintf_emulation (buf, sizeof buf, "%2c", 'b'); EXPECTED_RESULT (" b"); ret = snprintf_emulation (buf, sizeof buf, "%-2c", 'c'); EXPECTED_RESULT ("c "); ret = snprintf_emulation (buf, sizeof buf, "%-2s", "d"); EXPECTED_RESULT ("d "); ret = snprintf_emulation (buf, sizeof buf, "%2s", "e"); EXPECTED_RESULT (" e"); ret = snprintf_emulation (buf, sizeof buf, "%2.1s", "fg"); EXPECTED_RESULT (" f"); ret = snprintf_emulation (buf, sizeof buf, "%-2.1s", "gh"); EXPECTED_RESULT ("g "); ret = snprintf_emulation (buf, sizeof buf, "%.s", "x"); EXPECTED_RESULT (""); ret = snprintf_emulation (buf, sizeof buf, "%-4.9s", "hi"); EXPECTED_RESULT ("hi "); ret = snprintf_emulation (buf, sizeof buf, "%.s", "x"); EXPECTED_RESULT (""); int n; ret = snprintf_emulation (buf, sizeof buf, "%-5.2s%n %s", "jkl", &n, "lmn"); EXPECTED_RESULT ("jk lmn"); ret = snprintf_emulation (buf, sizeof buf, "%0-3.2i", n); EXPECTED_RESULT ("05 "); ret = snprintf_emulation (buf, sizeof buf, "%p", reinterpret_cast (0x1234abc)); EXPECTED_RESULT ("0x1234abc"); ret = snprintf_emulation (buf, sizeof buf, "%12p", reinterpret_cast (0x1234abc)); EXPECTED_RESULT (" 0x1234abc"); ret = snprintf_emulation (buf, sizeof buf, "%-12p", reinterpret_cast (0x1234abc)); EXPECTED_RESULT ("0x1234abc "); ret = snprintf_emulation (buf, sizeof buf, "%hhu", 0x101); EXPECTED_RESULT ("1"); ret = snprintf_emulation (buf, sizeof buf, "%hu", 0x10002); EXPECTED_RESULT ("2"); ret = snprintf_emulation (buf, sizeof buf, "%#lx", 0x87654321ul); EXPECTED_RESULT ("0x87654321"); ret = snprintf_emulation (buf, sizeof buf, "%llu", 612578912487901265ull); EXPECTED_RESULT ("612578912487901265"); ret = snprintf_emulation (buf, sizeof buf, "%-+010.7d", 98765); EXPECTED_RESULT ("+0098765 "); ret = snprintf_emulation (buf, 10, "%-+010.7d", 98765); EXPECTED_RESULT_LEN ("+0098765 ", 10); ret = snprintf_emulation (buf, sizeof buf, "%f", 3.14); EXPECTED_RESULT ("3.140000"); ret = snprintf_emulation (buf, sizeof buf, "%10f", -3.14); EXPECTED_RESULT (" -3.140000"); ret = snprintf_emulation (buf, sizeof buf, "%+-10F", 3.14); EXPECTED_RESULT ("+3.140000 "); ret = snprintf_emulation (buf, sizeof buf, "%010f", -3.14); EXPECTED_RESULT ("-03.140000"); ret = snprintf_emulation (buf, sizeof buf, "% f", 3.14); EXPECTED_RESULT (" 3.140000"); ret = snprintf_emulation (buf, sizeof buf, "% f", HUGE_VAL); EXPECTED_RESULT (" inf"); ret = snprintf_emulation (buf, sizeof buf, "%f", -HUGE_VAL); EXPECTED_RESULT ("-inf"); ret = snprintf_emulation (buf, sizeof buf, "%#F", HUGE_VAL); EXPECTED_RESULT ("INF"); ret = snprintf_emulation (buf, sizeof buf, "%5F", -HUGE_VAL); EXPECTED_RESULT (" -INF"); #ifndef ACE_LYNXOS_MAJOR ret = snprintf_emulation (buf, sizeof buf, "%f", std::numeric_limits::quiet_NaN ()); EXPECTED_RESULTS ("nan", "-nan"); ret = snprintf_emulation (buf, sizeof buf, "%+F", std::numeric_limits::quiet_NaN ()); EXPECTED_RESULTS ("+NAN", "-NAN"); #endif ret = snprintf_emulation (buf, sizeof buf, "%.f", 2.17); EXPECTED_RESULT ("2"); ret = snprintf_emulation (buf, sizeof buf, "%#.f", 2.17); EXPECTED_RESULT ("2."); ret = snprintf_emulation (buf, sizeof buf, "%.1f", 18.); EXPECTED_RESULT ("18.0"); ret = snprintf_emulation (buf, sizeof buf, "%.1f", .9); EXPECTED_RESULT ("0.9"); ret = snprintf_emulation (buf, sizeof buf, "%.2f", .01); EXPECTED_RESULT ("0.01"); ret = snprintf_emulation (buf, sizeof buf, "%.2e", .01); EXPECTED_RESULT ("1.00e-02"); ret = snprintf_emulation (buf, sizeof buf, "%#.E", .01); EXPECTED_RESULT ("1.E-02"); ret = snprintf_emulation (buf, sizeof buf, "%+.E", .01); EXPECTED_RESULT ("+1E-02"); ret = snprintf_emulation (buf, sizeof buf, "%e", 3.14159265); EXPECTED_RESULT ("3.141592e+00"); ret = snprintf_emulation (buf, sizeof buf, "% .e", 0.); EXPECTED_RESULT (" 0e+00"); ret = snprintf_emulation (buf, sizeof buf, "% -8.e", 0.); EXPECTED_RESULT (" 0e+00 "); #if !defined _MSC_VER || ACE_CC_MAJOR_VERSION > 7 ret = snprintf_emulation (buf, sizeof buf, "% -11.2e", -0.); EXPECTED_RESULT ("-0.00e+00 "); #endif ret = snprintf_emulation (buf, sizeof buf, "%.E", 9e101); EXPECTED_RESULTS ("9E+101", "8E+101"); // could be rounded ret = snprintf_emulation (buf, sizeof buf, "%g", 3.); EXPECTED_RESULT ("3"); ret = snprintf_emulation (buf, sizeof buf, "%g", 3.000001); EXPECTED_RESULT ("3"); ret = snprintf_emulation (buf, sizeof buf, "%.6g", 3.000001); EXPECTED_RESULT ("3"); ret = snprintf_emulation (buf, sizeof buf, "%G", 3000000.1); EXPECTED_RESULT ("3E+06"); ret = snprintf_emulation (buf, sizeof buf, "%+#g", 3000000.1); EXPECTED_RESULT ("+3.00000e+06"); ret = snprintf_emulation (buf, sizeof buf, "%G", -3000010.); EXPECTED_RESULTS ("-3.00001E+06", "-3E+06"); ret = snprintf_emulation (buf, sizeof buf, "%g", .0001); EXPECTED_RESULT ("0.0001"); ret = snprintf_emulation (buf, sizeof buf, "%- g", .00001); EXPECTED_RESULT (" 1e-05"); ret = snprintf_emulation (buf, sizeof buf, "%a", 4.); EXPECTED_RESULT ("0x8p-1"); ret = snprintf_emulation (buf, sizeof buf, "%#a", 4.); EXPECTED_RESULT ("0x8.p-1"); ret = snprintf_emulation (buf, sizeof buf, "%A", -3.125); EXPECTED_RESULT ("-0XC.8P-2"); ret = snprintf_emulation (buf, sizeof buf, "%+a", 0.); EXPECTED_RESULT ("+0x0p+0"); ret = snprintf_emulation (buf, sizeof buf, "%+-10.1a", 0.); EXPECTED_RESULT ("+0x0.0p+0 "); ret = snprintf_emulation (buf, sizeof buf, "%0+10.1a", 0.); EXPECTED_RESULT ("+0x00.0p+0"); ret = snprintf_emulation (buf, sizeof buf, "% 09A", 16.625); EXPECTED_RESULT (" 0X8.5P+1"); ret = snprintf_emulation (buf, sizeof buf, "% 010a", 16.625); EXPECTED_RESULT (" 0x08.5p+1"); ret = snprintf_emulation (buf, sizeof buf, "%%%d%#x", 1, 2); EXPECTED_RESULT ("%10x2"); ret = snprintf_emulation (buf, sizeof buf, "foo %%%% bar"); EXPECTED_RESULT ("foo %% bar"); ret = snprintf_emulation (buf, sizeof buf, ""); EXPECTED_RESULT (""); ret = snprintf_emulation (buf, sizeof buf, "foo"); EXPECTED_RESULT ("foo"); ret = snprintf_emulation (buf, sizeof buf, "%'d", 12345); LOG_RESULT ("12,345"); ret = snprintf_emulation (buf, sizeof buf, "%'d", 123456); LOG_RESULT ("123,456"); ret = snprintf_emulation (buf, sizeof buf, "%'d", 1234567890); LOG_RESULT ("1,234,567,890"); ret = snprintf_emulation (buf, sizeof buf, "%'.f", 12345.); LOG_RESULT ("12,345"); ret = snprintf_emulation (buf, sizeof buf, "%'.f", 1234567890.); LOG_RESULT ("1,234,567,890"); ret = snprintf_emulation (buf, sizeof buf, "%'.6d", 12345); LOG_RESULT ("012,345"); ret = snprintf_emulation (buf, sizeof buf, "%0'8d", 12345); LOG_RESULT ("0012,345"); ret = snprintf_emulation (buf, sizeof buf, "a%%b%2$*3$.*1$s %%%%%%%4$*3$.*1$s", 3, "cdef", 4, "fgh"); EXPECTED_RESULT ("a%b cde %%% fgh"); ret = snprintf_emulation (buf, sizeof buf, "%3$d %6$d %5$d %4$d %8$d %9$d %7$d %1$d %2$d %10$d %11$d", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); EXPECTED_RESULT ("3 6 5 4 8 9 7 1 2 10 11"); ret = snprintf_emulation (buf, sizeof buf, "%2$0*1$d %3$.*1$f %1$.*2$d", 3, 2, 3.1); EXPECTED_RESULT ("002 3.100 03"); ret = snprintf_emulation (buf, sizeof buf, "%2$#*1$x", -4, 10); EXPECTED_RESULT ("0xa "); return failed ? 1 : 0; } #endif // ACE_HAS_VSNPRINTF_EMULATION int swab_test () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing swab method\n"))); int error_count = 0; char const from[] = "BADCFEHGJILKNMPORQTSVUXWZY"; char to[] = ".........................."; char expect[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; ACE_OS::swab (from, to, sizeof (from)); if (ACE_OS::strcmp (to, expect) != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("swab error: %C, expected %C\n"), to, expect)); ++error_count; } return error_count; } int gai_strerror_test () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing gai_strerror method\n"))); const ACE_TCHAR* error_text = ACE_OS::gai_strerror (EAI_FAMILY); ACE_UNUSED_ARG (error_text); return 0; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("OS_Test")); // Enable a locale that has digit grouping so that snprintf's %'d is // different than %d. If the locale is not available the test won't // fail (log file needs to be examined to check formatting). #ifdef ACE_WIN32 std::setlocale(LC_NUMERIC, "en-US"); #elif defined ACE_LINUX std::setlocale(LC_NUMERIC, "en_US.utf8"); #endif int status = 0; int result; if ((result = access_test ()) != 0) status = result; if ((result = rename_test ()) != 0) status = result; if ((result = string_emulation_test ()) != 0) status = result; if ((result = snprintf_test (ACE_OS::snprintf)) != 0) status = result; #if defined (ACE_HAS_VSNPRINTF_EMULATION) if ((result = snprintf_test (snprintf_emulation)) != 0) status = result; if ((result = snprintf_emulation_test ()) != 0) status = result; #endif if ((result = getpwnam_r_test ()) != 0) status = result; if ((result = ctime_r_test ()) != 0) status = result; if ((result = string_strsncpy_test ()) != 0) status = result; if ((result = strsignal_test ()) != 0) status = result; if ((result = cpu_info_test ()) != 0) status = result; if ((result = pagesize_test ()) != 0) status = result; if ((result = ceilf_test ()) != 0) status = result; if ((result = floorf_test ()) != 0) status = result; if ((result = ceil_test ()) != 0) status = result; if ((result = floor_test ()) != 0) status = result; if ((result = ceill_test ()) != 0) status = result; if ((result = floorl_test ()) != 0) status = result; if ((result = log2_test ()) != 0) status = result; if ((result = last_error_test ()) != 0) status = result; if ((result = ace_ctype_test ()) != 0) status = result; if ((result = swab_test ()) != 0) status = result; if ((result = compiler_test ()) != 0) status = result; if ((result = version_test ()) != 0) status = result; if ((result = gai_strerror_test ()) != 0) status = result; ACE_END_TEST; return status; } #undef THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL ace-8.0.4+dfsg.orig/tests/Message_Queue_Test_Ex.cpp0000644000175000017500000005606215027201773021231 0ustar sudipsudip //============================================================================= /** * @file Message_Queue_Test_Ex.cpp * * This is: * 1. A simple test of the ACE_Message_Queue_Ex that executes * a performance measurement test for both single-threaded * (null synch) and thread-safe ACE_Message_Queue_Ex * instantiations. * 2. An example of using a user-defined class to parameterize * ACE_Message_Queue_Ex. * * @author Michael Vitlo * @author copied the code from: Irfan Pyarali and David L. Levine */ //============================================================================= #include "test_config.h" #include "ace/Thread_Manager.h" #include #include "ace/Message_Queue.h" #include "ace/Synch_Traits.h" #include "ace/Null_Mutex.h" #include "ace/Null_Condition.h" #include "ace/High_Res_Timer.h" #include "ace/Message_Block.h" #include "ace/OS_NS_sys_time.h" #include "ace/Barrier.h" #include "Message_Queue_Test_Ex.h" // Declares User_Class const ACE_TCHAR usage[] = ACE_TEXT ("usage: Message_Queue_Test_Ex \n"); using QUEUE = ACE_Message_Queue_Ex; static const int MAX_MESSAGES = 10000; static const char test_message[] = "ACE_Message_Queue_Ex Test Message"; static int max_messages = MAX_MESSAGES; static int chain_limit = 4; static ACE_Barrier tester_barrier (2); // Dynamically allocate to avoid a static. static ACE_High_Res_Timer *timer = 0; // Helper printing function static void print_message (const ACE_TCHAR *message) { ACE_Time_Value tv; timer->elapsed_time (tv); ACE_DEBUG ((LM_INFO, ACE_TEXT ("%s: %u messages took %u msec (%f msec/message)\n"), message, max_messages, tv.msec (), (double) tv.msec () / max_messages)); } #if defined (ACE_HAS_THREADS) using SYNCH_QUEUE = ACE_Message_Queue_Ex; /** * Container for data passed to sender and receiver in * performance test. * * For use in multithreaded performance test. */ struct Queue_Wrapper { /// The message queue. SYNCH_QUEUE *q_ {}; /// Pointer to messages blocks for sender to send to reciever. User_Class **send_block_ {}; /// Default constructor. Queue_Wrapper () = default; }; /** * Container for data passed to sender in the MQ_Ex_N_Tester * performance test. * * For use in multithreaded performance test. */ struct MQ_Ex_N_Tester_Wrapper { MQ_Ex_N_Tester *tester_ {}; User_Class *head_send_block_ {}; }; #endif /* ACE_HAS_THREADS */ // Encapsulates the sent messages creation and destruction struct Send_Messages { Send_Messages (int number_of_messages, int chain_limit): send_block_ (0), number_of_messages_ (number_of_messages), chain_limit_ (chain_limit) { } int create_messages (const char test_message[]) { int limit = this->number_of_messages_ / this->chain_limit_; ACE_NEW_RETURN (this->send_block_, User_Class *[limit], -1); int i, j; for (i = 0; i < limit; ++i) { User_Class *&temp1 = this->send_block_[i]; ACE_NEW_RETURN (temp1, User_Class (test_message), -1); User_Class *tail = temp1; for (j = 1; j < this->chain_limit_; ++j) { User_Class *temp2 = 0; ACE_NEW_RETURN (temp2, User_Class (test_message), -1); tail->next (temp2); tail = temp2; } } this->head_send_block_ = this->send_block_[0]; return 0; } ~Send_Messages () { int j, i = 0; int limit = this->number_of_messages_ / this->chain_limit_; for (; i < limit; ++i) { User_Class *&temp1 = this->send_block_[i]; for (j = 0; j < this->chain_limit_; ++j) { User_Class *temp2 = temp1->next (); delete temp1; temp1 = temp2; } } delete [] this->send_block_; } User_Class * head_send_block_; User_Class ** send_block_; int number_of_messages_; int chain_limit_; }; // Encapsulates the received messages creation and destruction struct Receive_Messages { Receive_Messages (int number_of_messages) : receive_block_ (0), number_of_messages_ (number_of_messages) { } int create () { ACE_NEW_RETURN (this->receive_block_, User_Class *[this->number_of_messages_], -1); return 0; } ~Receive_Messages () { delete [] this->receive_block_; } User_Class **receive_block_; int number_of_messages_; }; static int single_thread_performance_test () { const char test_message[] = "ACE_Message_Queue_Ex Test Message"; const ACE_TCHAR *message = ACE_TEXT ("ACE_Message_Queue_Ex, single thread"); // Create a message queue. QUEUE *msgq = 0; ACE_NEW_RETURN (msgq, QUEUE, -1); // Create the messages. Allocate off the heap in case messages is // large relative to the amount of stack space available. User_Class **send_block = 0; ACE_NEW_RETURN (send_block, User_Class *[max_messages], -1); int i = 0; for (i = 0; i < max_messages; ++i) ACE_NEW_RETURN (send_block[i], User_Class (test_message), -1); User_Class **receive_block_p = 0; ACE_NEW_RETURN (receive_block_p, User_Class *[max_messages], -1); timer->start (); // Send/receive the messages. for (i = 0; i < max_messages; ++i) { if (msgq->enqueue_tail (send_block[i]) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("enqueue")), -1); if (msgq->dequeue_head (receive_block_p[i]) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("dequeue_head")), -1); } timer->stop (); print_message (message); timer->reset (); delete [] receive_block_p; for (i = 0; i < max_messages; ++i) delete send_block[i]; delete [] send_block; delete msgq; return 0; } int MQ_Ex_N_Tester::single_thread_performance_test () { // Create the messages. Allocate off the heap in case messages is // large relative to the amount of stack space available. if ((0 != this->test_enqueue_tail ()) || (0 != this->test_enqueue_head ()) ) { return -1; } return 0; } int MQ_Ex_N_Tester::test_enqueue_tail () { const ACE_TCHAR *message = ACE_TEXT ("ACE_Message_Queue_Ex_N, test_enqueue_tail"); // Send_Messages creates messages and deletes them when it gets out of scope Send_Messages messages (max_messages, chain_limit); if (-1 == messages.create_messages (test_message)) { return -1; } Receive_Messages r_messages (max_messages); if (-1 == r_messages.create ()) { return -1; } // prepare int limit = max_messages / chain_limit; timer->start (); // Send with just one call for (int i = 0; i < limit; ++i) { if (-1 == this->st_queue_.enqueue_tail (messages.send_block_[i])) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("enqueue_tail_n")), -1); } for (int j = 0, k = 0; j < chain_limit; ++j, ++k) { if (this->st_queue_.dequeue_head (r_messages.receive_block_[k]) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("dequeue_head")), -1); } } } timer->stop (); print_message (message); timer->reset (); return 0; } int MQ_Ex_N_Tester::test_enqueue_head () { const ACE_TCHAR *message = ACE_TEXT ("ACE_Message_Queue_Ex_N, test_enqueue_head"); // Send_Messages creates messages and deletes them when it gets out of scope Send_Messages messages (max_messages, chain_limit); if (-1 == messages.create_messages (test_message)) { return -1; } Receive_Messages r_messages (max_messages); if (-1 == r_messages.create ()) { return -1; } // prepare int i, j, k = 0; int limit = max_messages / chain_limit; timer->start (); // Send/receive the messages. // Send with just one call for (i = 0; i < limit; ++i) { if (-1 == this->st_queue_.enqueue_head (messages.send_block_[i])) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("enqueue_tail_n")), -1); } for (j = 0; j < chain_limit; ++j, ++k) { if (this->st_queue_.dequeue_head (r_messages.receive_block_[k]) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("dequeue_head")), -1); } } } timer->stop (); print_message (message); timer->reset (); return 0; } #if defined (ACE_HAS_THREADS) static void * receiver (void *arg) { Queue_Wrapper *queue_wrapper = reinterpret_cast (arg); int i; User_Class **receive_block_p = 0; ACE_NEW_RETURN (receive_block_p, User_Class *[max_messages], (void *) -1); for (i = 0; i < max_messages; ++i) if (queue_wrapper->q_->dequeue_head (receive_block_p[i]) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("dequeue_head")), 0); timer->stop (); delete [] receive_block_p; return 0; } static void * sender (void *arg) { Queue_Wrapper *queue_wrapper = reinterpret_cast (arg); int i; timer->start (); // Send the messages. for (i = 0; i < max_messages; ++i) if (queue_wrapper->q_-> enqueue_tail (queue_wrapper->send_block_[i]) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("enqueue")), 0); return 0; } static int performance_test () { Queue_Wrapper queue_wrapper; const ACE_TCHAR *message = ACE_TEXT ("ACE_Message_Queue_Ex"); int i = 0; // Create the messages. Allocate off the heap in case messages is // large relative to the amount of stack space available. Allocate // it here instead of in the sender, so that we can delete it after // the _receiver_ is done. User_Class **send_block = 0; ACE_NEW_RETURN (send_block, User_Class *[max_messages], -1); for (i = 0; i < max_messages; ++i) ACE_NEW_RETURN (send_block[i], User_Class (test_message), -1); queue_wrapper.send_block_ = send_block; ACE_NEW_RETURN (queue_wrapper.q_, SYNCH_QUEUE, -1); if (ACE_Thread_Manager::instance ()->spawn ((ACE_THR_FUNC) sender, &queue_wrapper, THR_BOUND) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("spawning sender thread")), -1); if (ACE_Thread_Manager::instance ()->spawn ((ACE_THR_FUNC) receiver, &queue_wrapper, THR_BOUND) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("spawning receiver thread")), -1); ACE_Thread_Manager::instance ()->wait (); print_message (message); timer->reset (); delete queue_wrapper.q_; queue_wrapper.q_ = 0; for (i = 0; i < max_messages; ++i) delete send_block[i]; delete [] send_block; return 0; } int MQ_Ex_N_Tester::performance_test () { const ACE_TCHAR *message = ACE_TEXT ("ACE_Message_Queue_Ex_N"); Send_Messages messages (max_messages, chain_limit); if (-1 == messages.create_messages (test_message)) { return -1; } MQ_Ex_N_Tester_Wrapper tester_wrapper; tester_wrapper.head_send_block_ = messages.head_send_block_; tester_wrapper.tester_ = this; if (ACE_Thread_Manager::instance ()->spawn ((ACE_THR_FUNC) &MQ_Ex_N_Tester::sender, &tester_wrapper, THR_BOUND) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("spawning sender thread")), -1); if (ACE_Thread_Manager::instance ()->spawn ((ACE_THR_FUNC) &MQ_Ex_N_Tester::receiver, this, THR_BOUND) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("spawning receiver thread")), -1); ACE_Thread_Manager::instance ()->wait (); print_message (message); timer->reset (); return 0; } ACE_THR_FUNC_RETURN MQ_Ex_N_Tester::receiver (void *args) { MQ_Ex_N_Tester *tester = reinterpret_cast (args); User_Class **receive_block_p = 0; ACE_NEW_RETURN (receive_block_p, User_Class *[max_messages], (ACE_THR_FUNC_RETURN) -1); int i; tester_barrier.wait (); for (i = 0; i < max_messages; ++i) { if (tester->mt_queue_.dequeue_head (receive_block_p[i]) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("dequeue_head"))); return (ACE_THR_FUNC_RETURN) -1; } } timer->stop (); delete [] receive_block_p; return 0; } ACE_THR_FUNC_RETURN MQ_Ex_N_Tester::sender (void *args) { MQ_Ex_N_Tester_Wrapper *tester_wrapper = reinterpret_cast (args); MQ_Ex_N_Tester *tester = tester_wrapper->tester_; Send_Messages messages (max_messages, chain_limit); if (-1 == messages.create_messages (test_message)) { return (ACE_THR_FUNC_RETURN) -1; } int limit = max_messages / chain_limit; tester_barrier.wait (); timer->start (); // Send/receive the messages. timer->start (); // Send with just one call for (int i = 0; i < limit; ++i) { if (-1 == tester->mt_queue_.enqueue_tail (messages.send_block_[i])) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("enqueue_tail_n"))); return (ACE_THR_FUNC_RETURN) -1; } } return 0; } #endif /* ACE_HAS_THREADS */ int basic_queue_test (ACE_Message_Queue_Ex& q) { int status = 0; if (!q.is_empty ()) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("New queue is not empty!\n"))); status = 1; } else { User_Class *b; ACE_Time_Value tv (ACE_OS::gettimeofday ()); // Now if (q.dequeue_head (b, &tv) != -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Dequeued from empty queue!\n"))); status = 1; } else if (errno != EWOULDBLOCK) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Dequeue timeout should be EWOULDBLOCK, got"))); status = 1; } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Timed dequeue test: OK\n"))); status = 0; // All is well } } return status; } int queue_priority_test (ACE_Message_Queue_Ex& q) { int status = 0; if (!q.is_empty ()) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Prio test queue not empty\n")), 1); // Set up a few objects with names for how they should come out of the queue. std::unique_ptr b1, b2, b3, b4; b1.reset (new User_Class ("first")); b2.reset (new User_Class ("second")); b3.reset (new User_Class ("third")); b4.reset (new User_Class ("fourth")); unsigned long prio = ACE_Message_Queue_Ex::DEFAULT_PRIORITY; prio += 1; if (-1 == q.enqueue_prio (b2.get (), 0, prio)) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("b2")), 1); if (-1 == q.enqueue_prio (b3.get (), 0, prio)) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("b3")), 1); prio -= 1; if (-1 == q.enqueue_prio (b4.get (), 0, prio)) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("b4")), 1); prio += 5; if (-1 == q.enqueue_prio (b1.get (), 0, prio)) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("b1")), 1); User_Class *b = 0; if (q.dequeue_head (b) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("dequeue 1"))); ++status; } else { if (ACE_OS::strcmp (b->message (), "first") != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("First dequeued was %C\n"), b->message ())); ++status; } } if (q.dequeue_head (b) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("dequeue 2"))); ++status; } else { if (ACE_OS::strcmp (b->message (), "second") != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Second dequeued was %C\n"), b->message ())); ++status; } } if (q.dequeue_head (b) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("dequeue 3"))); ++status; } else { if (ACE_OS::strcmp (b->message (), "third") != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Third dequeued was %C\n"), b->message ())); ++status; } } if (q.dequeue_head (b) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("dequeue 4"))); ++status; } else { if (ACE_OS::strcmp (b->message (), "fourth") != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Fourth dequeued was %C\n"), b->message ())); ++status; } } if (status == 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Priority queueing test: OK\n"))); return status; } class Queue_Ex_Iterator_No_Lock : public ACE_Message_Queue_Iterator { public: typedef ACE_Message_Queue_Ex MESSAGE_QUEUE_EX_T; explicit Queue_Ex_Iterator_No_Lock (MESSAGE_QUEUE_EX_T& queue_in) : ACE_Message_Queue_Iterator (queue_in.queue ()) {} virtual ~Queue_Ex_Iterator_No_Lock () = default; int next (User_Class*& message_inout) { if (ACE_Message_Queue_Iterator::curr_) { message_inout = reinterpret_cast (ACE_Message_Queue_Iterator::curr_->base ()); return 1; } return 0; } int done () const { return (!ACE_Message_Queue_Iterator::curr_ ? 1 : 0); } int advance () { if (ACE_Message_Queue_Iterator::curr_) { ACE_Message_Queue_Iterator::curr_ = ACE_Message_Queue_Iterator::curr_->next (); } return (ACE_Message_Queue_Iterator::curr_ ? 1 : 0); } }; int queue_iterator_test (ACE_Message_Queue_Ex& q) { int status = 0; if (!q.is_empty ()) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Iterator test queue not empty\n")), 1); // Set up a few objects with names for how they should come out of the queue. std::unique_ptr b1 = std::make_unique ("first"); std::unique_ptr b2 = std::make_unique ("second"); std::unique_ptr b3 = std::make_unique ("third"); std::unique_ptr b4 = std::make_unique ("fourth"); if (-1 == q.enqueue_tail (b1.get (), 0)) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("b1")), 1); if (-1 == q.enqueue_tail (b2.get (), 0)) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("b2")), 1); if (-1 == q.enqueue_tail (b3.get (), 0)) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("b3")), 1); if (-1 == q.enqueue_tail (b4.get (), 0)) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("b4")), 1); User_Class* b = nullptr; { ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, aGuard, q.lock (), 1); int counter = 0; for (Queue_Ex_Iterator_No_Lock iterator (q); iterator.next (b); iterator.advance ()) { ACE_ASSERT (b); ++counter; if (counter == 1) { if (ACE_OS::strcmp (b->message (), "first") != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("First message was %C\n"), b->message ())); ++status; } } else if (counter == 4) { if (ACE_OS::strcmp (b->message (), "fourth") != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Fourth message was %C\n"), b->message ())); ++status; } } b = nullptr; } } while (!q.is_empty ()) q.dequeue_head (b, 0); if (status == 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Iterator test: OK\n"))); return status; } int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Message_Queue_Test_Ex")); if (argc == 2) { if (! ACE_OS::strcmp (argv[1], ACE_TEXT ("-?"))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%s/n"), usage)); } else { max_messages = ACE_OS::atoi (argv[1]); } } int status = 0; // Be sure that the a timed out get sets the error code properly. ACE_Message_Queue_Ex q1; ACE_Message_Queue_Ex_N q2; if (0 != basic_queue_test (q1) || 0 != basic_queue_test (q2)) { ++status; } // Check priority operations. if (0 != queue_priority_test (q1)) { ++status; } // Check iterator operations. if (0 != queue_iterator_test (q1)) { ++status; } ACE_NEW_RETURN (timer, ACE_High_Res_Timer, -1); status += single_thread_performance_test (); #if defined (ACE_HAS_THREADS) status += performance_test (); #endif /* ACE_HAS_THREADS */ { MQ_Ex_N_Tester ex_n_tester; status += ex_n_tester.single_thread_performance_test (); #if defined (ACE_HAS_THREADS) status += ex_n_tester.performance_test (); #endif /* ACE_HAS_THREADS */ } if (status != 0) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("test failed"))); delete timer; timer = 0; ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/Based_Pointer_Test_Lib.cpp0000644000175000017500000000107415027201773021342 0ustar sudipsudip //============================================================================= /** * @file Based_Pointer_Test_Lib.cpp * * This test confirms the function of the Based_Pointer_Repository * * @author Steve Williams */ //============================================================================= #include "ace/ACE.h" #include "ace/svc_export.h" #include "ace/Based_Pointer_Repository.h" extern "C" ACE_Svc_Export void *get_based_pointer_repository_instance () { void* baddr = ACE_BASED_POINTER_REPOSITORY::instance(); return baddr; } ace-8.0.4+dfsg.orig/tests/SPIPE_Test.cpp0000644000175000017500000001462415027201773016723 0ustar sudipsudip //============================================================================= /** * @file SPIPE_Test.cpp * * This is a simple test of Named Pipes that uses * ACE_SPIPE_Acceptor and ACE_SPIPE_Connector classes. The test * forks two processes or spawns two threads (depending upon the * platform) and then executes the client and server allowing * them to use the named pipe to exchange data. No user input is * required as far as command line arguments are concerned. * * @author Prashant Jain */ //============================================================================= #include "test_config.h" #include "ace/Thread.h" #include "ace/Thread_Manager.h" #include "ace/SPIPE_Addr.h" #include "ace/SPIPE_Connector.h" #include "ace/SPIPE_Acceptor.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #if defined (ACE_HAS_STREAM_PIPES) || defined (ACE_HAS_WIN32_NAMED_PIPES) # define TEST_HAS_STREAM_PIPES #endif #if defined (TEST_HAS_STREAM_PIPES) static const char ACE_ALPHABET[] = "abcdefghijklmnopqrstuvwxyz"; // pipe name to use static const ACE_TCHAR *PIPE_NAME = ACE_TEXT ("ace_pipe_name"); static void * client (void *) { const ACE_TCHAR *rendezvous = PIPE_NAME; ACE_SPIPE_Stream cli_stream; ACE_SPIPE_Connector con; ACE_OS::sleep (5); if (con.connect (cli_stream, ACE_SPIPE_Addr (rendezvous)) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n%a"), rendezvous, 1)); for (const char *c = ACE_ALPHABET; *c != '\0'; c++) if (cli_stream.send (c, 1) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("send"))); if (cli_stream.close () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("close"))); #if defined (ACE_HAS_WIN32_NAMED_PIPES) // Wait for server to get ready... ACE_OS::sleep (1); // Connect in bytestream-oriented mode. if (con.connect (cli_stream, ACE_SPIPE_Addr (rendezvous), 0, ACE_Addr::sap_any, 0, O_RDWR, 0, 0, PIPE_READMODE_BYTE) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n%a"), rendezvous, 1)); // Write out the alphabet all at once. if (cli_stream.send_n (ACE_ALPHABET, ACE_OS::strlen (ACE_ALPHABET)) != (ssize_t) ACE_OS::strlen (ACE_ALPHABET)) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("send_n"))); // Write out the alphabet one byte at a time for (const char *d = ACE_ALPHABET; *d != '\0'; d++) if (cli_stream.send (d, 1) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("send"))); if (cli_stream.close () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("close"))); #endif #if !defined (ACE_WIN32) ACE_OS::exit (0); #endif return 0; } static void * server (void *) { ACE_SPIPE_Acceptor acceptor; ACE_SPIPE_Stream new_stream; char buf[BUFSIZ]; const char *t = ACE_ALPHABET; const ACE_TCHAR *rendezvous = PIPE_NAME; // Initialize named pipe listener. if (acceptor.open (ACE_SPIPE_Addr (rendezvous)) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n%a"), ACE_TEXT ("open"), 1)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("waiting for connection\n"))); // Accept a client connection if (acceptor.accept (new_stream, 0) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n%a"), ACE_TEXT ("accept"), 1)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Accepted connection\n"))); while (new_stream.recv (buf, 1) > 0) { ACE_TEST_ASSERT (*t == buf[0]); t++; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("End of connection. Closing handle\n"))); new_stream.close (); acceptor.close (); #if defined (ACE_HAS_WIN32_NAMED_PIPES) // Initialize an NT bytestream named pipe listener. if (acceptor.open (ACE_SPIPE_Addr (rendezvous), 1, 0, 0, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n%a"), ACE_TEXT ("open"), 1)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("waiting for connection\n"))); // Accept a client connection if (acceptor.accept (new_stream, 0) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n%a"), ACE_TEXT ("accept"), 1)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Accepted connection\n"))); // The client will write the entire buffer at once, verify that we // can stream it in one byte at a time. for (t = ACE_ALPHABET; *t; t++) { if (new_stream.recv (buf, 1) <= 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n%a"), ACE_TEXT ("recv"), 1)); break; } ACE_TEST_ASSERT (*t == buf[0]); } // Wait for the client to stream in the buffer one byte at a time. ACE_OS::sleep (1); // Verify that we can read the stream of individual bytes all at // once. if (new_stream.recv (buf, sizeof(buf)) != (ssize_t) ACE_OS::strlen (ACE_ALPHABET)) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n%a"), ACE_TEXT ("recv"), 1)); else ACE_TEST_ASSERT(ACE_OS::memcmp(ACE_ALPHABET, buf, ACE_OS::strlen (ACE_ALPHABET)) == 0); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("End of connection. Closing handle\n"))); new_stream.close (); acceptor.close (); #endif /* defined (ACE_HAS_WIN32NAMED_PIPES) */ return 0; } #endif /* TEST_HAS_STREAM_PIPES */ int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("SPIPE_Test")); #if defined (TEST_HAS_STREAM_PIPES) #if !defined (ACE_LACKS_FORK) switch (ACE_OS::fork ()) { case -1: ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n%a"), ACE_TEXT ("fork failed"))); ACE_OS::exit (-1); case 0: client (0); default: server (0); } #elif defined (ACE_HAS_THREADS) if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (client), (void *) 0, THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n%a"), ACE_TEXT ("thread create failed"))); if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (server), (void *) 0, THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n%a"), ACE_TEXT ("thread create failed"))); ACE_Thread_Manager::instance ()->wait (); #endif /* !ACE_LACKS_EXEC */ #else ACE_DEBUG ((LM_INFO, ACE_TEXT ("SPIPE is not supported on this platform\n"))); #endif /* TEST_HAS_STREAM_PIPES */ ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/SOCK_Dgram_Test.cpp0000644000175000017500000002656215027201773017720 0ustar sudipsudip//============================================================================= /** * @file SOCK_Dgram_Test.cpp * * Tests that a call to open with an any address binds to the any address * for the protocol passed in. * * This test uses the same test setup as SOCK_Test. * * @author Brian Buesker (bbuesker@qualcomm.com) */ //============================================================================= #include "test_config.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_sys_wait.h" #include "ace/Thread.h" #include "ace/Thread_Manager.h" #include "ace/SOCK_Dgram.h" #include "ace/Log_Msg.h" #include "ace/Time_Value.h" #include "ace/OS_NS_unistd.h" #define SERVER_PORT 20000 #define TEST_DATA ACE_TEXT ("UDP Open Test") static void * client (void *arg) { ACE_INET_Addr *remote_addr = (ACE_INET_Addr *) arg; ACE_INET_Addr server_addr, peer_addr; ACE_SOCK_Dgram cli_dgram; ACE_Time_Value timeout (1); ACE_TCHAR buf[20]; ACE_TCHAR hostname_string[100]; if (remote_addr->get_type () == AF_INET) { server_addr.set (remote_addr->get_port_number (), ACE_LOCALHOST, 1, remote_addr->get_type ()); } #if defined (ACE_HAS_IPV6) else { server_addr.set (remote_addr->get_port_number(), ACE_IPV6_LOCALHOST, 1, remote_addr->get_type ()); } #endif /* ACE_HAS_IPV6 */ server_addr.addr_to_string (hostname_string, 100); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) starting client UDP send to %s\n"), hostname_string)); if (cli_dgram.open (ACE_Addr::sap_any, server_addr.get_type ()) == -1) { ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) protocol %d, %p\n"), server_addr.get_type (), ACE_TEXT ("SOCK_Dgram open"))); return 0; } { if (remote_addr->get_type () == AF_INET) { #if defined (ACE_RECVPKTINFO) int sockopt = 1; if (cli_dgram.set_option(IPPROTO_IP, ACE_RECVPKTINFO, &sockopt, sizeof sockopt) == -1) { ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) setsockopt failed\n"))); return 0; } else { ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) setsockopt succeeded\n"))); } #endif } #if defined (ACE_HAS_IPV6) else { #if defined (ACE_RECVPKTINFO6) int sockopt = 1; if (cli_dgram.set_option(IPPROTO_IPV6, ACE_RECVPKTINFO6, &sockopt, sizeof sockopt) == -1) { ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) setsockopt failed\n"))); return 0; } else { ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) setsockopt succeeded\n"))); } #endif } #endif } if (cli_dgram.send (TEST_DATA, sizeof (TEST_DATA), server_addr) == -1) { ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) UDP send to %s %p\n"), hostname_string, ACE_TEXT ("failed"))); return 0; } { ACE_INET_Addr local_addr, to_addr; cli_dgram.get_local_addr(local_addr); if (local_addr.get_type () == AF_INET) { local_addr.set (local_addr.get_port_number (), ACE_LOCALHOST, 1, local_addr.get_type ()); to_addr.set (9999, ACE_LOCALHOST, 1, AF_INET); } #if defined (ACE_HAS_IPV6) else { local_addr.set (local_addr.get_port_number(), ACE_IPV6_LOCALHOST, 1, local_addr.get_type ()); to_addr.set (9999, ACE_IPV6_LOCALHOST, 1, AF_INET6); } #endif /* ACE_HAS_IPV6 */ #if defined(ACE_LACKS_RECVMSG) ssize_t rcv_cnt = cli_dgram.recv (buf, sizeof (buf), peer_addr, 0, &timeout); #else iovec iov[1]; // Some platforms define iov_base as char* instead of void*. iov[0].iov_base = (char *)buf; iov[0].iov_len = sizeof buf; ssize_t rcv_cnt = cli_dgram.recv (iov, 1, peer_addr, 0, &to_addr); #endif if (rcv_cnt == -1) { if (errno == ETIME) { ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) UDP recv on proto %d timed out\n"), server_addr.get_type ())); } else { ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) UDP recv on proto %d %p\n"), server_addr.get_type (), ACE_TEXT("failed"))); } } else { // recv() ok, check data, 'from', and 'to' address size_t rcv_siz = static_cast (rcv_cnt); if (rcv_siz != sizeof (TEST_DATA)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) recv cnt %B; should be %B\n"), rcv_siz, sizeof (TEST_DATA))); } else { buf[rcv_siz/sizeof (ACE_TCHAR)] = '\0'; if (ACE_OS::strncmp (buf, TEST_DATA, ACE_OS::strlen (TEST_DATA))) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) recv string should be %s; ") ACE_TEXT (" but is %s\n"), TEST_DATA, buf)); } if (peer_addr.get_type () != server_addr.get_type ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) recv addr type %d; should be %d\n"), peer_addr.get_type (), server_addr.get_type ())); if (peer_addr.get_size () != server_addr.get_size ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) recv addr size %d; should be %d\n"), peer_addr.get_size (), server_addr.get_size ())); #if (defined ACE_RECVPKTINFO6 || defined ACE_RECVPKTINFO) && !defined ACE_FACE_SAFETY_EXTENDED if (local_addr != to_addr) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) local addr is not equal to sent-to addr\n"))); #endif } } cli_dgram.close(); return 0; } static void * server (void *arg) { ACE_SOCK_Dgram *server_dgram = (ACE_SOCK_Dgram *) arg; ACE_INET_Addr peer_addr; ACE_TCHAR buf[20]; ACE_TCHAR hostname_string[100]; ssize_t rcv_cnt; if ((rcv_cnt = server_dgram->recv (buf, sizeof (buf), peer_addr, 0)) == -1) { ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) %p\n"), ACE_TEXT("server recv"))); } else { // recv() ok, check data and 'from' address size_t rcv_siz = static_cast (rcv_cnt); if (rcv_siz != sizeof (TEST_DATA)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) recv cnt %B; should be %B\n"), rcv_siz, sizeof (TEST_DATA))); } else { buf[rcv_siz / sizeof (ACE_TCHAR)] = '\0'; if (ACE_OS::strncmp (buf, TEST_DATA, ACE_OS::strlen (TEST_DATA))) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) recv string should be %s; ") ACE_TEXT (" but is %s\n"), TEST_DATA, buf)); } if (0 == peer_addr.addr_to_string (hostname_string, sizeof (hostname_string))) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Echoing data to %s\n"), hostname_string)); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("addr_to_string"))); if (server_dgram->send (TEST_DATA, sizeof (TEST_DATA), peer_addr, 0) == -1) { ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) %p\n"), ACE_TEXT("Server UDP send failed"))); } } server_dgram->close (); return 0; } static int spawn (int proto) { ACE_SOCK_Dgram server_dgram; ACE_INET_Addr server_addr; if (proto == AF_INET) { server_addr.set (SERVER_PORT, ACE_LOCALHOST, 1, proto); } #if defined (ACE_HAS_IPV6) else { server_addr.set (SERVER_PORT, ACE_IPV6_LOCALHOST, 1, proto); } #endif /* ACE_HAS_IPV6 */ // Bind UDP server to the appropriate port if (server_dgram.open (server_addr, proto) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("server dgram open")), 1); } else { if (server_addr.get_port_number() != SERVER_PORT) { ACE_TCHAR hostname_string[100]; server_addr.addr_to_string (hostname_string, 100); ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT("(%P|%t) Portnumber has unexpected value of %d on host %s\n"), server_addr.get_port_number(), hostname_string), 1); } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) started server at proto %d, port %d\n"), proto, server_addr.get_port_number ())); #if !defined (ACE_LACKS_FORK) switch (ACE_OS::fork (ACE_TEXT ("child"))) { case -1: ACE_ERROR_BREAK ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("fork failed"))); /* NOTREACHED */ case 0: client (&server_addr); ACE_OS::exit (0); /* NOTREACHED */ default: server ((void *) &server_dgram); ACE_OS::wait (); } #elif defined (ACE_HAS_THREADS) if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (server), (void *) &server_dgram, THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("thread create failed")), 1); if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (client), (void *) &server_addr, THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("thread create failed")), 1); // Wait for the threads to exit. ACE_Thread_Manager::instance ()->wait (); #else ACE_ERROR ((LM_INFO, ACE_TEXT ("(%P|%t) ") ACE_TEXT ("only one thread may be run ") ACE_TEXT ("in a process on this platform\n"))); #endif /* ACE_HAS_THREADS */ } server_dgram.close (); } return 0; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("SOCK_Dgram_Test")); int retval = spawn (AF_INET); #if defined (ACE_HAS_IPV6) if (retval == 0) { retval = spawn (AF_INET6); } #endif /* ACE_HAS_IPV6 */ ACE_END_TEST; return retval; } ace-8.0.4+dfsg.orig/tests/Config_Test.ini0000644000175000017500000000151315027201773017236 0ustar sudipsudip# -------------------------------------------------------------------- # Example test.ini file for import_config_as_strings of the # class # -------------------------------------------------------------------- # Use whitespace (tabs and spaces) freely. # String to the left of the equal sign can be delimited with double # quotes. # -------------------------------------------------------------------- [network] TimeToLive = 100 Delay = FALSE DestIPAddress = localhost DestPort = 12670 ReconnectInterval = 3 [logger] Heading = "ACE - Adaptive Communication Environment" SeekIndex = 14 TraceLevel = 6 # Can comment lines like this Justification = left_justified LogFilePath = log/ TransactionFilePath = data/ ace-8.0.4+dfsg.orig/tests/Test_Output.cpp0000644000175000017500000001371215027201773017340 0ustar sudipsudip// -*- C++ -*- // ============================================================================ /** * @file Test_Output.cpp * * This file factors out common macros and other utilities used by the * ACE automated regression tests. * * @author Prashant Jain * @author Tim Harrison * @author David Levine * @author Don Hinton */ // ============================================================================ #include "test_config.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_sys_stat.h" #include "ace/Guard_T.h" #include "ace/Object_Manager.h" // FUZZ: disable check_for_streams_include #include "ace/streams.h" #include "ace/Framework_Component.h" #include "ace/Log_Msg.h" #include "ace/ACE.h" #if defined (VXWORKS) # include "ace/OS_NS_unistd.h" # include "ace/OS_NS_fcntl.h" #endif /* VXWORKS */ ACE_Test_Output *ACE_Test_Output::instance_ = 0; ACE_Test_Output::ACE_Test_Output () : output_file_ (0) { #if !defined (ACE_LACKS_IOSTREAM_TOTALLY) this->output_file_ = new OFSTREAM; #endif /* ACE_LACKS_IOSTREAM_TOTALLY */ } ACE_Test_Output::~ACE_Test_Output () { #if !defined (ACE_LACKS_IOSTREAM_TOTALLY) ACE_LOG_MSG->msg_ostream (&cerr, 0); #endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ ACE_LOG_MSG->clr_flags (ACE_Log_Msg::OSTREAM); ACE_LOG_MSG->set_flags (ACE_Log_Msg::STDERR); #if !defined (ACE_LACKS_IOSTREAM_TOTALLY) delete this->output_file_; #endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ } OFSTREAM * ACE_Test_Output::output_file () { // the output_file_ is loaned to ACE_LOG_MSG // and something else might destroy and/or change the stream // so return what ACE_LOG_MSG is using. #if defined (ACE_LACKS_IOSTREAM_TOTALLY) return reinterpret_cast(ACE_LOG_MSG->msg_ostream ()); #else return dynamic_cast(ACE_LOG_MSG->msg_ostream ()); #endif /* ACE_LACKS_IOSTREAM_TOTALLY */ } int ACE_Test_Output::set_output (const ACE_TCHAR *filename, int append) { ACE_TCHAR temp[MAXPATHLEN + 1] = { 0 }; // Ignore the error value since the directory may already exist. const ACE_TCHAR *test_dir = 0; #if defined (ACE_WIN32) || !defined (ACE_USES_WCHAR) test_dir = ACE_OS::getenv (ACE_TEXT ("ACE_TEST_DIR")); #else ACE_TCHAR tempenv[MAXPATHLEN + 1] = { 0 }; char const * const test_dir_n = ACE_OS::getenv ("ACE_TEST_DIR"); if (test_dir_n == 0) { test_dir = 0; } else { ACE_OS::strncpy (tempenv, ACE_TEXT_CHAR_TO_TCHAR (test_dir_n), MAXPATHLEN); test_dir = tempenv; } #endif /* ACE_WIN32 */ if (test_dir == 0) test_dir = ACE_DEFAULT_TEST_DIR; // This could be done with ACE_OS::sprintf() but it requires different // format strings for wide-char POSIX vs. narrow-char POSIX and Windows. // Easier to keep straight like this. ACE_OS::strncpy (temp, test_dir, MAXPATHLEN); ACE_OS::strcat (temp, ACE_LOG_DIRECTORY); ACE_OS::strcat (temp, ACE::basename (filename, ACE_DIRECTORY_SEPARATOR_CHAR)); ACE_OS::strcat (temp, ACE_LOG_FILE_EXT_NAME); #if defined (ACE_VXWORKS) // This is the only way I could figure out to avoid a console // warning about opening an existing file (w/o O_CREAT), or // attempting to unlink a non-existent one. ACE_HANDLE fd = ACE_OS::open (temp, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); if (fd != ERROR) { ACE_OS::close (fd); ACE_OS::unlink (temp); } #else /* ! ACE_VXWORKS */ // This doesn't seem to work on VxWorks if the directory doesn't // exist: it creates a plain file instead of a directory. If the // directory does exist, it causes a weird console error message // about "cat: input error on standard input: Is a directory". So, // VxWorks users must create the directory manually. ACE_OS::mkdir (ACE_LOG_DIRECTORY_FOR_MKDIR); #endif /* ACE_VXWORKS */ # if !defined (ACE_LACKS_IOSTREAM_TOTALLY) this->output_file_->open (ACE_TEXT_ALWAYS_CHAR (temp), ios::out | (append ? ios::app : ios::trunc)); if (!this->output_file_->good ()) return -1; #else /* when ACE_LACKS_IOSTREAM_TOTALLY */ const ACE_TCHAR *fmode = 0; if (append) fmode = ACE_TEXT ("a"); else fmode = ACE_TEXT ("w"); this->output_file_ = ACE_OS::fopen (temp, fmode); # endif /* ACE_LACKS_IOSTREAM_TOTALLY */ ACE_LOG_MSG->msg_ostream (this->output_file_, 0); ACE_LOG_MSG->clr_flags (ACE_Log_Msg::STDERR | ACE_Log_Msg::LOGGER ); ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM); return 0; } void ACE_Test_Output::close () { if (this->output_file_ && (this->output_file_ == ACE_LOG_MSG->msg_ostream ())) { #if !defined (ACE_LACKS_IOSTREAM_TOTALLY) this->output_file_->flush (); this->output_file_->close (); #else ACE_OS::fflush (this->output_file_); ACE_OS::fclose (this->output_file_); #endif /* !ACE_LACKS_IOSTREAM_TOTALLY */ ACE_LOG_MSG->msg_ostream (0, 0); } // else something else changed the stream and hence should // have closed the output_file_ } ACE_Test_Output * ACE_Test_Output::instance () { if (ACE_Test_Output::instance_ == 0) { // Perform Double-Checked Locking Optimization. ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, *ACE_Static_Object_Lock::instance (), 0)); if (ACE_Test_Output::instance_ == 0) { ACE_NEW_RETURN (ACE_Test_Output::instance_, ACE_Test_Output, 0); ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Test_Output, ACE_Test_Output::instance_) } } return ACE_Test_Output::instance_; } const ACE_TCHAR * ACE_Test_Output::dll_name () { return ACE_TEXT ("Test_Output"); } const ACE_TCHAR * ACE_Test_Output::name () { return ACE_TEXT ("ACE_Test_Output"); } void ACE_Test_Output::close_singleton () { delete ACE_Test_Output::instance_; ACE_Test_Output::instance_ = 0; } ace-8.0.4+dfsg.orig/tests/Collection_Test.cpp0000644000175000017500000000743415027201773020137 0ustar sudipsudip //============================================================================= /** * @file Collection_Test.cpp * * This is a simple test of the ACE collection classes and its * iterators. * * @author Irfan Pyarali */ //============================================================================= #include "test_config.h" #include "ace/Containers.h" #include "Collection_Test.h" UglyThing::UglyThing (void* alloc, deletion_func dfunc) : alloc_ (alloc) , dfunc_ (dfunc) { } bool UglyThing::operator== (const UglyThing& r) const { return this->alloc_ == r.alloc_; } using DATA = UglyThing; using UNBOUNDED_SET = ACE_Unbounded_Set; using UNBOUNDED_SET_ITERATOR = ACE_Unbounded_Set_Iterator; using UNBOUNDED_SET_CONST_ITERATOR = ACE_Unbounded_Set_Const_Iterator; using ARRAY_DATA = int; using ARRAY = ACE_Array; using ARRAY_ITERATOR = ACE_Array_Iterator; void iterate_const(const UNBOUNDED_SET& set) { { UNBOUNDED_SET_CONST_ITERATOR iterator (set); while (!iterator.done ()) { DATA *data = 0; iterator.next (data); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%x,%x\n"), data->alloc_, (void *) data->dfunc_)); DATA data_second = *iterator; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%x,%x\n"), data_second.alloc_, (void *) data_second.dfunc_)); iterator.advance (); } } } struct DummyFunctor { int operator() () { return 0; } }; int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Collection_Test")); deletion_func NO_DFUNC = (deletion_func)0; DummyFunctor dummyfunc; { UNBOUNDED_SET unbounded_set; unbounded_set.insert (UglyThing ((void*)&unbounded_set, NO_DFUNC)); unbounded_set.insert (UglyThing ((void*)&dummyfunc, NO_DFUNC)); { for (UNBOUNDED_SET::iterator iterator = unbounded_set.begin (); iterator != unbounded_set.end (); ++iterator) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%x,%x\n"), (*iterator).alloc_, (void *) (*iterator).dfunc_)); } } unbounded_set.insert (UglyThing (0, NO_DFUNC)); unbounded_set.remove (UglyThing ((void*)&dummyfunc, NO_DFUNC)); { UNBOUNDED_SET_ITERATOR iterator (unbounded_set); while (!iterator.done ()) { DATA *data = 0; iterator.next (data); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%x,%x\n"), data->alloc_, (void *) data->dfunc_)); iterator.advance (); } } iterate_const (unbounded_set); unbounded_set.reset (); { DATA *data; UNBOUNDED_SET_ITERATOR i (unbounded_set); while (i.next (data) != 0) { ACE_DEBUG ((LM_DEBUG, "%x,%x\n", data->alloc_, (void *) data->dfunc_)); i.advance (); } } iterate_const (unbounded_set); } { ARRAY array; } { ARRAY array (0); } { ARRAY array1; array1.size (2); array1[0] = 4; array1[1] = 4; ARRAY array2 (2, 4); ARRAY array3 (array2); ARRAY array4; array4 = array2; ACE_TEST_ASSERT (array1 == array2); ACE_TEST_ASSERT (array1 == array3); ACE_TEST_ASSERT (array1 == array4); { for (size_t i = 0; i != array1.size (); ++i) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%d\n"), array1[i])); ACE_TEST_ASSERT (array1[i] == 4); } } { ARRAY_ITERATOR iterator (array1); while (!iterator.done ()) { ARRAY_DATA *data = 0; iterator.next (data); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%d\n"), (*data))); ACE_TEST_ASSERT (*data == 4); iterator.advance (); } } } ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Pipe_Test.cpp0000644000175000017500000001024715027201773016735 0ustar sudipsudip //============================================================================= /** * @file Pipe_Test.cpp * * Tests the construction of multiple pipes in a process. * * @author Irfan Pyarali */ //============================================================================= #include "test_config.h" #include "ace/Pipe.h" #include "ace/Process.h" #include "ace/Get_Opt.h" #include "ace/ACE.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_stdlib.h" #include "ace/OS_NS_unistd.h" // Indicates whether we should close the pipe or not. static int close_pipe = 1; // Indicates whether we're running as the child or the parent. static int child_process = 0; // Number of iterations to run the test. static int iterations = ACE_MAX_ITERATIONS; // Explain usage and exit. static void print_usage_and_die () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("usage: %n [-d (don't close pipes)] ") ACE_TEXT ("[-c (child process)] [-i (iterations)]\n"))); ACE_OS::exit (1); } // Parse the command-line arguments and set options. static void parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("dci:")); int c; while ((c = get_opt ()) != -1) switch (c) { case 'd': close_pipe = 0; break; case 'c': child_process = 1; break; case 'i': iterations = ACE_OS::atoi (get_opt.opt_arg ()); break; default: print_usage_and_die (); break; } } // Consolidate the ACE_Pipe initializations. #ifdef ACE_HAS_PROCESS_SPAWN static void open_pipe (ACE_Pipe &pipe, const char *name) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("opening %C\n"), name)); int result = pipe.open (); ACE_TEST_ASSERT (result != -1); result = pipe.read_handle () != ACE_INVALID_HANDLE && pipe.write_handle () != ACE_INVALID_HANDLE; ACE_TEST_ASSERT (result == 1); if (close_pipe) pipe.close (); } #endif int run_main (int argc, ACE_TCHAR *argv[]) { parse_args (argc, argv); #ifndef ACE_HAS_PROCESS_SPAWN ACE_START_TEST (ACE_TEXT ("Pipe_Test")); ACE_END_TEST; #else if (child_process) { ACE_APPEND_LOG (ACE_TEXT("Pipe_Test-children")); ACE_Pipe a, b, c, d, e; open_pipe (a, "a"); open_pipe (b, "b"); open_pipe (c, "c"); open_pipe (d, "d"); open_pipe (e, "e"); ACE_END_LOG; } else { ACE_START_TEST (ACE_TEXT("Pipe_Test")); ACE_INIT_LOG (ACE_TEXT("Pipe_Test-children")); ACE_Process_Options options; # ifndef ACE_LACKS_VA_FUNCTIONS options.command_line (ACE_TEXT ("%") ACE_TEXT_PRIs ACE_TEXT (" -c%") ACE_TEXT_PRIs, argc > 0 ? argv[0] : ACE_TEXT ("Pipe_Test"), close_pipe == 0 ? ACE_TEXT (" -d") : ACE_TEXT ("")); # else ACE_UNUSED_ARG (cmdline_fmt); # endif ACE_exitcode status = 0; for (int i = 0; i < ::iterations; i++) { ACE_Process server; if (server.spawn (options) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("spawn failed")), -1); } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Server forked with pid = %d.\n"), server.getpid ())); } // Wait for the process we just created to exit. server.wait (&status); // Check if child exited without error. if (WIFEXITED (status) != 0 && WEXITSTATUS (status) != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Child of server %d finished with error ") ACE_TEXT ("exit status %d\n"), server.getpid (), WEXITSTATUS (status))); ACE_END_TEST; ACE_OS::exit (WEXITSTATUS (status)); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Server %d finished\n"), server.getpid ())); } ACE_END_TEST; } #endif // ACE_HAS_PROCESS_SPAWN return 0; } ace-8.0.4+dfsg.orig/tests/DLL_Test_Parent_Export.h0000644000175000017500000000436715027201773021000 0ustar sudipsudip // -*- C++ -*- // Definition for Win32 Export directives. // This file is generated automatically by generate_export_file.pl -s DLL_Test_Parent // ------------------------------ #ifndef DLL_TEST_PARENT_EXPORT_H #define DLL_TEST_PARENT_EXPORT_H #include "ace/config-all.h" #if defined (ACE_AS_STATIC_LIBS) && !defined (DLL_TEST_PARENT_HAS_DLL) # define DLL_TEST_PARENT_HAS_DLL 0 #endif /* ACE_AS_STATIC_LIBS && DLL_TEST_PARENT_HAS_DLL */ #if !defined (DLL_TEST_PARENT_HAS_DLL) # define DLL_TEST_PARENT_HAS_DLL 1 #endif /* ! DLL_TEST_PARENT_HAS_DLL */ #if defined (DLL_TEST_PARENT_HAS_DLL) && (DLL_TEST_PARENT_HAS_DLL == 1) # if defined (DLL_TEST_PARENT_BUILD_DLL) # define DLL_Test_Parent_Export ACE_Proper_Export_Flag # define DLL_TEST_PARENT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) # define DLL_TEST_PARENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) # else /* DLL_TEST_PARENT_BUILD_DLL */ # define DLL_Test_Parent_Export ACE_Proper_Import_Flag # define DLL_TEST_PARENT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) # define DLL_TEST_PARENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) # endif /* DLL_TEST_PARENT_BUILD_DLL */ #else /* DLL_TEST_PARENT_HAS_DLL == 1 */ # define DLL_Test_Parent_Export # define DLL_TEST_PARENT_SINGLETON_DECLARATION(T) # define DLL_TEST_PARENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) #endif /* DLL_TEST_PARENT_HAS_DLL == 1 */ // Set DLL_TEST_PARENT_NTRACE = 0 to turn on library specific tracing even if // tracing is turned off for ACE. #if !defined (DLL_TEST_PARENT_NTRACE) # if (ACE_NTRACE == 1) # define DLL_TEST_PARENT_NTRACE 1 # else /* (ACE_NTRACE == 1) */ # define DLL_TEST_PARENT_NTRACE 0 # endif /* (ACE_NTRACE == 1) */ #endif /* !DLL_TEST_PARENT_NTRACE */ #if (DLL_TEST_PARENT_NTRACE == 1) # define DLL_TEST_PARENT_TRACE(X) #else /* (DLL_TEST_PARENT_NTRACE == 1) */ # if !defined (ACE_HAS_TRACE) # define ACE_HAS_TRACE # endif /* ACE_HAS_TRACE */ # define DLL_TEST_PARENT_TRACE(X) ACE_TRACE_IMPL(X) # include "ace/Trace.h" #endif /* (DLL_TEST_PARENT_NTRACE == 1) */ #endif /* DLL_TEST_PARENT_EXPORT_H */ // End of auto generated file. ace-8.0.4+dfsg.orig/tests/Service_Config_Test.UTF-16.conf.xml0000644000175000017500000000547215027201773022554 0ustar sudipsudip<?xml version='1.0'?> <!-- Converted from Service_Config_Test.conf by svcconf-convert.pl --> <ACE_Svc_Conf> <!-- Dynamically loading each of the Service Objects below causes a --> <!-- number of threads to be spawned, each one invoking the Service --> <!-- Configurator (e.g. ACE_Service_Config::process_directive(). If the --> <!-- Service Configurator is thread safe and reentrant, then parsing of --> <!-- this `Service_Config_Test.conf' file should run to completion --> <!-- without error. --> <!-- --> <!-- Test_Object_1 will cause Test_Object_2 and Test_Object_3 to be --> <!-- dynamically loaded. Dynamic loading of each of object will occur in --> <!-- a separate thread. --> <dynamic id="Test_Object_1" type="Service_Object"> <initializer init="_make_Service_Config_DLL" path="Service_Config_DLL" params="2 3"/> </dynamic> <!-- Test_Object_4 will cause Test_Object_5 and Test_Object_6 to be --> <!-- dynamically loaded. Dynamic loading of each of object will occur in --> <!-- a separate thread. --> <dynamic id="Test_Object_4" type="Service_Object"> <initializer init="_make_Service_Config_DLL" path="Service_Config_DLL" params="5 6"/> </dynamic> <!-- Final_Object does nothing but print a completion message. --> <dynamic id="Final_Object" type="Service_Object"> <initializer init="_make_Service_Config_DLL" path="Service_Config_DLL" params="FINAL"/> </dynamic> </ACE_Svc_Conf> ace-8.0.4+dfsg.orig/tests/Multicast_Test.cpp0000644000175000017500000007467415027201773020023 0ustar sudipsudip// ============================================================================ // // = LIBRARY // tests // // = DESCRIPTION // This program tests ACE_SOCK_Dgram_Mcast class. // It specifically tests subscribing to multiple groups on the same socket // on one or more physical interfaces (if available). // // The test can be run as a producer, consumer, or both producer/consumer // (default). The test requires at least two (2) multicast groups which can // be configured as command line options. The consumer subscribes to a // single group per instance and an additional instance tries to subscribe // to all groups on a single socket (if the ACE_SOCK_Dgram_Mcast instance // bind()'s the first address to the socket, additional joins will fail). // The producer iterates through the list of group addresses and sends a // single message containing the destination address and port to each one. // It also sends messages to five (5) additional groups and a message to an // additional port for each group in order to produce a bit of "noise" in // order to help validate how well the multicast filtering works on a // particular platform. // // The list of destination groups start at 239.255.0.1 (default) and // increment by 1 up to 5 (default) groups. Both of these values, as well // as others, can be overridden via command-line options. Use the -? // option to display the usage message... // // = AUTHOR // Don Hinton // // ============================================================================ #include "test_config.h" #include "ace/Get_Opt.h" #include "ace/Vector_T.h" #include "ace/SOCK_Dgram_Mcast.h" #include "ace/ACE.h" #include "ace/Reactor.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_strings.h" #include "ace/OS_NS_sys_time.h" #include "ace/Task.h" #include "ace/Atomic_Op.h" #include "ace/SString.h" #include "ace/Signal.h" #include #if defined (ACE_HAS_IP_MULTICAST) && defined (ACE_HAS_THREADS) /* * The 'finished' flag is used to break out of an infninite loop in the * task::svc () method. The 'handler' will set the flag in respose to * SIGINT (CTRL-C). */ static sig_atomic_t finished = 0; extern "C" void handler (int) { finished = 1; } static const int MCT_ITERATIONS = 10; static const int MCT_GROUPS = 5; static const int MCT_MIN_GROUPS = 2; static const char MCT_START_GROUP[] = "239.255.0.1"; static const int MCT_START_PORT = 16000; static const size_t MAX_STRING_SIZE = 200; int advance_addr (ACE_INET_Addr &addr); // Keep track of errors so we can report them on exit. static sig_atomic_t error = 0; /* * MCast_Config holds configuration data for this test. */ class MCT_Config { public: enum { PRODUCER = 1, CONSUMER = 2, BOTH = PRODUCER | CONSUMER }; MCT_Config () : group_start_ (MCT_START_PORT, MCT_START_GROUP), groups_ (0), debug_ (0), role_ (BOTH), sdm_opts_ (ACE_SOCK_Dgram_Mcast::DEFOPTS), iterations_ (MCT_ITERATIONS), ttl_ (1), wait_ (2) { if (IP_MAX_MEMBERSHIPS == 0) this->groups_ = MCT_GROUPS; else this->groups_ = (std::min) (IP_MAX_MEMBERSHIPS, MCT_GROUPS); } ~MCT_Config () {} //FUZZ: disable check_for_lack_ACE_OS int open (int argc, ACE_TCHAR *argv[]); //FUZZ: enable check_for_lack_ACE_OS int debug () const { return this->debug_;} void dump () const; int groups () const { return this->groups_;} const ACE_INET_Addr group_start () const { return this->group_start_;} u_long role () const { return this->role_;} int iterations () const { return this->iterations_;} int ttl () const { return this->ttl_;} //FUZZ: disable check_for_lack_ACE_OS int wait () const { return this->wait_;} //FUZZ: enable check_for_lack_ACE_OS ACE_SOCK_Dgram_Mcast::options options () const { return static_cast (this->sdm_opts_); } private: // Starting group address. (only IPv4 capable right now...) ACE_INET_Addr group_start_; // Number of groups we will try to use in the test. int groups_; // Debug flag. int debug_; // Role, i.e., PRODUCER, CONSUMER, BOTH: defaults to BOTH u_long role_; // ACE_SOCK_Dgram_Mcast ctor options u_long sdm_opts_; // Producer iterations int iterations_; // TTL, time to live, for use over routers. int ttl_; // Time to wait on CONSUMER threads to end before killing test. int wait_; }; int MCT_Config::open (int argc, ACE_TCHAR *argv[]) { int retval = 0; int help = 0; //FUZZ: disable check_for_lack_ACE_OS ACE_Get_Opt getopt (argc, argv, ACE_TEXT (":?"), 1, 1); //FUZZ: enable check_for_lack_ACE_OS if (getopt.long_option (ACE_TEXT ("GroupStart"), 'g', ACE_Get_Opt::ARG_REQUIRED) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add GroupStart option.\n")), 1); if (getopt.long_option (ACE_TEXT ("Groups"), 'n', ACE_Get_Opt::ARG_REQUIRED) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add Groups option.\n")), 1); if (getopt.long_option (ACE_TEXT ("Debug"), 'd', ACE_Get_Opt::NO_ARG) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add Debug option.\n")), 1); if (getopt.long_option (ACE_TEXT ("Role"), 'r', ACE_Get_Opt::ARG_REQUIRED) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add Role option.\n")), 1); if (getopt.long_option (ACE_TEXT ("SDM_options"), 'm', ACE_Get_Opt::ARG_REQUIRED) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add Multicast_Options option.\n")), 1); if (getopt.long_option (ACE_TEXT ("Iterations"), 'i', ACE_Get_Opt::ARG_REQUIRED) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add iterations option.\n")), 1); if (getopt.long_option (ACE_TEXT ("TTL"), 't', ACE_Get_Opt::ARG_REQUIRED) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add TTL option.\n")), 1); if (getopt.long_option (ACE_TEXT ("Wait"), 'w', ACE_Get_Opt::ARG_REQUIRED) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add wait option.\n")), 1); if (getopt.long_option (ACE_TEXT ("help"), 'h', ACE_Get_Opt::NO_ARG) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add help option.\n")), 1); //FUZZ: disable check_for_lack_ACE_OS // Now, let's parse it... int c = 0; while ((c = getopt ()) != EOF) { //FUZZ: enable check_for_lack_ACE_OS switch (c) { case 0: // Long Option. This should never happen. retval = -1; break; case 'g': { // @todo validate all these, i.e., must be within range // 224.255.0.0 to 238.255.255.255, but we only allow the // administrative "site local" range, 239.255.0.0 to // 239.255.255.255. ACE_TCHAR *group = getopt.opt_arg (); if (this->group_start_.set (group) != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Bad group address:%s\n"), group)); } } break; case 'i': this->iterations_ = ACE_OS::atoi (getopt.opt_arg ()); break; case 'n': { int n = ACE_OS::atoi (getopt.opt_arg ()); // I'm assuming 0 means unlimited, so just use whatever the // user provides. if (IP_MAX_MEMBERSHIPS == 0) this->groups_ = n; else this->groups_ = (std::min) ((std::max) (n, MCT_MIN_GROUPS), IP_MAX_MEMBERSHIPS); break; } case 'd': this->debug_ = 1; break; case 'r': { ACE_TCHAR *c = getopt.opt_arg (); if (ACE_OS::strcasecmp (c, ACE_TEXT ("CONSUMER")) == 0) this->role_ = CONSUMER; else if (ACE_OS::strcasecmp (c, ACE_TEXT ("PRODUCER")) == 0) this->role_ = PRODUCER; else { help = 1; retval = -1; } } break; case 'm': { //@todo add back OPT_BINDADDR_NO... ACE_TCHAR *c = getopt.opt_arg (); if (ACE_OS::strcasecmp (c, ACE_TEXT ("OPT_BINDADDR_YES")) == 0) ACE_SET_BITS (this->sdm_opts_, ACE_SOCK_Dgram_Mcast::OPT_BINDADDR_YES); else if (ACE_OS::strcasecmp (c, ACE_TEXT ("OPT_BINDADDR_NO")) == 0) ACE_CLR_BITS (this->sdm_opts_, ACE_SOCK_Dgram_Mcast::OPT_BINDADDR_YES); else if (ACE_OS::strcasecmp (c, ACE_TEXT ("DEFOPT_BINDADDR")) == 0) { ACE_CLR_BITS (this->sdm_opts_, ACE_SOCK_Dgram_Mcast::OPT_BINDADDR_YES); ACE_SET_BITS (this->sdm_opts_, ACE_SOCK_Dgram_Mcast::DEFOPT_BINDADDR); } else if (ACE_OS::strcasecmp (c, ACE_TEXT ("OPT_NULLIFACE_ALL")) == 0) ACE_SET_BITS (this->sdm_opts_, ACE_SOCK_Dgram_Mcast::OPT_NULLIFACE_ALL); else if (ACE_OS::strcasecmp (c, ACE_TEXT ("OPT_NULLIFACE_ONE")) == 0) ACE_CLR_BITS (this->sdm_opts_, ACE_SOCK_Dgram_Mcast::OPT_NULLIFACE_ALL); else if (ACE_OS::strcasecmp (c, ACE_TEXT ("DEFOPT_NULLIFACE")) == 0) { ACE_CLR_BITS (this->sdm_opts_, ACE_SOCK_Dgram_Mcast::OPT_NULLIFACE_ALL); ACE_SET_BITS (this->sdm_opts_, ACE_SOCK_Dgram_Mcast::DEFOPT_NULLIFACE); } else if (ACE_OS::strcasecmp (c, ACE_TEXT ("DEFOPTS")) == 0) this->sdm_opts_ = ACE_SOCK_Dgram_Mcast::DEFOPTS; else { help = 1; retval = -1; } } break; case 't': this->ttl_ = ACE_OS::atoi (getopt.opt_arg ()); break; case 'w': this->wait_ = ACE_OS::atoi (getopt.opt_arg ()); break; case ':': // This means an option requiring an argument didn't have one. ACE_ERROR ((LM_ERROR, ACE_TEXT (" Option '%c' requires an argument but ") ACE_TEXT ("none was supplied\n"), getopt.opt_opt ())); help = 1; retval = -1; break; case '?': case 'h': default: if (ACE_OS::strcmp (argv[getopt.opt_ind () - 1], ACE_TEXT ("-?")) != 0 && getopt.opt_opt () != 'h') // Don't allow unknown options. ACE_ERROR ((LM_ERROR, ACE_TEXT (" Found an unknown option (%c) ") ACE_TEXT ("we couldn't handle.\n"), getopt.opt_opt ())); // getopt.last_option ())); //readd with "%s" when // last_option() is available. help = 1; retval = -1; break; } } if (retval == -1) { if (help) // print usage here ACE_ERROR ((LM_ERROR, ACE_TEXT ("usage: %s [options]\n") ACE_TEXT ("Options:\n") ACE_TEXT (" -g {STRING} --GroupStart={STRING} ") ACE_TEXT ("starting multicast group address\n") ACE_TEXT (" ") ACE_TEXT ("(default=239.255.0.1:16000)\n") ACE_TEXT (" -n {#} --Groups={#} ") ACE_TEXT ("number of groups (default=5)\n") ACE_TEXT (" -d --Debug ") ACE_TEXT ("debug flag (default=off)\n") ACE_TEXT (" -r {STRING} --Role={STRING} ") ACE_TEXT ("role {PRODUCER|CONSUMER|BOTH}\n") ACE_TEXT (" ") ACE_TEXT ("(default=BOTH)\n") ACE_TEXT (" -m {STRING} --SDM_options={STRING} ") ACE_TEXT ("ACE_SOCK_Dgram_Mcast ctor options\n") ACE_TEXT (" ") ACE_TEXT ("(default=DEFOPTS)\n") ACE_TEXT (" -i {#} --Iterations={#} ") ACE_TEXT ("number of iterations (default=100)\n") ACE_TEXT (" -t {#} --TTL={#} ") ACE_TEXT ("time to live (default=1)\n") ACE_TEXT (" -w {#} --Wait={#} ") ACE_TEXT ("number of seconds to wait on CONSUMER\n") ACE_TEXT (" ") ACE_TEXT ("(default=2)\n") ACE_TEXT (" -h/? --help ") ACE_TEXT ("show this message\n"), argv[0])); return -1; } return 0; } void MCT_Config::dump () const { ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Dumping MCT_Config\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\tIP_MAX_MEMBERSHIPS = %d\n"), IP_MAX_MEMBERSHIPS)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\tgroups_ = %d\n"), this->groups_)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\trole_ = %s\n"), (ACE_BIT_ENABLED (this->role_, PRODUCER) && ACE_BIT_ENABLED (this->role_, CONSUMER)) ? ACE_TEXT ("PRODUCER/CONSUMER") : ACE_BIT_ENABLED (this->role_, PRODUCER) ? ACE_TEXT ("PRODUCER") : ACE_TEXT ("CONSUMER"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\tsdm_options_ = %d\n"), this->sdm_opts_)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\titerations_ = %d\n"), this->iterations_)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\tttl_ = %d\n"), this->ttl_)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\twait_ = %d\n"), this->wait_)); // Note that this call to get_host_addr is the non-reentrant // version, but it's okay for us. ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\tgroups_start_ = %s:%d\n"), this->group_start_.get_host_addr (), this->group_start_.get_port_number ())); ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } /******************************************************************************/ class MCT_Event_Handler : public ACE_Event_Handler { public: MCT_Event_Handler (ACE_SOCK_Dgram_Mcast::options options = ACE_SOCK_Dgram_Mcast::DEFOPTS); ~MCT_Event_Handler () override; int join (const ACE_INET_Addr &mcast_addr, int reuse_addr = 1, const ACE_TCHAR *net_if = 0); int leave (const ACE_INET_Addr &mcast_addr, const ACE_TCHAR *net_if = 0); // = Event Handler hooks. int handle_input (ACE_HANDLE handle) override; int handle_close (ACE_HANDLE fd, ACE_Reactor_Mask close_mask) override; ACE_HANDLE get_handle () const override; // Turn loopback on/off. Must be called after at least 1 join() is performed. int loopback (bool on_off); protected: ACE_SOCK_Dgram_Mcast *mcast (); int find (const char *buf); private: ACE_SOCK_Dgram_Mcast mcast_; // List of groups we've joined ACE_Vector address_vec_; // Flag used to set the 'finished' flag when the last event handler // gets removed from the reactor. static ACE_Atomic_Op active_handlers_; }; ACE_Atomic_Op MCT_Event_Handler::active_handlers_ = 0; MCT_Event_Handler::MCT_Event_Handler (ACE_SOCK_Dgram_Mcast::options options) : mcast_ (options) { // Increment the number of active handlers in the reactor. Note this isn't // really correct, but it should work for our simple example. ++MCT_Event_Handler::active_handlers_; } MCT_Event_Handler::~MCT_Event_Handler () { size_t size = this->address_vec_.size (); for (size_t i = 0; i < size; ++i) { delete this->address_vec_[i]; this->address_vec_[i] = 0; } mcast_.close (); } ACE_SOCK_Dgram_Mcast * MCT_Event_Handler::mcast () { return &this->mcast_; } int MCT_Event_Handler::find (const char *buf) { size_t const size = this->address_vec_.size (); size_t i = 0; for (i = 0; i < size; ++i) { if (ACE_OS::strcasecmp (buf, this->address_vec_[i]->c_str ()) == 0) return 0; } // Not found, so output message we received along with a list of groups // we've joined for debugging. ACE_CString local; for (i = 0; i < size; ++i) { local += "\t"; local += this->address_vec_[i]->c_str (); local += "\n"; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%C not in:\n%C"), buf, local.c_str ())); return -1; } int MCT_Event_Handler::join (const ACE_INET_Addr &mcast_addr, int reuse_addr, const ACE_TCHAR *net_if) { char buf[MAX_STRING_SIZE]; ACE_OS::snprintf (buf, MAX_STRING_SIZE, "%s/%d", mcast_addr.get_host_addr (), mcast_addr.get_port_number ()); if (this->mcast_.join (mcast_addr, reuse_addr, net_if) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("MCT_Event_Handler::join %C %p\n"), buf, ACE_TEXT ("failed")), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Joined %C\n"), buf)); ACE_CString *str = 0; ACE_NEW_RETURN (str, ACE_CString (buf), -1); this->address_vec_.push_back (str); return 0; } int MCT_Event_Handler::leave (const ACE_INET_Addr &mcast_addr, const ACE_TCHAR *net_if) { if (this->mcast_.leave (mcast_addr, net_if) == 0) { char buf[MAX_STRING_SIZE]; size_t size = this->address_vec_.size (); for (size_t i = 0; i < size; ++i) { ACE_OS::snprintf (buf, MAX_STRING_SIZE, "%s/%d", mcast_addr.get_host_addr (), mcast_addr.get_port_number ()); if (ACE_OS::strcasecmp (buf, this->address_vec_[i]->c_str ()) == 0) { this->address_vec_[i]->set (""); break; } } return 0; } return -1; } int MCT_Event_Handler::handle_input (ACE_HANDLE /*handle*/) { char buf[MAX_STRING_SIZE]; ACE_OS::memset (buf, 0, sizeof buf); ACE_INET_Addr addr; if (this->mcast ()->recv (buf, sizeof buf, addr) == -1) { ++error; ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("MCT_Event_Handler::handle_input - ") ACE_TEXT ("calling recv\n")), -1); } // Zero length buffer means we are done. if (ACE_OS::strlen (buf) == 0) return -1; else if (this->find (buf) == -1) { ++error; ACE_DEBUG ((LM_ERROR, ACE_TEXT ("MCT_Event_Handler::handle_input - ") ACE_TEXT ("Received dgram for a group we didn't join ") ACE_TEXT ("(%s)\n"), buf)); } return 0; } int MCT_Event_Handler::handle_close (ACE_HANDLE /*fd*/, ACE_Reactor_Mask /*close_mask*/) { // If this is the last handler, use the finished flag to signal // the task to exit. if (--MCT_Event_Handler::active_handlers_ == 0) finished = 1; // The DONT_CALL flag keeps the reactor from calling handle_close () // again, since we commit suicide below. this->reactor ()->remove_handler (this, ACE_Event_Handler::ALL_EVENTS_MASK | ACE_Event_Handler::DONT_CALL); this->reactor (0); delete this; return 0; } ACE_HANDLE MCT_Event_Handler::get_handle () const { return this->mcast_.get_handle (); } // Turn loopback on/off int MCT_Event_Handler::loopback (bool on_off) { char loopback_on = on_off ? 1 : 0; return this->mcast_.set_option (IP_MULTICAST_LOOP, loopback_on); } /******************************************************************************/ /* * Our MCT_Task object will be an Active Object if we are running the Consumer * side of the test. open() calls active() which creates a thread and calls * the svc() method that calls runs the reactor event loop. */ class MCT_Task : public ACE_Task { public: MCT_Task (const MCT_Config &config, ACE_Reactor *reactor = ACE_Reactor::instance ()); ~MCT_Task () override; //FUZZ: disable check_for_lack_ACE_OS // = Task hooks. int open (void *args = 0) override; //FUZZ: enable check_for_lack_ACE_OS int svc () override; private: const MCT_Config &config_; }; MCT_Task::MCT_Task (const MCT_Config &config, ACE_Reactor *reactor) : config_ (config) { this->reactor (reactor); } MCT_Task::~MCT_Task () {} int MCT_Task::open (void *) { MCT_Event_Handler *handler = 0; ACE_INET_Addr addr = this->config_.group_start (); int groups = this->config_.groups (); for (int i = 0; i < groups; ++i) { ACE_NEW_RETURN (handler, MCT_Event_Handler (this->config_.options ()), -1); // We subscribe to all groups for the first one and one each for // all the others. if (i == 0) { // go ahead and hide the other one since we want our own. ACE_INET_Addr addr = this->config_.group_start (); for (int j = 0; j < groups; ++j) { // If OPT_BINDADDR_YES is set, this will fail after the first // join, so just break and keep on going, otherwise it's a // real error. if (j > 0 && ACE_BIT_ENABLED (ACE_SOCK_Dgram_Mcast::OPT_BINDADDR_YES, this->config_.options ())) break; if (handler->join (addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("MCT_Task::open - join error\n")), -1); advance_addr (addr); } } else { if (handler->join (addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("MCT_Task::open - join error\n")), -1); } advance_addr (addr); // This test needs loopback because we're both sending and receiving. // Loopback is usually the default, but be sure. if (-1 == handler->loopback (true)) ACE_ERROR ((LM_WARNING, ACE_TEXT ("%p\n"), ACE_TEXT ("MCT_Task::open - enable loopback"))); if (this->reactor ()->register_handler (handler, READ_MASK) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("MCT_Task::open - cannot register ") ACE_TEXT ("handler\n")), -1); } if (this->activate (THR_NEW_LWP) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("MCT_TASK:open - activate failed")), -1); return 0; } int MCT_Task::svc () { // make sure this thread owns the reactor or handle_events () won't do // anything. this->reactor ()->owner (ACE_Thread::self ()); // loop and call handle_events... while (!finished) this->reactor ()->handle_events (); return 0; } /******************************************************************************/ int send_dgram (ACE_SOCK_Dgram &socket, ACE_INET_Addr addr, int done = 0) { // Send each message twice, once to the right port, and once to the "wrong" // port. This helps generate noise and lets us see if port filtering is // working properly. const char *address = addr.get_host_addr (); int port = addr.get_port_number (); for (int i = 0; i < 2; ++i) { char buf[MAX_STRING_SIZE]; if (done) buf[0] = 0; else ACE_OS::snprintf (buf, MAX_STRING_SIZE, "%s/%d", address, port); if (socket.send (buf, ACE_OS::strlen (buf),addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Send to %C, %p\n"), address, ACE_TEXT ("send_dgram - error calling send on ") ACE_TEXT ("ACE_SOCK_Dgram.")), -1); addr.set_port_number (++port); } return 0; } int producer (MCT_Config &config) { int retval = 0; //FUZZ: disable check_for_lack_ACE_OS ACE_DEBUG ((LM_INFO, ACE_TEXT ("Starting producer...\n"))); ACE_SOCK_Dgram socket (ACE_sap_any_cast (ACE_INET_Addr &), PF_INET); //FUZZ: enable check_for_lack_ACE_OS // Note that is is IPv4 specific and needs to be changed once // if (config.ttl () > 1) { int ttl = config.ttl (); if (socket.set_option (IPPROTO_IP, IP_MULTICAST_TTL, (void*) &ttl, sizeof ttl) != 0) ACE_DEBUG ((LM_ERROR, ACE_TEXT ("could net set socket option IP_MULTICAST_TTL ") ACE_TEXT ("= %d\n"), ttl)); else ACE_DEBUG ((LM_INFO, ACE_TEXT ("set IP_MULTICAST_TTL = %d\n"), ttl)); } int iterations = config.iterations (); // we add an extra 5 groups for noise. int groups = config.groups () + 5; for (int i = 0; (i < iterations || iterations == 0) && !finished; ++i) { ACE_INET_Addr addr = config.group_start (); for (int j = 0; j < groups && !finished; ++j) { if ((retval += send_dgram (socket, addr, ((i + 1) == iterations))) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Calling send_dgram.\n"))); if ((retval += advance_addr (addr)) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Calling advance_addr.\n"))); } // Give the task thread a chance to run. ACE_Thread::yield (); } socket.close (); return retval; } /* * Advance the address by 1, e.g., 239.255.0.1 => 239.255.0.2 * Note that the algorithm is somewhat simplistic, but sufficient for our * purpose. */ int advance_addr (ACE_INET_Addr &addr) { int a, b, c, d; ::sscanf (addr.get_host_addr (), "%d.%d.%d.%d", &a, &b, &c, &d); if (d < 255) ++d; else if (c < 255) { d = 1; ++c; } else if (b < 255) { d = 1; c = 0; ++b; } else if (a < 239) { d = 1; c = 0; b = 0; ++a; } else ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("advance_addr - Cannot advance multicast ") ACE_TEXT ("group address past %s\n"), addr.get_host_addr ()), -1); ACE_TCHAR buf[MAX_STRING_SIZE]; ACE_OS::snprintf (buf, MAX_STRING_SIZE, ACE_TEXT ("%d.%d.%d.%d:%d"), a, b, c, d, addr.get_port_number ()); addr.set (buf); return 0; } int run_main (int argc, ACE_TCHAR *argv[]) { int retval = 0; MCT_Config config; retval = config.open (argc, argv); if (retval != 0) return 1; const ACE_TCHAR *temp = ACE_TEXT ("Multicast_Test"); ACE_TString test = temp; u_long role = config.role (); if (ACE_BIT_DISABLED (role, MCT_Config::PRODUCER) || ACE_BIT_DISABLED (role, MCT_Config::CONSUMER)) { if (ACE_BIT_ENABLED (role, MCT_Config::PRODUCER)) test += ACE_TEXT ("-PRODUCER"); else test += ACE_TEXT ("-CONSUMER"); } // Start test only if options are valid. ACE_START_TEST (test.c_str ()); // Register a signal handler to close down application gracefully. ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT); // Dump the configuration info to the log if caller passed debug option. if (config.debug ()) config.dump (); ACE_Reactor *reactor = ACE_Reactor::instance (); MCT_Task *task = new MCT_Task (config, reactor); if (ACE_BIT_ENABLED (role, MCT_Config::CONSUMER)) { ACE_DEBUG ((LM_INFO, ACE_TEXT ("Starting consumer...\n"))); // Open makes it an active object. retval += task->open (); } // now produce the datagrams... if (ACE_BIT_ENABLED (role, MCT_Config::PRODUCER)) retval += producer (config); if (ACE_BIT_ENABLED (role, MCT_Config::CONSUMER)) { // and wait for everything to finish ACE_DEBUG ((LM_INFO, ACE_TEXT ("start waiting for consumer to finish...\n"))); // Wait for the threads to exit. // But, wait for a limited time since we could hang if the last udp // message isn't received. ACE_Time_Value max_wait ( config.wait ()/* seconds */); ACE_Time_Value wait_time (ACE_OS::gettimeofday () + max_wait); ACE_Time_Value *ptime = ACE_BIT_ENABLED (role, MCT_Config::PRODUCER) ? &wait_time : 0; if (ACE_Thread_Manager::instance ()->wait (ptime) == -1) { // We will no longer wait for this thread, so we must // force it to exit otherwise the thread will be referencing // deleted memory. finished = 1; reactor->end_reactor_event_loop (); if (errno == ETIME) ACE_ERROR ((LM_ERROR, ACE_TEXT ("maximum wait time of %d msec exceeded\n"), max_wait.msec ())); else ACE_OS::perror (ACE_TEXT ("wait")); ++error; // This should exit now that we ended the reactor loop. task->wait (); } } delete task; ACE_END_TEST; return (retval == 0 && error == 0) ? 0 : 1; } #else int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Multicast_Test")); ACE_ERROR ((LM_INFO, ACE_TEXT ("This test must be run on a platform ") ACE_TEXT ("that support IP multicast.\n"))); ACE_END_TEST; return 1; } #endif /* ACE_HAS_IP_MULTICAST && ACE_HAS_THREADS */ ace-8.0.4+dfsg.orig/tests/TSS_Static_Test.cpp0000644000175000017500000000521615027201773020020 0ustar sudipsudip //============================================================================= /** * @file TSS_Static_Test.cpp * * This program tests the interaction between TSS and thread keys * created during static construction. VxWorks static construction * is quite broken. This test is designed to test changes to work * around a bug in the VxWorks loader that constructs static objects * multiple times. It sounds hard to believe, but I've seen it! * * @author Chad Elliott */ //============================================================================= #include "test_config.h" #include "ace/ACE.h" #include "ace/Init_ACE.h" #include "ace/Thread.h" #if defined (ACE_HAS_TSS_EMULATION) class Some_Object { public: Some_Object (); ~Some_Object (); }; Some_Object::Some_Object () { ACE::init (); // Cause the ACE_Log_Msg to be constructed during static construction ACE_DEBUG ((LM_DEBUG, "")); // Assign something to TSS during static construction ACE_thread_key_t key; if (ACE_Thread::keycreate (&key, 0) == 0) { ACE_Thread::setspecific (key, this); } } Some_Object::~Some_Object () { ACE::fini (); } static Some_Object sobject; int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("TSS_Static_Test")); int status = 0; ACE_thread_key_t key; if (ACE_Thread::keycreate (&key, 0) == 0) { void* specific = 0; if (ACE_Thread::getspecific (key, &specific) == 0) { if (specific == 0) { ACE_DEBUG ((LM_DEBUG, "Got back pointer: %x from key: %d. " "Good!\n", (size_t)specific, key)); } else { ++status; ACE_ERROR ((LM_ERROR, "Something (%x) was found in tss " "slot %d.\n" "Nothing should be stored in our " "TSS slot!\n", (size_t)specific, key)); } } else { ++status; ACE_ERROR ((LM_ERROR, "Unable to get the thread specific " "storage.\n")); } } else { ++status; ACE_ERROR ((LM_ERROR, "Unable to create the thread specific " "storage key.\n")); } ACE_END_TEST; return status; } #else int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("TSS_Static_Test")); ACE_DEBUG ((LM_INFO, ACE_TEXT ("This test requires TSS Emulation.\n"))); ACE_END_TEST; return 0; } #endif /* ACE_HAS_TSS_EMULATION */ ace-8.0.4+dfsg.orig/tests/Cached_Conn_Test.h0000644000175000017500000000126415027201773017630 0ustar sudipsudip //============================================================================= /** * @file Cached_Conn_Test.h * * Define class needed for generating templates. * * @author Kirthika Parameswaran */ //============================================================================= #ifndef ACE_TESTS_CACHED_CONN_TEST_H #define ACE_TESTS_CACHED_CONN_TEST_H #include "ace/SOCK_Stream.h" #include "ace/Svc_Handler.h" class Svc_Handler : public ACE_Svc_Handler { public: Svc_Handler (ACE_Thread_Manager *t = 0); int open (void *v = 0); int close (u_long flags = 0); }; #endif /* ACE_TESTS_CACHED_ACCEPT_CONN_TEST_H */ ace-8.0.4+dfsg.orig/tests/Handle_Set_Test.cpp0000644000175000017500000001315115027201773020043 0ustar sudipsudip //============================================================================= /** * @file Handle_Set_Test.cpp * * This test illustrates the use of ACE_Handle_Set to maintain a * set of handles. No command line arguments are needed to run * the test. * * @author Prashant Jain */ //============================================================================= #include "test_config.h" #include "ace/OS_NS_stdlib.h" #include "ace/Profile_Timer.h" #include "ace/Handle_Set.h" #include "ace/Containers.h" static void test_duplicates (size_t count) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing %B duplicates\n"), count)); size_t duplicates = 0; size_t sets = 0; size_t clears = 0; ACE_Handle_Set handle_set; u_int seed = (u_int) ACE_OS::time (0); for (size_t i = 0; i < count; i++) { size_t const handle = static_cast (ACE_OS::rand_r (&seed) % ACE_Handle_Set::MAXSIZE); if (ACE_ODD (handle)) { if (handle_set.is_set ((ACE_HANDLE) handle)) ++duplicates; handle_set.set_bit ((ACE_HANDLE) handle); ++sets; } else { if (handle_set.is_set ((ACE_HANDLE) handle)) --duplicates; handle_set.clr_bit ((ACE_HANDLE) handle); ++clears; } } ACE_TEST_ASSERT (count == sets + clears); ACE_TEST_ASSERT (handle_set.num_set () + duplicates == sets); ACE_Handle_Set copy_set (handle_set); ACE_TEST_ASSERT (copy_set.num_set () + duplicates == sets); ACE_Handle_Set move_set (std::move(handle_set)); ACE_TEST_ASSERT (move_set.num_set () + duplicates == sets); ACE_Handle_Set move_assign = std::move(copy_set); ACE_TEST_ASSERT (move_assign.num_set () + duplicates == sets); } // This is the vector of handles to test. These numbers are chosen to // test for boundaries conditions. Note that if // is less than any of these // values, the logic in will simply ignore // these values. #if defined (ACE_WIN64) // The casts below are legit... # pragma warning(push) # pragma warning(disable : 4312) #endif /* ACE_WIN64 */ static ACE_HANDLE handle_vector[] = { (ACE_HANDLE) 0, (ACE_HANDLE) 1, (ACE_HANDLE) 31, (ACE_HANDLE) 32, (ACE_HANDLE) 63, (ACE_HANDLE) 64, (ACE_HANDLE) 65, (ACE_HANDLE) 127, (ACE_HANDLE) 128, (ACE_HANDLE) 129, (ACE_HANDLE) 254, (ACE_HANDLE) 255, (ACE_HANDLE) (ACE_DEFAULT_SELECT_REACTOR_SIZE - 1), (ACE_HANDLE) ACE_DEFAULT_SELECT_REACTOR_SIZE, ACE_INVALID_HANDLE }; #if defined (ACE_WIN64) # pragma warning(pop) #endif /* ACE_WIN64 */ static void test_boundaries () { ACE_Handle_Set handle_set; ACE_Unbounded_Set set; ACE_HANDLE handle; // First test an empty set. for (ACE_Handle_Set_Iterator i1 (handle_set); (handle = i1 ()) != ACE_INVALID_HANDLE; ) { ACE_TEST_ASSERT (0 == ACE_TEXT ("this shouldn't get called since ") ACE_TEXT ("the set is empty!\n")); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_DEFAULT_SELECT_REACTOR_SIZE %d\n"), ACE_DEFAULT_SELECT_REACTOR_SIZE)); // Insert the vector of s into the set. #if defined (ACE_WIN64) // The casts below are legit... # pragma warning(push) # pragma warning(disable : 4312) #endif /* ACE_WIN64 */ for (int i = 0; handle_vector[i] != ACE_INVALID_HANDLE; i++) { if (handle_vector[i] < (ACE_HANDLE) ACE_DEFAULT_SELECT_REACTOR_SIZE) { handle_set.set_bit (handle_vector[i]); set.insert (handle_vector[i]); } } #if defined (ACE_WIN64) # pragma warning(pop) #endif /* ACE_WIN64 */ int count = 0; for (ACE_Handle_Set_Iterator i2 (handle_set); (handle = i2 ()) != ACE_INVALID_HANDLE; ) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("obtained handle %d\n"), handle)); int const done = set.remove (handle); ACE_TEST_ASSERT (done == 0); count++; } ACE_TEST_ASSERT (count == handle_set.num_set ()); } static void test_performance (size_t max_handles, size_t max_iterations) { ACE_Handle_Set handle_set; size_t i; for (i = 0; i < max_handles; i++) handle_set.set_bit ((ACE_HANDLE) i); ACE_Profile_Timer timer; size_t count = 0; timer.start (); for (i = 0; i < max_iterations; i++) { ACE_Handle_Set_Iterator iter (handle_set); // Only iterate up to . while (iter () != ACE_INVALID_HANDLE) count++; } timer.stop (); ACE_TEST_ASSERT (count == max_handles * max_iterations); ACE_Profile_Timer::ACE_Elapsed_Time et; timer.elapsed_time (et); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("real time = %f secs, user time = %f secs, ") ACE_TEXT ("system time = %f secs\n"), et.real_time, et.user_time, et.system_time)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("time per each of the %d calls = %f usecs\n"), count, et.real_time / double (count) * 1000000)); } int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Handle_Set_Test")); int count = argc > 1 ? ACE_OS::atoi (argv[1]) : ACE_Handle_Set::MAXSIZE; size_t max_handles = argc > 2 ? ACE_OS::atoi (argv[2]) : ACE_Handle_Set::MAXSIZE; size_t max_iterations = argc > 3 ? ACE_OS::atoi (argv[3]) : ACE_MAX_ITERATIONS; test_duplicates (count); test_boundaries (); test_performance (max_handles, max_iterations); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/QtReactor_Test.cpp0000644000175000017500000006471115027201773017751 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file QtReactor_Test.cpp * * Simple test of QtReactor. Test is intended to verify if QtReactor * correctly cooperates with Qt event loop in typical application. Test * creates a number of timers which send datagrams. These datagrams are * expected by datagram_handlers registered in reactor. Test asynchronously * establishes also a number of loopback tcp connections using ACE_Acceptors * and ACE_Connectors. Socket activities are handled asynchronously to ensure * that reactor does not lose events in traffic transmission. Moreover, test * registers and removes handlers frequently to cover register/remove_handler * method of QtReactor which are known (10/07/2004) to be buggy. * * Classes: * QTestApplication - main qt application running event loop for a * finite time * Dgram_Handler - responsible for sending and receiving datagrams as * well as handling timeouts. Datagrams are sent in * handle_timeout method. * TCPConnectionHandler - connection handler responsible for sending and * receiving data using tcp streams. * TCPAcceptorHandler - acceptor responsible for acceptance and * registration of connections in HandlersRegister * class. * HandlersRegister - register of event_handlers, responsible also for * the analysis of test results. * * @author Marek Brudka */ //============================================================================= #include "test_config.h" #include #include #include "ace/OS_NS_time.h" #include "ace/Time_Value.h" #include "ace/QtReactor/QtReactor.h" #include "ace/Event_Handler.h" #include "ace/Argv_Type_Converter.h" #include "ace/Acceptor.h" #include "ace/Connector.h" #include "ace/SOCK_Acceptor.h" #include "ace/SOCK_Connector.h" #include "ace/SOCK_Dgram.h" // Qt specific code #include "QtReactor_Test.h" /* QTestApplication class implementation */ QTestApplication::QTestApplication (int argc, char *argv[]): QApplication (argc, argv, FALSE) /* do not enable GUI */ { //FUZZ: disable check_for_lack_ACE_OS connect (&finishTimer_, SIGNAL (timeout ()), this, SLOT (finishTest ())); //FUZZ: enable check_for_lack_ACE_OS } void QTestApplication::finishTest () { ACE_OS::exit (); } void QTestApplication::exec (int msec) { finishTimer_.stop (); if (0 < msec ) { finishTimer_.setSingleShot (TRUE); finishTimer_.start (msec); } inherited::exec (); } // maximum time for testing QtReactor (msec) const int TotalTestTime = 8000; // how many handlers for each event handler class should be started ? #ifndef __QNXNTO__ const int HandlersNo = 8 ; #else /* __QNXNTO__ */ // it seems that Qt 3.1 for NTO 6.2 is compiled with rather small FD_SETSIZE // Nevertheless, test works fine with native select reactor const int HandlersNo = 4; #endif // base port for sending datagrams const u_short BaseDgramPort = 5931; // port for TCP connections const u_short BaseTCPPort = 5931; // how many datagrams should be sent for a single handler const int DgramsToSend = 64; // how many bytes to send vie TCP const int TCPBytesToSend = 1024; // how many times to reply tcp recv const int TCPClientPings = 16; // total number of bytes in TCP transmission const int TCPTotalBytesToSend = TCPClientPings * TCPBytesToSend; /** \class DgramHandler \brief Simple event handler that receives and counts datagrams as well as sends dgrams using timeouts. */ class DgramHandler: public ACE_Event_Handler { public: DgramHandler (ACE_Reactor *p_reactor = 0); virtual ~DgramHandler (); //FUZZ: disable check_for_lack_ACE_OS int open (const ACE_INET_Addr &local, int protocol_family=ACE_PROTOCOL_FAMILY_INET, int protocol=0, int reuse_addr=0); //FUZZ: enable check_for_lack_ACE_OS virtual ACE_HANDLE get_handle () const; virtual int handle_input (ACE_HANDLE handle); virtual int handle_close (ACE_HANDLE handle,ACE_Reactor_Mask close_mask); virtual int handle_timeout (const ACE_Time_Value ¤t_time, const void *act=0); int dgramsSent () const; int dgramsReceived () const; int timeoutsTriggered () const; int expectedTriggers () const; void expectedTriggers (int); private: int dgramsSent_; //!< the number of sent datagrams int dgramsReceived_; //!< the number of received datagrams int timeoutsTriggered_; int expectedTriggers_; ACE_SOCK_Dgram peer_; //!< datagram socket we listen to }; /** \class TCPConnectionHandler \brief TCP stream handler for both sides of connection. */ class TCPConnectionHandler : public ACE_Svc_Handler { public: typedef ACE_Svc_Handler inherited; public: TCPConnectionHandler (bool p_serverSide = false); virtual ~TCPConnectionHandler (); virtual int handle_output (ACE_HANDLE handle); virtual int handle_input (ACE_HANDLE handle); virtual int handle_close (ACE_HANDLE handle,ACE_Reactor_Mask close_mask); //FUZZ: disable check_for_lack_ACE_OS ///FUZZ: enable check_for_lack_ACE_OS virtual int open (void * = 0); int scheduleSend (ACE_Message_Block *); int sendBuffers (); int totalReceived () const; int totalSent () const; private: ACE_Message_Block *buffers_; int totalReceived_; //!< total number of received bytes int totalSent_; //!< total number of send bytes bool serverSide_; //!< if true, echo received data int pingsNo_; //!< number of pings client should make }; typedef ACE_Connector< TCPConnectionHandler, ACE_SOCK_CONNECTOR > TCPConnectorHandler; class TCPAcceptorHandler; // forward declaration /* \class HandlersRegister \brief The collection of test tools. Here ACE classes bind to Qt application */ class HandlersRegister { public: HandlersRegister (ACE_Reactor *p_reactor); virtual ~HandlersRegister (); int scheduleTimers (const ACE_Time_Value &p_TestTime); //!< schedule ace timers int registerDgramHandlers (); //!< open dgrams socket and register in reactor int registerTCPHandlers (); //!< creates TCP acceptors and connector int analyze () const; //!< analyze results int analyzeTimeouts () const; //!< analyze triggered timeouts int analyzeDgrams () const; //!< analyze collected dgrams int analyzeTCP () const; //!< analyze TCP transmission int registerTCPServer (TCPConnectionHandler *); int TCPServersNo () const; //!< return the number of accepted connections private: ACE_Reactor *reactor_; //!< reactor for this application DgramHandler *DgramHandlers_[ HandlersNo] ;//!< dgram input handlers int TCPServersNo_; //!< number of accepted connections TCPConnectionHandler *TCPServers_[ HandlersNo ]; TCPConnectionHandler *TCPClients_[ HandlersNo ]; TCPAcceptorHandler *acceptor_; TCPConnectorHandler *connectors_[ HandlersNo ]; }; class TCPAcceptorHandler : public ACE_Acceptor< TCPConnectionHandler, ACE_SOCK_ACCEPTOR > { public: typedef ACE_Acceptor< TCPConnectionHandler, ACE_SOCK_ACCEPTOR > inherited; public: TCPAcceptorHandler (HandlersRegister *p_handlersRegister); virtual ~TCPAcceptorHandler (); virtual int make_svc_handler (TCPConnectionHandler *& sh); virtual int activate_svc_handler (TCPConnectionHandler * sh); private: HandlersRegister *handlersRegister_; }; /* DgramHandler class implementation */ DgramHandler::DgramHandler (ACE_Reactor *p_reactor): ACE_Event_Handler (p_reactor), dgramsSent_ (0), dgramsReceived_ (0), timeoutsTriggered_ (0), expectedTriggers_ (0) { reference_counting_policy ().value (Reference_Counting_Policy::ENABLED); } DgramHandler::~DgramHandler () { ACE_TRACE ("DgramHandler::~DgramHandler"); } int DgramHandler::open (const ACE_INET_Addr &local, int protocol_family, int protocol, int reuse_addr) { if (0 > peer_.open (local, protocol_family, protocol, reuse_addr)) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" (%P) %p\n"), ACE_TEXT ("Cannot oper dgram socket")), -1); return 0; } ACE_HANDLE DgramHandler::get_handle () const { return peer_.get_handle (); } int DgramHandler::handle_input (ACE_HANDLE) { int recvBuffer; ACE_INET_Addr peerAddress; int result = peer_.recv (&recvBuffer, sizeof (recvBuffer) , peerAddress); if (0 >= result) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" (%P) %p\n"), ACE_TEXT ("While reading datagram from socket")) , -1); else ++dgramsReceived_; return 0; } int DgramHandler::handle_timeout (const ACE_Time_Value ¤t_time, const void *act) { ACE_UNUSED_ARG (current_time); ACE_UNUSED_ARG (act); int sendBuffer = 0; if (++timeoutsTriggered_ >= expectedTriggers_) reactor ()->cancel_timer (this, 1); ACE_SOCK_Dgram socket; if (-1 == socket.open (ACE_INET_Addr (static_cast< u_short > (0), static_cast< ACE_UINT32 > (INADDR_ANY)), ACE_PROTOCOL_FAMILY_INET, 0, 1)) ACE_ERROR ((LM_ERROR, ACE_TEXT (" (%P) %p\n"), ACE_TEXT ("Cannot open socket for sending Qt dgrams"))); ACE_INET_Addr peerAddr; peer_.get_local_addr (peerAddr); if (sizeof (sendBuffer) != socket.send (&sendBuffer, sizeof (sendBuffer), peerAddr)) ACE_ERROR ((LM_ERROR, ACE_TEXT (" (%P) %p\n"), ACE_TEXT ("Cannot send dgram"))); else ++dgramsSent_; socket.close (); return 0; } int DgramHandler::handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask) { if (peer_.get_handle () != handle ) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Unknown handle %d DgramHandler::handle_close " "with mask %x. My handle is %d\n"), handle, close_mask, peer_.get_handle ())); else peer_.close (); return 0; } int DgramHandler::dgramsSent () const { return dgramsSent_; } int DgramHandler::dgramsReceived () const { return dgramsReceived_; } int DgramHandler::timeoutsTriggered () const { return timeoutsTriggered_; } void DgramHandler::expectedTriggers (int triggers) { expectedTriggers_ = triggers; } int DgramHandler::expectedTriggers () const { return expectedTriggers_; } /* TCPConnectionHandler class implementation */ TCPConnectionHandler::TCPConnectionHandler (bool p_serverSide): buffers_ (0), totalReceived_ (0), totalSent_ (0), serverSide_ (p_serverSide), pingsNo_ (TCPClientPings) { reference_counting_policy ().value (Reference_Counting_Policy::ENABLED); } TCPConnectionHandler::~TCPConnectionHandler () { ACE_TRACE ("TCPConnectionHandler::~TCPConnectionHandler"); } int TCPConnectionHandler::handle_input (ACE_HANDLE handle) { ACE_UNUSED_ARG (handle); ACE_Message_Block *buffer = new ACE_Message_Block (TCPBytesToSend); int bytesReceived = peer_.recv (buffer->wr_ptr (), buffer->space ()); if (bytesReceived > 0) { totalReceived_ += bytesReceived; if (serverSide_ || --pingsNo_ > 0) // echo received buffer { buffer->wr_ptr (bytesReceived); int result = scheduleSend (buffer); if (0 > result) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" (%P) %p\n"), ACE_TEXT ("Cannot schedule TCP reply")), -1); } else buffer->release (); return 0; } if (errno != EWOULDBLOCK) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" (%P:%p (%d)\n"), ACE_TEXT ("TCPConnectionHandler::handle_input call with no data on handle "), handle), -1); ACE_ERROR ((LM_WARNING, ACE_TEXT (" (%P:%p (%d)\n"), ACE_TEXT ("TCPConnectionHandler::handle_input call with no data on handle "), handle)); return 0; } int TCPConnectionHandler::handle_output (ACE_HANDLE handle) { ACE_UNUSED_ARG (handle); if (!buffers_) ACE_ERROR ((LM_ERROR, ACE_TEXT ("TCPConnectionHandler::handle_output call for empty buffers (%d)\n"), handle)); if (0 > sendBuffers ()) // socket broken, kill yourself return -1; if (!buffers_) // everything already send, unregister { reactor ()->cancel_wakeup (this, ACE_Event_Handler::WRITE_MASK | ACE_Event_Handler::DONT_CALL); reactor ()->remove_handler (this, ACE_Event_Handler::WRITE_MASK | ACE_Event_Handler::DONT_CALL); } return 0; } int TCPConnectionHandler::open (void * ) { int result = inherited::open (); if (!serverSide_) { ACE_Message_Block *buffer = new ACE_Message_Block (TCPBytesToSend); char *bufferData = buffer->wr_ptr (); int i; for (i = buffer->size () - 1; i >= 0; --i) bufferData[ i ] = static_cast< char > (i); buffer->wr_ptr (buffer->size ()); if (0 != (scheduleSend (buffer))) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Cannot schedule initial send\n")), -1); } return result; } int TCPConnectionHandler::scheduleSend (ACE_Message_Block * buffer) { // link buffer to the end of buffers list if (buffers_) { ACE_Message_Block *lastBuffer = buffers_; while (lastBuffer->cont ()) lastBuffer = lastBuffer->cont () ; lastBuffer->cont (buffer); } else buffers_ = buffer; if (0 > sendBuffers ()) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" (%P) %p\n"), ACE_TEXT ("Cannot schedule TCP send.")), -1); return 0; } int TCPConnectionHandler::sendBuffers () { int result = 0; if (buffers_) if (0 < (result = peer_.send_n (buffers_))) // remove sent blocks { totalSent_ += result; while (buffers_ && static_cast< size_t > (result) >= buffers_->length ()) { ACE_Message_Block *buffer = buffers_; result -= buffers_->length (); buffers_= buffers_->cont (); buffer->cont (0); buffer->release (); } if (buffers_) // some buffers were not sent, truncate data buffers_->rd_ptr (result); } return result; } int TCPConnectionHandler::handle_close (ACE_HANDLE handle,ACE_Reactor_Mask close_mask) { if (peer_.get_handle () != handle ) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Unknown handle %d TCPConnectionHandler::handle_close " "with mask %x. My handle is %d\n"), handle, close_mask, peer_.get_handle ())); else peer_.close (); return 0; } int TCPConnectionHandler::totalReceived () const { return totalReceived_; } int TCPConnectionHandler::totalSent () const { return totalSent_; } /* HandlersRegister class implementation */ HandlersRegister::HandlersRegister (ACE_Reactor *p_reactor): reactor_ (p_reactor), TCPServersNo_ (0) { int i; for (i = 0; i < HandlersNo; ++i) { // create dgram input handler DgramHandlers_[ i ] = new DgramHandler (p_reactor); TCPServers_[ i ] = 0; TCPClients_[ i ] = new TCPConnectionHandler (false); connectors_[ i ] =new TCPConnectorHandler (p_reactor, ACE_NONBLOCK); connectors_[ i ]->reference_counting_policy ().value ( ACE_Event_Handler::Reference_Counting_Policy::ENABLED) ; } acceptor_ = new TCPAcceptorHandler (this); acceptor_->reactor (p_reactor); } HandlersRegister::~HandlersRegister () { int i; if (acceptor_) { reactor_->remove_handler (acceptor_, ACE_Event_Handler::ALL_EVENTS_MASK); acceptor_->close (); acceptor_->remove_reference (); } for (i = 0; i < HandlersNo; ++i) { reactor_->cancel_timer (DgramHandlers_[ i ], 1); reactor_->remove_handler (DgramHandlers_[ i ], ACE_Event_Handler::ALL_EVENTS_MASK); DgramHandlers_[ i ]->remove_reference (); if (TCPServers_[ i ]) { reactor_->remove_handler (TCPServers_[ i ], ACE_Event_Handler::ALL_EVENTS_MASK); TCPServers_[ i ]->remove_reference (); } reactor_->remove_handler (connectors_[ i ], ACE_Event_Handler::ALL_EVENTS_MASK); connectors_[ i ]->close (); connectors_[ i ]->remove_reference (); if (TCPClients_[ i ]) { reactor_->remove_handler (TCPClients_[ i ], ACE_Event_Handler::ALL_EVENTS_MASK); TCPClients_[ i ]->remove_reference (); } } } int HandlersRegister::TCPServersNo () const { return TCPServersNo_; } int HandlersRegister::scheduleTimers (const ACE_Time_Value &p_TestTime) { int i; for (i = 0; i < HandlersNo; ++i) { if (-1 == reactor_->schedule_timer (DgramHandlers_[ i ], (const void *) 0, ACE_Time_Value::zero, p_TestTime * (0.5 / DgramsToSend))) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" (%P) %p\n"), ACE_TEXT ("Cannot schedule ACE timer")), -1); DgramHandlers_[ i ] ->expectedTriggers (DgramsToSend); } return 0; } int HandlersRegister::registerDgramHandlers () { int i; // open dgram handlers for all ports for (i = 0; i < HandlersNo; ++i) if (-1 == DgramHandlers_[ i ]->open ( ACE_INET_Addr (i + BaseDgramPort, ACE_TEXT ("127.0.0.1"), ACE_PROTOCOL_FAMILY_INET))) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" (%P) %p\n"), ACE_TEXT ("Cannot open dgram handler")), -1); // register dgram handlers for (i = 0; i < HandlersNo; ++i) if (-1 == reactor_->register_handler (DgramHandlers_[ i ], ACE_Event_Handler::READ_MASK)) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" (%P) %p\n"), ACE_TEXT ("Cannot register dgram handler")), -1); return 0; } int HandlersRegister::registerTCPHandlers () { ACE_INET_Addr addr (BaseTCPPort); if (-1 == acceptor_->open (addr, reactor_, 1)) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" (%P) %p\n"), ACE_TEXT ("Cannot open acceptor port")), -1); int i; addr.set (BaseTCPPort, ACE_TEXT ("127.0.0.1")); for (i = 0; i < HandlersNo; ++i) { if (-1 == connectors_[ i ]->connect ( TCPClients_[ i ], addr, ACE_Synch_Options::asynch)) if (errno != EWOULDBLOCK ) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" (%P) %p (%d)\n"), ACE_TEXT ("Cannot connect connector"), i), -1); } return 0; } int HandlersRegister::registerTCPServer (TCPConnectionHandler *handler) { if (TCPServersNo_ < HandlersNo) { TCPServers_[ TCPServersNo_++ ] = handler; return 0; } ACE_ERROR ((LM_ERROR, ACE_TEXT ("Too many servers registered (%d). ACE_Reactor or ACE_Acceptor broken?\n"), handler->get_handle ())); return -1; } int HandlersRegister::analyze () const { int result = 0; if (0 > analyzeTimeouts ()) result = -1; if (0 > analyzeDgrams ()) result = -1; if (0 > analyzeTCP ()) result = -1; return result; } int HandlersRegister::analyzeTimeouts () const { int i; int result = 0; for (i = 0; i < HandlersNo; ++i) if (DgramHandlers_[ i ]->expectedTriggers () != DgramHandlers_[ i ]->timeoutsTriggered ()) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Dgram_Handlers (%d) expected %d timeouts" " but triggered only %d.\n"), i, DgramHandlers_[ i ]->expectedTriggers (), DgramHandlers_[ i ]->timeoutsTriggered ())); result = -1; } return result; } int HandlersRegister::analyzeDgrams () const { int result = 0; int i; for (i = 0; i < HandlersNo; ++i) if (DgramHandlers_[ i ]->dgramsSent () != DgramHandlers_[ i ]->dgramsReceived ()) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("DgramsHandler (%d) sent %d dgrams but received only %d." "Either reactor failed or system lost local dgrams..\n"), DgramHandlers_[ i ]->dgramsSent (), DgramHandlers_[ i ]->dgramsReceived ())); result = -1 ; } return result; } int HandlersRegister::analyzeTCP () const { int i; int result = 0; for (i = 0; i < HandlersNo; ++i) { if (TCPClients_[ i ]->totalSent () != TCPTotalBytesToSend ) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("TCPClient (%d): wanted to send %d but sent only (%d).\n"), i, TCPTotalBytesToSend, TCPClients_[ i ]->totalSent ())); result = -1; } if (TCPClients_[ i ]->totalReceived () != TCPTotalBytesToSend ) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("TCPClient (%d): expected %d bytes but received only (%d).\n"), i, TCPTotalBytesToSend, TCPClients_[ i ]->totalReceived ())); result = -1; } if (TCPServers_[ i ]) { if (TCPServers_[ i ]->totalSent () != TCPTotalBytesToSend ) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("TCPServer (%d): wanted to send %d bytes " "but sent only (%d).\n"), i, TCPTotalBytesToSend, TCPServers_[ i ]->totalSent ())); result = -1; } if (TCPServers_[ i ]->totalReceived () != TCPTotalBytesToSend ) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("TCPServer (%d): expected %d bytes but received only (%d).\n"), i, TCPTotalBytesToSend, TCPServers_[ i ]->totalReceived ())); result = -1; } } else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("TCPServer (%d): not connected.\n"), i)); result = -1; } } return result; } /* TCPAcceptorHandler class implementation */ TCPAcceptorHandler::TCPAcceptorHandler (HandlersRegister *p_handlersRegister): handlersRegister_ (p_handlersRegister) { reference_counting_policy ().value (Reference_Counting_Policy::ENABLED); } int TCPAcceptorHandler::make_svc_handler (TCPConnectionHandler *& sh) { sh = new TCPConnectionHandler (true); sh->reactor (reactor ()); if (handlersRegister_->TCPServersNo () >= HandlersNo) ACE_ERROR ((LM_ERROR, ACE_TEXT ("TCPAcceptorHandler::make_svc_handler called to many times!\n"))); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TCPAcceptorHandler::make_svc_handler new TCP server created\n"))); return 0; } int TCPAcceptorHandler::activate_svc_handler (TCPConnectionHandler * sh) { if (0 == inherited::activate_svc_handler (sh) ) { if (0 != handlersRegister_->registerTCPServer (sh)) // for analysis { // release event handler reactor ()->remove_handler (sh, ACE_Event_Handler::ALL_EVENTS_MASK); sh->remove_reference (); // report error ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Cannot register server TCPConnectionHandler\n")), -1); } } else ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Failed to create server TCPConnectionHandler\n")), -1); return 0; } TCPAcceptorHandler::~TCPAcceptorHandler () { ACE_TRACE ("TCPAcceptorHandler::~TCPAcceptorHandler"); } void testNativeReactor (int, ACE_TCHAR *[]) { ACE_DEBUG ((LM_INFO, ACE_TEXT ("Testing autotest using native reactor\n"))); ACE_Reactor reactor; HandlersRegister handlersRegister (&reactor); ACE_Time_Value testTime (TotalTestTime / 1000, (TotalTestTime % 1000) * 1000); if (0 <= handlersRegister.scheduleTimers (testTime) && 0 <= handlersRegister.registerDgramHandlers () && 0 <= handlersRegister.registerTCPHandlers ()) { reactor.run_reactor_event_loop (testTime); if (0 != handlersRegister.analyze ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Test failed for native reactor. " "Fix QtReactor_Test or ACE_Reactor.\n"))); else ACE_ERROR ((LM_INFO, ACE_TEXT ("Test seems to work with native reactor.\n"))); } } void testQtReactor (int argc, ACE_TCHAR *argv[]) { // Qt specific code ACE_DEBUG ((LM_INFO, ACE_TEXT ("Testing QtReactor\n"))); ACE_Argv_Type_Converter ct (argc, argv); QTestApplication app (argc, ct.get_ASCII_argv ()); ACE_QtReactor qtReactor (&app); ACE_Reactor reactor (&qtReactor); HandlersRegister handlersRegister (&reactor); ACE_Time_Value testTime (TotalTestTime / 1000, (TotalTestTime % 1000) * 1000); if (0 <= handlersRegister.scheduleTimers (testTime) && 0 <= handlersRegister.registerDgramHandlers () && 0 <= handlersRegister.registerTCPHandlers ()) { app.exec (TotalTestTime); if (0 != handlersRegister.analyze ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("QtReactor_Test failed.\n"))); else ACE_ERROR ((LM_INFO, ACE_TEXT ("QtReactor_Test passed.\n"))); } } int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("QtReactor_Test")); testNativeReactor (argc, argv); testQtReactor (argc, argv); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/MT_Reference_Counted_Notify_Test.cpp0000644000175000017500000002615715027201773023356 0ustar sudipsudip //============================================================================= /** * @file MT_Reference_Counted_Notify_Test.cpp * * This test is used to check reference counting of the event * handlers when it interacts with the reactor notification * mechanism. * * @author Irfan Pyarali */ //============================================================================= #include "test_config.h" #include "ace/OS_NS_unistd.h" #include "ace/Reactor.h" #include "ace/Select_Reactor.h" #include "ace/TP_Reactor.h" #include "ace/WFMO_Reactor.h" #include "ace/Dev_Poll_Reactor.h" #include "ace/Task.h" #include "ace/Get_Opt.h" #if defined (ACE_HAS_THREADS) static int test_select_reactor = 1; static int test_tp_reactor = 1; static int test_wfmo_reactor = 1; static int test_dev_poll_reactor = 1; static int test_empty_notify = 1; static int test_simple_notify = 1; static int test_reference_counted_notify = 1; static int iterations = 5; static int debug = 1; class Reference_Counted_Event_Handler : public ACE_Event_Handler { public: Reference_Counted_Event_Handler (); ~Reference_Counted_Event_Handler () override; int handle_input (ACE_HANDLE) override; ACE_Event_Handler::Reference_Count add_reference () override; ACE_Event_Handler::Reference_Count remove_reference () override; }; Reference_Counted_Event_Handler::Reference_Counted_Event_Handler () { this->reference_counting_policy ().value (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Reference count in Reference_Counted_Event_Handler() ") ACE_TEXT ("is %d\n"), this->reference_count_.load ())); } Reference_Counted_Event_Handler::~Reference_Counted_Event_Handler () { if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Reference count in ~Reference_Counted_Event_Handler() ") ACE_TEXT ("is %d\n"), this->reference_count_.load ())); if (0 != this->reference_count_.load ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Reference count in ~Reference_Counted_Event_Handler() ") ACE_TEXT ("should be 0 but is %d\n"), this->reference_count_.load ())); } int Reference_Counted_Event_Handler::handle_input (ACE_HANDLE) { if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Reference count in Reference_Counted_Event_Handler::") ACE_TEXT ("handle_input() is %d\n"), this->reference_count_.load ())); if (2 != this->reference_count_.load ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Reference count in Reference_Counted_Event_Handler::") ACE_TEXT ("handle_input() should be 2 but is %d\n"), this->reference_count_.load ())); return 0; } ACE_Event_Handler::Reference_Count Reference_Counted_Event_Handler::add_reference () { ACE_Event_Handler::Reference_Count reference_count = this->ACE_Event_Handler::add_reference (); if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Reference count after add_reference() is %d\n"), this->reference_count_.load ())); return reference_count; } ACE_Event_Handler::Reference_Count Reference_Counted_Event_Handler::remove_reference () { ACE_Event_Handler::Reference_Count reference_count = this->ACE_Event_Handler::remove_reference (); if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Reference count after remove_reference() is %d\n"), reference_count)); return reference_count; } class Simple_Event_Handler : public ACE_Event_Handler { public: Simple_Event_Handler (int notifies); ~Simple_Event_Handler () override; int handle_input (ACE_HANDLE) override; int notifies_; }; Simple_Event_Handler::Simple_Event_Handler (int notifies) : notifies_ (notifies) { if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Simple_Event_Handler()\n"))); } Simple_Event_Handler::~Simple_Event_Handler () { if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("~Simple_Event_Handler()\n"))); } int Simple_Event_Handler::handle_input (ACE_HANDLE) { if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Simple_Event_Handler::handle_input()\n"))); this->notifies_--; if (this->notifies_ == 0) delete this; return 0; } class Event_Loop_Thread : public ACE_Task_Base { public: Event_Loop_Thread (ACE_Thread_Manager &thread_manager, ACE_Reactor &reactor, int extra_iterations_needed); int svc () override; ACE_Reactor &reactor_; int extra_iterations_needed_; }; Event_Loop_Thread::Event_Loop_Thread (ACE_Thread_Manager &thread_manager, ACE_Reactor &reactor, int extra_iterations_needed) : ACE_Task_Base (&thread_manager), reactor_ (reactor), extra_iterations_needed_ (extra_iterations_needed) { } int Event_Loop_Thread::svc () { int counter = 0; // Simply run the event loop. this->reactor_.owner (ACE_Thread::self ()); while (1) { counter++; if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Event Loop iteration %d....\n"), counter)); this->reactor_.handle_events (); if (counter == iterations + this->extra_iterations_needed_) break; } return 0; } void notify (ACE_Reactor &reactor, ACE_Event_Handler *event_handler, int extra_iterations_needed) { ACE_Thread_Manager thread_manager; // Create a thread to run the event loop. Event_Loop_Thread event_loop_thread (thread_manager, reactor, extra_iterations_needed); int result = event_loop_thread.activate (); ACE_TEST_ASSERT (result == 0); for (int i = 0; i < iterations; ++i) { ACE_OS::sleep (ACE_Time_Value (0, 500 * 1000)); result = reactor.notify (event_handler, ACE_Event_Handler::READ_MASK); ACE_TEST_ASSERT (result == 0); } thread_manager.wait (); } template class test { public: test (int extra_iterations_needed); }; template test::test (int extra_iterations_needed) { if (test_empty_notify) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n\nTesting empty notifies...\n\n"))); REACTOR_IMPLEMENTATION impl; ACE_Reactor reactor (&impl, 0); notify (reactor, 0, extra_iterations_needed); } if (test_simple_notify) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n\nTesting simple notifies...\n\n"))); REACTOR_IMPLEMENTATION impl; ACE_Reactor reactor (&impl, 0); Simple_Event_Handler *simple_event_handler = new Simple_Event_Handler (iterations); notify (reactor, simple_event_handler, extra_iterations_needed); } if (test_reference_counted_notify) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n\nTesting reference counted notifies...\n\n"))); REACTOR_IMPLEMENTATION impl; ACE_Reactor reactor (&impl, 0); Reference_Counted_Event_Handler *reference_counted_event_handler = new Reference_Counted_Event_Handler; ACE_Event_Handler_var safe_event_handler (reference_counted_event_handler); notify (reactor, reference_counted_event_handler, extra_iterations_needed); } } static int parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("a:b:c:d:e:f:g:z:")); int cc; while ((cc = get_opt ()) != -1) { switch (cc) { case 'a': test_select_reactor = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'b': test_tp_reactor = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'c': test_wfmo_reactor = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'd': test_dev_poll_reactor = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'e': test_empty_notify = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'f': test_simple_notify = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'g': test_reference_counted_notify = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'z': debug = ACE_OS::atoi (get_opt.opt_arg ()); break; default: ACE_ERROR ((LM_ERROR, ACE_TEXT ("\nusage: %s \n\n") ACE_TEXT ("\t[-a test Select Reactor] (defaults to %d)\n") ACE_TEXT ("\t[-b test TP Reactor] (defaults to %d)\n") ACE_TEXT ("\t[-c test WFMO Reactor] (defaults to %d)\n") ACE_TEXT ("\t[-d test Dev Poll Reactor] (defaults to %d)\n") ACE_TEXT ("\t[-e test empty notify] (defaults to %d)\n") ACE_TEXT ("\t[-f test simple notify] (defaults to %d)\n") ACE_TEXT ("\t[-g test reference counted notify] (defaults to %d)\n") ACE_TEXT ("\t[-z debug] (defaults to %d)\n") ACE_TEXT ("\n"), argv[0], test_select_reactor, test_tp_reactor, test_wfmo_reactor, test_dev_poll_reactor, test_empty_notify, test_simple_notify, test_reference_counted_notify, debug)); return -1; } } return 0; } int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("MT_Reference_Counted_Notify_Test")); // Validate options. int result = parse_args (argc, argv); if (result != 0) return result; int extra_iterations_needed = 1; int extra_iterations_not_needed = 0; if (test_select_reactor) { ACE_DEBUG ((LM_DEBUG, "\n\nTesting Select Reactor....\n\n")); test test (extra_iterations_not_needed); ACE_UNUSED_ARG (test); } if (test_tp_reactor) { ACE_DEBUG ((LM_DEBUG, "\n\nTesting TP Reactor....\n\n")); test test (extra_iterations_not_needed); ACE_UNUSED_ARG (test); } #if defined (ACE_HAS_EVENT_POLL) if (test_dev_poll_reactor) { ACE_DEBUG ((LM_DEBUG, "\n\nTesting Dev Poll Reactor....\n\n")); test test (extra_iterations_not_needed); ACE_UNUSED_ARG (test); } #endif #if defined (ACE_WIN32) if (test_wfmo_reactor) { ACE_DEBUG ((LM_DEBUG, "\n\nTesting WFMO Reactor....\n\n")); test test (extra_iterations_needed); ACE_UNUSED_ARG (test); } #else /* ACE_WIN32 */ ACE_UNUSED_ARG (extra_iterations_needed); #endif /* ACE_WIN32 */ ACE_END_TEST; return 0; } #else /* ACE_HAS_THREADS */ int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("MT_Reference_Counted_Notify_Test")); ACE_ERROR ((LM_INFO, ACE_TEXT ("threads not supported on this platform\n"))); ACE_END_TEST; return 0; } #endif /* ACE_HAS_THREADS */ ace-8.0.4+dfsg.orig/tests/NonBlocking_Conn_Test.cpp0000644000175000017500000002203715027201773021220 0ustar sudipsudip //============================================================================= /** * @file NonBlocking_Conn_Test.cpp * * This test checks for the proper working of the following: * - blocking connections * - blocking connections with timeouts * - non-blocking connections * - non-blocking connections without waiting for completions * - non-blocking connections with timeouts * * @author Irfan Pyarali */ //============================================================================= #include "test_config.h" #include "NonBlocking_Conn_Test.h" #include "ace/Connector.h" #include "ace/SOCK_Connector.h" #include "ace/Select_Reactor.h" #include "ace/TP_Reactor.h" #include "ace/WFMO_Reactor.h" #include "ace/Get_Opt.h" static bool test_select_reactor = true; static bool test_tp_reactor = true; static bool test_wfmo_reactor = true; static int result = 0; Svc_Handler::Svc_Handler (bool is_ref_counted) : status_ (0), completion_counter_ (0), is_ref_counted_ (is_ref_counted) { if (this->is_ref_counted_) { // Enable reference counting on the event handler. this->reference_counting_policy ().value ( ACE_Event_Handler::Reference_Counting_Policy::ENABLED); } } void Svc_Handler::connection_status (Connection_Status &status, int &completion_counter) { this->status_ = &status; this->completion_counter_ = &completion_counter; } int Svc_Handler::open (void *) { *this->status_ = Svc_Handler::Conn_SUCCEEDED; (*this->completion_counter_)++; ACE_TCHAR buf[BUFSIZ]; ACE_INET_Addr raddr; this->peer ().get_remote_addr (raddr); raddr.addr_to_string (buf, sizeof buf); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Connection to %s is opened\n"), buf)); return 0; } int Svc_Handler::handle_close (ACE_HANDLE handle, ACE_Reactor_Mask mask) { *this->status_ = Svc_Handler::Conn_FAILED; (*this->completion_counter_)++; // Only if there is no reference counting can call parent's // handle_close() as it does plain 'delete this'. if (!this->is_ref_counted_) { using super = ACE_Svc_Handler; return super::handle_close (handle, mask); } return 0; } using CONNECTOR = ACE_Connector; static const char* hosts[] = { "www.russiantvguide.com:80", "news.bbc.co.uk:80", "www.cnn.com:80", "www.waca.com.au:80", "www.uganda.co.ug:80", "cse.wustl.edu:80", "www.dre.vanderbilt.edu:80", "www.msn.com:80", "www.presidencymaldives.gov.mv:80" }; static int number_of_connections = 0; static bool with_ref_counting = false; void test_connect (ACE_Reactor &reactor, ACE_INET_Addr *addresses, ACE_Synch_Options &synch_options, Svc_Handler::Completion_Status complete_nonblocking_connections) { CONNECTOR connector (&reactor); int i = 0; int completion_counter = 0; Svc_Handler::Connection_Status *connection_status = new Svc_Handler::Connection_Status[number_of_connections]; Svc_Handler **svc_handlers = new Svc_Handler *[number_of_connections]; for (i = 0; i < number_of_connections; ++i) { svc_handlers[i] = new Svc_Handler (with_ref_counting); svc_handlers[i]->connection_status (connection_status[i], completion_counter); } connector.connect_n (number_of_connections, svc_handlers, addresses, 0, synch_options); if (!synch_options[ACE_Synch_Options::USE_REACTOR]) ACE_TEST_ASSERT (completion_counter == number_of_connections); if (complete_nonblocking_connections != Svc_Handler::Comp_NO) { while (completion_counter != number_of_connections) { connector.reactor ()->handle_events (); } } connector.close (); for (i = 0; i < number_of_connections; ++i) { ACE_TCHAR buffer[1024]; addresses[i].addr_to_string (buffer, sizeof buffer / sizeof (ACE_TCHAR), 1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Connection to %s %s\n"), buffer, connection_status[i] == Svc_Handler::Conn_SUCCEEDED ? ACE_TEXT("succeeded") : ACE_TEXT("failed"))); ACE_Event_Handler_var release_guard; if (with_ref_counting) { release_guard.reset (svc_handlers[i]); } if (connection_status[i] == Svc_Handler::Conn_SUCCEEDED) { svc_handlers[i]->close (); } } delete[] svc_handlers; delete[] connection_status; } void test (ACE_Reactor_Impl *impl) { size_t const nr_names = sizeof hosts / sizeof (char *); ACE_INET_Addr *addresses = new ACE_INET_Addr[nr_names]; number_of_connections = 0; for (size_t i = 0; i < nr_names; ++i) { if (addresses[number_of_connections].set (hosts[i]) == 0) ++number_of_connections; else ACE_DEBUG ((LM_INFO, ACE_TEXT ("%p\n"), ACE_TEXT_CHAR_TO_TCHAR (hosts[i]))); } ACE_Reactor reactor (impl, 1); ACE_Synch_Options blocking_connect = ACE_Synch_Options::defaults; ACE_DEBUG ((LM_DEBUG, "Blocking connections...\n")); test_connect (reactor, addresses, blocking_connect, Svc_Handler::Comp_IGNORE); blocking_connect.set (ACE_Synch_Options::USE_TIMEOUT, ACE_Time_Value (0, 50 * 1000)); ACE_DEBUG ((LM_DEBUG, "Blocking connections (with timeouts)...\n")); test_connect (reactor, addresses, blocking_connect, Svc_Handler::Comp_IGNORE); ACE_Synch_Options nonblocking_connect (ACE_Synch_Options::USE_REACTOR); ACE_DEBUG ((LM_DEBUG, "Non-blocking connections...\n")); test_connect (reactor, addresses, nonblocking_connect, Svc_Handler::Comp_YES); ACE_DEBUG ((LM_DEBUG, "Non-blocking connections (without waiting for completions)...\n")); test_connect (reactor, addresses, nonblocking_connect, Svc_Handler::Comp_NO); nonblocking_connect.set (ACE_Synch_Options::USE_REACTOR | ACE_Synch_Options::USE_TIMEOUT, ACE_Time_Value (0, 500 * 1000)); ACE_DEBUG ((LM_DEBUG, "Non-blocking connections (with timeouts)...\n")); test_connect (reactor, addresses, nonblocking_connect, Svc_Handler::Comp_YES); delete[] addresses; } static int parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("a:b:c:")); int cc; while ((cc = get_opt ()) != -1) { switch (cc) { case 'a': test_select_reactor = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'b': test_tp_reactor = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'c': test_wfmo_reactor = ACE_OS::atoi (get_opt.opt_arg ()); break; case '?': case 'u': default: ACE_ERROR ((LM_ERROR, ACE_TEXT ("\nusage: %s \n\n") ACE_TEXT ("\t[-a test Select Reactor] (defaults to %d)\n") ACE_TEXT ("\t[-b test TP Reactor] (defaults to %d)\n") ACE_TEXT ("\t[-c test WFMO Reactor] (defaults to %d)\n") ACE_TEXT ("\n"), argv[0], test_select_reactor, test_tp_reactor, test_wfmo_reactor)); return -1; } } return 0; } int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("NonBlocking_Conn_Test")); // Validate options. result = parse_args (argc, argv); if (result != 0) return result; if (test_select_reactor) { ACE_DEBUG ((LM_DEBUG, "Testing Select Reactor....\n")); with_ref_counting = false; test (new ACE_Select_Reactor); ACE_DEBUG ((LM_DEBUG, "Testing Select Reactor (ref counted)....\n")); with_ref_counting = true; test (new ACE_Select_Reactor); } if (test_tp_reactor) { ACE_DEBUG ((LM_DEBUG, "Testing TP Reactor....\n")); with_ref_counting = false; test (new ACE_TP_Reactor); ACE_DEBUG ((LM_DEBUG, "Testing TP Reactor (ref counted)....\n")); with_ref_counting = true; test (new ACE_TP_Reactor); } #if defined (ACE_WIN32) if (test_wfmo_reactor) { ACE_DEBUG ((LM_DEBUG, "Testing WFMO Reactor....\n")); with_ref_counting = false; test (new ACE_WFMO_Reactor); ACE_DEBUG ((LM_DEBUG, "Testing WFMO Reactor (ref counted)....\n")); with_ref_counting = true; test (new ACE_WFMO_Reactor); } #endif /* ACE_WIN32 */ ACE_END_TEST; return result; } ace-8.0.4+dfsg.orig/tests/Hash_Multi_Map_Manager_Test.cpp0000644000175000017500000002645615027201773022335 0ustar sudipsudip //============================================================================= /** * @file Hash_Multi_Map_Manager_Test.cpp * * This test illustrates the use of to * maintain a hash table using strings. * * @author Shanshan Jiang */ //============================================================================= #include "test_config.h" #include "ace/Hash_Multi_Map_Manager_T.h" #include "ace/Null_Mutex.h" using HASH_STRING_MAP = ACE_Hash_Multi_Map_Manager, ACE_Equal_To, ACE_Null_Mutex>; using HASH_STRING_ENTRY = HASH_STRING_MAP::ENTRY; using HASH_STRING_VALUE_SET = HASH_STRING_ENTRY::VALUE_SET; using HASH_STRING_VALUE_SET_ITERATOR = HASH_STRING_ENTRY::VALUE_SET_ITERATOR; using HASH_STRING_ITERATOR = HASH_STRING_MAP::ITERATOR; using HASH_STRING_CONST_ITERATOR = HASH_STRING_MAP::CONST_ITERATOR; using HASH_STRING_REVERSE_ITERATOR = HASH_STRING_MAP::REVERSE_ITERATOR; static const ACE_TCHAR *color_sorts[] = {ACE_TEXT ("warm"), ACE_TEXT ("cold"), ACE_TEXT ("neutral"), 0}; static const ACE_TCHAR *warm_colors[] = {ACE_TEXT ("red"), ACE_TEXT ("yellow"), ACE_TEXT ("orange"), 0}; static const ACE_TCHAR *cold_colors[] = {ACE_TEXT ("blue"), ACE_TEXT ("cyan"), 0}; static const ACE_TCHAR *neutral_colors[] = {ACE_TEXT ("green"), ACE_TEXT ("purple"), 0}; static int run_test () { HASH_STRING_MAP colors; size_t i; // Check the operation. for (i = 0; warm_colors[i] != 0; i++) { if (colors.bind (color_sorts[0], warm_colors[i]) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("bind failed for %s in %s\n"), warm_colors[i], color_sorts[0]), -1); } HASH_STRING_ENTRY *entry = 0; for (i = 0; cold_colors[i] != 0; i++) { if (colors.bind (color_sorts[1], cold_colors[i], entry) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("bind failed for %s in %s\n"), cold_colors[i], color_sorts[1]), -1); } HASH_STRING_VALUE_SET value_set; entry = 0; for (i = 0; neutral_colors[i] != 0; i++) value_set.insert (neutral_colors[i]); if (colors.bind (color_sorts[2], value_set, entry) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("bind failed for %s\n"), color_sorts[2]), -1); // Check the operation. value_set.reset (); if (colors.trybind (color_sorts[2], value_set) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("bind failed for %s\n"), color_sorts[2]), -1); value_set.reset (); entry = 0; if (colors.trybind (color_sorts[2], value_set, entry) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("bind failed for %s\n"), color_sorts[2]), -1); value_set.reset (); entry = 0; if (colors.trybind (color_sorts[2], value_set, entry) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("bind failed for %s\n"), color_sorts[2]), -1); // Check the operation. value_set.reset (); value_set.insert (neutral_colors[0]); if (colors.rebind (color_sorts[2], value_set) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("bind failed for %s\n"), color_sorts[2]), -1); value_set.reset (); value_set.insert (neutral_colors[1]); entry = 0; if (colors.rebind (color_sorts[2], value_set, entry) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("bind failed for %s\n"), color_sorts[2]), -1); value_set.reset (); value_set.insert (neutral_colors[0]); HASH_STRING_VALUE_SET old_value_set; if (colors.rebind (color_sorts[2], value_set, old_value_set) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("bind failed for %s\n"), color_sorts[2]), -1); value_set.reset (); value_set.insert (neutral_colors[1]); old_value_set.reset (); entry = 0; if (colors.rebind (color_sorts[2], value_set, old_value_set, entry) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("bind failed for %s\n"), color_sorts[2]), -1); value_set.reset (); value_set.insert (neutral_colors[0]); const ACE_TCHAR *old_key; old_value_set.reset (); if (colors.rebind (color_sorts[2], value_set, old_key, old_value_set) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("bind failed for %s\n"), color_sorts[2]), -1); value_set.reset (); for (i = 0; neutral_colors[i] != 0; i++) value_set.insert (neutral_colors[i]); old_key = 0; old_value_set.reset (); entry = 0; if (colors.rebind (color_sorts[2], value_set, old_key, old_value_set, entry) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("bind failed for %s\n"), color_sorts[2]), -1); // Check the operation. for (i = 0; color_sorts[i] != 0; i++) if (colors.find (color_sorts[i]) == 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s found\n"), color_sorts[i])); else ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%s not found\n"), color_sorts[i]), -1); entry = 0; for (i = 0; color_sorts[i] != 0; i++) if (colors.find (color_sorts[i], entry) == 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s found\n"), color_sorts[i])); else ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%s not found\n"), color_sorts[i]), -1); value_set.reset (); for (i = 0; color_sorts[i] != 0; i++) if (colors.find (color_sorts[i], value_set) == 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s found\n"), color_sorts[i])); else ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%s not found\n"), color_sorts[i]), -1); for (i = 0; warm_colors[i] != 0; i++) if (colors.find (color_sorts[0], warm_colors[i]) == 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s color %s found\n"), color_sorts[0], warm_colors[i])); else ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%s color %s not found\n"), color_sorts[0], warm_colors[i]), -1); // Check the iterator. i = 0; entry = 0; for (HASH_STRING_ITERATOR hash_iter (colors); hash_iter.next (entry) != 0; hash_iter.advance ()) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("iterating (%d): %s:\n"), i, entry->key ())); i++; for (HASH_STRING_VALUE_SET_ITERATOR iter (entry->item ()); iter != entry->item ().end (); iter++) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s \n"), *iter)); } } // Check the unbind operation. if (colors.unbind (color_sorts[0]) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("unbind failed for %s\n"), color_sorts[1]), -1); for (i = 0; warm_colors[i] != 0; i++) { if (colors.bind (color_sorts[0], warm_colors[i]) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("bind failed for %s in %s\n"), warm_colors[i], color_sorts[0]), -1); } value_set.reset (); if (colors.unbind (color_sorts[0], value_set) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("unbind failed for %s\n"), color_sorts[1]), -1); for (i = 0; warm_colors[i] != 0; i++) { if (colors.bind (color_sorts[0], warm_colors[i]) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("bind failed for %s in %s\n"), warm_colors[i], color_sorts[0]), -1); } for (i = 0; warm_colors[i] != 0; i++) { if (colors.unbind (color_sorts[0], warm_colors[i]) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("unbind failed for %s in %s\n"), warm_colors[i], color_sorts[0]), -1); } // Check the reverse iterator. i = 0; entry = 0; for (HASH_STRING_REVERSE_ITERATOR hash_iter (colors); hash_iter.next (entry) != 0; hash_iter.advance ()) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("reverse iterating (%d): %s\n"), i, entry->key ())); i++; for (HASH_STRING_VALUE_SET_ITERATOR iter (entry->item ()); iter != entry->item ().end (); iter++) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s \n"), *iter)); } } entry = 0; colors.find (color_sorts[1], entry); if (colors.unbind (entry) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("unbind failed for %s\n"), color_sorts[1]), -1); // Check the const iterator. i = 0; entry = 0; for (HASH_STRING_CONST_ITERATOR hash_iter (colors); hash_iter.next (entry) != 0; hash_iter.advance ()) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("const iterating (%d): %s\n"), i, entry->key ())); i++; for (HASH_STRING_VALUE_SET_ITERATOR iter (entry->item ()); iter != entry->item ().end (); iter++) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s \n"), *iter)); } } // Check the unbind_all operation. if (colors.unbind_all () != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("unbind_all failed\n")), -1); return 0; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Hash_Multi_Map_Manager_Test")); run_test (); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/MT_Reactor_Timer_Test.cpp0000644000175000017500000002523315027201773021200 0ustar sudipsudip //============================================================================= /** * @file MT_Reactor_Timer_Test.cpp * * This is a simple test that illustrates the timer mechanism of * the reactor scheduling timers, handling expired timers and * cancelling scheduled timers from multiple threads. No command * line arguments are needed to run the test. * * @author Steve Huston */ //============================================================================= #include "test_config.h" #include "MT_Reactor_Timer_Test.h" #include "ace/ACE.h" #include "ace/OS_NS_unistd.h" #if defined (ACE_HAS_THREADS) // This test exercises the setting and cancelling of timers from a // thread other than the one the reactor is running in. It sets up an // initial set of timers (3, 4, 5 seconds) from the main thread. When // the second thread starts, it cancels the 3 second timer and sets a // 2-second timer and an already-expired timer, which should be the // first to fire. It then sleeps for 3 seconds (letting the 2 second // timer fire, and if things are slow, the 4 second timer will also // fire. Then it sets 2 more timers at 10 and 12 seconds and cancels // the original 5 second timer. Then returns, ending the thread. The // destructor for Time_Handler insures that everything happened // correctly. Time_Handler::Time_Handler () { for (int i = 0; i < Time_Handler::TIMER_SLOTS; this->timer_id_[i++] = Time_Handler::TIMER_NOTSET) continue; this->prev_timer_ = -1; } // Set up initial timer conditions. Timers set up at 3, 4, and 5 // seconds. The one at 3 seconds will get cancelled when the thread // starts. void Time_Handler::setup () { ACE_Reactor *r = ACE_Reactor::instance (); this->timer_id_[2] = r->schedule_timer (this, (const void *) 2, ACE_Time_Value (3)); this->timer_id_[3] = r->schedule_timer (this, (const void *) 3, ACE_Time_Value (4)); this->timer_id_[4] = r->schedule_timer (this, (const void *) 4, ACE_Time_Value (5)); return; } int Time_Handler::verify_results () { ACE_TEST_ASSERT (this->timer_id_[0] == Time_Handler::TIMER_FIRED); ACE_TEST_ASSERT (this->timer_id_[1] == Time_Handler::TIMER_FIRED); ACE_TEST_ASSERT (this->timer_id_[2] == Time_Handler::TIMER_CANCELLED); ACE_TEST_ASSERT (this->timer_id_[3] == Time_Handler::TIMER_FIRED); ACE_TEST_ASSERT (this->timer_id_[4] == Time_Handler::TIMER_CANCELLED); ACE_TEST_ASSERT (this->timer_id_[5] == Time_Handler::TIMER_FIRED); ACE_TEST_ASSERT (this->timer_id_[6] == Time_Handler::TIMER_FIRED); for (int i = 7; i < Time_Handler::TIMER_SLOTS; i++) ACE_TEST_ASSERT (this->timer_id_[i] == Time_Handler::TIMER_NOTSET); return 0; } int Time_Handler::svc () { ACE_Reactor *r = ACE_Reactor::instance (); ACE_TEST_ASSERT (r->cancel_timer (this->timer_id_[2]) == 1); this->timer_id_[2] = Time_Handler::TIMER_CANCELLED; this->timer_id_[1] = r->schedule_timer(this, (const void *) 1, ACE_Time_Value (2)); // This one may get the callback before we return, so serialize. this->lock_.acquire (); this->timer_id_[0] = r->schedule_timer(this, (const void *) 0, ACE_Time_Value (0, -5)); this->lock_.release (); ACE_OS::sleep(3); this->timer_id_[5] = r->schedule_timer(this, (const void *)5, ACE_Time_Value (10)); this->timer_id_[6] = r->schedule_timer(this, (const void *)6, ACE_Time_Value (12)); ACE_TEST_ASSERT (r->cancel_timer (this->timer_id_[4]) == 1); this->timer_id_[4] = Time_Handler::TIMER_CANCELLED; // Test that cancelling a timers through a nill ACE_Event_Handler // pointer just does nothing instead of crash ACE_Event_Handler_var timer_var; ACE_TEST_ASSERT (r->cancel_timer (timer_var.handler()) == 0); return 0; } int Time_Handler::handle_timeout (const ACE_Time_Value &tv, const void *arg) { long time_tag = static_cast (reinterpret_cast (arg)); ACE_UNUSED_ARG(tv); ACE_GUARD_RETURN (ACE_Thread_Mutex, id_lock, this->lock_, 0); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%T (%t): Timer #%d (id #%d) expired\n"), time_tag, this->timer_id_[time_tag])); ACE_TEST_ASSERT (time_tag > this->prev_timer_); ACE_TEST_ASSERT (this->timer_id_[time_tag] != Time_Handler::TIMER_NOTSET); ACE_TEST_ASSERT (this->timer_id_[time_tag] != Time_Handler::TIMER_CANCELLED); ACE_TEST_ASSERT (this->timer_id_[time_tag] != Time_Handler::TIMER_FIRED); this->timer_id_[time_tag] = Time_Handler::TIMER_FIRED; this->prev_timer_ = time_tag; return 0; } #endif /* ACE_HAS_THREADS */ Dispatch_Count_Handler::Dispatch_Count_Handler () { ACE_Reactor *r = ACE_Reactor::instance (); this->input_seen_ = this->notify_seen_ = 0; this->timers_fired_ = 0; // Initialize the pipe. if (this->pipe_.open () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_Pipe::open"))); // Register the "read" end of the pipe. else if (r->register_handler (this->pipe_.read_handle (), this, ACE_Event_Handler::READ_MASK) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("register_handler"))); // Put something in our pipe and smoke it... ;-) else if (ACE::send (this->pipe_.write_handle (), "z", 1) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("send"))); // Call notify to prime the pump for this, as well. else if (r->notify (this) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("notify"))); } int Dispatch_Count_Handler::handle_close (ACE_HANDLE h, ACE_Reactor_Mask m) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%T (%t): handle_close\n"))); ACE_TEST_ASSERT (h == this->pipe_.read_handle () && m == ACE_Event_Handler::READ_MASK); return 0; } int Dispatch_Count_Handler::handle_input (ACE_HANDLE h) { char c; ACE_TEST_ASSERT (this->input_seen_ == 0); this->input_seen_ = 1; if (ACE::recv (h, &c, 1) != 1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("recv")), -1); ACE_TEST_ASSERT (c == 'z'); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%T (%t): handle_input\n"))); // Trigger the hook. return -1; } int Dispatch_Count_Handler::handle_exception (ACE_HANDLE h) { ACE_UNUSED_ARG (h); ACE_TEST_ASSERT (this->notify_seen_ == 0); this->notify_seen_ = 1; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%T (%t): handle_exception\n"))); return 0; } int Dispatch_Count_Handler::handle_timeout (const ACE_Time_Value &tv, const void *arg) { ACE_UNUSED_ARG (tv); ++this->timers_fired_; long value = static_cast (reinterpret_cast (arg)); // This case just tests to make sure the Reactor is counting timer // expiration correctly. ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%T (%t): expiration %d\n"), value)); return 0; } int Dispatch_Count_Handler::verify_results () { int result = 0; if (this->input_seen_ != 1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("input_seen_ is not 1 but %d\n"), input_seen_)); result = -1; } if (this->notify_seen_ != 1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("notify_seen_ is not 1 but %d\n"), notify_seen_)); result = -1; } if (this->timers_fired_ != ACE_MAX_TIMERS) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("timers fired not equal max timers: %d != %d\n"), this->timers_fired_, ACE_MAX_TIMERS)); result = -1; } return result; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("MT_Reactor_Timer_Test")); int status = 0; int test_result = 0; ACE_Reactor *r = ACE_Reactor::instance (); Dispatch_Count_Handler callback; for (int i = ACE_MAX_TIMERS; i > 0; i--) // Schedule a timeout to expire immediately. if (r->schedule_timer (&callback, reinterpret_cast (static_cast (i)), ACE_Time_Value (0)) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("schedule_timer")), 1); ACE_Time_Value no_waiting (0); size_t events = 0; while (1) { int result = r->handle_events (no_waiting); // Timeout. if (result == 0) break; // Make sure there were no errors. ACE_TEST_ASSERT (result != -1); events += result; } // All + 2 I/O dispatches (one for // and the other for ) should be counted in // events. if (events < ACE_MAX_TIMERS + 2) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("expected %d events, got %d instead\n"), ACE_MAX_TIMERS + 2, events)); } status = callback.verify_results (); if (status != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Dispatch counting test failed.\n"))); test_result = 1; } #if defined (ACE_HAS_THREADS) Time_Handler other_thread; ACE_Time_Value time_limit (30); // Set up initial set of timers. other_thread.setup (); other_thread.activate (THR_NEW_LWP | THR_JOINABLE); status = ACE_Reactor::instance()->run_reactor_event_loop (time_limit); // Should have returned only because the time limit is up... ACE_TEST_ASSERT (status != -1); ACE_TEST_ASSERT (time_limit.sec () == 0); status = other_thread.wait (); if (status == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p, errno is %d\n"), "wait ()", ACE_ERRNO_GET)); ACE_TEST_ASSERT (status != -1); } status = other_thread.verify_results (); if (status != 0) test_result = 1; #else ACE_ERROR ((LM_INFO, ACE_TEXT ("threads not supported on this platform\n"))); #endif /* ACE_HAS_THREADS */ ACE_END_TEST; return test_result; } ace-8.0.4+dfsg.orig/tests/Lazy_Map_Manager_Test.cpp0000644000175000017500000001520115027201773021201 0ustar sudipsudip //============================================================================= /** * @file Lazy_Map_Manager_Test.cpp * * This is a simple test of the and * that illustrates how lazy map managers * allow the deletion of entries while iterating over the map. * * @author Irfan Pyarali */ //============================================================================= #include "test_config.h" #include "ace/Map_Manager.h" #include "ace/Active_Map_Manager.h" // Simple map manager. using LAZY_MAP = ACE_Map_Manager; // Displaying the contents of a map manager. void display_map (LAZY_MAP &map) { { // Simple iteration printing the entries. for (LAZY_MAP::iterator iter = map.begin (); iter != map.end (); ++iter) { LAZY_MAP::ENTRY &entry = *iter; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%d "), entry.int_id_)); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); } { // Simple reverse iteration printing the entries. for (LAZY_MAP::reverse_iterator iter = map.rbegin (); iter != map.rend (); ++iter) { LAZY_MAP::ENTRY &entry = *iter; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%d "), entry.int_id_)); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); } // Test for map manager. void map_test () { // Map of size 3. LAZY_MAP map (3); int i = 0; // Insert a few entries. for (i = 0; i < 3; ++i) map.bind (i, i); display_map (map); // Remove middle one. map.unbind (1); display_map (map); // Remove the entry on one end. map.unbind (0); display_map (map); // Remove the entry on the other end. map.unbind (2); display_map (map); // If we have lazy map managers, we can delete entries while // iterating over the map. #if defined (ACE_HAS_LAZY_MAP_MANAGER) // Insert a few entries. for (i = 0; i < 3; ++i) map.bind (i, i); display_map (map); // Remove middle one. { // Deletion while iterating. for (LAZY_MAP::iterator iter = map.begin (); iter != map.end (); ++iter) { LAZY_MAP::ENTRY &entry = *iter; if (entry.int_id_ == 1) map.unbind (1); } display_map (map); } // Remove the entry on one end. { // Deletion while iterating. for (LAZY_MAP::iterator iter = map.begin (); iter != map.end (); ++iter) { LAZY_MAP::ENTRY &entry = *iter; if (entry.int_id_ == 0) map.unbind (0); } display_map (map); } // Remove the entry on the other end. { // Deletion while iterating. for (LAZY_MAP::iterator iter = map.begin (); iter != map.end (); ++iter) { LAZY_MAP::ENTRY &entry = *iter; if (entry.int_id_ == 2) map.unbind (2); } display_map (map); } #endif /* ACE_HAS_LAZY_MAP_MANAGER */ // Insert a few entries. This will force an increase in map size. for (i = 0; i < 4; ++i) map.bind (i, i); display_map (map); // Remove a few entries (in reverse order). for (i = 3; i >= 0; --i) map.unbind (i); display_map (map); } // Simple active map manager. using ACTIVE_MAP = ACE_Active_Map_Manager; // Displaying the contents of an active map manager. void display_map (ACTIVE_MAP &map) { { // Simple iteration printing the entries. for (ACTIVE_MAP::iterator iter = map.begin (); iter != map.end (); ++iter) { ACTIVE_MAP::ENTRY &entry = *iter; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%d "), entry.int_id_)); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); } { // Simple reverse iteration printing the entries. for (ACTIVE_MAP::reverse_iterator iter = map.rbegin (); iter != map.rend (); ++iter) { ACTIVE_MAP::ENTRY &entry = *iter; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%d "), entry.int_id_)); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); } // Test for active map manager. void active_map_test () { // Map of size 3. ACTIVE_MAP map (3); ACE_Active_Map_Manager_Key keys[4]; int i = 0; // Insert a few entries. for (i = 0; i < 3; ++i) map.bind (i, keys[i]); display_map (map); // Remove middle one. map.unbind (keys[1]); display_map (map); // Remove the entry on one end. map.unbind (keys[0]); display_map (map); // Remove the entry on the other end. map.unbind (keys[2]); display_map (map); // If we have lazy map managers, we can delete entries while // iterating over the map. #if defined (ACE_HAS_LAZY_MAP_MANAGER) // Insert a few entries. for (i = 0; i < 3; ++i) map.bind (i, keys[i]); display_map (map); // Remove middle one. { // Deletion while iterating. for (ACTIVE_MAP::iterator iter = map.begin (); iter != map.end (); ++iter) { ACTIVE_MAP::ENTRY &entry = *iter; if (entry.int_id_ == 1) map.unbind (keys[1]); } display_map (map); } // Remove the entry on one end. { // Deletion while iterating. for (ACTIVE_MAP::iterator iter = map.begin (); iter != map.end (); ++iter) { ACTIVE_MAP::ENTRY &entry = *iter; if (entry.int_id_ == 0) map.unbind (keys[0]); } display_map (map); } // Remove the entry on the other end. { // Deletion while iterating. for (ACTIVE_MAP::iterator iter = map.begin (); iter != map.end (); ++iter) { ACTIVE_MAP::ENTRY &entry = *iter; if (entry.int_id_ == 2) map.unbind (keys[2]); } display_map (map); } #endif /* ACE_HAS_LAZY_MAP_MANAGER */ // Insert a few entries. This will force an increase in map size. for (i = 0; i < 4; ++i) map.bind (i, keys[i]); display_map (map); // Remove a few entries (in reverse order). for (i = 3; i >= 0; --i) map.unbind (keys[i]); display_map (map); } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Lazy_Map_Manager_Test")); ACE_LOG_MSG->clr_flags (ACE_Log_Msg::VERBOSE_LITE); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nMap Manager...\n\n"))); map_test (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nActive Map Manager...\n\n"))); active_map_test (); ACE_LOG_MSG->set_flags (ACE_Log_Msg::VERBOSE_LITE); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Service_Config_Test.WCHAR_T.conf.xml0000644000175000017500000001316015027201773023012 0ustar sudipsudip<?xml version='1.0'?> <!-- Converted from Service_Config_Test.conf by svcconf-convert.pl --> <ACE_Svc_Conf> <!-- Dynamically loading each of the Service Objects below causes a --> <!-- number of threads to be spawned, each one invoking the Service --> <!-- Configurator (e.g. ACE_Service_Config::process_directive(). If the --> <!-- Service Configurator is thread safe and reentrant, then parsing of --> <!-- this `Service_Config_Test.conf' file should run to completion --> <!-- without error. --> <!-- --> <!-- Test_Object_1 will cause Test_Object_2 and Test_Object_3 to be --> <!-- dynamically loaded. Dynamic loading of each of object will occur in --> <!-- a separate thread. --> <dynamic id="Test_Object_1" type="Service_Object"> <initializer init="_make_Service_Config_DLL" path="Service_Config_DLL" params="2 3"/> </dynamic> <!-- Test_Object_4 will cause Test_Object_5 and Test_Object_6 to be --> <!-- dynamically loaded. Dynamic loading of each of object will occur in --> <!-- a separate thread. --> <dynamic id="Test_Object_4" type="Service_Object"> <initializer init="_make_Service_Config_DLL" path="Service_Config_DLL" params="5 6"/> </dynamic> <!-- Final_Object does nothing but print a completion message. --> <dynamic id="Final_Object" type="Service_Object"> <initializer init="_make_Service_Config_DLL" path="Service_Config_DLL" params="FINAL"/> </dynamic> </ACE_Svc_Conf> ace-8.0.4+dfsg.orig/tests/Service_Config_Test.cpp0000644000175000017500000005637415027201773020740 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Service_Config_Test.cpp * * This is a simple test to make sure the ACE Service Configurator * framework is working correctly. * * @author David Levine * @author Ossama Othman */ //============================================================================= #include "test_config.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_errno.h" #include "ace/OS_NS_Thread.h" #include "ace/Log_Msg.h" #include "ace/Object_Manager.h" #include "ace/Service_Config.h" #include "ace/Service_Object.h" #include "ace/Service_Repository.h" #include "ace/Service_Types.h" #include "ace/Reactor.h" #include "ace/Thread_Manager.h" #include "ace/ARGV.h" static const u_int VARIETIES = 3; static u_int error = 0; class MyRepository : public ACE_Service_Repository { public: array_type& array () { return service_array_; } }; /** * @class Test_Singleton * * @brief Test the Singleton * * This should be a template class, with singleton instantiations. * But to avoid having to deal with compilers that want template * declarations in separate files, it's just a plain class. The * instance argument differentiates the "singleton" instances. It * also demonstrates the use of the param arg to the cleanup () * function. */ class Test_Singleton { public: static Test_Singleton *instance (u_short variety); ~Test_Singleton (); private: u_short variety_; static u_short current_; Test_Singleton (u_short variety); friend class misspelled_verbase_friend_declaration_to_avoid_compiler_warning_with_private_ctor; }; u_short Test_Singleton::current_ = 0; extern "C" void test_singleton_cleanup (void *object, void *) { // We can't reliably use ACE_Log_Msg in a cleanup hook. Yet. /* ACE_DEBUG ((LM_DEBUG, "cleanup %d\n", (u_short) param)); */ delete (Test_Singleton *) object; } Test_Singleton * Test_Singleton::instance (u_short variety) { static Test_Singleton *instances[VARIETIES] = { 0 }; if (instances[variety] == 0) { ACE_NEW_RETURN (instances[variety], Test_Singleton (variety), 0); } ACE_Object_Manager::at_exit (instances[variety], test_singleton_cleanup, reinterpret_cast (static_cast (variety)), "Test_Singleton"); return instances[variety]; } Test_Singleton::Test_Singleton (u_short variety) : variety_ (variety) { if (variety_ != current_++) { ACE_DEBUG ((LM_ERROR, ACE_TEXT ("ERROR: instance %u created out of order!\n"), variety_)); ++error; } } // We can't reliably use ACE_Log_Msg in a destructor that is called by // ACE_Object_Manager. Yet. Test_Singleton::~Test_Singleton () { /* ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Test_Singleton %u dtor\n"), variety_)); */ if (variety_ != --current_) { ACE_OS::fprintf (stderr, ACE_TEXT ("ERROR: instance %u destroyed out of order!\n"), variety_); /* ACE_DEBUG ((LM_ERROR, ACE_TEXT ("ERROR: instance %u destroyed out of order!\n"), variety_)); */ ++error; } } void testFailedServiceInit (int, ACE_TCHAR *[]) { static const ACE_TCHAR *refuse_svc = #if (ACE_USES_CLASSIC_SVC_CONF == 1) ACE_TEXT ("dynamic Refuses_Svc Service_Object * ") ACE_TEXT (" Service_Config_DLL:_make_Refuses_Init() \"\"") #else ACE_TEXT ("") ACE_TEXT (" ") ACE_TEXT ("") #endif /* (ACE_USES_CLASSIC_SVC_CONF == 1) */ ; int error_count = 0; if ((error_count = ACE_Service_Config::process_directive (refuse_svc)) != 1) { ++error; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Failed init test should have returned 1; ") ACE_TEXT ("returned %d instead\n"), error_count)); } // Try to find the service; it should not be there. ACE_Service_Type const *svcp = 0; if (-1 != ACE_Service_Repository::instance ()->find (ACE_TEXT ("Refuses_Svc"), &svcp)) { ++error; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Found service repo entry for Refuses_Svc\n"))); ACE_Service_Type_Impl const *svc_impl = svcp->type (); ACE_TCHAR msg[1024]; ACE_TCHAR *msgp = msg; if (svc_impl->info (&msgp, sizeof (msg) / sizeof (ACE_TCHAR)) > 0) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Refuses_Svc said: %s\n"), msg)); } else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Repo reports no Refuses_Svc; correct.\n"))); } void testLoadingServiceConfFileAndProcessNo (int argc, ACE_TCHAR *argv[]) { u_int error0 = error; ACE_ARGV new_argv; ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Starting testLoadingServiceConfFileAndProcessNo\n"))); #if defined (ACE_USES_WCHAR) // When using full Unicode support, use the version of the Service // Configurator file appropriate to the platform. // For example, Windows Unicode uses UTF-16. // // iconv(1) found on Linux, for example, can // be used to convert between encodings. // // Byte ordering is also an issue, so we should be // generating this file on-the-fly from the UTF-8 encoded // file by using functions like iconv(1) or iconv(3). # if defined (ACE_WIN32) const ACE_TCHAR svc_conf[] = ACE_TEXT ("Service_Config_Test.UTF-16") ACE_TEXT (ACE_DEFAULT_SVC_CONF_EXT); # else const ACE_TCHAR svc_conf[] = ACE_TEXT ("Service_Config_Test.WCHAR_T") ACE_TEXT (ACE_DEFAULT_SVC_CONF_EXT); # endif /* ACE_WIN32 */ #else // ASCII (UTF-8) encoded Service Configurator file. const ACE_TCHAR svc_conf[] = ACE_TEXT ("Service_Config_Test") ACE_TEXT (ACE_DEFAULT_SVC_CONF_EXT); #endif /* ACE_USES_WCHAR */ ACE_TCHAR pid_file_name [MAXPATHLEN]; #if defined (TEST_DIR) ACE_OS::strcpy (pid_file_name, TEST_DIR); ACE_OS::strcat (pid_file_name, ACE_DIRECTORY_SEPARATOR_STR); ACE_OS::strcat (pid_file_name, ACE_TEXT ("Service_Config_Test.pid")); #else ACE_OS::strcpy (pid_file_name, ACE_TEXT ("Service_Config_Test.pid")); #endif ACE_TCHAR svc_conf_file_name [MAXPATHLEN]; #if defined (TEST_DIR) ACE_OS::strcpy (svc_conf_file_name, TEST_DIR); ACE_OS::strcat (svc_conf_file_name, ACE_DIRECTORY_SEPARATOR_STR); ACE_OS::strcat (svc_conf_file_name, svc_conf); #else ACE_OS::strcpy (svc_conf_file_name, svc_conf); #endif // Process the Service Configurator directives in this test's Making // sure we have more than one option with an argument, to capture // any errors caused by "reshuffling" of the options. if (new_argv.add (argv) == -1 || new_argv.add (ACE_TEXT ("-d")) == -1 || new_argv.add (ACE_TEXT ("-k")) == -1 || new_argv.add (ACE_TEXT ("xxx")) == -1 || new_argv.add (ACE_TEXT ("-p")) == -1 || new_argv.add (pid_file_name) == -1 || new_argv.add (ACE_TEXT ("-f")) == -1 || new_argv.add (svc_conf_file_name) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("line %l %p\n"), ACE_TEXT ("new_argv.add"))); ++error; } // We need this scope to make sure that the destructor for the // gets called. ACE_Service_Config daemon; ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Starting daemon using %s\n"), new_argv.buf ())); if (daemon.open (new_argv.argc (), new_argv.argv ()) == -1 && errno != ENOENT) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("line %l %p\n"), ACE_TEXT ("daemon.open"))); ++error; } ACE_Time_Value tv (argc > 1 ? ACE_OS::atoi (argv[1]) : 2); if (ACE_Reactor::instance()->run_reactor_event_loop (tv) == -1) { ++error; ACE_ERROR ((LM_ERROR, ACE_TEXT ("line %l %p\n"), ACE_TEXT ("run_reactor_event_loop"))); } // Wait for all threads to complete. ACE_Thread_Manager::instance ()->wait (); if (error == error0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT("testLoadingServiceConfFileAndProcessNo completed successfully\n"))); else ACE_ERROR ((LM_ERROR, ACE_TEXT("testLoadingServiceConfFileAndProcessNo test failed\n"))); } void testLoadingServiceConfFile (int argc, ACE_TCHAR *argv[]) { ACE_ARGV new_argv; #if defined (ACE_USES_WCHAR) // When using full Unicode support, use the version of the Service // Configurator file appropriate to the platform. // For example, Windows Unicode uses UTF-16. // // iconv(1) found on Linux, for example, can // be used to convert between encodings. // // Byte ordering is also an issue, so we should be // generating this file on-the-fly from the UTF-8 encoded // file by using functions like iconv(1) or iconv(3). # if defined (ACE_WIN32) const ACE_TCHAR svc_conf[] = ACE_TEXT ("Service_Config_Test.UTF-16") ACE_TEXT (ACE_DEFAULT_SVC_CONF_EXT); # else const ACE_TCHAR svc_conf[] = ACE_TEXT ("Service_Config_Test.WCHAR_T") ACE_TEXT (ACE_DEFAULT_SVC_CONF_EXT); # endif /* ACE_WIN32 */ #else // ASCII (UTF-8) encoded Service Configurator file. const ACE_TCHAR svc_conf[] = ACE_TEXT ("Service_Config_Test") ACE_TEXT (ACE_DEFAULT_SVC_CONF_EXT); #endif /* ACE_USES_WCHAR */ // Process the Service Configurator directives in this test's if (new_argv.add (argv) == -1 || new_argv.add (ACE_TEXT ("-f")) == -1 || new_argv.add (svc_conf) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("line %l %p\n"), ACE_TEXT ("new_argv.add"))); ++error; } // We need this scope to make sure that the destructor for the // gets called. ACE_Service_Config daemon; if (daemon.open (new_argv.argc (), new_argv.argv ()) == -1) { if (errno == ENOENT) ACE_DEBUG ((LM_WARNING, ACE_TEXT ("ACE_Service_Config::open: %p\n"), svc_conf)); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Service_Config::open: %p\n"), ACE_TEXT ("error"))); } ACE_Time_Value tv (argc > 1 ? ACE_OS::atoi (argv[1]) : 2); if (ACE_Reactor::instance()->run_reactor_event_loop (tv) == -1) { ++error; ACE_ERROR ((LM_ERROR, ACE_TEXT ("line %l %p\n"), ACE_TEXT ("run_reactor_event_loop"))); } // Wait for all threads to complete. ACE_Thread_Manager::instance ()->wait (); } // Loading and unloading the ACE logger service should not smash singletons. void testUnloadingACELoggingStrategy (int, ACE_TCHAR *[]) { static const ACE_TCHAR *load_logger = #if (ACE_USES_CLASSIC_SVC_CONF == 1) ACE_TEXT ("dynamic Logger Service_Object * ") ACE_TEXT (" ACE:_make_ACE_Logging_Strategy() \"\"") #else ACE_TEXT ("") ACE_TEXT (" ") ACE_TEXT ("") #endif /* (ACE_USES_CLASSIC_SVC_CONF == 1) */ ; static const ACE_TCHAR *unload_logger = #if (ACE_USES_CLASSIC_SVC_CONF == 1) ACE_TEXT ("remove Logger") #else ACE_TEXT (""); #endif /* (ACE_USES_CLASSIC_SVC_CONF == 1) */ ; ACE_Reactor *r1 = ACE_Reactor::instance(); // Ensure no errors are logged while searching for a valid ACE lib name; // these skew the scoreboard results. u_long mask = ACE_LOG_MSG->priority_mask (ACE_Log_Msg::PROCESS); ACE_LOG_MSG->priority_mask (mask & ~LM_ERROR, ACE_Log_Msg::PROCESS); ACE_DEBUG ((LM_DEBUG, "Was %x, now %x\n", mask, mask & ~LM_ERROR)); int error_count = ACE_Service_Config::process_directive (load_logger); ACE_LOG_MSG->priority_mask (mask); if (error_count != 0) { ++error; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Load ACE Logger should have returned 0; ") ACE_TEXT ("returned %d instead\n"), error_count)); } ACE_Service_Config::process_directive (unload_logger); ACE_Reactor *r2 = ACE_Reactor::instance (); if (r1 != r2) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Reactor before %@, after %@\n"), r1, r2)); } // @brief The size of a repository is unlimited and can be exceeded void testLimits (int , ACE_TCHAR *[]) { static const ACE_TCHAR *svc_desc1 = #if (ACE_USES_CLASSIC_SVC_CONF == 1) ACE_TEXT ("dynamic Test_Object_1_More Service_Object * ") ACE_TEXT (" Service_Config_DLL:_make_Service_Config_DLL() \"Test_Object_1_More\"") #else ACE_TEXT ("") ACE_TEXT (" ") ACE_TEXT ("") #endif /* (ACE_USES_CLASSIC_SVC_CONF == 1) */ ; static const ACE_TCHAR *svc_desc2 = #if (ACE_USES_CLASSIC_SVC_CONF == 1) ACE_TEXT ("dynamic Test_Object_2_More Service_Object * ") ACE_TEXT (" Service_Config_DLL:_make_Service_Config_DLL() \"Test_Object_2_More\"") #else ACE_TEXT ("") ACE_TEXT (" ") ACE_TEXT ("") #endif /* (ACE_USES_CLASSIC_SVC_CONF == 1) */ ; u_int error0 = error; // Ensure enough room for one in a own, the repository can extend ACE_Service_Gestalt one (1, true); // Add two. // We cant simply rely on the fact that insertion fails, because it // is typical to have no easy way of getting detailed error // information from a parser. one.process_directive (svc_desc1); one.process_directive (svc_desc2); if (-1 == one.find (ACE_TEXT ("Test_Object_1_More"), 0, 0)) { ++error; ACE_ERROR ((LM_ERROR, ACE_TEXT("Expected to have registered the first service\n"))); } if (-1 == one.find (ACE_TEXT ("Test_Object_2_More"), 0, 0)) { ++error; ACE_ERROR ((LM_ERROR, ACE_TEXT("Expected to have registered the second service\n"))); } { ACE_GUARD (ACE_SYNCH_RECURSIVE_MUTEX, ace_mon, one.current_service_repository ()->lock ()); ACE_Service_Repository_Iterator sri (*one.current_service_repository (), 0); size_t index = 0; for (const ACE_Service_Type *sr; sri.next (sr) != 0; sri.advance ()) { if (index == 0 && ACE_OS::strcmp (sr->name(), ACE_TEXT ("Test_Object_1_More")) != 0) { ++error; ACE_ERROR ((LM_ERROR, ACE_TEXT("Service 1 is wrong\n"))); } if (index == 1 && ACE_OS::strcmp (sr->name(), ACE_TEXT ("Test_Object_2_More")) != 0) { ++error; ACE_ERROR ((LM_ERROR, ACE_TEXT("Service 2 is wrong\n"))); } ++index; } } // Test close one.current_service_repository ()->close(); if (one.current_service_repository ()->current_size () != 0) { ++error; ACE_ERROR ((LM_ERROR, ACE_TEXT("Size of repository should be 0\n"))); } if (error == error0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Limits test completed successfully\n"))); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Limits test failed\n"))); } void testrepository (int, ACE_TCHAR *[]) { MyRepository repository; ACE_DLL handle; ACE_Service_Type s0 (ACE_TEXT ("0"), 0, handle, false); ACE_Service_Type s1 (ACE_TEXT ("1"), 0, handle, false); ACE_Service_Type s2 (ACE_TEXT ("2"), 0, handle, false); ACE_Service_Type s3 (ACE_TEXT ("3"), 0, handle, false); ACE_Service_Type* result = 0; repository.insert (&s0); if (repository.current_size () != 1) { ++error; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Repository was wrong size %d\n"), repository.current_size ())); } repository.insert (&s1); if (repository.current_size () != 2) { ++error; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Repository was wrong size %d\n"), repository.current_size ())); } repository.insert (&s2); if (repository.current_size () != 3) { ++error; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Repository was wrong size %d\n"), repository.current_size ())); } if (repository.remove (ACE_TEXT ("1"), &result) != 0) { ++error; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Remove failed\n"))); } if (repository.current_size () != 3) { ++error; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Repository was wrong size %d\n"), repository.current_size ())); } if (repository.array ()[1] != 0) { ++error; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Element 1 not zero\n"), repository.current_size ())); } repository.insert (&s3); if (repository.current_size () != 4) { ++error; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Repository was wrong size %d\n"), repository.current_size ())); } repository.remove (ACE_TEXT ("0"), &result); if (repository.remove (ACE_TEXT ("1"), &result) != -1) { ++error; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Double remove didn't return -1\n"))); } repository.remove (ACE_TEXT ("2"), &result); repository.remove (ACE_TEXT ("3"), &result); if (repository.current_size () != 4) { ++error; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Repository was wrong size %d\n"), repository.current_size ())); } repository.close (); if (repository.current_size () != 0) { ++error; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Repository was wrong size %d\n"), repository.current_size ())); } } // @brief ?? void testOrderlyInstantiation (int , ACE_TCHAR *[]) { for (u_int i = 0; i < VARIETIES; ++i) { Test_Singleton *s = Test_Singleton::instance (i); if (s == 0) { ++error; ACE_ERROR ((LM_ERROR, ACE_TEXT ("instance () allocate failed!\n"))); } } } // This test verifies that services loaded by a normal ACE startup can be // located from a thread spawned outside of ACE's control. // // To do this, we need a native thread entry and, thus, it needs special care // for each platform type. Feel free to add more platforms as needed here and // in main() where the test is called. #if defined (ACE_HAS_WTHREADS) || defined (ACE_HAS_PTHREADS) # if defined (ACE_HAS_WTHREADS) extern "C" unsigned int __stdcall # else extern "C" ACE_THR_FUNC_RETURN # endif nonacethreadentry (void *args) { ACE_Log_Msg::inherit_hook (0, *(ACE_OS_Log_Msg_Attributes *)args); if (ACE_Service_Config::instance()->find(ACE_TEXT("Test_Object_1_Thr")) != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("In thr %t cannot find Test_Object_1_Thr ") ACE_TEXT ("via ACE_Service_Config\n"))); ++error; } else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("In thr %t, located Test_Object_1_Thr ") ACE_TEXT ("via ACE_Service_Config\n"))); if (0 != ACE_Service_Repository::instance()->find (ACE_TEXT("Test_Object_1_Thr"))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("In thr %t cannot find Test_Object_1_Thr ") ACE_TEXT ("via ACE_Service_Repository\n"))); ++error; } else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("In thr %t, located Test_Object_1_Thr ") ACE_TEXT ("via ACE_Service_Repository\n"))); return 0; } void testNonACEThread () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Beginning non-ACE thread lookup test\n"))); static const ACE_TCHAR *svc_desc = #if (ACE_USES_CLASSIC_SVC_CONF == 1) ACE_TEXT ("dynamic Test_Object_1_Thr Service_Object * ") ACE_TEXT (" Service_Config_DLL:_make_Service_Config_DLL() \"Test_Object_1_Thr\"") #else ACE_TEXT ("") ACE_TEXT (" ") ACE_TEXT ("") #endif /* (ACE_USES_CLASSIC_SVC_CONF == 1) */ ; static const ACE_TCHAR *svc_remove = #if (ACE_USES_CLASSIC_SVC_CONF == 1) ACE_TEXT ("remove Test_Object_1_Thr") #else ACE_TEXT ("") ACE_TEXT ("") #endif /* (ACE_USES_CLASSIC_SVC_CONF == 1) */ ; if (-1 == ACE_Service_Config::process_directive (svc_desc)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Error loading service"))); ++error; return; } // Allow the spawned thread to contribute to the logging output. ACE_OS_Log_Msg_Attributes log_msg_attrs; ACE_Log_Msg::init_hook (log_msg_attrs); u_int errors_before = error; #if defined (ACE_HAS_WTHREADS) HANDLE thr_h = (HANDLE)_beginthreadex (0, 0, &nonacethreadentry, &log_msg_attrs, 0, 0); if (thr_h == 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("_beginthreadex"))); ++error; } else { WaitForSingleObject (thr_h, INFINITE); CloseHandle (thr_h); } #elif defined (ACE_HAS_PTHREADS) pthread_t thr_id; int status = pthread_create (&thr_id, 0, nonacethreadentry, &log_msg_attrs); if (status != 0) { errno = status; ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("pthread_create"))); ++error; } else { pthread_join (thr_id, 0); } #endif if (error != errors_before) // The test failed; see if we can still see it { if (0 != ACE_Service_Config::instance()->find (ACE_TEXT ("Test_Object_1_Thr"))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Main thr %t cannot find Test_Object_1_Thr\n"))); ++error; } else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Main thr %t DOES find Test_Object_1_Thr\n"))); } if (-1 == ACE_Service_Config::process_directive (svc_remove)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Error removing service"))); ++error; } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Non-ACE thread lookup test completed\n"))); } } #endif /* ACE_HAS_WTHREADS || ACE_HAS_PTHREADS */ int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Service_Config_Test")); testOrderlyInstantiation (argc, argv); testFailedServiceInit (argc, argv); testLoadingServiceConfFile (argc, argv); testLoadingServiceConfFileAndProcessNo (argc, argv); testUnloadingACELoggingStrategy (argc, argv); testLimits (argc, argv); testrepository (argc, argv); #if defined (ACE_HAS_WTHREADS) || defined (ACE_HAS_PTHREADS) unsigned int n_threads = 64; #if defined (ACE_DEFAULT_THREAD_KEYS) n_threads = 2 * ACE_DEFAULT_THREAD_KEYS; #endif // Test with a large amount of threads to determine whether // TSS works correctly with non ACE threads for (unsigned int i = 0 ; i < n_threads; i++) { testNonACEThread(); } #endif ACE_END_TEST; return error; } ace-8.0.4+dfsg.orig/tests/INET_Addr_Test.cpp0000644000175000017500000004623715027201773017541 0ustar sudipsudip //============================================================================= /** * @file INET_Addr_Test.cpp * * Performs several tests on the ACE_INET_Addr class. It creates several * IPv4 and IPv6 addresses and checks that the address formed by the * class is valid. * * @author John Aughey (jha@aughey.com) */ //============================================================================= #include "test_config.h" #include "ace/OS_NS_string.h" #include "ace/INET_Addr.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_arpa_inet.h" #include "ace/SString.h" #include "ace/OS_NS_unistd.h" // Make sure that ACE_Addr::addr_type_ is the same // as the family of the inet_addr_. static int check_type_consistency (const ACE_INET_Addr &addr) { int family = -1; if (addr.get_type () == AF_INET) { struct sockaddr_in *sa4 = (struct sockaddr_in *)addr.get_addr(); family = sa4->sin_family; } #if defined (ACE_HAS_IPV6) else if (addr.get_type () == AF_INET6) { struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)addr.get_addr(); family = sa6->sin6_family; } #endif if (addr.get_type () != family) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Inconsistency between ACE_SOCK::addr_type_ (%d) ") ACE_TEXT ("and the sockaddr family (%d)\n"), addr.get_type (), family)); return 1; } return 0; } static bool test_tao_use () { char host[256]; if (::gethostname (host, 255) != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Test TAO Use fail %p\n"), ACE_TEXT ("gethostname"))); return false; } ACE_INET_Addr addr; addr.set ((unsigned short)0, host); ACE_CString full (host); full += ":12345"; addr.set (full.c_str ()); u_short p = addr.get_port_number (); if (p != 12345) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Test TAO Use expected port 12345 got %d\n"), p)); return false; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Test TAO Use passed\n"))); return true; } static bool test_port_assignment () { #if defined (ACE_HAS_IPV6) ACE_INET_Addr addr1 (static_cast (0), ACE_IPV6_ANY, AF_INET6); ACE_INET_Addr addr2; addr1.set_port_number (12345); addr2.set (addr1); if (addr1.get_port_number () != addr2.get_port_number ()) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("port number not properly copied. ") ACE_TEXT ("addr1 port = %d addr2 port = %d\n"), addr1.get_port_number (), addr2.get_port_number ())); return false; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Test Port Assignment passed\n"))); #else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Test Port Assignment is IPv6 only\n"))); #endif /* ACE_HAS_IPV6 */ return true; } static bool test_multiple () { bool success = true; // Check the behavior when there are multiple addresses assigned to a name. // The NTP pool should always return multiples, though always different. ACE_INET_Addr ntp; if (ntp.set (123, ACE_TEXT ("pool.ntp.org")) == -1) { // This is just a warning to prevent fails on lookups on hosts with no // DNS service. The real value of this test is to accurately get // multiples from the result. ACE_ERROR ((LM_WARNING, ACE_TEXT ("%p\n"), ACE_TEXT ("pool.ntp.org"))); return true; } size_t count = 0; ACE_TCHAR addr_string[256]; do { ++count; // If lookup succeeded, there's at least one ntp.addr_to_string (addr_string, sizeof (addr_string)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("IPv4 %B: %s\n"), count, addr_string)); } while (ntp.next ()); success = count > 1; #if defined (ACE_HAS_IPV6) ACE_INET_Addr ntp6; if (ntp6.set (123, ACE_TEXT ("2.pool.ntp.org"), 1, AF_INET6) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("2.pool.ntp.org"))); return false; } count = 0; do { ++count; // If lookup succeeded, there's at least one ntp6.addr_to_string (addr_string, sizeof (addr_string)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("IPv6 %B: %s\n"), count, addr_string)); } while (ntp6.next ()); if (count <= 1) success = false; #endif /* ACE_HAS_IPV6 */ return success; } static bool test_port_names() { bool success = true; ACE_INET_Addr addr; #if defined (ACE_LACKS_GETSERVBYNAME) // Since we don't have getservbyname, the call to set should fail. // Check that the call does in fact fail. if (addr.set("telnet") == 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("set with 'telnet' succeeded (expected failure)\n"))); success = false; } #else if (addr.set("telnet") != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("set with 'telnet' failed (expected success)\n"))); success = false; } if (addr != ACE_INET_Addr("0.0.0.0:23")) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("set with 'telnet' failed to yield correct address\n"))); success = false; } #endif /* ACE_LACKS_GETSERVBYNAME */ if (addr.set("not a port name") == 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("set with 'not a port name' succeeded (expected failure)\n"))); success = false; } return success; } struct Address { const char* name; bool loopback; }; int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("INET_Addr_Test")); int status = 0; // Innocent until proven guilty // Try to set up known IP and port. u_short port (80); ACE_UINT32 const ia_any = INADDR_ANY; ACE_INET_Addr local_addr(port, ia_any); status |= check_type_consistency (local_addr); if (local_addr.get_port_number () != 80) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Got port %d, expecting 80\n"), (int)(local_addr.get_port_number ()))); status = 1; } if (local_addr.get_ip_address () != ia_any) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Mismatch on local IP addr\n"))); status = 1; } // Assignment constructor ACE_INET_Addr local_addr2 (local_addr); status |= check_type_consistency (local_addr2); if (local_addr2.get_port_number () != 80) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Copy got port %d, expecting 80\n"), (int)(local_addr2.get_port_number ()))); status = 1; } if (local_addr2.get_ip_address () != ia_any) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Mismatch on copy local IP addr\n"))); status = 1; } if (local_addr != local_addr2) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Copy local addr mismatch\n"))); status = 1; } // Try to parse out a simple address:port string. Intentionally reuse // the ACE_INET_Addr to ensure resetting an address works. const char *addr_ports[] = { "127.0.0.1:80", "www.dre.vanderbilt.edu:80", 0 }; ACE_INET_Addr addr_port; for (int i = 0; addr_ports[i] != 0; ++i) { if (addr_port.set (addr_ports[i]) == 0) { status |= check_type_consistency (addr_port); if (addr_port.get_port_number () != 80) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Got port %d from %s\n"), (int)(addr_port.get_port_number ()), addr_ports[i])); status = 1; } ACE_INET_Addr check (addr_ports[i]); if (addr_port != check) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Reset on iter %d failed\n"), i)); if (addr_port.get_type() != check.get_type()) { ACE_ERROR ((LM_ERROR, ACE_TEXT (" addr_port.get_type()= %d, check.get_type()=%d\n") , addr_port.get_type(), check.get_type())); } if (addr_port.get_size() != check.get_size()) { ACE_ERROR ((LM_ERROR, ACE_TEXT (" addr_port.get_size()= %d, check.get_size()=%d\n") , addr_port.get_size(), check.get_size())); } #if defined(ACE_HAS_IPV6) if (addr_port.get_type() == check.get_type() && addr_port.get_size() == check.get_size()){ if (addr_port.get_type() == AF_INET6) { const struct sockaddr_in6 *addr_port_in6 = static_cast (addr_port.get_addr()); const struct sockaddr_in6 *check_in6 = static_cast (check.get_addr()); ACE_ERROR((LM_ERROR, ACE_TEXT (" addr_port_in6->sin6_family=%d, check_in6->sin6_family=%d\n") , (int)addr_port_in6->sin6_family, (int)check_in6->sin6_family)); ACE_ERROR((LM_ERROR, ACE_TEXT (" addr_port_in6->sin6_port=%d, check_in6->sin6_port=%d\n") , (int)addr_port_in6->sin6_port, (int)check_in6->sin6_port)); ACE_ERROR((LM_ERROR, ACE_TEXT (" addr_port_in6->sin6_flowinfo=%d, check_in6->sin6_flowinfo=%d\n") , (int)addr_port_in6->sin6_flowinfo, (int)check_in6->sin6_flowinfo)); ACE_ERROR((LM_ERROR, ACE_TEXT (" addr_port_in6->sin6_scope_id=%d, check_in6->sin6_scope_id=%d\n") , (int)addr_port_in6->sin6_scope_id, (int)check_in6->sin6_scope_id)); ACE_ERROR((LM_DEBUG, ACE_TEXT (" addr_port_in6->sin6_addr="))); ACE_HEX_DUMP((LM_DEBUG, reinterpret_cast(&addr_port_in6->sin6_addr), sizeof(addr_port_in6->sin6_addr))); ACE_ERROR((LM_DEBUG, ACE_TEXT (" check_in6->sin6_addr="))); ACE_HEX_DUMP((LM_DEBUG, reinterpret_cast(&check_in6->sin6_addr), sizeof(check_in6->sin6_addr))); } } #endif status = 1; } } else { // Sometimes this fails because the run-time host lacks the capability to // resolve a name. But it shouldn't fail on the first one, 127.0.0.1. if (i == 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%C: %p\n"), addr_ports[i], ACE_TEXT ("lookup"))); status = 1; } else { ACE_ERROR ((LM_WARNING, ACE_TEXT ("%C: %p\n"), addr_ports[i], ACE_TEXT ("lookup"))); } } } const char *ipv4_addresses[] = { "127.0.0.1", "138.38.180.251", "64.219.54.121", "192.0.0.1", "10.0.0.1", 0 }; ACE_INET_Addr addr; status |= check_type_consistency (addr); char hostaddr[1024]; for (int i=0; ipv4_addresses[i] != 0; i++) { struct in_addr addrv4; ACE_OS::memset ((void *) &addrv4, 0, sizeof addrv4); ACE_UINT32 addr32; ACE_OS::inet_pton (AF_INET, ipv4_addresses[i], &addrv4); ACE_OS::memcpy (&addr32, &addrv4, sizeof (addr32)); status |= !(addr.set (80, ipv4_addresses[i]) == 0); status |= check_type_consistency (addr); /* ** Now check to make sure get_ip_address matches and get_host_addr ** matches. */ if (addr.get_ip_address () != ACE_HTONL (addr32)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error: %C failed get_ip_address() check\n") ACE_TEXT ("0x%x != 0x%x\n"), ipv4_addresses[i], addr.get_ip_address (), ACE_HTONL (addr32))); status = 1; } if (addr.get_host_addr () != 0 && ACE_OS::strcmp (addr.get_host_addr(), ipv4_addresses[i]) != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%C failed get_host_addr() check\n") ACE_TEXT ("%C != %C\n"), ipv4_addresses[i], addr.get_host_addr (), ipv4_addresses[i])); status = 1; } // Now we check the operation of get_host_addr(char*,int) const char* haddr = addr.get_host_addr (&hostaddr[0], sizeof(hostaddr)); if (haddr != 0 && ACE_OS::strcmp (&hostaddr[0], haddr) != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%C failed get_host_addr(char* buf,int) check\n") ACE_TEXT ("buf ['%C'] != return value ['%C']\n"), ipv4_addresses[i], &hostaddr[0], haddr)); status = 1; } if (ACE_OS::strcmp (&hostaddr[0], ipv4_addresses[i]) != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%C failed get_host_addr(char*,int) check\n") ACE_TEXT ("buf ['%C'] != expected value ['%C']\n"), ipv4_addresses[i], &hostaddr[0], ipv4_addresses[i])); status = 1; } // Clear out the address by setting it to 1 and check addr.set (0, ACE_UINT32 (1), 1); status |= check_type_consistency (addr); if (addr.get_ip_address () != 1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Failed to set address to 1\n"))); status = 1; } // Now set the address using a 32 bit number and check that we get // the right string out of get_host_addr(). addr.set (80, addr32, 0); // addr32 is already in network byte order status |= check_type_consistency(addr); if (addr.get_host_addr () != 0 && ACE_OS::strcmp (addr.get_host_addr (), ipv4_addresses[i]) != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%C failed second get_host_addr() check\n") ACE_TEXT ("return value ['%C'] != expected value ['%C']\n"), ipv4_addresses[i], addr.get_host_addr (), ipv4_addresses[i])); status = 1; } // Test for ACE_INET_Addr::set_addr(). struct sockaddr_in sa4; sa4.sin_family = AF_INET; sa4.sin_addr = addrv4; sa4.sin_port = ACE_HTONS (8080); addr.set (0, ACE_UINT32 (1), 1); addr.set_addr (&sa4, sizeof(sa4)); status |= check_type_consistency (addr); if (addr.get_port_number () != 8080) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_INET_Addr::set_addr() ") ACE_TEXT ("failed to update port number.\n"))); status = 1; } if (addr.get_ip_address () != ACE_HTONL (addr32)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_INET_Addr::set_addr() ") ACE_TEXT ("failed to update address.\n"))); status = 1; } } #if defined (ACE_HAS_IPV6) if (ACE::ipv6_enabled ()) { char local_host_name[1024]; ACE_OS::hostname(local_host_name, 1024); const char* local_names[] = {"localhost", local_host_name}; for (int i = 0; i < 2; ++i) { ACE_INET_Addr addr; int old_type = addr.get_type(); if (addr.set(12345, local_names[i]) == 0) { if (addr.get_type() != old_type) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("IPv6 set failed: addr.set(12345, \"%C\"), old addr.type() = %d, new addr_type()= %d\n"), local_names[i], old_type, addr.get_type ())); status = 1; } } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("IPv6 set failed: addr.set(12345, \"%C\") returns nonzero\n"), local_names[i])); } } const char *ipv6_addresses[] = { "1080::8:800:200c:417a", // unicast address "ff01::101", // multicast address "::1", // loopback address "::", // unspecified addresses 0 }; for (int i=0; ipv6_addresses[i] != 0; i++) { ACE_INET_Addr addr (80, ipv6_addresses[i]); status |= check_type_consistency (addr); if (0 != ACE_OS::strcmp (addr.get_host_addr (), ipv6_addresses[i])) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("IPv6 get_host_addr failed: %C != %C\n"), addr.get_host_addr (), ipv6_addresses[i])); status = 1; } } const char *ipv6_names[] = { "naboo.dre.vanderbilt.edu", "v6.ipv6-test.com", 0 }; for (int i=0; ipv6_names[i] != 0; i++) { ACE_INET_Addr addr (80, ipv6_names[i]); status |= check_type_consistency (addr); if (0 != ACE_OS::strcmp (addr.get_host_name (), ipv6_names[i])) { // Alias? Check lookup on the reverse. ACE_INET_Addr alias_check; if (alias_check.set (80, addr.get_host_name ()) == 0) { if (addr != alias_check) ACE_ERROR ((LM_WARNING, ACE_TEXT ("IPv6 name mismatch: %s (%s) != %s\n"), addr.get_host_name (), addr.get_host_addr (), ipv6_names[i])); } else { ACE_ERROR ((LM_WARNING, ACE_TEXT ("IPv6 reverse lookup mismatch: %s (%s) != %s\n"), addr.get_host_name (), addr.get_host_addr (), ipv6_names[i])); } } } } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("IPv6 tests done\n"))); #else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_HAS_IPV6 not set; no IPv6 tests run\n"))); #endif struct Address loopback_addresses[] = { {"127.0.0.1", true}, {"127.1.2.3", true} , {"127.0.0.0", true}, {"127.255.255.255", true} , {"126.255.255.255", false}, {"128.0.0.0", false}, {0, true} }; for (int i=0; loopback_addresses[i].name != 0; i++) { struct in_addr addrv4; ACE_UINT32 addr32 = 0; ACE_OS::inet_pton (AF_INET, loopback_addresses[i].name, &addrv4); ACE_OS::memcpy (&addr32, &addrv4, sizeof (addr32)); addr.set (80, loopback_addresses[i].name); if (addr.is_loopback() != loopback_addresses[i].loopback) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_INET_Addr::is_loopback() ") ACE_TEXT ("failed to distinguish loopback address. %C\n") , loopback_addresses[i].name)); status = 1; } } if (addr.string_to_addr ("127.0.0.1:72000", AF_INET) != -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_INET_Addr::string_to_addr() ") ACE_TEXT ("failed to detect port number overflow\n"))); status = 1; } if (!test_tao_use ()) status = 1; if (!test_multiple ()) status = 1; if (!test_port_assignment ()) status = 1; ACE_INET_Addr a1 (80, "127.0.0.1"); ACE_INET_Addr a2 = a1; if (a1 != a2) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Address equality check failed after assignment\n"))); status = 1; } if (!test_port_names ()) status = 1; ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/Thread_Attrs_Test.cpp0000644000175000017500000001650415027201773020426 0ustar sudipsudip //============================================================================= /** * @file Thread_Attrs_Test.cpp * * This test program ensures that attributes set on a thread via the * ACE_Task/ACE_Thread_Manager are honored. * * @author Steve Huston */ //============================================================================= #include "test_config.h" #include "ace/Task.h" #if defined (ACE_HAS_THREADS) class Cancel_Check : public ACE_Task { public: // Create a checker with the state, type requested. Cancel_Check (bool enable, bool async); //FUZZ: disable check_for_lack_ACE_OS // Spawn the thread int open (void * = 0) override; //FUZZ: enable check_for_lack_ACE_OS // Check the cancel settings against what is expected then exit. int svc () override; /// Returns true iff settings match what was requested. bool operator! (); private: bool enable_req_; bool async_req_; bool failed_; }; bool Cancel_Check::operator!() { return this->failed_; } Cancel_Check::Cancel_Check (bool enable, bool async) : enable_req_ (enable), async_req_(async), failed_ (false) { } int Cancel_Check::svc () { #if defined (ACE_HAS_PTHREADS) && !defined (ACE_LACKS_PTHREAD_CANCEL) int state; pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &state); if (state == PTHREAD_CANCEL_ENABLE && !this->enable_req_) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Cancel found enabled, should not be\n"))); this->failed_ = true; } else if (state == PTHREAD_CANCEL_DISABLE && this->enable_req_) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Cancel found disabled, should not be\n"))); this->failed_ = true; } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Cancel found %s; ok\n"), state == PTHREAD_CANCEL_ENABLE ? ACE_TEXT ("enabled") : ACE_TEXT ("disabled"))); } int type; pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &type); if (type == PTHREAD_CANCEL_ASYNCHRONOUS && !this->async_req_) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Cancel type async, should not be\n"))); this->failed_ = true; } else if (type == PTHREAD_CANCEL_DEFERRED && this->async_req_) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Cancel type deferred, should not be\n"))); this->failed_ = true; } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Cancel type %s; ok\n"), type == PTHREAD_CANCEL_DEFERRED ? ACE_TEXT ("deferred") : ACE_TEXT ("asynchronous"))); } #endif return 0; } int Cancel_Check::open (void *) { long flags = THR_NEW_LWP | THR_JOINABLE; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Flags before cancels: 0x%x\n"), flags)); flags |= (this->enable_req_ ? THR_CANCEL_ENABLE : THR_CANCEL_DISABLE); flags |= (this->async_req_ ? THR_CANCEL_ASYNCHRONOUS : THR_CANCEL_DEFERRED); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Flags after cancels: 0x%x\n"), flags)); if (this->activate (flags) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Cancel_Check activate failed")), -1); return 0; } /** * @class Stack_Size_Check * * @brief Defines a task that verifies its stack size. */ class Stack_Size_Check : public ACE_Task { public: /// Create the thread with specified stack size Stack_Size_Check (size_t stack_size); //FUZZ: disable check_for_lack_ACE_OS /// Spawn the thread int open (void * = 0) override; //FUZZ: enable check_for_lack_ACE_OS /// Check the stack size against what is expected then exit. int svc () override; /// Returns true iff failed_ == false. bool operator! (); private: size_t stack_size_; /// Flag indicating the test failed. bool failed_; }; bool Stack_Size_Check::operator!() { return this->failed_; } Stack_Size_Check::Stack_Size_Check (size_t stack_size) : stack_size_ (stack_size), failed_ (false) { } int Stack_Size_Check::svc () { size_t my_size = 0; #ifdef __USE_GNU pthread_attr_t my_attrs; pthread_getattr_np (pthread_self (), &my_attrs); pthread_attr_getstacksize (&my_attrs, &my_size); pthread_attr_destroy (&my_attrs); #else // No known way to do this yet... feel free to fill this in. my_size = this->stack_size_; #endif /* __USE_GNU */ // The Posix docs say that the size set for the threads stack will be the // *minimum* size allocated (the actual size may be bigger because of // a) pagesize rounding, b) guardsize addition) so we can really only // check if we have gotten *at least* what we asked for. if (my_size < this->stack_size_) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%t: My stack size attr %B; expected %B\n"), my_size, this->stack_size_)); this->failed_ = true; } else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%t: My stack size attr %B; correct.\n"), my_size)); return 0; } int Stack_Size_Check::open (void *) { if (this->activate (THR_NEW_LWP | THR_JOINABLE, 1, 0, ACE_DEFAULT_THREAD_PRIORITY, -1, 0, 0, 0, &stack_size_) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Stack_Size_Check activate failed")), -1); return 0; } #endif /* ACE_HAS_THREADS */ int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Thread_Attrs_Test")); int status = 0; #if defined (ACE_HAS_THREADS) Stack_Size_Check size_checker (40*1024); status = size_checker.open(0); if (status == 0) { if (size_checker.wait () == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("size_checker %p\n"), ACE_TEXT ("wait")), 1); if (!size_checker) status = 1; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Cancel flags sanity check:\n") ACE_TEXT (" THR_CANCEL_ENABLE: 0x%x\n") ACE_TEXT (" THR_CANCEL_DISABLE: 0x%x\n") ACE_TEXT (" THR_CANCEL_DEFERRED: 0x%x\n") ACE_TEXT (" THR_CANCEL_ASYNCHRONOUS: 0x%x\n"), THR_CANCEL_ENABLE, THR_CANCEL_DISABLE, THR_CANCEL_DEFERRED, THR_CANCEL_ASYNCHRONOUS)); // Cancel check args: enable (yes/no), async/deferred Cancel_Check check1 (true, true); Cancel_Check check2 (true, false); Cancel_Check check3 (false, true); Cancel_Check check4 (false, false); if (check1.open(0) == 0) { check1.wait (); if (!check1) status = 1; check2.open (0); check2.wait (); if (!check2) status = 1; check3.open (0); check3.wait (); if (!check3) status = 1; check4.open (0); check4.wait (); if (!check4) status = 1; } else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Cancel_Check open"))); status = 1; } #else ACE_ERROR ((LM_INFO, ACE_TEXT ("threads not supported on this platform\n"))); #endif /* ACE_HAS_THREADS */ ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/Max_Default_Port_Test.cpp0000644000175000017500000001735515027201773021244 0ustar sudipsudip//============================================================================= /** * @file Max_Default_Port_Test.cpp * * This is a test for ACE_MAX_DEFAULT_PORT value. The test tests the * highest value of the port number at which an event handler can be * registered and a Connector can be connected to. * * Some weird behaviour has been reported on Windows NT (sp 3) when * the port number exceeds 65279 resulting ACE_MAX_DEFAULT_PORT to set * to zero on that platform. * * In this test, the event handler is started at the port value * USHRT_MAX and decremented for 'ports_to_test' port values and tested * if the highest port number used agrees with ACE_MAX_DEFAULT_PORT value. * * @author Chanaka Liyanaarachchi */ //============================================================================= #include "test_config.h" #include "ace/Reactor.h" #include "ace/SOCK_Connector.h" #include "ace/Thread_Manager.h" #include "ace/OS_NS_unistd.h" #include "ace/Time_Value.h" #include "Max_Default_Port_Test.h" // implement a retry and recuperation mechanism for VxWorks because test will otherwise fail // on a non-optimized kernel with several ETIME errors on the client connects. #if defined (ACE_VXWORKS) int retry_port_ = 0; #endif My_Accept_Handler::My_Accept_Handler (ACE_INET_Addr &addr) : addr_ (addr) { if (addr.get_port_number() != 0) this->open (addr); } My_Accept_Handler::~My_Accept_Handler () { this->peer_acceptor_.close (); // Prevent handle leaks } int My_Accept_Handler::open (ACE_INET_Addr &addr) { if (this->peer_acceptor_.open (addr, 1) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("My_Accept_Handler open"))); ACE_OS::exit (1); } return 0; } ACE_HANDLE My_Accept_Handler::get_handle () const { return this->peer_acceptor_.get_handle (); } int My_Accept_Handler::handle_input (ACE_HANDLE) { if (this->peer_acceptor_.accept(this->stream_, 0) == -1) { ACE_ERROR((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("peer_acceptor.accept"))); ACE_OS::exit(1); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("My_Accept_Handler::handle_input\n"))); // Close the opened stream, else it'll leak a handle. Don't close // the acceptor here, though, because get_handle() needs it to // correctly allow removal from the reactor later. It gets closed // in the destructor. this->stream_.close (); return 0; } u_short My_Accept_Handler::port () { return this->addr_.get_port_number(); } long max_connected_port = 0; void * client (void *arg) { ACE_INET_Addr *remote_addr = reinterpret_cast (arg); ACE_INET_Addr server_addr (remote_addr->get_port_number (), ACE_LOCALHOST, AF_INET); ACE_SOCK_Stream cli_stream; ACE_SOCK_Connector con; ACE_Time_Value timeout (ACE_DEFAULT_TIMEOUT); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Connecting to port %d\n"), server_addr.get_port_number())); // Initiate connection with server; don't wait forever if (con.connect (cli_stream, server_addr, &timeout) == -1) { #if defined (ACE_VXWORKS) if (errno == ETIME) { if ( ++retry_port_<6 ) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Going to retry port %d\n"), server_addr.get_port_number())); } } if ( retry_port_>5 ) { retry_port_ = 0; #endif ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("connection failed"))); #if defined (ACE_VXWORKS) } #endif return 0; } #if defined (ACE_VXWORKS) retry_port_ = 0; #endif // if connect succesful, what is the max port number we connected // up to now. int connected_port = server_addr.get_port_number (); if (connected_port > max_connected_port) max_connected_port = connected_port; cli_stream.close (); return 0; } int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Max_Default_Port_Test")); ACE_UNUSED_ARG (argc); ACE_UNUSED_ARG (argv); #ifndef ACE_LACKS_ACCEPT u_short max_listened_port = 0; #if defined (__Lynx__) // LynxOS can handle only 80 test iterations. // This needs to be investigated further -- olli 12.11.2007 const u_short ports_to_test = 80; #else const u_short ports_to_test = 300; #endif //Ports beyond 65279 were said to bad on NT sp 3. for (u_short idx = USHRT_MAX; idx != USHRT_MAX - ports_to_test; --idx) { #if defined (ACE_VXWORKS) if (retry_port_>0) { ++idx; ACE_OS::sleep (ACE_Time_Value (2*ACE_DEFAULT_TIMEOUT)); } #endif ACE_INET_Addr addr (idx); My_Accept_Handler *eh = new My_Accept_Handler (addr); if ( ACE_Reactor::instance()->register_handler ( eh, ACE_Event_Handler::ACCEPT_MASK) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Failed to register event handler")), 1); } ACE_DEBUG ((LM_DEBUG, "Registered event handler at %d\n", idx)); ACE_Time_Value tv (1); #if defined (ACE_HAS_THREADS) if (ACE_Thread_Manager::instance ()->spawn_n (1, ACE_THR_FUNC (client), reinterpret_cast (&addr), THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("thread create failed")), 1); ACE_Thread_Manager::instance ()->wait (); #else ACE_UNUSED_ARG (client); ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) only one thread may be run in a process on this platform\n%a"), 1)); #endif //ACE_HAS_THREADS if (ACE_Reactor::instance()->handle_events (tv) == -1 ) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Reactor::handle_events")), 1); } // see if I can register a reactor at this port. if (eh->port () == idx) { if (idx > max_listened_port) max_listened_port = idx; } else { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Test Fail, listening port %d\n"), eh->port()), 1); } ACE_Reactor::instance()->remove_handler ( eh, ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); delete eh; } ACE_DEBUG ((LM_DEBUG, "Value of ACE_MAX_DEFAULT_PORT %d\n", ACE_MAX_DEFAULT_PORT)); ACE_DEBUG ((LM_DEBUG, "Highest port value I can listen at %d\n", max_listened_port)); ACE_DEBUG ((LM_DEBUG, "Highest port value I can connect to %d\n", max_connected_port)); if ((max_listened_port == ACE_MAX_DEFAULT_PORT) && (max_connected_port == ACE_MAX_DEFAULT_PORT)) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Valid ACE_MAX_DEFAULT_PORT value: %d\n"), max_listened_port)); } else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invalid ACE_MAX_DEFAULT_PORT ") ACE_TEXT ("or %d port may be busy; got to %d\n"), ACE_MAX_DEFAULT_PORT, max_listened_port)); } #endif // ACE_LACKS_ACCEPT ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/run_test.lst0000644000175000017500000002144515027201773016726 0ustar sudipsudip# This is the list of tests that need to be run by run_test.pl. # Each line has its own test, and a test can be followed by a # list of platforms it runs or does not run on. # # Example: Foo_Test: !linux # Example: Bar_Test: # Example: Baz_Test: Win32 !Borland # # Foo_Test runs on all configurations except for linux # # Bar_Test runs on all configurations # # Baz_Test only runs on Win32 configurations but not on Borland # configurations. ACE_Init_Test: MFC ACE_Test Aio_Platform_Test Arg_Shifter_Test ARGV_Test Array_Map_Test Atomic_Op_Test Auto_Event_Test Auto_IncDec_Test Barrier_Test Based_Pointer_Test: !STATIC !ACE_FOR_TAO !PHARLAP Basic_Types_Test Bound_Ptr_Test: !ACE_FOR_TAO Buffer_Stream_Test Bug_1576_Regression_Test Bug_1890_Regression_Test Bug_2368_Regression_Test: Bug_2434_Regression_Test Bug_2497_Regression_Test Bug_2540_Regression_Test Bug_2609_Regression_Test: !ST !ACE_FOR_TAO Bug_2610_Regression_Test: !ST !ACE_FOR_TAO !FIXED_BUGS_ONLY Bug_2659_Regression_Test: !ST !VxWorks Bug_2653_Regression_Test: !ST Bug_2740_Regression_Test: !ST Bug_2772_Regression_Test: !ST !FIXED_BUGS_ONLY Bug_2815_Regression_Test Bug_2820_Regression_Test Bug_2980_Regression_Test: !STATIC !Win32 !VxWorks !WCHAR !FACE_SAFETY Bug_3102_Regression_Test Bug_3319_Regression_Test Bug_3334_Regression_Test: !STATIC Bug_3432_Regression_Test Bug_3500_Regression_Test Bug_3505_Regression_Test Bug_3532_Regression_Test Bug_3539_Regression_Test Bug_3541_Regression_Test Bug_3673_Regression_Test Bug_3709_Regression_Test: !LabVIEW_RT Bug_3710_Regression_Test Bug_3729_Regression_Test: Bug_3744_Regression_Test: !FIXED_BUGS_ONLY Bug_3758_Regression_Test: !FIXED_BUGS_ONLY Bug_3878_Regression_Test Bug_3911_Regression_Test: !FIXED_BUGS_ONLY !ACE_FOR_TAO Bug_3912_Regression_Test: !STATIC Bug_3943_Regression_Test: !ACE_FOR_TAO Bug_3974_Regression_Test Bug_4055_Regression_Test: !ST Bug_4189_Regression_Test: !ST !ACE_FOR_TAO CDR_Array_Test: !ACE_FOR_TAO CDR_File_Test: !ACE_FOR_TAO CDR_Fixed_Test: !ACE_FOR_TAO CDR_Test Chrono_Test Cache_Map_Manager_Test Cached_Accept_Conn_Test: !ACE_FOR_TAO !LabVIEW_RT Cached_Allocator_Test: !ACE_FOR_TAO Cached_Conn_Test: !ACE_FOR_TAO !LabVIEW_RT Capabilities_Test: !ACE_FOR_TAO Codecs_Test: !NO_CODECS !ACE_FOR_TAO Collection_Test Compiler_Features_01_Test Compiler_Features_02_Test Compiler_Features_03_Test Compiler_Features_04_Test Compiler_Features_05_Test Compiler_Features_06_Test Compiler_Features_07_Test Compiler_Features_09_Test Compiler_Features_11_Test Compiler_Features_12_Test Compiler_Features_13_Test Compiler_Features_14_Test Compiler_Features_15_Test Compiler_Features_16_Test Compiler_Features_17_Test Compiler_Features_18_Test Compiler_Features_19_Test Compiler_Features_21_Test Compiler_Features_23_Test Compiler_Features_24_Test Compiler_Features_25_Test Compiler_Features_26_Test Compiler_Features_27_Test Compiler_Features_28_Test Compiler_Features_29_Test Compiler_Features_31_Test Compiler_Features_32_Test Compiler_Features_33_Test Compiler_Features_34_Test Compiler_Features_35_Test Compiler_Features_36_Test Compiler_Features_37_Test Compiler_Features_38_Test Compiler_Features_39_Test Compiler_Features_40_Test Compiler_Features_41_Test Compiler_Features_42_Test Config_Test: !LynxOS !VxWorks !ACE_FOR_TAO Conn_Test: !ACE_FOR_TAO DLL_Test: !STATIC DLList_Test: !ACE_FOR_TAO Date_Time_Test: !ACE_FOR_TAO Dev_Poll_Reactor_Test: !nsk !ST Dev_Poll_Reactor_Echo_Test: !nsk !ST Dirent_Test: !VxWorks_RTP !LabVIEW_RT Dynamic_Priority_Test Dynamic_Test Enum_Interfaces_Test: !NO_NETWORK !LynxOS Env_Value_Test: !LabVIEW_RT FIFO_Test: !ACE_FOR_TAO Framework_Component_Test: !STATIC !nsk Future_Set_Test: !nsk !ACE_FOR_TAO Future_Test: !nsk !ACE_FOR_TAO Future_Stress_Test: !nsk !ACE_FOR_TAO Get_Opt_Test Handle_Set_Test: !ACE_FOR_TAO Hash_Map_Bucket_Iterator_Test Hash_Map_Manager_Test Hash_Multi_Map_Manager_Test High_Res_Timer_Test: !ACE_FOR_TAO NDDS_Timer_Test: NDDS INET_Addr_Test: !NO_NETWORK IOStream_Test Integer_Truncate_Test Intrusive_Auto_Ptr_Test Lazy_Map_Manager_Test Log_Msg_Test: !ACE_FOR_TAO Log_Msg_Backend_Test: !ACE_FOR_TAO Log_Thread_Inheritance_Test: !ST Logging_Strategy_Test: !LynxOS !STATIC !ST Manual_Event_Test MEM_Stream_Test: !VxWorks !nsk !ACE_FOR_TAO !PHARLAP !QNX !LynxOS MM_Shared_Memory_Test: !VxWorks !nsk !ACE_FOR_TAO !LynxOS MT_NonBlocking_Connect_Test: !ST MT_Reactor_Timer_Test MT_Reactor_Upcall_Test: !nsk MT_Reference_Counted_Event_Handler_Test: !LynxOS MT_Reference_Counted_Event_Handler_Test -b 0: LynxOS MT_Reference_Counted_Event_Handler_Test -a 0: LynxOS MT_Reference_Counted_Notify_Test MT_SOCK_Test: !LynxOS Malloc_Test: !VxWorks !LynxOS !ACE_FOR_TAO !PHARLAP Map_Manager_Test: !ACE_FOR_TAO Map_Test: !ACE_FOR_TAO Max_Default_Port_Test: !ST Mem_Map_Test: !VxWorks !nsk !ACE_FOR_TAO !LynxOS Memcpy_Test: !ACE_FOR_TAO Message_Block_Large_Copy_Test Message_Block_Test: !ACE_FOR_TAO Message_Queue_Notifications_Test Message_Queue_Test: !ACE_FOR_TAO Message_Queue_Test_Ex: !ACE_FOR_TAO Monotonic_Manual_Event_Test Monotonic_Message_Queue_Test: !ACE_FOR_TAO Monotonic_Task_Test: !ACE_FOR_TAO Multicast_Test: !ST !NO_MCAST !nsk !LynxOS !LabVIEW_RT Multicast_Interfaces_Test: !ST !NO_MCAST !nsk !LynxOS !LabVIEW_RT !FACE_SAFETY Multihomed_INET_Addr_Test: !ACE_FOR_TAO Naming_Test: !NO_OTHER !LynxOS !VxWorks !nsk !ACE_FOR_TAO !PHARLAP Network_Adapters_Test: !ACE_FOR_TAO New_Fail_Test: ALL !DISABLED NonBlocking_Conn_Test Notification_Queue_Unit_Test Notify_Performance_Test: !nsk !ACE_FOR_TAO OS_Test Object_Manager_Test Object_Manager_Flipping_Test Obstack_Test OrdMultiSet_Test Pipe_Test: !PHARLAP !VxWorks Priority_Buffer_Test Priority_Reactor_Test: !ACE_FOR_TAO Priority_Task_Test Proactor_File_Test: !VxWorks !LynxOS !nsk !ACE_FOR_TAO !BAD_AIO Proactor_Scatter_Gather_Test: !VxWorks !nsk !ACE_FOR_TAO Proactor_Test: !VxWorks !LynxOS !nsk !ACE_FOR_TAO !BAD_AIO Proactor_Timer_Test: !VxWorks !nsk !ACE_FOR_TAO Proactor_UDP_Test: !VxWorks !LynxOS !nsk !ACE_FOR_TAO !BAD_AIO Process_Env_Test: !VxWorks !PHARLAP Process_Test: !VxWorks !ACE_FOR_TAO !PHARLAP Process_Manager_Test: !VxWorks !ACE_FOR_TAO !PHARLAP Process_Manual_Event_Test: !VxWorks !ACE_FOR_TAO !PHARLAP Process_Mutex_Test: !VxWorks !ACE_FOR_TAO !PHARLAP Process_Semaphore_Test: !VxWorks !ACE_FOR_TAO !PHARLAP RB_Tree_Test Bug_3332_Regression_Test Reactor_Dispatch_Order_Test Reactor_Dispatch_Order_Test_Dev_Poll: Reactor_Exceptions_Test Reactor_Fairness_Test: !FIXED_BUGS_ONLY Reactor_Notify_Test: !ST !ACE_FOR_TAO Reactor_Notification_Queue_Test Reactor_Performance_Test: !ACE_FOR_TAO Reactor_Registration_Test Reactor_Remove_Resume_Test Reactor_Remove_Resume_Test_Dev_Poll: Reactor_Timer_Test: !ACE_FOR_TAO Reactors_Test Reader_Writer_Test Recursive_Condition_Test: !ST Recursive_Mutex_Test: !ST Refcounted_Auto_Ptr_Test: !ACE_FOR_TAO Reference_Counted_Event_Handler_Test -d 0 Refcounted_Event_Handler_Test_DevPoll: Reverse_Lock_Test RW_Process_Mutex_Test: !VxWorks !ACE_FOR_TAO !PHARLAP !Cygwin Sendfile_Test: !NO_NETWORK !VxWorks !LabVIEW_RT Signal_Test: !VxWorks !Cygwin SOCK_Acceptor_Test: !NO_NETWORK SOCK_Connector_Test: !NO_NETWORK SOCK_Netlink_Test: !ACE_FOR_TAO SOCK_Send_Recv_Test: !NO_NETWORK SOCK_Test: !NO_NETWORK SPIPE_Test: !nsk !ACE_FOR_TAO SString_Test: !ACE_FOR_TAO Stack_Trace_Test: SV_Shared_Memory_Test: !MSVC !VxWorks !nsk !ACE_FOR_TAO Semaphore_Test: !ACE_FOR_TAO Service_Config_Test: !STATIC Missing_Svc_Conf_Test: !STATIC Service_Config_Stream_Test: !STATIC !FIXED_BUGS_ONLY Sigset_Ops_Test Simple_Message_Block_Test Singleton_Test Singleton_Restart_Test Svc_Handler_Test: !ACE_FOR_TAO Task_Wait_Test TP_Reactor_Test: !ACE_FOR_TAO TSS_Test TSS_Leak_Test: !ST !FIXED_BUGS_ONLY TSS_Static_Test Task_Test Task_Group_Test Task_Ex_Test Thread_Attrs_Test Thread_Manager_Test Thread_Mutex_Test Thread_Pool_Reactor_Resume_Test: !NO_OTHER !ST Thread_Pool_Reactor_Test: !NO_OTHER Thread_Pool_Test Thread_Creation_Threshold_Test: !LynxOS Time_Service_Test: !STATIC !DISABLED !missing_netsvcs TOKEN Time_Value_Test Timeprobe_Test Timer_Cancellation_Test Timer_Queue_Reference_Counting_Test Timer_Queue_Test: !ACE_FOR_TAO Token_Strategy_Test: !ST !nsk Tokens_Test: MSVC !DISABLED TOKEN UPIPE_SAP_Test: !nsk !ACE_FOR_TAO Unbounded_Set_Test Upgradable_RW_Test: !ACE_FOR_TAO Vector_Test WFMO_Reactor_Test: !nsk INET_Addr_Test_IPV6: !nsk Max_Default_Port_Test_IPV6: !nsk Multicast_Test_IPV6: !NO_MCAST !nsk Multihomed_INET_Addr_Test_IPV6: !nsk !ACE_FOR_TAO Proactor_Test_IPV6: !nsk !ACE_FOR_TAO !BAD_AIO SOCK_Send_Recv_Test_IPV6 SOCK_Dgram_Test: !NO_NETWORK SOCK_Dgram_Bcast_Test: !ACE_FOR_TAO SOCK_SEQPACK_SCTP_Test: !MSVC !nsk !ACE_FOR_TAO SOCK_Test_IPv6: !nsk Process_Strategy_Test: !VxWorks !LynxOS !ACE_FOR_TAO !PHARLAP Recursive_Condition_Bug_Test: !ST UnloadLibACE: !STATIC !LabVIEW_RT UUID_Test: !NO_UUID !ACE_FOR_TAO Wild_Match_Test SSL/Bug_2912_Regression_Test: SSL !ACE_FOR_TAO !BAD_AIO SSL/SSL_Asynch_Stream_Test: SSL !ACE_FOR_TAO !BAD_AIO !FIXED_BUGS_ONLY SSL/Thread_Pool_Reactor_SSL_Test: SSL UNIX_Addr_Test: !ACE_FOR_TAO ace-8.0.4+dfsg.orig/tests/Proactor_Test.h0000644000175000017500000000752315027201773017301 0ustar sudipsudip //============================================================================= /** * @file Proactor_Test.h * * Define class needed for generating templates. IBM C++ requires this to * be in its own file for auto template instantiation. * * @author @author Alexander Libman */ //============================================================================= #ifndef ACE_TESTS_PROACTOR_TEST_H #define ACE_TESTS_PROACTOR_TEST_H #include "ace/Synch_Traits.h" #include "ace/Thread_Mutex.h" // forward declaration class TestData; class Server : public ACE_Service_Handler { public: Server (); Server (TestData *tester, int id); ~Server (); int id () { return this->id_; } size_t get_total_snd () { return this->total_snd_; } size_t get_total_rcv () { return this->total_rcv_; } long get_total_w () { return this->total_w_; } long get_total_r () { return this->total_r_; } // This is called to pass the new connection's addresses. virtual void addresses (const ACE_INET_Addr& peer, const ACE_INET_Addr& local); /// This is called after the new connection has been accepted. virtual void open (ACE_HANDLE handle, ACE_Message_Block &message_block); void cancel (); protected: //// This is called when asynchronous operation from the //// socket completes. /** * @name AIO callback handling * * These methods are called by the framework */ virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result); /// This is called when an asynchronous to the socket /// completes. virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result); private: int initiate_read_stream (); int initiate_write_stream (ACE_Message_Block &mb, size_t nbytes); TestData *tester_; int id_; ACE_Asynch_Read_Stream rs_; ACE_Asynch_Write_Stream ws_; ACE_HANDLE handle_; ACE_SYNCH_MUTEX lock_; int io_count_; // Number of currently outstanding I/O requests int flg_cancel_; size_t total_snd_; // Number of bytes successfully sent size_t total_rcv_; // Number of bytes successfully received int total_w_; // Number of write operations int total_r_; // Number of read operations }; // ******************************************* // Client // ******************************************* class Client : public ACE_Service_Handler { public: /// This is called after the new connection has been established. virtual void open (ACE_HANDLE handle, ACE_Message_Block &message_block); Client (); Client (TestData *tester, int id); ~Client (); int id () { return this->id_; } size_t get_total_snd () { return this->total_snd_; } size_t get_total_rcv () { return this->total_rcv_; } int get_total_w () { return this->total_w_; } int get_total_r () { return this->total_r_; } // This is called to pass the new connection's addresses. virtual void addresses (const ACE_INET_Addr& peer, const ACE_INET_Addr& local); /// This is called when asynchronous reads from the socket complete virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result); /// This is called when asynchronous writes from the socket complete virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result); void cancel (); private: int initiate_read_stream (); int initiate_write_stream (); void close (); TestData *tester_; int id_; ACE_Asynch_Read_Stream rs_; ACE_Asynch_Write_Stream ws_; ACE_HANDLE handle_; ACE_SYNCH_MUTEX lock_; int io_count_; int stop_writing_; // Writes are shut down; just read. int flg_cancel_; size_t total_snd_; size_t total_rcv_; int total_w_; int total_r_; }; #endif /* ACE_TESTS_PROACTOR_TEST_H */ ace-8.0.4+dfsg.orig/tests/Memcpy_Test.cpp0000644000175000017500000000560215027201773017271 0ustar sudipsudip//============================================================================= /** * @file Memcpy_Test.cpp * * @author Mike Marinez * * This test compares the performance of ACE_OS::memcpy with * that of smemcpy which unrolls the memcpy loop upto size = 16. */ //============================================================================= #include "ace/OS_NS_string.h" #include "ace/High_Res_Timer.h" #include "test_config.h" void * smemcpy (void *dest, const void *src, const size_t n) { unsigned char *to = static_cast (dest); const unsigned char *from = static_cast (src); // Unroll the loop... switch (n) { case 16: to[ 15] = from[ 15]; ACE_FALLTHROUGH; case 15: to[ 14] = from[ 14]; ACE_FALLTHROUGH; case 14: to[ 13] = from[ 13]; ACE_FALLTHROUGH; case 13: to[ 12] = from[ 12]; ACE_FALLTHROUGH; case 12: to[ 11] = from[ 11]; ACE_FALLTHROUGH; case 11: to[ 10] = from[ 10]; ACE_FALLTHROUGH; case 10: to[ 9] = from[ 9]; ACE_FALLTHROUGH; case 9: to[ 8] = from[ 8]; ACE_FALLTHROUGH; case 8: to[ 7] = from[ 7]; ACE_FALLTHROUGH; case 7: to[ 6] = from[ 6]; ACE_FALLTHROUGH; case 6: to[ 5] = from[ 5]; ACE_FALLTHROUGH; case 5: to[ 4] = from[ 4]; ACE_FALLTHROUGH; case 4: to[ 3] = from[ 3]; ACE_FALLTHROUGH; case 3: to[ 2] = from[ 2]; ACE_FALLTHROUGH; case 2: to[ 1] = from[ 1]; ACE_FALLTHROUGH; case 1: to[ 0] = from[ 0]; ACE_FALLTHROUGH; case 0: return dest; default: return ACE_OS::memcpy (dest, src, n); } } void testit (int type) { char buffer[16]; size_t const size = 16; switch (type) { case 0: smemcpy ((void*)buffer, (void*)" THIS IS A TEST", size); break; case 1: ACE_OS::memcpy ((void*)buffer, (void*)" THIS IS A TEST", size); break; } } namespace { enum { ITERATIONS = 100000000 }; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Memcpy_Test")); //ACE_Time_Value start, now; struct timeval start, now; for (int i = ITERATIONS; i > 0; --i) testit (0); start = ACE_High_Res_Timer::gettimeofday_hr (); for (int j = ITERATIONS; j > 0; --j) testit (0); now = ACE_High_Res_Timer::gettimeofday_hr (); double fast = 1000000 *(now.tv_sec - start.tv_sec) + now.tv_usec - start.tv_usec; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%f uSec per iteration for fast version.\n"), fast / ITERATIONS)); start = ACE_High_Res_Timer::gettimeofday_hr (); for (int k = ITERATIONS; k > 0; --k) testit (1); now = ACE_High_Res_Timer::gettimeofday_hr (); double slow = 1000000 * (now.tv_sec-start.tv_sec) + now.tv_usec - start.tv_usec; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%f uSec per iteration for slow version.\n"), slow / ITERATIONS)); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/INET_Addr_Test_IPV6.cpp0000644000175000017500000001477315027201773020345 0ustar sudipsudip// ============================================================================ /** * @file INET_Addr_Test_IPV6.cpp * * @brief Additional tests on the ACE_INET_Addr class above and beyond * those found in INET_Addr_Test. These primarily focus on additional * functionality and bug fixes to ACE_INET_Addr. * * @author John Aughey * Brian Buesker */ // ============================================================================ #include "test_config.h" #include "ace/OS_NS_string.h" #include "ace/INET_Addr.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_arpa_inet.h" #if defined (ACE_HAS_IPV6) #define LINK_LOCAL_ADDR ACE_TEXT ("fe80::") #define SITE_LOCAL_ADDR ACE_TEXT ("fec0::") #define THE_INTERFACE ("eth0") // Make sure that ACE_Addr::addr_type_ is the same // as the family of the inet_addr_. static int check_type_consistency (const ACE_INET_Addr &addr) { int family = -1; if (addr.get_type () == AF_INET) { struct sockaddr_in *sa4 = (struct sockaddr_in *)addr.get_addr(); family = sa4->sin_family; } else if (addr.get_type () == AF_INET6) { struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)addr.get_addr(); family = sa6->sin6_family; } if (addr.get_type () != family) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Inconsistency between ACE_SOCK::addr_type_ (%d) ") ACE_TEXT ("and the sockaddr family (%d)\n"), addr.get_type (), family)); return 1; } return 0; } // A test to ensure ACE_INET_Addr can select the protocol family. static bool check_both_families() { bool good = true; ACE_INET_Addr a; if (-1 == a.set(ACE_TEXT (""), ACE_TEXT ("www.google.com"), ACE_TEXT ("tcp"))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("both test 4, www.google.com"))); good = false; } else { ACE_TCHAR str[1000]; a.addr_to_string (str, 1000, 1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("got type %d, addr %s\n"), a.get_type(), str)); // Should have selected IPv4. if (a.get_type() != AF_INET) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Wrong address family, expecting IPv4\n"))); good = false; } } ACE_INET_Addr b; if (-1 == b.set(ACE_TEXT(""), ACE_TEXT("www.google.com"), ACE_TEXT("tcp6"))) { ACE_ERROR((LM_ERROR, ACE_TEXT("%p\n"), ACE_TEXT("both test 6, www.google.com"))); good = false; } else { ACE_TCHAR str[1000]; b.addr_to_string(str, 1000, 1); ACE_DEBUG((LM_DEBUG, ACE_TEXT("got type %d, addr %s\n"), b.get_type(), str)); // Should have selected IPv6. if (b.get_type() != AF_INET6) { ACE_ERROR((LM_ERROR, ACE_TEXT("Wrong address family, expecting IPv6\n"))); good = false; } } return good; } #endif /* ACE_HAS_IPV6 */ int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("INET_Addr_Test_IPV6")); int status = 0; // Innocent until proven guilty #if defined (ACE_HAS_IPV6) if (ACE::ipv6_enabled ()) { ACE_INET_Addr addr ("::"); // this should switch it back to an IPv4 address addr.set (80); if (AF_INET != addr.get_type()) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("set failed: Address type %d != AF_INET\n"), addr.get_type())); status = 1; } // this should get mapped to an IPv6 address addr.set (80, ACE_UINT32 (INADDR_ANY), 1, 1); if (AF_INET6 != addr.get_type()) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("set failed: Address type %d != AF_INET6\n"), addr.get_type())); status = 1; } // Test for ACE_INET_Addr::set_addr(). struct in_addr addrv4; ACE_OS::inet_pton (AF_INET, "127.0.0.1", &addrv4); struct sockaddr_in sa4; sa4.sin_family = AF_INET; sa4.sin_addr = addrv4; sa4.sin_port = ACE_HTONS (8080); addr.set (0, ACE_UINT32 (1), 1); // test to make sure this doesn't get mapped to an IPv6 address addr.set_addr (&sa4, sizeof(sa4), 0); if (addr.get_type() != AF_INET) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("set_addr failed: Address type %d != AF_INET\n"), addr.get_type())); status = 1; } // now test to make sure it does get mapped to an IPv6 address addr.set_addr (&sa4, sizeof(sa4), 1); if (addr.get_type() != AF_INET6) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("set_addr failed: Address type %d != AF_INET6\n"), addr.get_type())); status = 1; } // test to make sure that the type gets set correctly when set is // called with another ACE_INET_Addr addr.set (0, ACE_UINT32 (1), 1); ACE_INET_Addr addrIPv6 ((u_short) 0, ACE_IPV6_LOCALHOST); addr.set (addrIPv6); status |= check_type_consistency (addr); #if defined (ACE_LINUX) // test a link local address to make sure the set_interface method works ACE_INET_Addr link_local_addr (80, LINK_LOCAL_ADDR); if (!link_local_addr.is_linklocal()) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("IPv6 is_linklocal failed\n"))); status = 1; } if (0 != ACE_OS::strcmp (ACE_TEXT_CHAR_TO_TCHAR(link_local_addr.get_host_addr ()), LINK_LOCAL_ADDR)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("IPv6 get_host_addr failed: %s != %s\n"), link_local_addr.get_host_addr (), LINK_LOCAL_ADDR)); status = 1; } if (-1 == link_local_addr.set_interface (THE_INTERFACE)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("IPv6 set_interface failed\n"))); status = 1; } // test a site local address ACE_INET_Addr site_local_addr (80, SITE_LOCAL_ADDR); if (!site_local_addr.is_sitelocal()) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("IPv6 is_sitelocal failed\n"))); status = 1; } #endif /* ACE_LINUX */ } if (!check_both_families()) status = 1; #endif /* ACE_HAS_IPV6 */ ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/Bug_2659_Regression_Test.cpp0000644000175000017500000001013315027201773021434 0ustar sudipsudip //============================================================================= /** * @file Bug_2659_Regression_Test.cpp * * Reproduces the problems reported in bug 2659: * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=2659 * * @author Ciju John */ //============================================================================= #include "test_config.h" #include "ace/Log_Msg.h" #include "ace/Task.h" #include "ace/OS_NS_unistd.h" #include "ace/Thread_Manager.h" #include "ace/TP_Reactor.h" #if !defined (ACE_LACKS_UNIX_SIGNALS) bool reactor_task_ready = false; //#define RUN_DEBUG 1 #if defined RUN_DEBUG #define EE_DEBUG(CNAME,MNAME,LOC) \ EntryExit ee (CNAME,MNAME,LOC) class EntryExit { public: EntryExit (const ACE_TCHAR* class_name, const ACE_TCHAR *method_name, void *location = 0) { class_name_ [20] = method_name_[20] = 0; ACE_OS::strncpy (class_name_, class_name, 20); ACE_OS::strncpy (method_name_, method_name, 20); location_ = location; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Entry %@ %s::%s\n") , location, class_name, method_name)); }; ~EntryExit () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Exit %@ %s::%s\n") , location_, class_name_, method_name_)); }; private: ACE_TCHAR class_name_[21]; ACE_TCHAR method_name_[21]; void *location_; }; #else #define EE_DEBUG(CNAME,MNAME,LOC) #endif // if defined RUN_DEBUG static void handle_signal (int ) { EE_DEBUG ("", "handle_signal", 0); // Dummy signal handler } class ReactorTask : public ACE_Task_Base { public: ~ReactorTask () override { EE_DEBUG ("ReactorTask", "~ReactorTask", this); }; int svc ( ) override { EE_DEBUG ("ReactorTask", "svc", this); // Register a valid signal handler // so process doesn't die upon receiving signal ACE_Sig_Action sa ((ACE_SignalHandler) &::handle_signal, SIGUSR1); ACE_UNUSED_ARG (sa); if (simulate_perform_work () == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) ERROR: simulated_perform_work failed.\n")) , -1); } return 0; }; private: int simulate_perform_work () { EE_DEBUG ("ReactorTask", "simulate_perform_work", this); // Create a reactor which doesn't automatically restart // upon interruption ACE_TP_Reactor tp_reactor (ACE_TP_Reactor::DEFAULT_SIZE, 0); reactor_task_ready = true; // This will return upon signal interruption return tp_reactor.handle_events (); } }; int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Bug_2659_Regression_Test")); EE_DEBUG ("", "run_main", 0); ReactorTask reactor_task; #if !defined ACE_HAS_PTHREADS || !defined ACE_LACKS_PTHREAD_KILL if (reactor_task.activate () == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) Task activation failed.\n")) , -1); } ACE_Thread_Manager *thread_manager = reactor_task.thr_mgr (); if (thread_manager == 0) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) No Thread Manager found.\n")) , -1); } while (!reactor_task_ready) { ACE_OS::sleep (1); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Signalling task.\n"))); if (thread_manager->kill_all (SIGUSR1) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) Task signalling failed.\n")), -1); } // Wait 5 seconds for the other thread to exit, if it didn't exit the // wait return -1 and we return with an error ACE_Time_Value timeout (5); if (thread_manager->wait (&timeout, false, false) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) Error, task wait failed.\n")), -1); } #endif ACE_END_TEST; return 0; } #else int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Bug_2659_Regression_Test")); ACE_ERROR ((LM_INFO, ACE_TEXT ("The Unix Signals capability is not supported on this platform\n"))); ACE_END_TEST; return 0; } #endif /* !defined (ACE_LACKS_UNIX_SIGNALS) */ ace-8.0.4+dfsg.orig/tests/Proactor_UDP_Test.cpp0000644000175000017500000017741715027201773020356 0ustar sudipsudip// ============================================================================ /** * @file Proactor_UDP_Test.cpp * * This program illustrates how the ACE_Proactor can be used to * implement an application that uses UDP/IP communications. * * @author Steve Huston , based on Proactor_Test.cpp */ // ============================================================================ #include "test_config.h" #if defined (ACE_HAS_THREADS) && (defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS)) // This only works on Win32 platforms and on Unix platforms // supporting POSIX aio calls. #include "ace/Signal.h" #include "ace/Service_Config.h" #include "ace/INET_Addr.h" #include "ace/SOCK_CODgram.h" #include "ace/SOCK_Dgram.h" #include "ace/Object_Manager.h" #include "ace/Get_Opt.h" #include "ace/Proactor.h" #include "ace/Task.h" #include "ace/Thread_Semaphore.h" #include "ace/OS_NS_ctype.h" #include "ace/OS_NS_errno.h" #include "ace/OS_NS_signal.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_sys_socket.h" #include "ace/Sock_Connect.h" #include "ace/os_include/netinet/os_tcp.h" #include "ace/Atomic_Op.h" #include "ace/Synch_Traits.h" #if defined (ACE_WIN32) # include "ace/WIN32_Proactor.h" #elif defined (ACE_HAS_AIO_CALLS) # include "ace/POSIX_Proactor.h" # include "ace/POSIX_CB_Proactor.h" #endif /* ACE_WIN32 */ // Proactor Type (UNIX only, Win32 ignored) using ProactorType = enum { DEFAULT = 0, AIOCB, SIG, CB }; static ProactorType proactor_type = DEFAULT; // POSIX : > 0 max number aio operations proactor, static size_t max_aio_operations = 0; // both: 0 run client or server / depends on host // != 0 run client and server static int both = 0; // Host that we're connecting to. static const ACE_TCHAR *host = 0; // number of Client instances static int clients = 1; const int MAX_CLIENTS = 1000; const int MAX_SERVERS = 1000; // duplex mode: == 0 half-duplex // != 0 full duplex static int duplex = 0; // number threads in the Proactor thread pool static int threads = 1; // Port that we're receiving session initiations on. static u_short port = ACE_DEFAULT_SERVER_PORT; // Log options static int loglevel; // 0 full , 1 only errors static size_t xfer_limit; // Number of bytes for Client to send. static char complete_message[] = "GET / HTTP/1.1\r\n" "Accept: */*\r\n" "Accept-Language: C++\r\n" "Accept-Encoding: gzip, deflate\r\n" "User-Agent: Proactor_Test/1.0 (non-compatible)\r\n" "Connection: Keep-Alive\r\n" "\r\n"; static char close_req_msg[] = "CLOSE"; static char close_ack_msg[] = "CLOSE-ACK"; class LogLocker { public: LogLocker () { ACE_LOG_MSG->acquire (); } virtual ~LogLocker () { ACE_LOG_MSG->release (); } }; // Function to remove signals from the signal mask. static int disable_signal (int sigmin, int sigmax) { #if !defined (ACE_LACKS_UNIX_SIGNALS) sigset_t signal_set; if (ACE_OS::sigemptyset (&signal_set) == - 1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error: (%P|%t):%p\n"), ACE_TEXT ("sigemptyset failed"))); for (int i = sigmin; i <= sigmax; i++) ACE_OS::sigaddset (&signal_set, i); // Put the . # if defined (ACE_LACKS_PTHREAD_THR_SIGSETMASK) // In multi-threaded application this is not POSIX compliant // but let's leave it just in case. if (ACE_OS::sigprocmask (SIG_BLOCK, &signal_set, 0) != 0) # else if (ACE_OS::thr_sigsetmask (SIG_BLOCK, &signal_set, 0) != 0) # endif /* ACE_LACKS_PTHREAD_THR_SIGSETMASK */ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Error: (%P|%t): %p\n"), ACE_TEXT ("SIG_BLOCK failed")), -1); #else ACE_UNUSED_ARG (sigmin); ACE_UNUSED_ARG (sigmax); #endif /* ACE_LACKS_UNIX_SIGNALS */ return 0; } // ************************************************************* // MyTask is ACE_Task resposible for : // 1. creation and deletion of // Proactor and Proactor thread pool // 2. running Proactor event loop // ************************************************************* /** * @class MyTask * * MyTask plays role for Proactor threads pool * * MyTask is ACE_Task resposible for: * 1. Creation and deletion of Proactor and Proactor thread pool * 2. Running Proactor event loop */ class MyTask : public ACE_Task { public: MyTask (): lock_ (), sem_ ((unsigned int) 0), proactor_(0) {} ~MyTask() override { (void) this->stop (); (void) this->delete_proactor(); } int svc () override; int start (int num_threads, ProactorType type_proactor, size_t max_op ); int stop (); private: int create_proactor (ProactorType type_proactor, size_t max_op); int delete_proactor (); ACE_SYNCH_RECURSIVE_MUTEX lock_; ACE_Thread_Semaphore sem_; ACE_Proactor * proactor_; }; int MyTask::create_proactor (ProactorType type_proactor, size_t max_op) { ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, monitor, this->lock_, -1); ACE_TEST_ASSERT (this->proactor_ == 0); #if defined (ACE_WIN32) ACE_UNUSED_ARG (type_proactor); ACE_UNUSED_ARG (max_op); ACE_WIN32_Proactor *proactor_impl = 0; ACE_NEW_RETURN (proactor_impl, ACE_WIN32_Proactor, -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT("(%t) Create Proactor Type = WIN32\n"))); #elif defined (ACE_HAS_AIO_CALLS) ACE_POSIX_Proactor * proactor_impl = 0; switch (type_proactor) { case AIOCB: ACE_NEW_RETURN (proactor_impl, ACE_POSIX_AIOCB_Proactor (max_op), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Create Proactor Type = AIOCB\n"))); break; #if defined(ACE_HAS_POSIX_REALTIME_SIGNALS) case SIG: ACE_NEW_RETURN (proactor_impl, ACE_POSIX_SIG_Proactor (max_op), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Create Proactor Type = SIG\n"))); break; #endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */ # if !defined(ACE_HAS_BROKEN_SIGEVENT_STRUCT) case CB: ACE_NEW_RETURN (proactor_impl, ACE_POSIX_CB_Proactor (max_op), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Create Proactor Type = CB\n"))); break; # endif /* !ACE_HAS_BROKEN_SIGEVENT_STRUCT */ default: ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Create Proactor Type = DEFAULT\n"))); break; } #endif /* ACE_WIN32 */ // always delete implementation 1 , not !(proactor_impl == 0) ACE_NEW_RETURN (this->proactor_, ACE_Proactor (proactor_impl, 1 ), -1); // Set new singleton and delete it in close_singleton() ACE_Proactor::instance (this->proactor_, 1); return 0; } int MyTask::delete_proactor () { ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, monitor, this->lock_, -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Delete Proactor\n"))); ACE_Proactor::close_singleton (); this->proactor_ = 0; return 0; } int MyTask::start (int num_threads, ProactorType type_proactor, size_t max_op) { if (this->create_proactor (type_proactor, max_op) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p.\n"), ACE_TEXT ("unable to create proactor")), -1); if (this->activate (THR_NEW_LWP, num_threads) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p.\n"), ACE_TEXT ("unable to activate thread pool")), -1); for (; num_threads > 0; num_threads--) { sem_.acquire (); } return 0; } int MyTask::stop () { if (this->proactor_ != 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Calling End Proactor event loop\n"))); this->proactor_->proactor_end_event_loop (); } if (this->wait () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p.\n"), ACE_TEXT ("unable to stop thread pool"))); return 0; } int MyTask::svc () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) MyTask started\n"))); disable_signal (ACE_SIGRTMIN, ACE_SIGRTMAX); disable_signal (SIGPIPE, SIGPIPE); // signal that we are ready sem_.release (1); this->proactor_->proactor_run_event_loop (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) MyTask finished\n"))); return 0; } // forward declaration class TestData; // "Server" is one side of a session. It's the same idea as in TCP, but // there's no acceptor in UDP; sessions are started by the client sending // a "start" datagram to a well-known UDP port. The start datagram tells // which port number the client is receiving on. The server then sends an // "ack" datagram to indicate the session is set up successfully and to say // which port the server is listening on. Thus, a unique pairing of server // and client port numbers is established. Each session will require a // separate server-side socket as well as the client. Note that experienced // UDP programmers will be quivering at this point knowing that there's no // reason to have multiple server-side sockets, and no real reason to // pre-register the client ports either since all the addressing info is // available on normal UDP programming. However, this is all necessary in // the POSIX case since the POSIX aio functions were not designed with UDP // in mind, and the addressing information is not available in UDP receive // completion callbacks; thus, each socket needs to be fully connected before // running session data. The addressing information needed to run this // use-case in the "normal" way is available on Windows, but this test runs // across many platforms, so can't rely on that information. class Server : public ACE_Handler { public: Server (); Server (TestData *tester, int id); ~Server () override; int id () { return this->id_; } size_t get_total_snd () { return this->total_snd_; } size_t get_total_rcv () { return this->total_rcv_; } long get_total_w () { return this->total_w_; } long get_total_r () { return this->total_r_; } /// This is called after the new session has been established. void go (ACE_HANDLE handle, const ACE_INET_Addr &client); void cancel (); protected: /** * @name AIO callback handling * * These methods are called by the framework */ /// This is called when asynchronous operation from the /// socket completes. void handle_read_dgram (const ACE_Asynch_Read_Dgram::Result &result) override; /// This is called when an asynchronous to the socket /// completes. void handle_write_dgram (const ACE_Asynch_Write_Dgram::Result &result) override; private: int initiate_read (); int initiate_write (ACE_Message_Block *mb, size_t nbytes); TestData *tester_; int id_; ACE_INET_Addr client_addr_; ACE_Asynch_Read_Dgram rs_; ACE_Asynch_Write_Dgram ws_; ACE_SYNCH_MUTEX lock_; int io_count_; // Number of currently outstanding I/O requests bool flg_cancel_; bool flg_closing_; size_t total_snd_; // Number of bytes successfully sent size_t total_rcv_; // Number of bytes successfully received int total_w_; // Number of write operations int total_r_; // Number of read operations }; // ******************************************* // Client // ******************************************* class Client : public ACE_Handler { public: Client (); Client (TestData *tester, int id); ~Client () override; void go (ACE_HANDLE h, const ACE_INET_Addr &server); int id () { return this->id_; } size_t get_total_snd () { return this->total_snd_; } size_t get_total_rcv () { return this->total_rcv_; } int get_total_w () { return this->total_w_; } int get_total_r () { return this->total_r_; } // This is called when asynchronous reads from the socket complete void handle_read_dgram (const ACE_Asynch_Read_Dgram::Result &result) override; // This is called when asynchronous writes from the socket complete void handle_write_dgram (const ACE_Asynch_Write_Dgram::Result &result) override; void cancel (); private: int initiate_read (); int initiate_write (); // FUZZ: disable check_for_lack_ACE_OS void close (); // FUZZ: enable check_for_lack_ACE_OS TestData *tester_; int id_; ACE_INET_Addr server_addr_; ACE_Asynch_Read_Dgram rs_; ACE_Asynch_Write_Dgram ws_; ACE_SYNCH_MUTEX lock_; int io_count_; int stop_writing_; // Writes are shut down; just read. bool flg_cancel_; size_t total_snd_; size_t total_rcv_; int total_w_; int total_r_; }; // TestData collects and reports on test-related transfer and connection // statistics. class TestData { public: TestData (); bool testing_done (); Server *server_up (); Client *client_up (); void server_done (Server *s); void client_done (Client *c); void stop_all (); void report (); private: struct Local_Stats { // Track number of sessions that report start, and those that report // their end (and stats). ACE_Atomic_Op sessions_up_; ACE_Atomic_Op sessions_down_; // Total read and write bytes for all sessions. ACE_Atomic_Op w_cnt_; ACE_Atomic_Op r_cnt_; // Total read and write operations issues for all sessions. ACE_Atomic_Op w_ops_; ACE_Atomic_Op r_ops_; } servers_, clients_; ACE_SYNCH_MUTEX list_lock_; Server *server_list_[MAX_SERVERS]; Client *client_list_[MAX_CLIENTS]; }; TestData::TestData () { int i; for (i = 0; i < MAX_SERVERS; ++i) this->server_list_[i] = 0; for (i = 0; i < MAX_CLIENTS; ++i) this->client_list_[i] = 0; } bool TestData::testing_done () { int svr_up = this->servers_.sessions_up_.value (); int svr_dn = this->servers_.sessions_down_.value (); int clt_up = this->clients_.sessions_up_.value (); int clt_dn = this->clients_.sessions_down_.value (); if (svr_up == 0 && clt_up == 0) // No connections up yet return false; return (svr_dn >= svr_up && clt_dn >= clt_up); } Server * TestData::server_up () { ++this->servers_.sessions_up_; ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, monitor, this->list_lock_, 0); for (int i = 0; i < MAX_SERVERS; ++i) { if (this->server_list_[i] == 0) { ACE_NEW_RETURN (this->server_list_[i], Server (this, i), 0); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Server %d up; now %d up, %d down.\n"), i, this->servers_.sessions_up_.value (), this->servers_.sessions_down_.value ())); return this->server_list_[i]; } } return 0; } Client * TestData::client_up () { ++this->clients_.sessions_up_; ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, monitor, this->list_lock_, 0); for (int i = 0; i < MAX_CLIENTS; ++i) { if (this->client_list_[i] == 0) { ACE_NEW_RETURN (this->client_list_[i], Client (this, i), 0); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Client %d up; now %d up, %d down.\n"), i, this->clients_.sessions_up_.value (), this->clients_.sessions_down_.value ())); return this->client_list_[i]; } } return 0; } void TestData::server_done (Server *s) { this->servers_.w_cnt_ += s->get_total_snd (); this->servers_.r_cnt_ += s->get_total_rcv (); this->servers_.w_ops_ += s->get_total_w (); this->servers_.r_ops_ += s->get_total_r (); ++this->servers_.sessions_down_; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Server %d gone; now %d up, %d down\n"), s->id (), this->servers_.sessions_up_.value (), this->servers_.sessions_down_.value ())); ACE_GUARD (ACE_SYNCH_MUTEX, monitor, this->list_lock_); int i; for (i = 0; i < MAX_SERVERS; ++i) { if (this->server_list_[i] == s) { if (s->id () != i) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Server %d is pos %d in list\n"), s->id (), i)); this->server_list_[i] = 0; break; } } if (i >= MAX_SERVERS) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Server %@ done but not listed\n"), s)); return; } void TestData::client_done (Client *c) { this->clients_.w_cnt_ += c->get_total_snd (); this->clients_.r_cnt_ += c->get_total_rcv (); this->clients_.w_ops_ += c->get_total_w (); this->clients_.r_ops_ += c->get_total_r (); ++this->clients_.sessions_down_; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Client %d gone; now %d up, %d down\n"), c->id (), this->clients_.sessions_up_.value (), this->clients_.sessions_down_.value ())); ACE_GUARD (ACE_SYNCH_MUTEX, monitor, this->list_lock_); int i; for (i = 0; i < MAX_CLIENTS; ++i) { if (this->client_list_[i] == c) { if (c->id () != i) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Client %d is pos %d in list\n"), c->id (), i)); this->client_list_[i] = 0; break; } } if (i >= MAX_CLIENTS) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Client %@ done but not listed\n"), c)); return; } void TestData::stop_all () { int i; // Lock and cancel everything. Then release the lock, possibly allowing // cleanups, then grab it again and delete all Servers and Clients. { ACE_GUARD (ACE_SYNCH_MUTEX, monitor, this->list_lock_); for (i = 0; i < MAX_CLIENTS; ++i) { if (this->client_list_[i] != 0) this->client_list_[i]->cancel (); } for (i = 0; i < MAX_SERVERS; ++i) { if (this->server_list_[i] != 0) this->server_list_[i]->cancel (); } } { ACE_GUARD (ACE_SYNCH_MUTEX, monitor, this->list_lock_); for (i = 0; i < MAX_CLIENTS; ++i) { if (this->client_list_[i] != 0) delete this->client_list_[i]; } for (i = 0; i < MAX_SERVERS; ++i) { if (this->server_list_[i] != 0) delete this->server_list_[i]; } } } void TestData::report () { // Print statistics ACE_TCHAR bufs [256]; ACE_TCHAR bufr [256]; ACE_OS::snprintf (bufs, 256, ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("(") ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT (")"), this->clients_.w_cnt_.value (), this->clients_.w_ops_.value ()); ACE_OS::snprintf (bufr, 256, ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("(") ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT (")"), this->clients_.r_cnt_.value (), this->clients_.r_ops_.value ()); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Clients total bytes (ops): snd=%s rcv=%s\n"), bufs, bufr)); ACE_OS::snprintf (bufs, 256, ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("(") ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT (")"), this->servers_.w_cnt_.value (), this->servers_.w_ops_.value ()); ACE_OS::snprintf (bufr, 256, ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("(") ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT (")"), this->servers_.r_cnt_.value (), this->servers_.r_ops_.value ()); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Servers total bytes (ops): snd=%s rcv=%s\n"), bufs, bufr)); if (this->clients_.w_cnt_.value () == 0 || this->clients_.r_cnt_.value () == 0 || this->servers_.w_cnt_.value () == 0 || this->servers_.r_cnt_.value () == 0 ) ACE_ERROR ((LM_ERROR, ACE_TEXT ("It appears that this test didn't ") ACE_TEXT ("really do anything. Something is very wrong.\n"))); } // Session set-up struct. struct Session_Data { ACE_INT32 direction_; // 0 == Start, 1 == Ack ACE_INT32 addr_; // Network byte order, must be IPv4 ACE_UINT16 port_; // UDP port, network byte order Session_Data() { ACE_OS::memset (this, 0, sizeof(*this)); } }; // Master is the server-side receiver of session establishment requests. // For each "start" dgram received, instantiates a new Server object, // indicating the addressing info for the client. // Master is initialized with a count of the number of expected sessions. After // this number are set up, Master will stop listening for session requests. // This is a bit fragile but is necessary because on HP-UX, et al., it // is impossible to close/cancel a socket with an outstanding UDP receive // So, this bit of messiness is necessary for portability. // When the Master is destroyed, it will try to stop establishing sessions // but this will only work on Windows. class Master : public ACE_Handler { public: Master (TestData *tester, const ACE_INET_Addr &recv_addr, int expected); ~Master () override; // Called when dgram receive operation completes. void handle_read_dgram (const ACE_Asynch_Read_Dgram::Result &result) override; private: void start_recv (); TestData *tester_; ACE_INET_Addr recv_addr_; ACE_SOCK_Dgram sock_; ACE_Asynch_Read_Dgram rd_; ACE_Message_Block *mb_; ACE_Atomic_Op sessions_expected_; volatile bool recv_in_progress_; }; // ************************************************************* Master::Master (TestData *tester, const ACE_INET_Addr &recv_addr, int expected) : tester_ (tester), recv_addr_ (recv_addr), mb_ (0), sessions_expected_ (expected), recv_in_progress_ (false) { if (this->sock_.open (recv_addr) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Master socket %p\n"), ACE_TEXT ("open"))); else { if (this->rd_.open (*this, this->sock_.get_handle ()) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Master reader %p\n"), ACE_TEXT ("open"))); this->mb_ = new ACE_Message_Block (sizeof (Session_Data)); start_recv (); } } Master::~Master () { if (this->recv_in_progress_) this->rd_.cancel (); this->sock_.close (); if (this->mb_ != 0) { this->mb_->release (); this->mb_ = 0; } } void Master::handle_read_dgram (const ACE_Asynch_Read_Dgram::Result &result) { // We should only receive Start datagrams with valid addresses to reply to. if (result.success ()) { if (result.bytes_transferred () != sizeof (Session_Data)) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) Master session data expected %B bytes; ") ACE_TEXT ("received %B\n"), sizeof (Session_Data), result.bytes_transferred ())); else { ACE_Message_Block *mb = result.message_block (); Session_Data *session = reinterpret_cast(mb->rd_ptr ()); if (session->direction_ == 0) { ACE_INET_Addr client_addr, me_addr; ACE_TCHAR client_str[80], me_str[80]; client_addr.set ((u_short)session->port_, session->addr_, 0); client_addr.addr_to_string (client_str, 80); // Set up the local and remote addresses - need fully-specified // addresses to use UDP aio on Linux. This is the socket that // the session will run over. The addressing info to be sent // back to the Client will be sent over the receive socket // to ensure it goes back to the client initiating the session. ACE_SOCK_CODgram sock; if (sock.open (client_addr) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) Master new socket for ") ACE_TEXT ("client %s: %p\n"), client_str, ACE_TEXT ("open"))); } else { sock.get_local_addr (me_addr); me_addr.addr_to_string (me_str, 80); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Master setting up server for ") ACE_TEXT ("local %s, peer %s\n"), me_str, client_str)); Session_Data session; session.direction_ = 1; // Ack session.addr_ = ACE_HTONL (me_addr.get_ip_address ()); session.port_ = ACE_HTONS (me_addr.get_port_number ()); if (this->sock_.send (&session, sizeof (session), client_addr) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) Master reply %p\n"), ACE_TEXT ("send"))); sock.close (); } else { Server *server = this->tester_->server_up (); server->go (sock.get_handle (), client_addr); } } if (--this->sessions_expected_ == 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("All expected sessions are up\n"))); } } else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) Badly formed Session request\n"))); } } } else { ACE_Log_Priority prio = LM_ERROR; #if defined (ACE_WIN32) if (result.error () == ERROR_OPERATION_ABORTED) prio = LM_DEBUG; #else if (result.error () == ECANCELED) prio = LM_DEBUG; #endif /* ACE_WIN32 */ // Multiple steps to log the error without squashing errno. ACE_LOG_MSG->conditional_set (__FILE__, __LINE__, -1, (int)(result.error ())); ACE_LOG_MSG->log (prio, ACE_TEXT ("(%t) Master %p\n"), ACE_TEXT ("recv")); // If canceled, don't try to restart. if (prio == LM_DEBUG) return; } this->start_recv (); } void Master::start_recv () { if (this->mb_ == 0) return; size_t unused = 0; this->mb_->reset (); if (this->rd_.recv (this->mb_, unused, 0) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) Master %p\n"), ACE_TEXT ("recv"))); else this->recv_in_progress_ = true; } // *************************************************** Server::Server () { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Shouldn't use this constructor!\n"))); } Server::Server (TestData *tester, int id) : tester_ (tester), id_ (id), io_count_ (0), flg_cancel_(false), flg_closing_ (false), total_snd_(0), total_rcv_(0), total_w_ (0), total_r_ (0) { } Server::~Server () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Server %d dtor; %d sends (%B bytes); ") ACE_TEXT ("%d recvs (%B bytes)\n"), this->id_, this->total_w_, this->total_snd_, this->total_r_, this->total_rcv_)); if (this->io_count_ != 0) ACE_ERROR ((LM_WARNING, ACE_TEXT ("(%t) Server %d deleted with ") ACE_TEXT ("%d I/O outstanding\n"), this->id_, this->io_count_)); // This test bounces data back and forth between Clients and Servers. // Therefore, if there was significantly more data in one direction, that's // a problem. Remember, the byte counts are unsigned values. int issue_data_warning = 0; if (this->total_snd_ > this->total_rcv_) { if (this->total_rcv_ == 0) issue_data_warning = 1; else if (this->total_snd_ / this->total_rcv_ > 2) issue_data_warning = 1; } else { if (this->total_snd_ == 0) issue_data_warning = 1; else if (this->total_rcv_ / this->total_snd_ > 2) issue_data_warning = 1; } if (issue_data_warning) ACE_DEBUG ((LM_WARNING, ACE_TEXT ("(%t) Above byte counts look odd; need review\n"))); if (this->tester_ != 0) this->tester_->server_done (this); if (this->handle () != ACE_INVALID_HANDLE) ACE_OS::closesocket (this->handle ()); this->id_ = -1; this->handle (ACE_INVALID_HANDLE); } void Server::cancel () { ACE_GUARD (ACE_SYNCH_MUTEX, monitor, this->lock_); this->flg_cancel_ = true; this->ws_.cancel (); this->rs_.cancel (); return; } void Server::go (ACE_HANDLE handle, const ACE_INET_Addr &client) { this->handle (handle); this->client_addr_.set (client); // Lock this before initiating I/O, else it may complete while we're // still setting up. { ACE_GUARD (ACE_SYNCH_MUTEX, monitor, this->lock_); if (this->ws_.open (*this, this->handle ()) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Server::ACE_Asynch_Write_Dgram::open"))); else if (this->rs_.open (*this, this->handle ()) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Server::ACE_Asynch_Read_Dgram::open"))); else this->initiate_read (); } if (this->io_count_ > 0) return; delete this; // Error setting up I/O factories } int Server::initiate_read () { if (this->flg_cancel_ || this->handle () == ACE_INVALID_HANDLE) return -1; ACE_Message_Block *mb = 0; ACE_NEW_RETURN (mb, ACE_Message_Block (1024), //BUFSIZ + 1), -1); // Inititiate receive size_t unused = 0; if (this->rs_.recv (mb, unused, 0) == -1) { mb->release (); ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) Server %d, %p\n"), this->id_, ACE_TEXT ("read")), -1); } this->io_count_++; this->total_r_++; return 0; } int Server::initiate_write (ACE_Message_Block *mb, size_t nbytes) { if (this->flg_cancel_ || this->handle () == ACE_INVALID_HANDLE) { mb->release (); return -1; } if (nbytes == 0) { mb->release (); ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT ("(%t) Server %d write nbytes == 0\n"), this->id_), -1); } if (this->ws_.send (mb, nbytes, 0, this->client_addr_) == -1) { mb->release (); ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT ("(%t) Server %d, %p\n"), this->id_, ACE_TEXT ("write")), -1); } this->io_count_++; this->total_w_++; return 0; } void Server::handle_read_dgram (const ACE_Asynch_Read_Dgram::Result &result) { { ACE_GUARD (ACE_SYNCH_MUTEX, monitor, this->lock_ ); ACE_Message_Block *mb = result.message_block (); // Reset pointers. mb->rd_ptr ()[result.bytes_transferred ()] = '\0'; if (loglevel > 1) { LogLocker log_lock; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) **** Server %d: handle_read_dgram() ****\n"), this->id_)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %B\n"), ACE_TEXT ("bytes_to_read"), result.bytes_to_read ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %d\n"), ACE_TEXT ("handle"), result.handle ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %B\n"), ACE_TEXT ("bytes_transfered"), result.bytes_transferred ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %@\n"), ACE_TEXT ("act"), result.act ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %d\n"), ACE_TEXT ("success"), result.success ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %@\n"), ACE_TEXT ("completion_key"), result.completion_key ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %d\n"), ACE_TEXT ("error"), result.error ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %s\n"), ACE_TEXT ("message_block"), mb->rd_ptr ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("**** end of message ****************\n"))); } else if (result.error () != 0) { ACE_Log_Priority prio; #if defined (ACE_WIN32) if (result.error () == ERROR_OPERATION_ABORTED) prio = LM_DEBUG; #else if (result.error () == ECANCELED) prio = LM_DEBUG; #endif /* ACE_WIN32 */ else prio = LM_ERROR; ACE_LOG_MSG->errnum (result.error ()); ACE_LOG_MSG->log (prio, ACE_TEXT ("(%t) Server %d; %p\n"), this->id_, ACE_TEXT ("read")); } else if (loglevel > 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Server %d: read %B bytes\n"), this->id_, result.bytes_transferred ())); } if (result.error () == 0 && result.bytes_transferred () > 0) { this->total_rcv_ += result.bytes_transferred (); // If client says we're done, ack it; we're done reading. size_t to_send = result.bytes_transferred (); if (ACE_OS::strcmp (mb->rd_ptr (), close_req_msg) == 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Server %d saw close request; ack\n"), this->id_)); this->flg_closing_ = true; mb->reset (); mb->copy (close_ack_msg); to_send = mb->length (); } if (this->initiate_write (mb, to_send) == 0) { if (duplex != 0 && !this->flg_closing_) this->initiate_read (); } } else mb->release (); --this->io_count_; if (this->io_count_ > 0) return; } delete this; } void Server::handle_write_dgram (const ACE_Asynch_Write_Dgram::Result &result) { { ACE_GUARD (ACE_SYNCH_MUTEX, monitor, this->lock_); ACE_Message_Block *mb = result.message_block (); if (loglevel > 1) { LogLocker log_lock; //mb.rd_ptr () [0] = '\0'; mb->rd_ptr (mb->rd_ptr () - result.bytes_transferred ()); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) **** Server %d: handle_write_dgram() ****\n"), this->id_)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %B\n"), ACE_TEXT ("bytes_to_write"), result.bytes_to_write ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %d\n"), ACE_TEXT ("handle"), result.handle ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %B\n"), ACE_TEXT ("bytes_transfered"), result.bytes_transferred ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %@\n"), ACE_TEXT ("act"), result.act ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %d\n"), ACE_TEXT ("success"), result.success ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %@\n"), ACE_TEXT ("completion_key"), result.completion_key ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %d\n"), ACE_TEXT ("error"), result.error ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %s\n"), ACE_TEXT ("message_block"), mb->rd_ptr ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("**** end of message ****************\n"))); } else if (result.error () != 0) { ACE_Log_Priority prio; #if defined (ACE_WIN32) if (result.error () == ERROR_OPERATION_ABORTED) prio = LM_DEBUG; #else if (result.error () == ECANCELED) prio = LM_DEBUG; #endif /* ACE_WIN32 */ else prio = LM_ERROR; ACE_LOG_MSG->errnum (result.error ()); ACE_LOG_MSG->log (prio, ACE_TEXT ("(%t) Server %d; %p\n"), this->id_, ACE_TEXT ("write")); } else if (loglevel > 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Server %d: wrote %B bytes ok\n"), this->id_, result.bytes_transferred ())); } mb->release (); if (result.error () == 0 && result.bytes_transferred () > 0) { this->total_snd_ += result.bytes_transferred (); if (duplex == 0 && !this->flg_closing_) this->initiate_read (); } --this->io_count_; if (this->io_count_ > 0) return; } delete this; } // ******************************************* // Connector // // Connector creates the proper number of Clients and initiates // sessions on them. // ******************************************* class Connector { public: Connector (TestData *tester); int start (const ACE_INET_Addr &addr, int num); private: TestData *tester_; }; // ************************************************************* Connector::Connector (TestData *tester) : tester_ (tester) { } int Connector::start (const ACE_INET_Addr& addr, int num) { ACE_OS::sleep(3); // Let Master get going if (num > MAX_CLIENTS) num = MAX_CLIENTS; if (num < 0) num = 1; int rc = 0; for (; rc < num; rc++) { ACE_SOCK_CODgram sock; if (sock.open (addr) == -1) ACE_ERROR_BREAK ((LM_ERROR, ACE_TEXT ("(%t) Starting client %d: %p\n"), rc, ACE_TEXT ("open"))); ACE_INET_Addr me; sock.get_local_addr (me); u_short my_port = ACE_HTONS (me.get_port_number ()); ACE_INT32 my_addr = ACE_HTONL (me.get_ip_address ()); Session_Data session; session.direction_ = 0; // Start session.addr_ = my_addr; session.port_ = my_port; if (sock.send (&session, sizeof (session)) == -1) ACE_ERROR_BREAK ((LM_ERROR, ACE_TEXT ("(%t) Starting client %d: %p\n"), rc, ACE_TEXT ("send"))); if (sock.recv (&session, sizeof (session)) == -1) ACE_ERROR_BREAK ((LM_ERROR, ACE_TEXT ("(%t) Starting client %d: %p\n"), rc, ACE_TEXT ("recv"))); ACE_INET_Addr server; server.set (session.port_, session.addr_, 0); Client *client = this->tester_->client_up (); ACE_TCHAR me_str[80], server_str[80]; me.addr_to_string (me_str, 80); server.addr_to_string (server_str, 80); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Client %d setting up local %s, peer %s\n"), client->id(), me_str, server_str)); sock.close (); if (sock.open (server, me) == -1) ACE_ERROR_BREAK ((LM_ERROR, ACE_TEXT ("(%t) Re-opening %p\n"), ACE_TEXT ("client"))); client->go (sock.get_handle (), server); sock.set_handle (ACE_INVALID_HANDLE); } return rc; } Client::Client () { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Shouldn't use this constructor!\n"))); } Client::Client (TestData *tester, int id) : tester_ (tester), id_ (id), io_count_ (0), stop_writing_ (0), flg_cancel_ (false), total_snd_ (0), total_rcv_ (0), total_w_ (0), total_r_ (0) { } Client::~Client () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Client %d dtor; %d sends (%B bytes); ") ACE_TEXT ("%d recvs (%B bytes)\n"), this->id_, this->total_w_, this->total_snd_, this->total_r_, this->total_rcv_)); if (this->io_count_ != 0) ACE_ERROR ((LM_WARNING, ACE_TEXT ("(%t) Client %d deleted with %d I/O outstanding\n"), this->id_, this->io_count_)); // This test bounces data back and forth between Clients and Servers. // Therefore, if there was significantly more data in one direction, that's // a problem. Remember, the byte counts are unsigned values. int issue_data_warning = 0; if (this->total_snd_ > this->total_rcv_) { if (this->total_rcv_ == 0) issue_data_warning = 1; else if (this->total_snd_ / this->total_rcv_ > 2) issue_data_warning = 1; } else { if (this->total_snd_ == 0) issue_data_warning = 1; else if (this->total_rcv_ / this->total_snd_ > 2) issue_data_warning = 1; } if (issue_data_warning) ACE_DEBUG ((LM_WARNING, ACE_TEXT ("(%t) Above byte counts look odd; need review\n"))); if (this->tester_ != 0) this->tester_->client_done (this); this->id_ = -1; if (this->handle () != ACE_INVALID_HANDLE) { ACE_OS::closesocket (this->handle ()); } this->handle (ACE_INVALID_HANDLE); } void Client::cancel () { ACE_GUARD (ACE_SYNCH_MUTEX, monitor, this->lock_); this->flg_cancel_ = true; this->ws_.cancel (); this->rs_.cancel (); return; } void Client::close () { // This must be called with the lock_ held. ++this->stop_writing_; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Closing Client %d writes; %d I/O outstanding\n"), this->id_, this->io_count_)); return; } void Client::go (ACE_HANDLE handle, const ACE_INET_Addr &server) { { ACE_GUARD (ACE_SYNCH_MUTEX, monitor, this->lock_); this->handle (handle); this->server_addr_.set (server); // Open send and receive factories. if (this->ws_.open (*this, handle) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) Client %d: %p\n"), this->id_, ACE_TEXT ("ACE_Asynch_Write_Dgram::open"))); else if (this->rs_.open (*this, handle) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) Client %d: %p\n"), this->id_, ACE_TEXT ("ACE_Asynch_Read_Dgram::open"))); else if (this->initiate_write () == 0) { if (duplex != 0) // Start an asynchronous read this->initiate_read (); } if (this->io_count_ > 0) return; } delete this; } int Client::initiate_write () { if (this->flg_cancel_ || this->handle () == ACE_INVALID_HANDLE) return -1; // stop_writing_ is set to 1 to say "stop". To avoid repeating the // close datagram for every echo, only send it once. Sure, there's a risk // it will get lost, but since this is most often intra-host, don't // worry about that very small risk. if (this->stop_writing_ > 0) // Need to tell server to "close" { if (this->stop_writing_ > 1) // Already told server to close return 0; ++this->stop_writing_; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Client %d requesting close\n"), this->id_)); ACE_Message_Block *mb = new ACE_Message_Block (ACE_OS::strlen (close_req_msg) + 1); mb->copy (close_req_msg); size_t unused; // Number of bytes sent if (this->ws_.send (mb, unused, 0, this->server_addr_) == -1) { mb->release (); ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) Client %d, %p\n"), this->id_, ACE_TEXT ("initiating closing send")), -1); } this->io_count_++; this->total_w_++; return 0; } static const size_t complete_message_length = ACE_OS::strlen (complete_message); #if defined (ACE_WIN32) ACE_Message_Block *mb1 = 0, *mb2 = 0, *mb3 = 0; // No need to allocate +1 for proper printing - the memory includes it already ACE_NEW_RETURN (mb1, ACE_Message_Block ((char *)complete_message, complete_message_length), -1); ACE_NEW_RETURN (mb2, ACE_Message_Block ((char *)complete_message, complete_message_length), -1); ACE_NEW_RETURN (mb3, ACE_Message_Block ((char *)complete_message, complete_message_length), -1); mb1->wr_ptr (complete_message_length); mb2->wr_ptr (complete_message_length); mb3->wr_ptr (complete_message_length); // chain them together mb1->cont (mb2); mb2->cont (mb3); size_t unused; // Number of bytes sent if (this->ws_.send (mb1, unused, 0, this->server_addr_) == -1) { mb1->release (); ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Client::ACE_Asynch_Write_Dgram::send")), -1); } #else /* ACE_WIN32 */ ACE_Message_Block *mb = 0; // No need to allocate +1 for proper printing - the memory includes // it already ACE_NEW_RETURN (mb, ACE_Message_Block (complete_message, complete_message_length), -1); mb->wr_ptr (complete_message_length); size_t unused; // Number of bytes sent if (this->ws_.send (mb, unused, 0, this->server_addr_) == -1) { mb->release (); ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT ("(%t) Client %d, %p\n"), this->id_, ACE_TEXT ("send")), -1); } #endif /* ACE_WIN32 */ this->io_count_++; this->total_w_++; return 0; } int Client::initiate_read () { if (this->flg_cancel_ || this->handle_ == ACE_INVALID_HANDLE) return -1; static const size_t complete_message_length = ACE_OS::strlen (complete_message); #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) ACE_Message_Block *mb1 = 0, *mb2 = 0, *mb3 = 0, *mb4 = 0, *mb5 = 0, *mb6 = 0; // We allocate +1 only for proper printing - we can just set the last byte // to '\0' before printing out ACE_NEW_RETURN (mb1, ACE_Message_Block (complete_message_length + 1), -1); ACE_NEW_RETURN (mb2, ACE_Message_Block (complete_message_length + 1), -1); ACE_NEW_RETURN (mb3, ACE_Message_Block (complete_message_length + 1), -1); // Let allocate memory for one more triplet, // This improves performance // as we can receive more the than one block at once // Generally, we can receive more triplets .... ACE_NEW_RETURN (mb4, ACE_Message_Block (complete_message_length + 1), -1); ACE_NEW_RETURN (mb5, ACE_Message_Block (complete_message_length + 1), -1); ACE_NEW_RETURN (mb6, ACE_Message_Block (complete_message_length + 1), -1); mb1->cont (mb2); mb2->cont (mb3); mb3->cont (mb4); mb4->cont (mb5); mb5->cont (mb6); // hide last byte in each message block, reserving it for later to set '\0' // for proper printouts mb1->size (mb1->size () - 1); mb2->size (mb2->size () - 1); mb3->size (mb3->size () - 1); mb4->size (mb4->size () - 1); mb5->size (mb5->size () - 1); mb6->size (mb6->size () - 1); // Inititiate read size_t unused = 0; if (this->rs_.recv (mb1, unused, 0) == -1) { mb1->release (); ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Client::ACE_Asynch_Read_Stream::readv")), -1); } #else /* ACE_HAS_WIN32_OVERLAPPED_IO */ // Try to read more chunks size_t blksize = ( complete_message_length > BUFSIZ ) ? complete_message_length : BUFSIZ; ACE_Message_Block *mb = 0; // We allocate +1 only for proper printing - we can just set the last byte // to '\0' before printing out ACE_NEW_RETURN (mb, ACE_Message_Block (blksize + 1), -1); // Inititiate read size_t unused = 0; if (this->rs_.recv (mb, unused, 0) == -1) { mb->release (); ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) Client %d, %p\n"), this->id_, ACE_TEXT ("read")), -1); } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO */ this->io_count_++; this->total_r_++; return 0; } void Client::handle_write_dgram (const ACE_Asynch_Write_Dgram::Result &result) { { ACE_GUARD (ACE_SYNCH_MUTEX, monitor, this->lock_); ACE_Message_Block *mb = result.message_block (); if (loglevel > 1) { LogLocker log_lock; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) **** Client %d: handle_write_dgram() ****\n"), this->id_)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %B\n"), ACE_TEXT ("bytes_to_write"), result.bytes_to_write ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %d\n"), ACE_TEXT ("handle"), result.handle ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %B\n"), ACE_TEXT ("bytes_transfered"), result.bytes_transferred ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %@\n"), ACE_TEXT ("act"), result.act ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %d\n"), ACE_TEXT ("success"), result.success ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %@\n"), ACE_TEXT ("completion_key"), result.completion_key ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %d\n"), ACE_TEXT ("error"), result.error ())); #if defined (ACE_WIN32) size_t bytes_transferred = result.bytes_transferred (); char index = 0; for (ACE_Message_Block* mb_i = mb; (mb_i != 0) && (bytes_transferred > 0); mb_i = mb_i->cont ()) { // write 0 at string end for proper printout (if end of mb, // it's 0 already) mb_i->rd_ptr()[0] = '\0'; size_t len = mb_i->rd_ptr () - mb_i->base (); // move rd_ptr backwards as required for printout if (len >= bytes_transferred) { mb_i->rd_ptr (0 - bytes_transferred); bytes_transferred = 0; } else { mb_i->rd_ptr (0 - len); bytes_transferred -= len; } ++index; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s%d = %s\n"), ACE_TEXT ("message_block, part "), index, mb_i->rd_ptr ())); } #else /* ACE_WIN32 */ // write 0 at string end for proper printout (if end of mb, it's 0 already) mb->rd_ptr()[0] = '\0'; // move rd_ptr backwards as required for printout mb->rd_ptr (- result.bytes_transferred ()); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %s\n"), ACE_TEXT ("message_block"), mb->rd_ptr ())); #endif /* ACE_WIN32 */ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("**** end of message ****************\n"))); } else if (result.error () != 0) { ACE_Log_Priority prio; #if defined (ACE_WIN32) if (result.error () == ERROR_OPERATION_ABORTED) prio = LM_DEBUG; #else if (result.error () == ECANCELED) prio = LM_DEBUG; #endif /* ACE_WIN32 */ else prio = LM_ERROR; ACE_LOG_MSG->errnum (result.error ()); ACE_LOG_MSG->log (prio, ACE_TEXT ("(%t) Client %d; %p\n"), this->id_, ACE_TEXT ("write")); } else if (loglevel > 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Client %d: wrote %B bytes ok\n"), this->id_, result.bytes_transferred ())); } mb->release (); if (result.error () == 0 && result.bytes_transferred () > 0) { this->total_snd_ += result.bytes_transferred (); if (this->total_snd_ >= xfer_limit) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Client %d sent %B, limit %B\n"), this->id_, this->total_snd_, xfer_limit)); this->close (); } if (duplex != 0) // full duplex, continue write { if ((this->total_snd_- this->total_rcv_) < 1024*32 ) //flow control this->initiate_write (); } else // half-duplex read reply, after read we will start write this->initiate_read (); } --this->io_count_; if (this->io_count_ > 0) return; } delete this; } void Client::handle_read_dgram (const ACE_Asynch_Read_Dgram::Result &result) { { ACE_GUARD (ACE_SYNCH_MUTEX, monitor, this->lock_); ACE_Message_Block *mb = result.message_block (); if (loglevel > 1) { LogLocker log_lock; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) **** Client %d: handle_read_dgram() ****\n"), this->id_)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %B\n"), ACE_TEXT ("bytes_to_read"), result.bytes_to_read ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %d\n"), ACE_TEXT ("handle"), result.handle ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %B\n"), ACE_TEXT ("bytes_transfered"), result.bytes_transferred ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %@\n"), ACE_TEXT ("act"), result.act ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %d\n"), ACE_TEXT ("success"), result.success ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %@\n"), ACE_TEXT ("completion_key"), result.completion_key ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %d\n"), ACE_TEXT ("error"), result.error ())); #if defined (ACE_WIN32) char index = 0; for (ACE_Message_Block* mb_i = mb; mb_i != 0; mb_i = mb_i->cont ()) { ++index; // write 0 at string end for proper printout mb_i->wr_ptr()[0] = '\0'; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s%d = %s\n"), ACE_TEXT ("message_block, part "), index, mb_i->rd_ptr ())); } #else /* ACE_WIN32 */ // write 0 at string end for proper printout mb->rd_ptr()[result.bytes_transferred ()] = '\0'; // for proper printout ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s = %s\n"), ACE_TEXT ("message_block"), mb->rd_ptr ())); #endif /* ACE_WIN32 */ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("**** end of message ****************\n"))); } else if (result.error () != 0) { ACE_Log_Priority prio; #if defined (ACE_WIN32) if (result.error () == ERROR_OPERATION_ABORTED) prio = LM_DEBUG; #else if (result.error () == ECANCELED) prio = LM_DEBUG; #endif /* ACE_WIN32 */ else prio = LM_ERROR; ACE_Log_Msg::instance ()->errnum (result.error ()); ACE_Log_Msg::instance ()->log (prio, ACE_TEXT ("(%t) Client %d; %p\n"), this->id_, ACE_TEXT ("read")); } else if (loglevel > 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Client %d: read %B bytes ok\n"), this->id_, result.bytes_transferred ())); } if (result.error () == 0 && result.bytes_transferred () > 0) { this->total_rcv_ += result.bytes_transferred (); // If we've closed and the server acked, we're done. if (this->stop_writing_ && ACE_OS::strcmp (mb->rd_ptr (), close_ack_msg) == 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Client %d recvd close-ack\n"), this->id_)); } else { if (duplex != 0) this->initiate_read (); else // half-duplex write, after write we will start read this->initiate_write (); } } mb->release (); --this->io_count_; if (this->io_count_ > 0) return; } delete this; } // ************************************************************* // Configuration helpers // ************************************************************* int print_usage (int /* argc */, ACE_TCHAR *argv[]) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("\nusage: %s") ACE_TEXT ("\n-o ") ACE_TEXT ("\n-t UNIX-only, Win32-default always:") ACE_TEXT ("\n a AIOCB") ACE_TEXT ("\n i SIG") ACE_TEXT ("\n c CB") ACE_TEXT ("\n d default") ACE_TEXT ("\n-d ") ACE_TEXT ("\n-h for Client mode") ACE_TEXT ("\n-n ") ACE_TEXT ("\n-p ") ACE_TEXT ("\n-c ") ACE_TEXT ("\n-b run client and server at the same time") ACE_TEXT ("\n f file") ACE_TEXT ("\n c console") ACE_TEXT ("\n-v log level") ACE_TEXT ("\n 0 - log errors and highlights") ACE_TEXT ("\n 1 - log level 0 plus progress information") ACE_TEXT ("\n 2 - log level 1 plus operation parameters and results") ACE_TEXT ("\n-x max transfer byte count per Client") ACE_TEXT ("\n-u show this message") ACE_TEXT ("\n"), argv[0] )); return -1; } static int set_proactor_type (const ACE_TCHAR *ptype) { if (!ptype) return 0; switch (ACE_OS::ace_toupper (*ptype)) { case 'D': proactor_type = DEFAULT; return 1; case 'A': proactor_type = AIOCB; return 1; case 'I': proactor_type = SIG; return 1; #if !defined (ACE_HAS_BROKEN_SIGEVENT_STRUCT) case 'C': proactor_type = CB; return 1; #endif /* !ACE_HAS_BROKEN_SIGEVENT_STRUCT */ default: break; } return 0; } static int parse_args (int argc, ACE_TCHAR *argv[]) { // First, set up all the defaults then let any args change them. both = 1; // client and server simultaneosly duplex = 1; // full duplex is on host = ACE_LOCALHOST; // server to connect port = ACE_DEFAULT_SERVER_PORT; // port to connect/listen max_aio_operations = 512; // POSIX Proactor params proactor_type = DEFAULT; // Proactor type = default threads = 3; // size of Proactor thread pool clients = 10; // number of clients loglevel = 0; // log level : only errors and highlights // Default transfer limit 50 messages per Sender xfer_limit = 50 * ACE_OS::strlen (complete_message); // Linux kernels up to at least 2.6.9 (RHEL 4) can't do full duplex aio. # if defined (ACE_LINUX) duplex = 0; #endif if (argc == 1) // no arguments , so one button test return 0; ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("x:t:o:n:p:d:h:c:v:ub")); int c; while ((c = get_opt ()) != EOF) { switch (c) { case 'x': // xfer limit xfer_limit = static_cast (ACE_OS::atoi (get_opt.opt_arg ())); if (xfer_limit == 0) xfer_limit = 1; // Bare minimum. break; case 'b': // both client and server both = 1; break; case 'v': // log level loglevel = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'd': // duplex duplex = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'h': // host for sender host = get_opt.opt_arg (); break; case 'p': // port number port = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'n': // thread pool size threads = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'c': // number of clients clients = ACE_OS::atoi (get_opt.opt_arg ()); if (clients > MAX_CLIENTS) clients = MAX_CLIENTS; break; case 'o': // max number of aio for proactor max_aio_operations = ACE_OS::atoi (get_opt.opt_arg ()); break; case 't': // Proactor Type if (set_proactor_type (get_opt.opt_arg ())) break; return print_usage (argc, argv); case 'u': default: return print_usage (argc, argv); } // switch } // while return 0; } int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Proactor_UDP_Test")); if (::parse_args (argc, argv) == -1) return -1; disable_signal (ACE_SIGRTMIN, ACE_SIGRTMAX); disable_signal (SIGPIPE, SIGPIPE); MyTask task1; TestData test; if (task1.start (threads, proactor_type, max_aio_operations) == 0) { // NOTE - there's no real reason this test is limited to IPv4 other // than the way Session_Data is set up - to expand this test to work // on IPv6 as well as IPv4, you need to do some work on passing the // Session_Data address differently. ACE_INET_Addr addr (port, ACE_LOCALHOST, AF_INET); Master master (&test, addr, clients); Connector connector (&test); int rc = 0; if (both != 0 || host == 0) // Acceptor { // Already running; if not needed will be deleted soon. rc = 1; } if (both != 0 || host != 0) { if (host == 0) host = ACE_LOCALHOST; if (addr.set (port, host, 1, addr.get_type ()) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), host)); else rc += connector.start (addr, clients); } // Wait a few seconds to let things get going, then poll til // all sessions are done. Note that when we exit this scope, the // Acceptor and Connector will be destroyed, which should prevent // further connections and also test how well destroyed handlers // are handled. ACE_OS::sleep (3); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Sleeping til sessions run down.\n"))); while (!test.testing_done ()) ACE_OS::sleep (1); test.stop_all (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Stop Thread Pool Task\n"))); task1.stop (); ACE_END_TEST; return 0; } #else int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Proactor_UDP_Test")); ACE_DEBUG ((LM_INFO, ACE_TEXT ("Threads or Asynchronous IO is unsupported.\n") ACE_TEXT ("Proactor_UDP_Test will not be run.\n"))); ACE_END_TEST; return 0; } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ ace-8.0.4+dfsg.orig/tests/Process_Mutex_Test.cpp0000644000175000017500000001457115027201773020644 0ustar sudipsudip//============================================================================= /** * @file Process_Mutex_Test.cpp * * Tests an shared between multiple child processes. * * @author Irfan Pyarali */ //============================================================================= #include "test_config.h" #include "ace/Mutex.h" #include "ace/Process.h" #include "ace/Process_Mutex.h" #include "ace/Get_Opt.h" #include "ace/ACE.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_fcntl.h" #include "ace/os_include/os_dirent.h" static int release_mutex = 1; static int child_process = 0; static const ACE_TCHAR *mutex_name = ACE_DEFAULT_MUTEX; #if defined (__Lynx__) static const u_int n_processes = 4; #else /* ! __Lynx__ */ static const u_int n_processes = ACE_MAX_PROCESSES; #endif /* ! __Lynx__ */ // Explain usage and exit. static void print_usage_and_die () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("usage: %n [-d (don't release mutex)] ") ACE_TEXT ("[-c (child process)] [-n mutex name]\n"))); ACE_OS::exit (1); } // Parse the command-line arguments and set options. static void parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("dcn:")); int c; while ((c = get_opt ()) != -1) switch (c) { case 'd': release_mutex = 0; break; case 'c': child_process = 1; break; case 'n': mutex_name = get_opt.opt_arg (); break; default: print_usage_and_die (); break; } } static void acquire_release () { ACE_Process_Mutex mutex (mutex_name); // Make sure the constructor succeeded ACE_TEST_ASSERT (ACE_LOG_MSG->op_status () == 0); // To see if we really are the only holder of the mutex below, // we'll try to create a file with exclusive access. If the file // already exists, we're not the only one holding the mutex. ACE_TCHAR mutex_check[MAXPATHLEN+1]; ACE_OS::strncpy (mutex_check, mutex_name, MAXPATHLEN); ACE_OS::strncat (mutex_check, ACE_TEXT ("_checker"), MAXPATHLEN); // Grab the lock int mutex_acq = mutex.acquire (); ACE_TEST_ASSERT (mutex_acq == 0); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) Mutex acquired %s\n"), mutex_name)); ACE_HANDLE checker_handle = ACE_OS::open (mutex_check, O_CREAT | O_EXCL); if (checker_handle == ACE_INVALID_HANDLE) { ACE_DEBUG ((LM_WARNING, ACE_TEXT ("(%P): %p\n"), ACE_TEXT ("checker file open"))); ACE_TEST_ASSERT (errno != EEXIST); } else ACE_OS::close (checker_handle); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) Working....\n"))); // Do some "work", i.e., just sleep for a couple of seconds. ACE_OS::sleep (2); // Free up the check file for the next acquirer. ACE_OS::unlink (mutex_check); // Check if we need to release the mutex if (release_mutex == 1) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P) Releasing the mutex %s\n"), mutex_name)); int mutex_release = mutex.release (); ACE_TEST_ASSERT (mutex_release == 0); } } int run_main (int argc, ACE_TCHAR *argv[]) { parse_args (argc, argv); // Child process code. if (child_process) { ACE_TCHAR lognm[MAXPATHLEN]; int mypid (ACE_OS::getpid ()); ACE_OS::snprintf (lognm, MAXPATHLEN, ACE_TEXT ("Process_Mutex_Test-child-%d"), mypid); ACE_START_TEST (lognm); acquire_release (); ACE_END_LOG; } else { ACE_START_TEST (ACE_TEXT ("Process_Mutex_Test")); # if !defined( ACE_HAS_SYSV_IPC) || defined(ACE_USES_MUTEX_FOR_PROCESS_MUTEX) // When Process_Mutex is pthreads based, then the owner of mutex destroys it // in destructor. This may disturb the other processes which still uses the // mutex. It is safer then to hold the mutex in main process, and destroy it after // children finish. This is temporary solution, and in future pthread base // Process_Mutex shall control the destruction of mutex better. ACE_Process_Mutex mutex( mutex_name ); # endif ACE_Process_Options options; #ifndef ACE_LACKS_VA_FUNCTIONS options.command_line (ACE_TEXT ("%") ACE_TEXT_PRIs ACE_TEXT (" -c -n %") ACE_TEXT_PRIs ACE_TEXT ("%") ACE_TEXT_PRIs, argc > 0 ? argv[0] : ACE_TEXT ("Process_Mutex_Test"), mutex_name, release_mutex == 0 ? ACE_TEXT (" -d") : ACE_TEXT ("")); #endif #ifdef ACE_HAS_PROCESS_SPAWN // Spawn child processes that will contend for the // lock. ACE_Process children[n_processes]; size_t i; for (i = 0; i < n_processes; i++) { // Spawn the child process. if (children[i].spawn (options) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("spawn of client %d failed\n"), i), -1); } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Parent spawned child process with pid = %d.\n"), children[i].getpid ())); } // Give the newly spawned child process a chance to start... // David Levine thinks this sleep() is required because // calling ::waitpid () before a fork'ed child has actually // been created may be a problem on some platforms. It's // not enough for fork() to have returned to the parent. ACE_OS::sleep (1); } for (i = 0; i < n_processes; i++) { ACE_exitcode child_status; // Wait for the child processes we created to exit. int wait_result = children[i].wait (&child_status); ACE_TEST_ASSERT (wait_result != -1); if (child_status == 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Child %d finished ok\n"), children[i].getpid ())); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("Child %d finished with status %d\n"), children[i].getpid (), child_status)); } #endif // ACE_HAS_PROCESS_SPAWN ACE_Process_Mutex::unlink (mutex_name); ACE_END_TEST; } return 0; } ace-8.0.4+dfsg.orig/tests/tests.mwc0000644000175000017500000000010215027201773016174 0ustar sudipsudip// -*- MPC -*- workspace { exclude { pharlap log } } ace-8.0.4+dfsg.orig/tests/Thread_Pool_Test.cpp0000644000175000017500000003247115027201773020243 0ustar sudipsudip //============================================================================= /** * @file Thread_Pool_Test.cpp * * This test program illustrates how the * synchronization mechanisms work in conjunction with the * . If the flag is set input comes * from stdin until the user enters a return -- otherwise, the * input is generated automatically. All worker threads shutdown * when (1) they receive a message block of length 0 or (2) the * queue is deactivated. * * @author Karlheinz Dorn * @author Douglas C. Schmidt * @author and Prashant Jain */ //============================================================================= #include "test_config.h" #include "ace/Task.h" #if defined (ACE_HAS_THREADS) #include "ace/Lock_Adapter_T.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" // Number of iterations to run the test. static size_t n_iterations = 100; // Controls whether the input is generated "manually" or automatically. static int manual = 0; /** * @class Thread_Pool * * @brief Defines a thread pool abstraction based on the . */ class Thread_Pool : public ACE_Task { public: /// Create the thread pool containing . Thread_Pool (int n_threads); /// Destructor... ~Thread_Pool () override; /** * Activate the task's thread pool, produce the messages that are * consumed by the threads in the thread pool, and demonstate how to * shutdown using the method. */ int test_queue_deactivation_shutdown (); /** * Activate the task's thread pool, produce the messages that are, * produce the messages that are consumed by the threads in the * thread pool, and demonstrate how to shutdown by enqueueing * "empty" messages into the queue. */ int test_empty_message_shutdown (); /// Iterate time printing off a message and "waiting" /// for all other threads to complete this iteration. int svc () override; /// Allows the producer to pass messages to the . int put (ACE_Message_Block *mb, ACE_Time_Value *tv = 0) override; private: //FUZZ: disable check_for_lack_ACE_OS /// Spawn the threads in the pool. int open (void * = 0) override; //FUZZ: enable check_for_lack_ACE_OS /// Close hook. int close (u_long) override; /// Serialize access to reference count, which /// will be decremented by multiple threads. ACE_Lock_Adapter lock_adapter_; /// Number of threads to spawn. int n_threads_; }; Thread_Pool::~Thread_Pool () { } int Thread_Pool::close (u_long) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) worker thread closing down\n"))); return 0; } Thread_Pool::Thread_Pool (int n_threads) : n_threads_ (n_threads) { } // Simply enqueue the Message_Block into the end of the queue. int Thread_Pool::put (ACE_Message_Block *mb, ACE_Time_Value *tv) { return this->putq (mb, tv); } // Iterate printing off a message and "waiting" for all // other threads to complete this iteration. int Thread_Pool::svc () { // Keep looping, reading a message out of the queue, until we get a // message with a length == 0, which signals us to quit. for (int count = 1; ; count++) { ACE_Message_Block *mb = 0; int result = this->getq (mb); ACE_TEST_ASSERT (result != -1 || errno == ESHUTDOWN); if (result == -1 && errno == ESHUTDOWN) { // The queue has been deactivated, so let's bail out. ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) in iteration %d, queue len = %d, ") ACE_TEXT ("queue deactivated, exiting\n"), count, this->msg_queue ()->message_count ())); break; } size_t length = mb->length (); if (length > 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) in iteration %d, queue len = %d, ") ACE_TEXT ("length = %d, text = \"%*s\"\n"), count, this->msg_queue ()->message_count (), length, length - 1, mb->rd_ptr ())); // We're responsible for deallocating this. mb->release (); if (length == 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) in iteration %d, queue len = %d, ") ACE_TEXT ("got \"empty\" message, exiting\n"), count, this->msg_queue ()->message_count ())); break; } } // Note that the method automatically removes us // from the when the thread exits. return 0; } int Thread_Pool::open (void *) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) producer start, dumping the Thread_Pool\n"))); this->dump (); // Create a pool of worker threads. if (this->activate (THR_NEW_LWP, this->n_threads_) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("activate failed")), -1); return 0; } // Activate the task's thread pool, produce the messages that are // consumed by the threads in the thread pool, and demonstate how to // shutdown using the method. int Thread_Pool::test_queue_deactivation_shutdown () { if (this->open () == -1) return -1; ACE_Message_Block *mb = 0; // Run the main loop that generates messages and enqueues them into // the pool of threads managed by . for (size_t count = 0; ; count++) { ssize_t n = 0; // Allocate a new message. ACE_NEW_RETURN (mb, ACE_Message_Block (BUFSIZ, ACE_Message_Block::MB_DATA, 0, 0, 0, &this->lock_adapter_), -1); if (manual) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) enter a new message for ") ACE_TEXT ("the task pool..."))); n = ACE_OS::read (ACE_STDIN, mb->wr_ptr (), mb->size ()); } else { static size_t count = 0; ACE_OS::snprintf (reinterpret_cast (mb->wr_ptr ()), BUFSIZ, ACE_SIZE_T_FORMAT_SPECIFIER, count); n = ACE_OS::strlen (mb->rd_ptr ()); if (count == n_iterations) n = 1; // Indicate that we need to shut down. else count++; if (count == 0 || (count % 20 == 0)) ACE_OS::sleep (1); } if (n > 1) { // Send a normal message to the waiting threads and continue // producing. mb->wr_ptr (n * sizeof (ACE_TCHAR)); // Pass the message to the Thread_Pool. if (this->put (mb) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT (" (%t) %p\n"), ACE_TEXT ("put"))); } else { // Release the since we're shutting down and // don't need it anymore. mb->release (); // Deactivate the message queue and return. ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n(%t) deactivating queue for %d threads, ") ACE_TEXT ("dump of task:\n"), this->thr_count ())); this->dump (); // Deactivate the queue. return this->msg_queue ()->deactivate (); } } } // Activate the task's thread pool, produce the messages that are, // produce the messages that are consumed by the threads in the thread // pool, and demonstrate how to shutdown by enqueueing "empty" // messages into the queue. int Thread_Pool::test_empty_message_shutdown () { if (this->open () == -1) return -1; ACE_Message_Block *mb = 0; // Run the main loop that generates messages and enqueues them into // the pool of threads managed by . for (size_t count = 0; ; count++) { ssize_t n = 0; // Allocate a new message. ACE_NEW_RETURN (mb, ACE_Message_Block (BUFSIZ, ACE_Message_Block::MB_DATA, 0, 0, 0, &this->lock_adapter_), -1); if (manual) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) enter a new message for ") ACE_TEXT ("the task pool..."))); n = ACE_OS::read (ACE_STDIN, mb->wr_ptr (), mb->size ()); } else { static size_t count = 0; ACE_OS::snprintf (reinterpret_cast (mb->wr_ptr ()), BUFSIZ, ACE_SIZE_T_FORMAT_SPECIFIER, count); n = ACE_OS::strlen (mb->rd_ptr ()); if (count == n_iterations) n = 1; // Indicate that we need to shut down. else count++; if (count == 0 || (count % 20 == 0)) ACE_OS::sleep (1); } if (n > 1) { // Send a normal message to the waiting threads and continue // producing. mb->wr_ptr (n * sizeof (ACE_TCHAR)); // Pass the message to the Thread_Pool. if (this->put (mb) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT (" (%t) %p\n"), ACE_TEXT ("put"))); } else { // Send a shutdown message to the waiting threads and return. ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n(%t) sending shutdown message to %d threads, ") ACE_TEXT ("dump of task:\n"), this->thr_count ())); this->dump (); size_t i = 0; // Enqueue an empty message to flag each consumer thread to // inform it to shutdown. for (i = this->thr_count (); i > 0; i--) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) end of input, ") ACE_TEXT ("enqueueing \"empty\" message %d\n"), i)); // Note the use of reference counting to avoid copying // the message contents. ACE_Message_Block *dup = mb->duplicate (); if (this->put (dup) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT (" (%t) %p\n"), ACE_TEXT ("put"))); } mb->release (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n(%t) end loop, dump of task:\n"))); this->dump (); return 0; } } } #endif /* ACE_HAS_THREADS */ int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Thread_Pool_Test")); #if defined (ACE_HAS_THREADS) int n_threads = ACE_MAX_THREADS; // Create the worker tasks. Thread_Pool thread_pool (n_threads); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) running test with %d threads\n"), n_threads)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) starting empty message shutdown test\n"))); // Activate the task's thread pool, produce the messages that are, // produce the messages that are consumed by the threads in the // thread pool, and demonstrate how to shutdown by enqueueing // "empty" messages into the queue. if (thread_pool.test_empty_message_shutdown () == -1) return 1; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) waiting for worker tasks to finish...\n"))); // Wait for all the threads to reach their exit point, at which // point the barrier in the destructor of the portion of // will return. if (thread_pool.wait () == -1) return 1; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) starting queue deactivation shutdown test\n"))); // Activate the task's thread pool, produce the messages that are // consumed by the threads in the thread pool, and demonstate how to // shutdown using the method. if (thread_pool.test_queue_deactivation_shutdown () == -1) return 1; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) waiting for worker tasks to finish...\n"))); // Wait for all the threads to reach their exit point, at which // point the barrier in the destructor of the portion of // will return. if (thread_pool.wait () == -1) return 1; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) all worker tasks destroyed, exiting test...\n"))); #else ACE_ERROR ((LM_INFO, ACE_TEXT ("threads not supported on this platform\n"))); #endif /* ACE_HAS_THREADS */ ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Framework_Component_Test.h0000644000175000017500000000143515027201773021463 0ustar sudipsudip //============================================================================= /** * @file Framework_Component_Test.h * * Define class needed for generating templates. * * @author Don Hinton */ //============================================================================= #ifndef ACE_TESTS_FRAMEWORK_COMPONENT_TEST_H #define ACE_TESTS_FRAMEWORK_COMPONENT_TEST_H #include "ace/Log_Msg.h" /// This we will use to test the ACE_Framework_Repository class Simple_Service { public: Simple_Service () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Simple_Service::Simple_Service\n"))); } virtual ~Simple_Service () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Simple_Service::~Simple_Service\n"))); } }; #endif /* ACE_TESTS_FRAMEWORK_COMPONENT_TEST_H */ ace-8.0.4+dfsg.orig/tests/Conn_Test.cpp0000644000175000017500000005311515027201773016736 0ustar sudipsudip //============================================================================= /** * @file Conn_Test.cpp * * This is a test of the and * classes. The test forks processes or spawns threads (depending * upon the platform) and then executes client and server allowing * them to connect and exchange data. The test also illustrates * how the works by showing how you can * cache connections on the client. * * @author Douglas C. Schmidt * @author Chris Cleeland * @author and Irfan Pyarali */ //============================================================================= #include "test_config.h" #include "ace/SOCK_Connector.h" #include "ace/LOCK_SOCK_Acceptor.h" #include "ace/Acceptor.h" #include "ace/Handle_Set.h" #include "ace/Connector.h" #include #include "ace/Get_Opt.h" #include "ace/Process_Mutex.h" #include "ace/Signal.h" #include "Conn_Test.h" #include "ace/Barrier.h" #include "ace/OS_NS_signal.h" #include "ace/OS_NS_sys_select.h" #include "ace/OS_NS_sys_wait.h" #include "ace/OS_NS_unistd.h" #include "ace/os_include/os_netdb.h" static const char ACE_ALPHABET[] = "abcdefghijklmnopqrstuvwxyz"; // This test doesn't work well using fork() on MacOS X. So we // will force it to use threads instead. #if defined (__APPLE__) # define ACE_LACKS_FORK #endif /* __APPLE__ */ // The following works around bugs with some operating systems, which // don't allow multiple threads/process to call accept() on the same // listen-mode port/socket. Also, note that since timed accept is // implemented using select(), and we use timed accepts with threads, // we need a real lock when using timed accepts even if the OS has // thread-safe accept. // #if defined (ACE_LACKS_FORK) # if defined (ACE_HAS_THREADS) # include "ace/Thread_Mutex.h" typedef ACE_Thread_Mutex ACCEPTOR_LOCKING; # else # include "ace/Null_Mutex.h" typedef ACE_Null_Mutex ACCEPTOR_LOCKING; # endif /* ACE_HAS_THREADS */ #else # if defined (ACE_HAS_THREAD_SAFE_ACCEPT) # include "ace/Null_Mutex.h" typedef ACE_Null_Mutex ACCEPTOR_LOCKING; # else # include "ace/Process_Mutex.h" using ACCEPTOR_LOCKING = ACE_Process_Mutex; # define CLEANUP_PROCESS_MUTEX # endif /* ACE_HAS_THREAD_SAFE_ACCEPT */ #endif /* ACE_LACKS_FORK */ using ACCEPTOR = ACE_Oneshot_Acceptor>; using CONNECTOR = ACE_Connector; using STRAT_CONNECTOR = ACE_Strategy_Connector; using NULL_CREATION_STRATEGY = ACE_NOOP_Creation_Strategy; using NULL_ACTIVATION_STRATEGY = ACE_NOOP_Concurrency_Strategy; using CACHED_CONNECT_STRATEGY = ACE_Cached_Connect_Strategy; #define CACHED_CONNECT_STRATEGY ACE_Cached_Connect_Strategy #define REFCOUNTED_HASH_RECYCLABLE_ADDR ACE_Refcounted_Hash_Recyclable // Default number of clients/servers. static int n_servers = 5; static int n_clients = 5; static int n_client_iterations = 3; Svc_Handler::Svc_Handler (ACE_Thread_Manager *) { } int Svc_Handler::open (void *) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) opening Svc_Handler %@ with handle %d\n"), this, this->peer ().get_handle ())); // Enable non-blocking I/O. if (this->peer ().enable (ACE_NONBLOCK) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("enable")), -1); return 0; } int Svc_Handler::recycle (void *) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) recycling Svc_Handler %@ with handle %d\n"), this, this->peer ().get_handle ())); return 0; } void Svc_Handler::send_data () { // Send data to server. for (const char *c = ACE_ALPHABET; *c != '\0'; c++) if (this->peer ().send_n (c, 1) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("send_n"))); } void Svc_Handler::recv_data () { ACE_SOCK_Stream &new_stream = this->peer (); ACE_Handle_Set handle_set; handle_set.set_bit (new_stream.get_handle ()); const char *t = ACE_ALPHABET; // Read data from client (terminate on error). for (ssize_t r_bytes; ;) { // Since we're in non-blocking mode we need to use to // avoid busy waiting. #if defined (ACE_WIN64) int select_width = 0; #else int select_width = int (new_stream.get_handle ()) + 1; #endif /* ACE_WIN64 */ int result = (direction == READX) ? ACE_OS::select (select_width, handle_set, 0, 0, &DEFAULT_TIME_VALUE) : ACE_OS::select (select_width, 0, handle_set, 0, &DEFAULT_TIME_VALUE); return result != -1; } int Svc_Handler::close (u_long side) { // Only run this protocol if we're the write-side (i.e., "1"). if (side == 1 && this->peer ().close () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("close_writer"))); // Trigger the shutdown. return this->handle_close (); } #if defined (ACE_HAS_THREADS) static void * client (void *arg) { ACE_INET_Addr *remote_addr = reinterpret_cast (arg); ACE_INET_Addr server_addr (remote_addr->get_port_number (), ACE_DEFAULT_SERVER_HOST); CONNECTOR connector; Svc_Handler *svc_handler = 0; // Run the blocking test. ACE_NEW_RETURN (svc_handler, Svc_Handler, 0); // Perform a blocking connect to the server. if (connector.connect (svc_handler, server_addr) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("connection failed"))); else { // Send the data to the server. svc_handler->send_data (); } return 0; } // Performs the iterative server activities. static void * server (void *arg) { ACCEPTOR *acceptor = (ACCEPTOR *) arg; ACE_INET_Addr cli_addr; ACE_TCHAR peer_host[MAXHOSTNAMELEN]; const ACE_Time_Value tv (ACE_DEFAULT_TIMEOUT); ACE_Synch_Options options (ACE_Synch_Options::USE_TIMEOUT, tv); Svc_Handler *svc_handler = 0; ACE_NEW_RETURN (svc_handler, Svc_Handler, 0); // Keep looping until we timeout on or fail. for (;;) { // Create a new to consume the data. int result = acceptor->accept (svc_handler, &cli_addr, options); // Timing out is the only way for threads to stop accepting // since we don't have signals. if (result == -1) { // svc_handler->close (); The ACE_Onsehot_Acceptor closed it. if (errno == ETIMEDOUT) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("accept timed out\n"))); return 0; } else ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("accept failed, shutting down")), 0); } // Use this rather than get_host_name() to properly adjust to the // charset width in use. cli_addr.get_host_name (peer_host, MAXHOSTNAMELEN); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) client %s connected from %d\n"), peer_host, cli_addr.get_port_number ())); svc_handler->recv_data (); break; } return 0; } // Spawn threads and run the client and server. int spawn_threads (ACCEPTOR *acceptor, ACE_INET_Addr *server_addr) { int status = 0; if (ACE_Thread_Manager::instance ()->spawn_n ( 1, (ACE_THR_FUNC) server, (void *) acceptor, THR_NEW_LWP , ACE_DEFAULT_THREAD_PRIORITY , -1 , 0 ) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), ACE_TEXT ("server thread create failed"), 1)); if (ACE_Thread_Manager::instance ()->spawn ((ACE_THR_FUNC) client, (void *) server_addr, THR_NEW_LWP, 0 ) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), ACE_TEXT ("client thread create failed"), 1)); // Wait for the threads to exit. // But, wait for a limited time because sometimes the test hangs on Irix. ACE_Time_Value const max_wait (400 /* seconds */); ACE_Time_Value const wait_time (ACE_OS::gettimeofday () + max_wait); if (ACE_Thread_Manager::instance ()->wait (&wait_time) == -1) { if (errno == ETIME) ACE_ERROR ((LM_ERROR, ACE_TEXT ("maximum wait time of %d msec exceeded\n"), max_wait.msec ())); else ACE_OS::perror (ACE_TEXT ("ACE_Thread_Manager::wait")); status = -1; } return status; } #endif /* ACE_HAS_THREADS */ //#endif /* ACE_WIN32 */ int run_main (int , ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Bug_3943_Regression_Test")); int status = 0; #if defined (ACE_HAS_THREADS) # if !defined (ACE_WIN32) || ((defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)) || !defined (ACE_LACKS_SEND)) # ifndef ACE_LACKS_ACCEPT ACCEPTOR acceptor; ACE_INET_Addr server_addr; // Bind acceptor to any port and then find out what the port was. if (acceptor.open (ACE_sap_any_cast (const ACE_INET_Addr &)) == -1 || acceptor.acceptor ().get_local_addr (server_addr) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("open"))); ACE_ASSERT (0); } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) starting server at port %d\n"), server_addr.get_port_number ())); if (spawn_threads (&acceptor, &server_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("spawn_threads")), 1); } if (!client_complete || !server_complete) status = 1; # ifdef CLEANUP_PROCESS_MUTEX ACE_Process_Mutex::unlink (acceptor.acceptor ().lock ().name ()); # endif # endif // ACE_LACKS_ACCEPT # endif /* ACE_HAS_WINSOCK2 && (ACE_HAS_WINSOCK2 != 0)) || !ACE_LACKS_SEND */ #else /* !ACE_HAS_THREADS */ ACE_ERROR ((LM_INFO, ACE_TEXT ("threads not supported on this platform\n"))); #endif /* ACE_HAS_THREADS */ ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/Monotonic_Task_Test.cpp0000644000175000017500000002262315027201773020770 0ustar sudipsudip //============================================================================= /** * @file Monotonic_Task_Test.cpp * * This is a test that verifies the time policy features of the * ACE_Task template. * A template instantiation based on the ACE_Monotonic_Time_Policy * is used to demonstrate the ability for making the task message queue * timeouts independent from system time changes (time shift). * Also demonstrated is how to instantiate a thread manager which is time * shift independent (for its wait timeouts) using time policy support for * conditions. * * @author Martin Corino */ //============================================================================= #include "test_config.h" #include "ace/Reactor.h" #include "ace/Timer_Queue.h" #include "ace/Thread_Manager.h" #include "ace/Message_Queue.h" #include "ace/Monotonic_Time_Policy.h" #include "ace/Synch_Traits.h" #include "ace/Timer_Heap_T.h" #include "ace/Event_Handler_Handle_Timeout_Upcall.h" #include "ace/TP_Reactor.h" #include "ace/Task_T.h" #include "ace/Truncate.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_sys_time.h" #include "ace/OS_NS_time.h" #include "ace/OS_NS_unistd.h" #if defined (ACE_HAS_MONOTONIC_TIME_POLICY) && defined (ACE_HAS_MONOTONIC_CONDITIONS) # if defined (ACE_WIN32) # include "ace/Date_Time.h" # endif # if defined (ACE_HAS_THREADS) void set_system_time(const ACE_Time_Value& tv) { # if defined (ACE_WIN32) ACE_Date_Time curdt (tv); SYSTEMTIME sys_time; sys_time.wDay = ACE_Utils::truncate_cast (curdt.day ()); sys_time.wMonth = ACE_Utils::truncate_cast (curdt.month ()); sys_time.wYear = ACE_Utils::truncate_cast (curdt.year ()); sys_time.wHour = ACE_Utils::truncate_cast (curdt.hour ()); sys_time.wMinute = ACE_Utils::truncate_cast (curdt.minute ()); sys_time.wSecond = ACE_Utils::truncate_cast (curdt.second ()); sys_time.wMilliseconds = ACE_Utils::truncate_cast (curdt.microsec () / 1000); if (!::SetLocalTime (&sys_time)) # else timespec_t curts; curts = tv; if (ACE_OS::clock_settime (CLOCK_REALTIME, &curts) != 0) # endif { ACE_DEBUG((LM_INFO, "(%P|%t) Unable to reset OS time. Insufficient privileges or not supported.\n")); } } class MyTask : public ACE_Task { public: MyTask () : stop_ (false), tm_ (monotonic_cond_attr_), cond_ (lock_, monotonic_cond_attr_), status_ (0) { // set monotonic timer aware thread manager for this task this->thr_mgr (&this->tm_); } ~MyTask () override { stop (); } int svc () override; int start (); int put_message (); int stop (); int status () { return this->status_; } private: bool stop_; ACE_Condition_Attributes_T monotonic_cond_attr_; ACE_Thread_Manager tm_; ACE_Thread_Mutex lock_; ACE_Condition cond_; int status_; }; int MyTask::start () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%P|%t) Starting MyTask\n"))); ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); if (this->activate (THR_NEW_LWP, 1) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p.\n"), ACE_TEXT ("unable to activate thread")), -1); if (this->cond_.wait () != 0) // wait for task to start { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Failed waiting for thread")), -1); } return 0; } int MyTask::put_message () { const char S1[] = "message"; ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); // Now (according to task time policy = monotonic time) ACE_Time_Value_T tv (this->gettimeofday ()); tv += ACE_Time_Value (5,0); // Now + 5 sec // wait for signal; should not come causing us to sleep 5 sec (monotonic) if (this->cond_.wait (&tv) == 0) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) MyTask::put_message - Received signal from thread before timeout\n")), -1); } ACE_DEBUG ((LM_DEBUG, "(%P|%t) MyTask::put_message - queueing message\n")); ACE_Message_Block* mb1 = new ACE_Message_Block(S1, sizeof S1); if (this->putq (mb1) < 0) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) MyTask::put_message - Failed to queue message\n")), -1); } return 0; } int MyTask::stop () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%P|%t) Stopping MyTask\n"))); { ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); this->stop_ = true; if (this->cond_.signal () != 0) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Failed signalling thread\n")), -1); } } return this->wait (); } int MyTask::svc () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%P|%t) MyTask::svc started\n"))); // Now (according to task time policy = monotonic time) ACE_Time_Value_T tv (this->gettimeofday ()); { ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%P|%t) MyTask::svc - signalling waiter\n"))); this->cond_.signal (); // signal waiter we have started // waiter will shift system time back 4 sec after this which would mess // up the first wait for a message if we were not using monotonic time } if (!this->msg_queue ()->is_empty ()) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("New task queue is not empty!\n"))); this->status_ = -1; } else { ACE_Message_Block *b; tv += ACE_Time_Value (3,0); // Now + 3 sec if (this->getq (b, &tv) != -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Dequeued before timeout elapsed!\n"))); this->status_ = -1; } else if (errno != EWOULDBLOCK) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Dequeue timeout should be EWOULDBLOCK, got"))); this->status_ = -1; } else { ACE_Time_Value_T tv_now (this->gettimeofday ()); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("First getq timed out at %#T (timeout was %#T)\n"), &tv_now, &tv)); tv = this->gettimeofday () + ACE_Time_Value (4,0); // Now (monotonic time) + 3 sec if (this->getq (b, &tv) != -1) { tv_now = tv.now (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Second getq succeeded at %#T\n"), &tv_now)); delete b; } else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Second getq timed out!\n"))); this->status_ = -1; } } } { ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%P|%t) MyTask::svc - waiting for stop\n"))); if (!this->stop_) this->cond_.wait (); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%t) MyTask finished\n"))); return 0; } # endif /* ACE_HAS_THREADS */ int run_main (int , ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Monotonic_Task_Test")); int status = 0; # if defined (ACE_HAS_THREADS) MyTask my_task; if (my_task.start () == 0) { // shift back in time 4 sec; this would mess up timeouts if // monotonic timer was not used ACE_Time_Value tv_shift (4, 0); set_system_time (ACE_OS::gettimeofday () - tv_shift); if (my_task.put_message () == 0) { // task should now have finished dequeueing and started waiting for stop signal // wait (2sec) on thread manager should timeout // use the time policy aware gettimeofday() // method of the task to get current time ACE_Time_Value_T tv (my_task.gettimeofday ()); tv += ACE_Time_Value (2, 0); // shift another 3 sec back in time; without monotonic timer support in // thread manager this would mess up the timed wait tv_shift += ACE_Time_Value (3, 0); set_system_time (ACE_OS::gettimeofday () - ACE_Time_Value (3,0)); if (my_task.thr_mgr ()->wait (&tv) == 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Thread manager did not time out\n"))); status = 1; } else { ACE_Time_Value_T tv_now (my_task.gettimeofday ()); ACE_DEBUG ((LM_INFO, ACE_TEXT ("Thread manager timed out at %#T\n"), &tv_now)); } } else status = 1; // ok, now stop task if (my_task.stop () != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Failed to stop task\n"))); status = 1; } // restore time set_system_time (ACE_OS::gettimeofday () + tv_shift); } else status = 1; # endif /* ACE_HAS_THREADS */ ACE_END_TEST; return status; } #else int run_main (int , ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Monotonic_Task_Test")); ACE_DEBUG((LM_INFO, "(%P|%t) ACE not compiled with monotonic time.\n")); ACE_END_TEST; return 0; } #endif ace-8.0.4+dfsg.orig/tests/Aio_Platform_Test.cpp0000644000175000017500000001343715027201773020420 0ustar sudipsudip //============================================================================= /** * @file Aio_Platform_Test.cpp * * Testing the platform for POSIX Asynchronous I/O. Basically * prints the predefined constants and also checks for their run * time values. If this test succeeds further tests at * $ACE_ROOT/examples/Reactor/Proactor can be used to test the * features further. * * @author Programming for the Real World. Bill O. GallMeister. Modified by Alexander Babu Arulanthu */ //============================================================================= #include "test_config.h" #include "ace/OS_NS_unistd.h" #if defined (_POSIX_ASYNCHRONOUS_IO) static int do_sysconf () { ACE_DEBUG ((LM_DEBUG, "Doing calls to know the run-time values of POSIX feature limits\n")); // Call sysconf to find out runtime values. errno = 0; #if defined (_SC_LISTIO_AIO_MAX) ACE_DEBUG ((LM_DEBUG, "Runtime value of LISTIO_AIO_MAX is %d, errno = %d, Minimum is 2\n", ACE_OS::sysconf (_SC_LISTIO_AIO_MAX), errno)); #elif defined (_SC_AIO_LISTIO_MAX) ACE_DEBUG ((LM_DEBUG, "Runtime value of AIO_LISTIO_MAX is %d, errno = %d, Minimum is 2\n", ACE_OS::sysconf (_SC_AIO_LISTIO_MAX), errno)); #else ACE_ERROR ((LM_ERROR, "_SC_LISTIO_AIO_MAX or _SC_AIO_LISTIO_MAX" " do not exist on this platform\n")); #endif /* _SC_LISTIO_AIO_MAX */ #if defined (_SC_AIO_MAX) errno = 0; ACE_DEBUG ((LM_DEBUG, "Runtime value of AIO_MAX is %d, errno = %d, Minimum is 1\n", ACE_OS::sysconf (_SC_AIO_MAX), errno)); #else ACE_ERROR ((LM_ERROR, "_SC_AIO_MAX does not exist on this platform\n")); #endif /* _SC_AIO_MAX */ #if defined (_SC_ASYNCHRONOUS_IO) errno = 0; ACE_DEBUG ((LM_DEBUG, "Runtime value of _POSIX_ASYNCHRONOUS_IO is %d, errno = %d\n", ACE_OS::sysconf (_SC_ASYNCHRONOUS_IO), errno)); #else /* Not _SC_ASYNCHRONOUS_IO */ ACE_ERROR ((LM_ERROR, "_SC_ASYNCHRONOUS_IO does not exist on this platform\n")); #endif /* _SC_ASYNCHRONOUS_IO */ #if defined (_SC_REALTIME_SIGNALS) errno = 0; ACE_DEBUG ((LM_DEBUG, "Runtime value of _POSIX_REALTIME_SIGNALS is %d, errno = %d\n", ACE_OS::sysconf (_SC_REALTIME_SIGNALS), errno)); #else /* Not _SC_REALTIME_SIGNALS */ ACE_ERROR ((LM_ERROR, "_SC_REALTIME_SIGNALS does not exist on this platform\n")); #endif /* _SC_REALTIME_SIGNALS */ #if defined (_SC_RTSIG_MAX) errno = 0; ACE_DEBUG ((LM_DEBUG, "Runtime value of RTSIG_MAX %d, Errno = %d, Minimum is 8\n", ACE_OS::sysconf (_SC_RTSIG_MAX), errno)); #else /* Not _SC_RTSIG_MAX */ ACE_ERROR ((LM_ERROR, "_SC_RTSIG_MAX does not exist on this platform\n")); #endif /* _SC_RTSIG_MAX */ #if defined (_SC_SIGQUEUE_MAX) errno = 0; ACE_DEBUG ((LM_DEBUG, "Runtime value of SIGQUEUE_MAX %d, Errno = %d, Minimum is 32\n", ACE_OS::sysconf (_SC_SIGQUEUE_MAX), errno)); #else /* Not _SC_SIGQUEUE_MAX */ ACE_ERROR ((LM_ERROR, "_SC_SIGQUEUE_MAX does not exist on this platform\n")); #endif /* _SC_SIGQUEUE_MAX */ return 0; } #endif /* _POSIX_ASYNCHRONOUS_IO */ static int have_asynchio () { #if defined (_POSIX_ASYNCHRONOUS_IO) #if defined (_POSIX_ASYNC_IO) #if _POSIX_ASYNC_IO == -1 ACE_DEBUG ((LM_DEBUG, "_POSIX_ASYNC_IO = -1.. ASYNCH IO NOT supported at all\n")); return -1; #else /* Not _POSIX_ASYNC_IO == -1 */ ACE_DEBUG ((LM_DEBUG, "_POSIX_ASYNC_IO = %d\n ASYNCH IO is supported FULLY\n", _POSIX_ASYNC_IO)); #endif /* _POSIX_ASYNC_IO == -1 */ #else /* Not defined _POSIX_ASYNC_IO */ ACE_ERROR ((LM_DEBUG, "_POSIX_ASYNC_IO is not defined.\n")); ACE_DEBUG ((LM_DEBUG, "AIO might *not* be supported on all the paths\n")); #endif /* _POSIX_ASYNC_IO */ // System defined POSIX Values. ACE_DEBUG ((LM_DEBUG, "System claims to have POSIX_ASYNCHRONOUS_IO\n")); #if defined(_POSIX_AIO_LISTIO_MAX) ACE_DEBUG ((LM_DEBUG, "Number of operations in one listio: " "Minimum value is 2: " "_POSIX_AIO_LISTIO_MAX = %d\n", _POSIX_AIO_LISTIO_MAX)); #else ACE_DEBUG ((LM_DEBUG, "No value for _POSIX_AIO_LISTIO_MAX\n")); #endif #if defined(_POSIX_AIO_MAX) ACE_DEBUG ((LM_DEBUG, "Number of simultaneous asynchronous I/Os: " "Minimum is 1: " "_POSIX_AIO_MAX = %d\n", _POSIX_AIO_MAX)); #else ACE_DEBUG ((LM_DEBUG, "No value for _POSIX_AIO_MAX\n")); #endif // @@ Debugging. ACE_DEBUG ((LM_DEBUG, "Before do_sysconf : Errno %d\n", errno)); // Check and print the run time values. do_sysconf (); // @@ Debugging. ACE_DEBUG ((LM_DEBUG, "After do_sysconf: Errno : %d\n", errno)); return 0; #else /* Not _POSIX_ASYNCHRONOUS_IO */ ACE_DEBUG ((LM_DEBUG, "No support._POSIX_ASYNCHRONOUS_IO itself is not defined\n")); return -1; #endif /* _POSIX_ASYNCHRONOUS_IO */ } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Aio_Platform_Test")); // Test the #defined and constants and runtime values. errno = 0; if (have_asynchio () == 0) ACE_DEBUG ((LM_DEBUG, "Basic test successful" "Check the run time values of the predefined constants\n" "ACE_HAS_AIO_CALLS can be defined for this platform\n" "Further tests at $ACE_ROOT/examples/Reactor/Proactor\n")); else ACE_ERROR ((LM_INFO, "AIO not supported on this platform\n")); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Bug_3912_Regression_Test.conf0000644000175000017500000000025115027201773021570 0ustar sudipsudip stream dynamic Close_Test_Stream STREAM *Service_Config_Stream_DLL:make_stream() active { dynamic Close_Test_Module Module *Service_Config_Stream_DLL:make_close() } ace-8.0.4+dfsg.orig/tests/Monotonic_Manual_Event_Test.cpp0000644000175000017500000002143515027201773022444 0ustar sudipsudip //============================================================================= /** * @file Monotonic_Manual_Event_Test.cpp * * This test verifies the functionality of the time policy support * for the implementation. * * @author Martin Corino */ //============================================================================= #include "test_config.h" #include "ace/Manual_Event.h" #include "ace/Thread.h" #include "ace/Thread_Manager.h" #include "ace/Get_Opt.h" #include "ace/OS_NS_sys_time.h" #include "ace/OS_NS_time.h" #include "ace/OS_NS_unistd.h" #include "ace/Atomic_Op.h" #if defined (ACE_HAS_MONOTONIC_TIME_POLICY) && defined (ACE_HAS_MONOTONIC_CONDITIONS) # include "ace/Monotonic_Time_Policy.h" # if defined (ACE_WIN32) # include "ace/Date_Time.h" # include "ace/Truncate.h" # endif // Test results, 'success' is 0 static int test_result = 0; # if defined (ACE_HAS_THREADS) // Event used in the tests. Start it "unsignalled" (i.e., its initial // state is 0). static ACE_Event_Base *evt = 0; // use monotonic or system time policy static bool use_monotonic = true; // Number of worker threads. static long n_workers = 10; // Absolute timeout for initial wait of workers static ACE_Time_Value *initial_timeout; // Number of wakeups. # if defined (ACE_HAS_BUILTIN_ATOMIC_OP) static ACE_Atomic_Op n_awoken; static ACE_Atomic_Op n_awoken2; # else static long n_awoken; static long n_awoken2; # endif // Explain usage and exit. static void print_usage_and_die () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("usage: %n [-w n_workers] [-s]\n"))); ACE_OS::exit (1); } static void parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("w:s")); int c; while ((c = get_opt ()) != -1) switch (c) { case 'w': n_workers = ACE_OS::atoi (get_opt.opt_arg ()); break; case 's': use_monotonic = false; break; default: print_usage_and_die (); break; } } void set_system_time(const ACE_Time_Value& tv) { # if defined (ACE_WIN32) ACE_Date_Time curdt (tv); SYSTEMTIME sys_time; sys_time.wDay = ACE_Utils::truncate_cast (curdt.day ()); sys_time.wMonth = ACE_Utils::truncate_cast (curdt.month ()); sys_time.wYear = ACE_Utils::truncate_cast (curdt.year ()); sys_time.wHour = ACE_Utils::truncate_cast (curdt.hour ()); sys_time.wMinute = ACE_Utils::truncate_cast (curdt.minute ()); sys_time.wSecond = ACE_Utils::truncate_cast (curdt.second ()); sys_time.wMilliseconds = ACE_Utils::truncate_cast (curdt.microsec () / 1000); if (!::SetLocalTime (&sys_time)) # else timespec_t curts; curts = tv; if (ACE_OS::clock_settime (CLOCK_REALTIME, &curts) != 0) # endif { ACE_DEBUG((LM_INFO, "(%P|%t) Unable to reset OS time. Insufficient privileges or not supported.\n")); } } // Worker tries to acquire the semaphore, hold it for a while, and // then manually releases it. static void * worker (void *) { if (evt->wait (initial_timeout) == -1) { if (ACE_OS::last_error () == ETIME) { ACE_Time_Value tm_now = initial_timeout->now (); ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" (%P|%t) Timed out waiting for start pulse at %#T\n"), &tm_now), 0); } else ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" (%P|%t) %p\n"), ACE_TEXT ("Failed waiting for pulse ()")), 0); } ACE_Time_Value tm_now = initial_timeout->now (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%P|%t) awake at %#T\n"), &tm_now)); if (++n_awoken < n_workers) { ACE_Time_Value *tv; ACE_Time_Value_T tm_mono; ACE_Time_Value tm_sys; //FUZZ: disable check_for_lack_ACE_OS ACE_Time_Value wait (1, 0); // Wait 1 sec //FUZZ: enable check_for_lack_ACE_OS if (use_monotonic) { tm_mono = tm_mono.now () + wait; tv = &tm_mono; } else { tm_sys = ACE_OS::gettimeofday () + wait; tv = &tm_sys; } if (evt->wait (tv) == -1) { // verify that we have ETIME if (ACE_OS::last_error () == ETIME) ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%P|%t) timeout\n"))); else ACE_ERROR ((LM_ERROR, ACE_TEXT (" (%P|%t) wait failed %p\n"), ACE_TEXT ("but not with ETIME"))); } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%P|%t) awake in time\n"))); if (++n_awoken2 >= (n_workers/2)) evt->reset (); // reset signal (rest times out) } // Check to ensure that an "infinite timeout" will work. if (evt->wait (0) == -1) { //FUZZ: disable check_for_lack_ACE_OS ACE_ERROR ((LM_ERROR, ACE_TEXT (" (%P|%t) %p\n"), ACE_TEXT ("Failed waiting for signal ()\n"))); //FUZZ: enable check_for_lack_ACE_OS } } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%P|%t) last awake; send signal\n"))); // last one wakes others if (evt->signal () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT (" (%P|%t) %p\n"), ACE_TEXT ("signal"))); ACE_OS::sleep (ACE_Time_Value (0, 200 * 1000 * 100)); // 200 msec } if (evt->wait () == -1) { //FUZZ: disable check_for_lack_ACE_OS ACE_ERROR ((LM_ERROR, ACE_TEXT (" (%P|%t) %p\n"), ACE_TEXT ("Failed waiting for signal ()\n"))); //FUZZ: enable check_for_lack_ACE_OS } ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%P|%t) worker finished\n"))); return 0; } # endif /* ACE_HAS_THREADS */ // Test event functionality. int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Monotonic_Manual_Event_Test")); # if defined (ACE_HAS_THREADS) ACE_Manual_Event_T monotonic_event (0); ACE_Manual_Event systime_event (0); ACE_Time_Value_T tm_mono; ACE_Time_Value tm_sys; parse_args (argc, argv); //FUZZ: disable check_for_lack_ACE_OS ACE_Time_Value wait (7, 0); // Wait 7 sec //FUZZ: enable check_for_lack_ACE_OS if (use_monotonic) { evt = &monotonic_event; tm_mono = tm_mono.now () + wait; initial_timeout = &tm_mono; } else { evt = &systime_event; tm_sys = ACE_OS::gettimeofday () + wait; initial_timeout = &tm_sys; } // shift forward in time 3 sec; this will mess up timeouts if // monotonic timer is not used ACE_Time_Value tv_shift (3, 0); set_system_time (ACE_OS::gettimeofday () + tv_shift); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("spawning workers - initial timeout till %#T\n"), initial_timeout)); if (ACE_Thread_Manager::instance ()->spawn_n (static_cast (n_workers), ACE_THR_FUNC (worker), 0, THR_NEW_LWP) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("spawn_n")), 1); // gives all workers chance to start ACE_OS::sleep (5); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("finished waiting for workers to start\n"))); // restore time (workers will already have failed without monotonic timer) set_system_time (ACE_OS::gettimeofday () - tv_shift); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("sending pulse ()\n"))); // Release the all workers. if (evt->pulse () == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("pulse")), 1); // Wait 2 sec ACE_OS::sleep (2); //FUZZ: disable check_for_lack_ACE_OS ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("sending signal ()\n"))); //FUZZ: enable check_for_lack_ACE_OS // Signal if (evt->signal () == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("signal")), 1); ACE_Thread_Manager::instance ()->wait (); # else ACE_UNUSED_ARG (argc); ACE_UNUSED_ARG (argv); ACE_ERROR ((LM_INFO, ACE_TEXT ("Threads not supported on this platform\n"))); # endif /* ACE_HAS_THREADS */ ACE_END_TEST; return test_result; } #else int run_main (int , ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Monotonic_Manual_Event_Test")); ACE_DEBUG((LM_INFO, "(%P|%t) ACE not compiled with monotonic time.\n")); ACE_END_TEST; return 0; } #endif ace-8.0.4+dfsg.orig/tests/Basic_Types_Test.cpp0000644000175000017500000001446015027201773020246 0ustar sudipsudip//============================================================================= /** * @file Basic_Types_Test.cpp * * Checks the #defines in ace/Basic_Types.h, and a few other basics. * * @author David L. Levine */ //============================================================================= #include "ace/config-all.h" // Don't use the ACE version accessors in class ACE, so that we can // support this test cleanly with the OS component, only. #include "ace/Version.h" #if defined (ACE_HAS_MINIMAL_ACE_OS) // Redefine these macros to allow the test to print out useful info. # undef ACE_DEBUG # define ACE_DEBUG(x) ACE_OS::fprintf x # define LM_DEBUG stdout # undef ACE_ERROR # define ACE_ERROR(x) ACE_OS::fprintf x # define LM_ERROR stderr # define ACE_START_TEST(x) ACE_OS::printf (x ACE_TEXT ("\n")) # define ACE_END_TEST #else /* ! ACE_HAS_MINIMAL_ACE_OS */ # include "test_config.h" #endif /* ! ACE_HAS_MINIMAL_ACE_OS */ #include "ace/Basic_Types.h" #include "ace/OS_NS_unistd.h" using a_function_pointer = void *(*)(void *); ACE_UINT32 check (const ACE_TCHAR* message, ACE_UINT32 i, ACE_UINT32 j) { if (i == j) { ACE_DEBUG ((LM_DEBUG, message, j, ACE_TEXT ("\n"))); return 0; } else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("assertion failed \"%s\": %u != %u\n"), message, i, j)); return 1; } } ACE_UINT32 check64 (const ACE_TCHAR* message, ACE_UINT64 i, ACE_UINT64 j) { if (i == j) { ACE_DEBUG ((LM_DEBUG, message, j, ACE_TEXT ("\n"))); return 0; } else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("assertion failed \"%s\": %u != %u\n"), message, i, j)); return 1; } } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Basic_Types_Test")); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("This is ACE Version %u.%u.%u\n\n"), ACE_MAJOR_VERSION, ACE_MINOR_VERSION, ACE_MICRO_VERSION)); u_int errors = 0; errors += check (ACE_TEXT ("ACE_SIZEOF_CHAR: %u%s"), sizeof (char), ACE_SIZEOF_CHAR); #if defined (ACE_HAS_WCHAR) errors += check (ACE_TEXT ("ACE_SIZEOF_WCHAR: %u%s"), sizeof (wchar_t), ACE_SIZEOF_WCHAR); #endif /* ACE_HAS_WCHAR */ errors += check (ACE_TEXT ("ACE_SIZEOF_SHORT: %u%s"), sizeof (short), ACE_SIZEOF_SHORT); errors += check (ACE_TEXT ("ACE_SIZEOF_INT: %u%s"), sizeof (int), ACE_SIZEOF_INT); errors += check (ACE_TEXT ("ACE_SIZEOF_LONG: %u%s"), sizeof (long), ACE_SIZEOF_LONG); errors += check (ACE_TEXT ("ACE_SIZEOF_LONG_LONG: %u%s"), #if defined (ACE_WIN32) sizeof (unsigned __int64), #else /* ! ACE_WIN32 && */ sizeof (long long), #endif /* ! ACE_WIN32 && */ ACE_SIZEOF_LONG_LONG); errors += check (ACE_TEXT ("sizeof 64-bit literal: %u%s"), sizeof ACE_UINT64_LITERAL (1), 8); errors += check (ACE_TEXT ("ACE_SIZEOF_VOID_P: %u%s"), sizeof (void *), ACE_SIZEOF_VOID_P); errors += check (ACE_TEXT ("ACE_SIZEOF_FLOAT: %u%s"), sizeof (float), ACE_SIZEOF_FLOAT); errors += check (ACE_TEXT ("ACE_SIZEOF_DOUBLE: %u%s"), sizeof (double), ACE_SIZEOF_DOUBLE); errors += check (ACE_TEXT ("ACE_SIZEOF_LONG_DOUBLE: %u%s"), sizeof (long double), ACE_SIZEOF_LONG_DOUBLE); errors += check (ACE_TEXT ("sizeof (ACE_INT16) is %u%s"), sizeof (ACE_INT16), 2); errors += check (ACE_TEXT ("sizeof (ACE_UINT16) is %u%s"), sizeof (ACE_UINT16), 2); errors += check (ACE_TEXT ("sizeof (ACE_INT32) is %u%s"), sizeof (ACE_INT32), 4); errors += check (ACE_TEXT ("sizeof (ACE_UINT32) is %u%s"), sizeof (ACE_UINT32), 4); errors += check (ACE_TEXT ("sizeof (ACE_INT64) is %u%s"), sizeof (ACE_INT64), 8); errors += check (ACE_TEXT ("sizeof (ACE_UINT64) is %u%s"), sizeof (ACE_UINT64), 8); // ACE assumes sizeof (ptrdiff_t) == sizeof (void*) if (sizeof (ptrdiff_t) == sizeof (void *)) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("sizeof (ptrdiff_t) == sizeof (void*)\n"))); else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("sizeof (ptrdiff_t) != sizeof (void*)\n"))); ++errors; } // ACE assumes sizeof (ptrdiff_t) >= sizeof (a_function_pointer) if (sizeof (ptrdiff_t) >= sizeof (a_function_pointer)) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("sizeof (ptrdiff_t) >= sizeof (a_function_pointer)\n"))); else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("sizeof (ptrdiff_t) < sizeof (a_function_pointer)\n"))); ++errors; } ACE_UINT16 test_val = 123; #if defined (ACE_LITTLE_ENDIAN) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("little endian\n"))); if (ACE_HTONS (test_val) == test_val) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Endian test: %d == %d but should be different\n"), ACE_HTONS (test_val), test_val)); #elif defined (ACE_BIG_ENDIAN) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("big endian\n"))); if (ACE_HTONS (test_val) != test_val) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Endian test: %d != %d but should be equal\n"), ACE_HTONS (test_val), test_val)); #else ACE_ERROR ((LM_ERROR, ACE_TEXT ("assertion failed: no ACE_*_ENDIAN definition!\n"))); ++errors; #endif /* ACE_LITTLE_ENDIAN */ test_val = 0x0123; ACE_UINT32 test_val_2 = 0x01234567; ACE_UINT64 test_val_3 = 0x0123456789abcdef; errors += check (ACE_TEXT ("ACE_SWAP_WORD(0x0123) is %u%s"), ACE_SWAP_WORD (test_val), 0x2301); errors += check (ACE_TEXT ("ACE_SWAP_LONG(0x01234567) is %u%s"), ACE_SWAP_LONG (test_val_2), 0x67452301); errors += check64 (ACE_TEXT ("ACE_SWAP_LONG_LONG(0x0123456789abcdef) is %Q%s"), ACE_SWAP_LONG_LONG (test_val_3), 0xefcdab8967452301); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("OS page size: %u\n"), ACE_OS::getpagesize ())); #if defined (_SC_PAGESIZE) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("sysconf page size: %d\n"), (int) ACE_OS::sysconf (_SC_PAGESIZE))); #endif /* _SC_PAGESIZE */ #if defined (_SC_CLK_TCK) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("clock ticks/sec = %d\n"), (int) ACE_OS::sysconf (_SC_CLK_TCK))); #endif /* _SC_CLK_TCK */ ACE_END_TEST; return errors == 0 ? 0 : 1; } ace-8.0.4+dfsg.orig/tests/Reactor_Notification_Queue_Test.cpp0000644000175000017500000001152715027201773023313 0ustar sudipsudip/** * @file Reactor_Notification_Queue_Test.cpp * * Verify that the notification queue can be used with large numbers * of events. * * Normally the ACE_Reactor uses a pipe to implement the notify() * methods. ACE can be compiled with * ACE_HAS_REACTOR_NOTIFICATION_QUEUE, with this configuration flag * the Reactor uses a user-space queue to contain the notifications. * A single message is sent through the pipe to indicate "pipe not * empty." * * @author Carlos O'Ryan */ #include "test_config.h" #include "ace/Reactor.h" #include "ace/TP_Reactor.h" #include "ace/Select_Reactor.h" #include "ace/WFMO_Reactor.h" class Event_Handler : public ACE_Event_Handler { public: Event_Handler(ACE_Reactor * reactor, int max_notifications, char const *test_name); /// Run the test void run(); /// Receive the notifications. int handle_exception(ACE_HANDLE) override; private: /** * @brief Implement a single iteration. * * Each iteration of the test consists of sending multiple * notifications simultaneously. */ void send_notifications (); /** * @brief Return true if the test is finished. */ bool done () const; private: /** * @brief The maximum number of notifications in any single * iteration. */ int max_notifications_; /** * @brief The name of the test */ char const * test_name_; /** * @brief Number of notifications received */ int notifications_sent_; /** * @brief Number of notifications sent */ int notifications_recv_; /** * @brief Number of notifications sent on each iteration */ int notifications_curr_; }; int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Reactor_Notification_Queue_Test")); #if !defined(ACE_HAS_REACTOR_NOTIFICATION_QUEUE) ACE_DEBUG ((LM_INFO, ACE_TEXT ("Notification queue disabled, ") ACE_TEXT ("small test version, ") ACE_TEXT ("which is of no practical use\n"))); int max_notifications = 16; #else int max_notifications = 1024 * 1024; #endif /* ACE_HAS_THREADS */ { ACE_Reactor select_reactor ( new ACE_Select_Reactor, 1); Event_Handler handler(&select_reactor, max_notifications, "Select_Reactor"); handler.run (); } { ACE_Reactor tp_reactor (new ACE_TP_Reactor, 1); Event_Handler handler(&tp_reactor, max_notifications, "TP_Reactor"); handler.run(); } #if 0 /// @@todo: Need to talk to Irfan to see how the WFMO handles this. #if defined (ACE_WIN32) { ACE_Reactor wfmo_reactor (new ACE_WFMO_Reactor, 1); Event_Handler handler(&wfmo_reactor, max_notifications, "WFMO_Reactor"); handler.run(); } #endif /*ACE_WIN32*/ #endif /*if 0 */ ACE_END_TEST; return 0; } Event_Handler::Event_Handler ( ACE_Reactor * reactor, int max_notifications, char const * test_name) : ACE_Event_Handler(reactor) , max_notifications_(max_notifications) , test_name_(test_name) , notifications_sent_(0) , notifications_recv_(0) , notifications_curr_(1) { } void Event_Handler::run () { send_notifications (); // Run for 30 seconds or until the test is done. for(int i = 0; i != 30 && !done(); ++i) { ACE_Time_Value tv (1,0); reactor ()->run_reactor_event_loop(tv); } if(!done()) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Test %C failed due to timeout ") ACE_TEXT (" sent=%d,recv=%d\n"), test_name_, notifications_sent_, notifications_recv_)); } else { ACE_DEBUG ((LM_INFO, ACE_TEXT ("Test %C passed sent=%d, recv=%d\n"), test_name_, notifications_sent_, notifications_recv_)); } } int Event_Handler::handle_exception (ACE_HANDLE) { ++notifications_recv_; if(notifications_recv_ == notifications_sent_) { if(notifications_curr_ >= max_notifications_) { return 0; } send_notifications(); } return 0; } void Event_Handler::send_notifications () { for (int i = 0; i != notifications_curr_; ++i) { if(reactor()->notify (this) == -1) { ACE_ERROR((LM_ERROR, ACE_TEXT ("Cannot send notifications in %C test (%d/%d)\n"), test_name_, i, notifications_curr_)); return; } ++notifications_sent_; } // ACE_ERROR((LM_ERROR, // "Started iteration with %d notify() calls in test %C\n", // notifications_curr_, test_name_)); notifications_curr_ *= 2; } bool Event_Handler::done () const { return (notifications_curr_ >= max_notifications_) && (notifications_sent_ == notifications_recv_); } ace-8.0.4+dfsg.orig/tests/Reactor_Fairness_Test.cpp0000644000175000017500000002566615027201773021304 0ustar sudipsudip //============================================================================= /** * @file Reactor_Fairness_Test.cpp * * This test is used to time the dispatching mechanisms of the * s. Both the and * can be tested. * * @author Irfan Pyarali */ //============================================================================= #include "test_config.h" #include "Reactor_Fairness_Test.h" #include "ace/Get_Opt.h" #include "ace/SOCK_Connector.h" #include "ace/SOCK_Acceptor.h" #include "ace/Acceptor.h" #include "ace/Reactor.h" #include "ace/Dev_Poll_Reactor.h" #include "ace/WFMO_Reactor.h" #include "ace/Select_Reactor.h" #include "ace/TP_Reactor.h" #include #include "ace/Numeric_Limits.h" #include "ace/Signal.h" #include "ace/Atomic_Op.h" #include "ace/Thread_Mutex.h" #if defined (ACE_HAS_THREADS) namespace { const char ACE_ALPHABET[] = "abcdefghijklmnopqrstuvwxyz"; // Number of connections to run int opt_nconnections = 5; // How many seconds to run the test on each reactor int opt_secs = 30; // How many thread to run in the reactor loop int opt_reactor_threads = 3; // Extra debug messages int opt_debug = 0; ACE_Atomic_Op reactor_thread_nr = 0; // Class to collect and report on data handling for each test pass. struct Result_Set { int nr_conns; using report_map = ACE_Array_Map; report_map reports; void reset (int n_connections) // Reset for next run { reports.clear (); nr_conns = n_connections; } void report (ACE_HANDLE h, unsigned int chunks) { std::pair newval (h, chunks); reports.insert (newval); } // Return 1 if this looks like a failure wrt fairness. int analyze_reports () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Results (%d entries):\n"), reports.size())); unsigned int max_chunks = 0; unsigned int min_chunks = ACE_Numeric_Limits::max(); for (report_map::iterator iter = reports.begin(); iter != reports.end (); ++iter) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" handle %d: %u\n"), (*iter).first, (*iter).second)); if ((*iter).second > max_chunks) max_chunks = (*iter).second; if ((*iter).second < min_chunks) min_chunks = (*iter).second; } if ((max_chunks - min_chunks) > max_chunks / 10) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Too much unfairness (max %u, min %u)\n"), max_chunks, min_chunks), 1); return 0; } }; Result_Set results; } // Handle incoming data int Read_Handler::handle_input (ACE_HANDLE h) { char buf[BUFSIZ]; ssize_t result = this->peer ().recv (buf, ACE_OS::strlen(ACE_ALPHABET)); if (opt_debug) ACE_DEBUG((LM_DEBUG, ACE_TEXT ("(%t) Read_Handler::handle_input h %d, result %b\n"), h, result)); if (result > 0) { if (opt_debug) { buf[result] = 0; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Read_Handler::handle_input: h %d: %C\n"), h, buf)); } ++this->chunks_in; } else if (result < 0) { if (errno == EWOULDBLOCK) return 0; else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("handle_input: h %d: %p (errno: %d)\n"), h, ACE_TEXT ("recv"), ACE_ERRNO_GET)); // This will cause handle_close to get called. return -1; } } else // result == 0 { if (opt_debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Handle %d closing\n"), h)); // This will cause handle_close to get called. return -1; } return 0; } // Handle connection shutdown. int Read_Handler::handle_close (ACE_HANDLE handle, ACE_Reactor_Mask /*close_mask*/) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Read_Handler handle %d close; %u chunks\n"), handle, chunks_in)); results.report (handle, this->chunks_in); // Shutdown this->destroy (); return 0; } // Pump data as fast as possible to all the sockets. ACE_THR_FUNC_RETURN sender (void *arg) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) running sender\n"))); // Ensure an error, not a signal, on broken pipe. ACE_Sig_Action no_sigpipe ((ACE_SignalHandler) SIG_IGN); ACE_Sig_Action original_action; no_sigpipe.register_action (SIGPIPE, &original_action); ACE_INET_Addr *connection_addr = reinterpret_cast (arg); int i; // Automagic memory cleanup. ACE_SOCK_Stream *temp_socks = 0; ACE_NEW_RETURN (temp_socks, ACE_SOCK_Stream [opt_nconnections], 0); std::unique_ptr socks (temp_socks); // Connection all connections before sending data. ACE_SOCK_Connector c; for (i = 0; i < opt_nconnections; i++) { if (c.connect (socks[i], *connection_addr) == -1) { if (errno != ECONNREFUSED || i == 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) conn %d %p\n"), ACE_TEXT ("connect"))); while (--i >= 0) socks[i].close (); break; } } socks[i].enable (ACE_NONBLOCK); } if (i < opt_nconnections) return 0; // Keep blasting data on all possible connections until this thread // is canceled. If we manage to overrun the receiver on all sockets, // sleep a bit for the receivers to catch up. ACE_thread_t me = ACE_Thread::self (); ACE_Thread_Manager *tm = ACE_Thread_Manager::instance (); size_t send_cnt = ACE_OS::strlen (ACE_ALPHABET); bool fail = false; while (!tm->testcancel (me) && !fail) { bool sent_something = false; for (i = 0; i < opt_nconnections; i++) { ssize_t cnt = socks[i].send (ACE_ALPHABET, send_cnt); if (opt_debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) h %d sent %b\n"), socks[i].get_handle(), cnt)); if (cnt > 0) { sent_something = true; continue; } if (errno == EWOULDBLOCK) continue; ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p; giving up\n"), ACE_TEXT ("sender"))); fail = true; break; } if (!fail && !sent_something) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Full sockets... pausing...\n"))); ACE_OS::sleep (1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Resuming sending.\n"))); } } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Done sending.\n"))); for (i = 0; i < opt_nconnections; i++) socks[i].close (); return 0; } ACE_THR_FUNC_RETURN reactor_loop (void *p) { ACE_Reactor *r = reinterpret_cast (p); int me = reactor_thread_nr++; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Reactor loop %d starting...\n"), me)); if (me == 0) r->owner (ACE_Thread::self ()); if (r->run_reactor_event_loop () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("reactor"))); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) reactor thread %d ending\n"), me)); return 0; } void run (ACE_Reactor_Impl &ri, const ACE_TCHAR *what, bool tp = true) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Starting test with %s\n"), what)); ACE_Reactor r (&ri); ACE_Thread_Manager *tm = ACE_Thread_Manager::instance (); ACE_Acceptor acceptor; // Bind acceptor to any port and then find out what the port was. ACE_INET_Addr server_addr; ACE_INET_Addr local_addr (ACE_sap_any_cast (const ACE_INET_Addr &)); if (acceptor.open (local_addr, &r) == -1 || acceptor.acceptor ().get_local_addr (server_addr) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("acceptor open"))); return; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) starting server at port %d\n"), server_addr.get_port_number ())); reactor_thread_nr = 0; // Reset for new set if (-1 == tm->spawn_n (tp ? opt_reactor_threads : 1, reactor_loop, &r)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("reactor thread spawn"))); acceptor.close(); return; } ACE_INET_Addr connection_addr (server_addr.get_port_number (), ACE_DEFAULT_SERVER_HOST); int sender_grp = tm->spawn (sender, &connection_addr); if (-1 == sender_grp) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("sender spawn"))); } else { ACE_OS::sleep (opt_secs); tm->cancel_grp (sender_grp); } r.end_reactor_event_loop (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) waiting for the test threads...\n"))); tm->wait (); } int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Reactor_Fairness_Test")); //FUZZ: disable check_for_lack_ACE_OS ACE_Get_Opt getopt (argc, argv, ACE_TEXT ("c:s:t:d"), 1); for (int c; (c = getopt ()) != -1; ) //FUZZ: enble check_for_lack_ACE_OS switch (c) { case 'c': opt_nconnections = ACE_OS::atoi (getopt.opt_arg ()); break; case 's': opt_secs = ACE_OS::atoi (getopt.opt_arg ()); break; case 't': opt_reactor_threads = ACE_OS::atoi (getopt.opt_arg ()); break; case 'd': opt_debug = 1; break; } // Run the test once for each reactor type available. int fails = 0; results.reset (opt_nconnections); { ACE_Select_Reactor r; run (r, ACE_TEXT ("Select Reactor"), false); // No thread pool } fails += results.analyze_reports (); results.reset (opt_nconnections); { ACE_TP_Reactor r; run (r, ACE_TEXT ("TP Reactor")); } fails += results.analyze_reports (); #if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) results.reset (opt_nconnections); { ACE_Dev_Poll_Reactor r; run (r, ACE_TEXT ("Dev_Poll Reactor")); } fails += results.analyze_reports (); #endif /* ACE_HAS_EVENT_POLL || ACE_HAS_DEV_POLL */ #if defined (ACE_WIN32) results.reset (opt_nconnections); { ACE_WFMO_Reactor r; run (r, ACE_TEXT ("WFMO Reactor")); } fails += results.analyze_reports (); #endif /* ACE_WIN32 */ ACE_END_TEST; return fails; } #else int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Reactor_Fairness_Test")); ACE_ERROR ((LM_INFO, ACE_TEXT ("threads not supported on this platform\n"))); ACE_END_TEST; return 0; } #endif /* ACE_HAS_THREADS */ ace-8.0.4+dfsg.orig/tests/Compiler_Features_01_Test.cpp0000644000175000017500000000244015027201773021744 0ustar sudipsudip/** * @file * * This program checks if the compiler / platform supports the * std::list container. The motivation for this test was a discussion * on the development mailing list, and the documentation was captured * in: * * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=3715 */ #include "test_config.h" // The first part of the test is to compile this line. If the program // does not compile the platform is just too broken. #include int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT("Compiler_Features_01_Test")); // As usual, the exit status from the test is 0 on success, 1 on // failure int status = 0; // Create a simple list ... using collection = std::list; collection c; // ... insert some elements ... c.push_back(5); c.push_back(4); c.push_back(3); c.push_back(2); c.push_back(1); // ... add all the numbers to validate that they are there ... int sum = 0; for(collection::iterator i = c.begin(), end = c.end(); i != end; ++i) { sum += *i; } // ... remember Euler ... int const expected = 5*(5+1)/2; if (sum != expected) { status = 1; ACE_ERROR ((LM_ERROR, ACE_TEXT("Expected %d got %d\n"), expected, sum)); } ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/Reactor_Remove_Resume_Test_Dev_Poll.cpp0000644000175000017500000003064515027201773024064 0ustar sudipsudip/** * @file Reactor_Remove_Resume_Test_Dev_Poll.cpp * * This test verifies that ACE reactors only remove or resume the event * handler used during an upcall, not another with same handle value. * There is are least one case where the event handler can change * during an upcall. The event handler could be removed by another * thread, and a new one is registered for a handle of the same value * (e.g. closed and then reopened) during an upcall. "Misbehaved" * event handlers could also cause this problem by closing and * deregistering the event handler during an upcall. * * @author Ossama Othman */ #include "test_config.h" #if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) #include "ace/Reactor.h" #include "ace/ACE.h" #include "ace/Dev_Poll_Reactor.h" #include "ace/Pipe.h" #include #include #include int overall_result = 0; // ------------------------------------------------------------ class Bogus_Handler : public ACE_Event_Handler { public: Bogus_Handler (ACE_Reactor * reactor, ACE_HANDLE read_handle, bool & okay_to_close); protected: ~Bogus_Handler () override; ACE_HANDLE get_handle () const override; int handle_input (ACE_HANDLE handle) override; int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask) override; int resume_handler () override; private: ACE_HANDLE const read_handle_; // If the reactor closes the event handler before it gets the okay, // we will issue an error. bool & okay_to_close_; }; Bogus_Handler::Bogus_Handler (ACE_Reactor * reactor, ACE_HANDLE read_handle, bool & okay_to_close) : ACE_Event_Handler (reactor) , read_handle_ (read_handle) , okay_to_close_ (okay_to_close) { this->reference_counting_policy ().value ( ACE_Event_Handler::Reference_Counting_Policy::ENABLED); } Bogus_Handler::~Bogus_Handler () { } ACE_HANDLE Bogus_Handler::get_handle () const { return this->read_handle_; } int Bogus_Handler::handle_input (ACE_HANDLE) { // This event handler should have been suspended, meaning it should // not have received any events. ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Bogus_Handler received an ") ACE_TEXT ("unexpected event.\n")), -1); } int Bogus_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask) { if (this->okay_to_close_) return 0; overall_result = -1; // This event handler is being closed by the reactor unexpectedly. ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Bogus_Handler unexpectedly closed\n")), -1); } int Bogus_Handler::resume_handler () { // We don't want the reactor to resume this event handler. return ACE_APPLICATION_RESUMES_HANDLER; } // ------------------------------------------------------------ class Bad_Handler : public ACE_Event_Handler { public: Bad_Handler (ACE_Reactor * reactor, ACE_HANDLE read_handle, bool & okay_to_close, bool suspension_test); ACE_HANDLE write_handle () const; protected: ~Bad_Handler () override; private: ACE_HANDLE get_handle () const override; int handle_input (ACE_HANDLE handle) override; int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask) override; int handle_input_result () const; private: ACE_HANDLE const read_handle_; bool handle_close_called_; // Passed on to the Bogus_Handler constructor. Not used by the // Bad_Handler, otherwise. bool & okay_to_close_; // Are we running the event handler suspension or removal test? bool suspension_test_; }; Bad_Handler::Bad_Handler (ACE_Reactor * reactor, ACE_HANDLE read_handle, bool & okay_to_close, bool suspension_test) : ACE_Event_Handler (reactor) , read_handle_ (read_handle) , handle_close_called_ (false) , okay_to_close_ (okay_to_close) , suspension_test_ (suspension_test) { this->reference_counting_policy ().value ( ACE_Event_Handler::Reference_Counting_Policy::ENABLED); } Bad_Handler::~Bad_Handler () { } ACE_HANDLE Bad_Handler::get_handle () const { return this->read_handle_; } int Bad_Handler::handle_input (ACE_HANDLE handle) { // Remove ourselves from the reactor, and trigger a different one // with the same handle to be registered. if (this->reactor ()->remove_handler (handle, ACE_Event_Handler::READ_MASK) != 0) { overall_result = -1; ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Unable to remove Bad_Handler ") ACE_TEXT ("from reactor\n")), 1); } ACE_Event_Handler_var bogus_handler ( new Bogus_Handler (this->reactor (), handle, this->okay_to_close_)); // Register and suspend a new handler. if (this->reactor ()->register_handler (handle, bogus_handler.handler (), ACE_Event_Handler::READ_MASK) != 0 || this->reactor ()->suspend_handler (handle) != 0) { overall_result = -1; ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Unable to register or suspend ") ACE_TEXT ("Bogus_Handler\n")), 1); } // Make sure a read event exists for dispatching during the next // event loop iteration. if (this->reactor ()->schedule_wakeup (handle, ACE_Event_Handler::READ_MASK) == -1) { overall_result = -1; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Wakeup scheduling failed\n"))); } return this->handle_input_result (); } int Bad_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask) { if (this->handle_close_called_) { overall_result = -1; ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Bad_Handler::handle_close() called ") ACE_TEXT ("more than once\n")), -1); } this->handle_close_called_ = true; return 0; } int Bad_Handler::handle_input_result () const { return (this->suspension_test_ // Attempt to force reactor to resume the handle after the // upcall completes. ? 0 // Attempt to force the new event handler to be removed from the // reactor. : -1); } // ------------------------------------------------------------ int register_handler (ACE_Reactor * reactor, ACE_HANDLE read_handle, bool & okay_to_close, bool suspension_test) { ACE_Event_Handler_var bad_handler (new Bad_Handler (reactor, read_handle, okay_to_close, suspension_test)); // Register for read events. if (reactor->register_handler (bad_handler.handler (), ACE_Event_Handler::READ_MASK) != 0) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Unable to register Bad_Handler with ") ACE_TEXT ("reactor\n")), -1); } return 0; } // ------------------------------------------------------------ int send_data (ACE_HANDLE write_handle) { char const foo[] = "foo"; size_t const len = sizeof (foo); // We want the number of bytes, not // the number of characters. ACE_Time_Value const timeout (2); // Trigger a read event on the pipe handle. This shouldn't timeout // since the pipe should be able to hold such a small amount of // data. size_t bytes_transferred = 0; ssize_t const result = ACE::send_n (write_handle, foo, len, &timeout, // timeout &bytes_transferred); if (result == -1 || bytes_transferred != len) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Unable to send data")), -1); } return 0; } // ------------------------------------------------------------ int handle_events (ACE_Reactor & reactor, bool & okay_to_close) { ACE_Time_Value timeout (2); // Only one event handler should have been dispatched. if (reactor.handle_events (&timeout) != 1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Initial event dispatch failed\n"))); } else { okay_to_close = true; // Run the event loop again in an attempt to make the reactor // dispatch the newly registered event handler. No events // should be dispatched. timeout.sec (2); int const result = reactor.handle_events (&timeout); if (result > 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Unexpectedly dispatched an event\n"))); } else if (result < 0) { overall_result = -1; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Event loop failed unexpectedly\n"))); } else return 0; } return -1; } // ------------------------------------------------------------ using reactor_factory_type = std::unique_ptr (*)(); std::unique_ptr dev_poll_reactor_factory () { ACE_DEBUG ((LM_INFO, ACE_TEXT ("Creating ACE_Dev_Poll_Reactor.\n"))); return std::unique_ptr (new ACE_Dev_Poll_Reactor); } // ------------------------------------------------------------ /** * @struct Caller * * @brief Reactor test execution functor. * * Reactor test execution functor. */ struct Run_Test : public std::function { /// Function call operator overload. void operator() (reactor_factory_type factory) { bool const suspension_test[] = { true, // Run suspension test. false // Run removal test. }; bool const * const begin = suspension_test; bool const * const end = suspension_test + sizeof (suspension_test) / sizeof (suspension_test[0]); for (bool const * i = begin; i != end; ++i) { bool const suspension_test = *i; if (suspension_test) { ACE_DEBUG ((LM_INFO, ACE_TEXT ("** Running suspension test **\n"))); } else { ACE_DEBUG ((LM_INFO, ACE_TEXT ("** Running removal test **\n"))); } std::unique_ptr the_factory (factory ()); ACE_Reactor reactor (the_factory.get ()); // In this test, it's only okay to close the Bogus_Handler // when the reactor is destroyed. bool okay_to_close = false; ACE_Pipe the_pipe; if (the_pipe.open () != 0 || register_handler (&reactor, the_pipe.read_handle (), okay_to_close, suspension_test) != 0 || send_data (the_pipe.write_handle ()) != 0 || handle_events (reactor, okay_to_close) != 0) { overall_result = -1; } okay_to_close = true; ACE_DEBUG ((LM_INFO, ACE_TEXT ("\n"))); // For log aesthetics. } } }; // ------------------------------------------------------------ int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Reactor_Remove_Resume_Test_Dev_Poll")); static reactor_factory_type const factories[] = { dev_poll_reactor_factory }; static size_t const factory_count = sizeof (factories) / sizeof (factories[0]); std::for_each (factories, factories + factory_count, Run_Test ()); if (overall_result != 0) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Test failed.\n"))); else ACE_ERROR ((LM_INFO, ACE_TEXT ("Test passed.\n"))); ACE_END_TEST; return overall_result; } #else /* ACE_HAS_EVENT_POLL || ACE_HAS_DEV_POLL */ int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Reactor_Remove_Resume_Test_Dev_Poll")); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_Dev_Poll_Reactor is not supported in this build\n"))); ACE_END_TEST; return 0; } #endif /* ACE_HAS_EVENT_POLL || ACE_HAS_DEV_POLL */ ace-8.0.4+dfsg.orig/tests/XtMotifReactor_Test.cpp0000644000175000017500000002103315027201773020745 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file XtMotifReactor_Test.cpp * * This is a simple test that illustrates the possibility to integrate * ACE to the X Main Loop. This program uses ACE_XtReactor class to * schedule three additional event sources: * 1. Events from button "Stop Test" (registed with XtAddCallback) * 2. Events from button "Press Me" (registed with XtAddCallback) * 3. Events from X timer (registed with XtAppAddTimeOut) * 4. Events from ACE timer (registed with ACE_XtReactor::schedule_timer) * 5. Events from the TCP/IP channel using ACE_Acceptor * No command line arguments are needed to run the test. * The program needs Motif or lestiff to be compiled and run. * * @author Kirill Rybaltchenko */ //============================================================================= #include "test_config.h" #include "ace/XtReactor/XtReactor.h" #include "ace/Event_Handler.h" #include "ace/Acceptor.h" #include "ace/SOCK_Acceptor.h" #include "ace/SOCK_Connector.h" #include "ace/Service_Config.h" #include "ace/Thread_Manager.h" #include "ace/OS_NS_unistd.h" #include /**/ #include /**/ #include /**/ #include /**/ #include /**/ #include /**/ #include /**/ static void set_label(Widget w, const char *p) { XtVaSetValues (w, XmNlabelString, XmStringCreateLocalized( (char*) p), static_cast(0)); } #define LABEL_WIDGET xmLabelWidgetClass #define BUTTON_WIDGET xmPushButtonWidgetClass #define PRESS_ME_CALLBACK XmNactivateCallback static Widget create_box(Widget parent, const char *name) { Arg al[10]; int ac = 0; XtSetArg (al[ac], XmNnumColumns, 3); ac++; XtSetArg (al[ac], XmNpacking, XmPACK_COLUMN); ac++; XtSetArg (al[ac], XmNentryAlignment, XmALIGNMENT_CENTER); ac++; return XmCreateRowColumn (parent, (char *) name, al, ac); } // Port we listen on. static const u_short SERV_TCP_PORT = 6670; // counter for events from "Press Me" button. static int count1 = 0; // counter for events from X Timer. static int count2 = 0; // counter for events from ACE Timer. static int count3 = 0; // Callback for "Stop Test" buton - quit the program. void Quit (Widget, XtPointer, XtPointer) { ACE_OS::exit (0); } static void * client (void *) { char buf[100]; size_t mes_len; ACE_OS::sleep (1); ACE_DEBUG ((LM_DEBUG, " (%P) Client: Starting...\n")); ACE_SOCK_Stream stream; ACE_SOCK_Connector connector; ACE_OS::snprintf (buf, 100, "Client: the life was good!"); mes_len = (int) htonl (ACE_OS::strlen (buf) + 1); if (connector.connect (stream, ACE_INET_Addr (SERV_TCP_PORT, ACE_DEFAULT_SERVER_HOST)) == -1) ACE_ERROR ((LM_ERROR, "(%P) %p\n", "Socket open")); if (stream.send (4, (void *) &mes_len, sizeof (size_t), (void *)buf, ACE_OS::strlen (buf) + 1) == -1) ACE_ERROR ((LM_ERROR, "(%P) %p\n", "Socket send")); if (stream.close () == -1) ACE_ERROR ((LM_ERROR, "(%P) %p\n", "Socket close")); ACE_DEBUG ((LM_DEBUG, "(%P) Client: Message has been sent, about to exit...\n")); return 0; } // Callback for "Press Me" button. static void inc_count (Widget, XtPointer client_data, XtPointer) { char new_string[80]; ACE_OS::snprintf (new_string, 80, "Events: [%d] [%d] [%d]", count1++, count2, count3); set_label((Widget) client_data, new_string); } // Callback for X Timer. static void inc_tmo (void *w, XtIntervalId *) { char new_string[80]; if (count2 > 10) ACE_OS::exit (0); ACE_OS::snprintf (new_string, 80, "Events: [%d] [%d] [%d]", count1, count2++, count3); set_label((Widget) w, new_string); (void) XtAppAddTimeOut (XtWidgetToApplicationContext ((Widget) w), 1000, inc_tmo, (Widget) w); } class EV_handler : public ACE_Event_Handler { public: virtual int handle_timeout (const ACE_Time_Value &, const void *arg) { char new_string[80]; ACE_OS::snprintf (new_string, 80, "Events: [%d] [%d] [%d]", count1, count2, count3++); set_label((Widget) arg, new_string); return 0; } }; class Connection_Handler : public ACE_Svc_Handler { public: //FUZZ: disable check_for_lack_ACE_OS virtual int open (void *) { //FUZZ: enable check_for_lack_ACE_OS char buf[100]; int head; ssize_t ret = this->peer ().recv_n ((char *) &head, sizeof (int)); if (ret != sizeof (int)) ACE_ERROR_RETURN ((LM_ERROR, "(%P) %p\n", "read header"), -1); ret = this->peer ().recv_n (buf, (int) ntohl (head)); if (ret != (int) ntohl (head)) ACE_ERROR_RETURN ((LM_ERROR, "(%P) %p\n", "read message"), -1); ACE_DEBUG ((LM_DEBUG, " (%P)Server (ACE_SOCKET channel message): [%s]\n", buf)); return 0; } }; #if defined (HummingBird_X) extern "C" void HCLXmInit (); #endif /* HummingBird_X */ int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("XtMotifReactor_Test")); XtAppContext app_context; Widget topLevel, goodbye, PressMe, lbl, digits_rc; Widget children[5]; #if defined (HummingBird_X) HCLXmInit (); #endif /* HummingBird_X */ topLevel = XtVaAppInitialize (&app_context, "XTReactor_Test", 0, 0, &argc, argv, 0, static_cast(0)); digits_rc = create_box(topLevel, "digits_rc"); //"Stop Test" button. goodbye = XtCreateWidget ( (char *) "goodbye", BUTTON_WIDGET, digits_rc, 0, 0); set_label(goodbye, "Stop Test"); //"Press Me" button PressMe = XtCreateWidget ((char *) "PressMe", BUTTON_WIDGET, digits_rc, 0, 0); //Display for event counter lbl = XtCreateWidget ((char *) "label_for_event_one", LABEL_WIDGET, digits_rc, 0, 0); set_label(lbl, "label_for_all_events"); int ac = 0; children[ac++] = goodbye; children[ac++] = PressMe; children[ac++] = lbl; XtManageChildren (children, ac); XtManageChild (digits_rc); //Register callback for "Stop Test" button XtAddCallback (goodbye, PRESS_ME_CALLBACK, Quit, 0); //Register callback for "Press Me" button XtAddCallback (PressMe, PRESS_ME_CALLBACK, inc_count, (XtPointer) lbl); // Register callback for X Timer (void) XtAppAddTimeOut (app_context, 1000, inc_tmo, (XtPointer) lbl); XtRealizeWidget (topLevel); // It will perform X Main Loop ACE_XtReactor reactor (app_context); ACE_Reactor r (&reactor); //Event Handler for ACE Timer. EV_handler evh; ACE_Acceptor acceptor; if (acceptor.open (ACE_INET_Addr ((u_short) SERV_TCP_PORT), &r) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1); if (reactor.schedule_timer (&evh, (const void *) lbl, ACE_Time_Value (2), ACE_Time_Value (2))==-1) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) can't register with reactor\n"), -1); ACE_Thread_Manager::instance ()->spawn ((ACE_THR_FUNC) client, 0, THR_NEW_LWP | THR_DETACHED); XtAppMainLoop (XtWidgetToApplicationContext (topLevel)); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/README0000644000175000017500000000764415027201773015224 0ustar sudipsudip This directory contains a battery of "one-button" regression tests that exercise many capabilities of ACE on the numerous platforms upon which it runs. In addition to providing an automated regression testing facility, these tests also show how to program many of the ACE features. Building and running the tests is straightforward: 1. Build all the tests in ACE_ROOT/tests, e.g., by running mwc.pl on the tests.mwc file and then using whatever build process you've selected to compile all the tests. 2. You then need to run all the tests, e.g., by running the perl script $ACE_ROOT/tests/run_test.pl Naturally, make sure that you've installed perl first! 3. If everything works then you should see something like this: ./run_test.pl auto_run_tests: tests/ACE_Test auto_run_tests_finished: tests/ACE_Test Time:1s Result:0 auto_run_tests: tests/Aio_Platform_Test auto_run_tests_finished: tests/Aio_Platform_Test Time:1s Result:0 auto_run_tests: tests/Arg_Shifter_Test auto_run_tests_finished: tests/Arg_Shifter_Test Time:1s Result:0 auto_run_tests: tests/ARGV_Test auto_run_tests_finished: tests/ARGV_Test Time:2s Result:0 auto_run_tests: tests/Array_Map_Test auto_run_tests_finished: tests/Array_Map_Test Time:1s Result:0 auto_run_tests: tests/Atomic_Op_Test auto_run_tests_finished: tests/Atomic_Op_Test Time:9s Result:0 auto_run_tests: tests/Auto_Event_Test .... 4. By default, all the output from the tests will be stored in separate files in the ./log/ (or .\log\) directory. You can override this, however, by setting the ACE_TEST_DIR environment variable to another prefix. ________________________________________ Please follow these directions when adding a new test to $ACE_ROOT/tests: 1. Use appropriate ACE_START_TEST and ACE_END_TEST macros in main () 2. Add new project entry to the tests.mpc file. 3. Add test to run_test.lst. ________________________________________ The tests have been run on a wide range of platforms (e.g., UNIX, VxWorks, LynxOS, Windows NT/2000/95/98/etc.) and they all work with the following exceptions: 1. UPIPE_Test and SPIPE_Test on Windows 95: these tests don't run on Windows 95 since Windows 95 does not support the server side functionality of accepting connections from clients using named pipes. 2. Proactor_Test (to be added) on Windows 95: this test does not run on Windows 95 since Windows 95 does not support I/O completion ports. 3. Of the tests (believed) relevant to the single threaded port to pSOSim, Sigset_Ops_Test, Sock_Connector_Test, Priority_Reactor_Test, Process_Strategy_Test, and Service_Config_Test are still failing. These are being debugged and will either be corrected or, if there are unsupported features in these tests, removed from the test suite for pSOSim. Notes: 1. Each test creates a log file and writes it to the ./log/ directory. The default log directory can be changed in the test_config.h file. 2. Each log file contains a time stamp of when the test began and also a time stamp indicating when the test ended. If the ending time stamp is missing, you can assume that the test did not succeed. 3. None of the tests require any command line parameters. This is in accordance with the keeping the test-suite a "one-button" test. If any of the tests require any variable parameters these are specified in test_config.h. 4. Time_Service_Test executes the Time Server and Clerk components as two processes and so the executable "main" need to be present in the netsvcs/servers directory. Be sure you build $ACE_ROOT/netsvcs/lib/ and $ACE_ROOT/netsvcs/servers before running this test. These components rely on config files. Two sample config files are also present in the test-suite, namely UNIXserver.conf and UNIXclerk.conf (and for Win32, Win32server.conf and Win32clerk.conf). If you have any questions/suggestions, please open an issue or discussion at https://github.com/DOCGroup/ACE_TAO. ace-8.0.4+dfsg.orig/tests/Thread_Pool_Reactor_Resume_Test.cpp0000644000175000017500000002502315027201773023235 0ustar sudipsudip //============================================================================= /** * @file Thread_Pool_Reactor_Resume_Test.cpp * * This program is an additional torture test of thread pool * reactors. This test is based on Thread_Pool_Reactor_Test.cpp * in $ACE_ROOT/tests. This test differs from the other one * slightly. The TP reactor is instantiated with the * with a value of 1 for the argument. The server * threads during the handle_input call resumes the handle that * would have been suspended by the reactor. * * Usage: Thread_Pool_Reactor_Test [-r ] * [-s ] [-c ] [-d ] * [-i ] [-n ] * * Default value: * : ACE_DEFAULT_RENDEZVOUS * : ACE_MAX_THREADS * : ACE_MAX_ITERATIONS * : ACE_MAX_ITERATIONS * : ACE_MAX_THREADS * : 50 usec * * @author Balachandran Natarajan */ //============================================================================= #include "test_config.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #include "ace/Get_Opt.h" #include "ace/SOCK_Connector.h" #include "ace/SOCK_Acceptor.h" #include "ace/Acceptor.h" #include "ace/Thread_Manager.h" #include "ace/TP_Reactor.h" #if defined (ACE_HAS_THREADS) && !defined ACE_LACKS_ACCEPT #include "Thread_Pool_Reactor_Resume_Test.h" using ACCEPTOR = ACE_Strategy_Acceptor; // Accepting end point. This is actually "localhost:10010", but some // platform couldn't resolve the name so we use the IP address // directly here. static const ACE_TCHAR *rendezvous = ACE_TEXT ("127.0.0.1:10010"); // Total number of server threads. static size_t svr_thrno = ACE_MAX_THREADS; // Default network parameters (MAX_BINDS and system buffers) are too small // for full test on some platforms; add platforms that can't handle too many // connection simultaneously here. #if defined (ACE_VXWORKS) #define ACE_LOAD_FACTOR /2 #else #define ACE_LOAD_FACTOR #endif // Total number of client threads. static size_t cli_thrno = ACE_MAX_THREADS ACE_LOAD_FACTOR; // Total connection attempts of a client thread. static size_t cli_conn_no = ACE_MAX_ITERATIONS ACE_LOAD_FACTOR; // Total requests a client thread sends. static size_t cli_req_no = ACE_MAX_THREADS ACE_LOAD_FACTOR; // Delay before a thread sending the next request (in msec.) static int req_delay = 50; static void parse_arg (int argc, ACE_TCHAR *argv[]) { //FUZZ: disable check_for_lack_ACE_OS ACE_Get_Opt getopt (argc, argv, ACE_TEXT ("r:s:c:d:i:n:")); int c; while ((c = getopt ()) != -1) { //FUZZ: enable check_for_lack_ACE_OS switch (c) { case 'r': // hostname:port rendezvous = getopt.opt_arg (); break; case 's': svr_thrno = ACE_OS::atoi (getopt.opt_arg ()); break; case 'c': cli_thrno = ACE_OS::atoi (getopt.opt_arg ()); break; case 'd': req_delay = ACE_OS::atoi (getopt.opt_arg ()); break; case 'i': cli_conn_no = ACE_OS::atoi (getopt.opt_arg ()); break; case 'n': cli_req_no = ACE_OS::atoi (getopt.opt_arg ()); break; default: ACE_ERROR ((LM_ERROR, "Usage: Thread_Pool_Reactor_Resume_Test [-r ]" "\t[-s ] [-c ] [-d ]" "\t[-i ]" "[-n ]\n")); break; } } } Request_Handler::Request_Handler (ACE_Thread_Manager *thr_mgr) : ACE_Svc_Handler (thr_mgr), nr_msgs_rcvd_(0) { // Enable reference counting. this->reference_counting_policy ().value (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); // Make sure we use TP_Reactor with this class (that's the whole // point, right?) this->reactor (ACE_Reactor::instance ()); } int Request_Handler::open (void *arg) { // Open base class. int result = ACE_Svc_Handler::open (arg); // Return on error. if (result == -1) return -1; // Else we have successfully registered with the Reactor. Give our // ownership to the Reactor. this->remove_reference (); // Return result. return result; } Request_Handler::~Request_Handler () { } int Request_Handler::resume_handler () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) resume_handler () called\n"))); return 1; } int Request_Handler::handle_input (ACE_HANDLE fd) { ACE_TCHAR buffer[BUFSIZ]; ACE_TCHAR len = 0; ssize_t result = this->peer ().recv (&len, sizeof (ACE_TCHAR)); if (result > 0 && this->peer ().recv_n (buffer, len * sizeof (ACE_TCHAR)) == static_cast (len * sizeof (ACE_TCHAR))) { ++this->nr_msgs_rcvd_; // Now the handle_input method has done what it can do, namely // read the data from the socket we can just resume the handler // at this point ACE_DEBUG ((LM_DEBUG, "(%t) svr input; fd: 0x%x; input: %s\n", fd, buffer)); if (ACE_OS::strcmp (buffer, ACE_TEXT ("shutdown")) == 0) ACE_Reactor::instance()->end_reactor_event_loop (); this->reactor ()->resume_handler (fd); return 0; } else { ACE_DEBUG ((LM_DEBUG, "(%t) Errno is %d and result is %d\n", ACE_ERRNO_GET, result)); ACE_DEBUG ((LM_DEBUG, "(%t) Request_Handler: 0x%x peer closed (0x%x)\n", this, fd)); } return -1; } int Request_Handler::handle_close (ACE_HANDLE fd, ACE_Reactor_Mask) { ACE_DEBUG ((LM_DEBUG, "(%t) svr close; fd: 0x%x, rcvd %d msgs\n", fd, this->nr_msgs_rcvd_)); if (this->nr_msgs_rcvd_ != cli_req_no) ACE_ERROR((LM_ERROR, ACE_TEXT ("(%t) Handler 0x%x: Expected %d messages; got %d\n"), this, cli_req_no, this->nr_msgs_rcvd_)); return 0; } static int reactor_event_hook (ACE_Reactor *) { ACE_DEBUG ((LM_DEBUG, "(%t) handling events ....\n")); return 0; } static ACE_THR_FUNC_RETURN svr_worker (void *) { // Server thread function. int result = ACE_Reactor::instance ()->run_reactor_event_loop (&reactor_event_hook); if (result == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Error handling events")), 0); ACE_DEBUG ((LM_DEBUG, "(%t) I am done handling events. Bye, bye\n")); return 0; } static ACE_THR_FUNC_RETURN cli_worker (void *arg) { // Client thread function. ACE_INET_Addr addr (rendezvous); ACE_SOCK_Stream stream; ACE_SOCK_Connector connect; ACE_Time_Value delay (0, req_delay); size_t len = * reinterpret_cast (arg); for (size_t i = 0 ; i < cli_conn_no; i++) { if (connect.connect (stream, addr) < 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("connect"))); continue; } for (size_t j = 0; j < cli_req_no; j++) { ACE_DEBUG ((LM_DEBUG, "(%t) conn_worker handle = %x, req = %d\n", stream.get_handle (), j+1)); if (stream.send_n (arg, (len + 1) * sizeof (ACE_TCHAR)) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("send_n"))); continue; } ACE_OS::sleep (delay); } stream.close (); } return 0; } static ACE_THR_FUNC_RETURN worker (void *) { ACE_OS::sleep (3); const ACE_TCHAR *msg = ACE_TEXT ("Message from Connection worker"); ACE_TCHAR buf [BUFSIZ]; buf[0] = static_cast ((ACE_OS::strlen (msg) + 1)); ACE_OS::strcpy (&buf[1], msg); ACE_INET_Addr addr (rendezvous); ACE_DEBUG((LM_DEBUG, "(%t) Spawning %d client threads...\n", cli_thrno)); int grp = ACE_Thread_Manager::instance ()->spawn_n (cli_thrno, &cli_worker, buf); ACE_TEST_ASSERT (grp != -1); ACE_Thread_Manager::instance ()->wait_grp (grp); ACE_DEBUG ((LM_DEBUG, "(%t) Client threads done; shutting down...\n")); ACE_SOCK_Stream stream; ACE_SOCK_Connector connect; if (connect.connect (stream, addr) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p Error while connecting\n"), ACE_TEXT ("connect"))); const ACE_TCHAR *sbuf = ACE_TEXT ("\011shutdown"); ACE_DEBUG ((LM_DEBUG, "shutdown stream handle = %x\n", stream.get_handle ())); if (stream.send_n (sbuf, (ACE_OS::strlen (sbuf) + 1) * sizeof (ACE_TCHAR)) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("send_n"))); ACE_DEBUG ((LM_DEBUG, "Sent message of length = %d\n", ACE_OS::strlen (sbuf))); stream.close (); return 0; } int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Thread_Pool_Reactor_Resume_Test")); parse_arg (argc, argv); // Changed the default ACE_TP_Reactor sr; ACE_Reactor new_reactor (&sr); ACE_Reactor::instance (&new_reactor); ACCEPTOR acceptor; ACE_INET_Addr accept_addr (rendezvous); if (acceptor.open (accept_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), 1); ACE_DEBUG((LM_DEBUG, ACE_TEXT ("(%t) Spawning %d server threads...\n"), svr_thrno)); ACE_Thread_Manager::instance ()->spawn_n (svr_thrno, svr_worker); ACE_Thread_Manager::instance ()->spawn (worker); ACE_Thread_Manager::instance ()->wait (); ACE_END_TEST; return 0; } #else int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Thread_Pool_Reactor_Resume_Test")); ACE_ERROR ((LM_INFO, "threads/accept not supported on this platform\n")); ACE_END_TEST; return 0; } #endif /* ACE_HAS_THREADS */ ace-8.0.4+dfsg.orig/tests/Map_Test.cpp0000644000175000017500000002523015027201773016553 0ustar sudipsudip //============================================================================= /** * @file Map_Test.cpp * * This is a simple test of the and illustrates how to * use the forward and reverse iterators. * * @author Irfan Pyarali */ //============================================================================= #include "test_config.h" #include "Map_Test.h" #include "ace/Map_T.h" #include "ace/Profile_Timer.h" #undef THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL #define THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL(X) \ ((X) \ ? static_cast(0) \ : ACE_VERSIONED_NAMESPACE_NAME::__ace_assert(__FILE__, __LINE__, ACE_TEXT_CHAR_TO_TCHAR (#X))) // Value type. using VALUE = size_t; // Generic map type. using TEST_MAP = ACE_Map; // Manager Manager adapter. using MAP_MANAGER_ADAPTER = ACE_Map_Manager_Adapter; // Hash Manager Manager adapter. using HASH_MAP_MANAGER_ADAPTER = ACE_Hash_Map_Manager_Ex_Adapter, Key_Generator>; // Active Manager Manager adapter. using ACTIVE_MAP_MANAGER_ADAPTER = ACE_Active_Map_Manager_Adapter; static void functionality_test (TEST_MAP &map, size_t iterations) { size_t counter; VALUE i; KEY *original_keys = new KEY[iterations]; KEY *modified_keys = new KEY[iterations]; // Setup the keys to have some initial data. for (i = 0; i < iterations; ++i) { original_keys[i].size (sizeof i / sizeof (KEY::TYPE)); ACE_OS::memcpy (&original_keys[i][0], &i, sizeof i); } // Make a copy of the keys so that we can compare with the original // keys later. for (i = 0; i < iterations; ++i) { modified_keys[i] = original_keys[i]; } // Add to the map, allowing keys to be modified. counter = 0; for (i = 0; i < iterations; ++i) { THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (map.bind_modify_key (i, modified_keys[i]) == 0); ++counter; THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (map.current_size () == counter); } // Forward iteration... { counter = 0; TEST_MAP::iterator end = map.end (); for (TEST_MAP::iterator iter = map.begin (); iter != end; ++iter, ++counter) { TEST_MAP::value_type entry = *iter; // Recover original key. KEY original_key; THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (map.recover_key (entry.first (), original_key) == 0); // Make sure recovering keys work. THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (original_keys[entry.second ()] == original_key); // Obtain value from key. VALUE original_value; ACE_OS::memcpy (&original_value, &original_key[0], sizeof original_value); // Debugging info. ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), counter, original_value, entry.second ())); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (counter == iterations); } // Reverse iteration... { counter = iterations; TEST_MAP::reverse_iterator end = map.rend (); for (TEST_MAP::reverse_iterator iter = map.rbegin (); iter != end; ++iter) { --counter; TEST_MAP::value_type entry = *iter; // Recover original key. KEY original_key; THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (map.recover_key (entry.first (), original_key) == 0); // Make sure recovering keys work. THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (original_keys[entry.second ()] == original_key); // Obtain value from key. VALUE original_value; ACE_OS::memcpy (&original_value, &original_key[0], sizeof original_value); // Debugging info. ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d|%d)"), counter, original_value, entry.second ())); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (counter == 0); } // Search using the modified keys. for (i = 0; i < iterations; ++i) { VALUE j; THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (map.find (modified_keys[i], j) != -1); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (i == j); } // Rmoved keys from map. counter = iterations; for (i = 0; i < iterations; ++i) { THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (map.unbind (modified_keys[i]) != -1); --counter; THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (map.current_size () == counter); } // Cleanup. delete[] modified_keys; delete[] original_keys; } static void insert_test (TEST_MAP &map, size_t iterations, KEY *keys) { // Add to the map, allowing keys to be created by the map. size_t counter = 0; for (VALUE i = 0; i < iterations; ++i) { THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (map.bind_create_key (i, keys[i]) == 0); ++counter; THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (map.current_size () == counter); } } static void find_test (TEST_MAP &map, size_t iterations, KEY *keys) { // Find system generated keys. for (VALUE i = 0; i < iterations; ++i) { VALUE j = 0; THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (map.find (keys[i], j) != -1); THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (i == j); } } static void unbind_test (TEST_MAP &map, size_t iterations, KEY *keys) { // Remove system generated keys. size_t counter = iterations; for (VALUE i = 0; i < iterations; ++i) { THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (map.unbind (keys[i]) != -1); --counter; THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL (map.current_size () == counter); } } static void performance_test (void (*ptf) (TEST_MAP &, size_t, KEY *), TEST_MAP &map, size_t iterations, KEY *keys, size_t table_size, const ACE_TCHAR *test_name) { ACE_Profile_Timer timer; timer.start (); (*ptf) (map, iterations, keys); timer.stop (); ACE_Profile_Timer::ACE_Elapsed_Time et; timer.elapsed_time (et); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("time to run %s of size %d for %d iterations\n"), test_name, table_size, iterations)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("real time = %f secs, user time = %f secs, system time = %f secs\n"), et.real_time, et.user_time, et.system_time)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("time per call = %f usecs\n"), (et.real_time / ACE_timer_t (iterations)) * 1000000)); } int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Map_Test")); ACE_LOG_MSG->clr_flags (ACE_Log_Msg::VERBOSE_LITE); size_t table_size = ACE_MAX_ITERATIONS / 2; size_t iterations = ACE_MAX_ITERATIONS; size_t functionality_tests = 1; if (argc > 1) functionality_tests = ACE_OS::atoi (argv[1]); if (argc > 2) table_size = ACE_OS::atoi (argv[2]); if (argc > 3) iterations = ACE_OS::atoi (argv[3]); MAP_MANAGER_ADAPTER map1 (table_size); HASH_MAP_MANAGER_ADAPTER map2 (table_size); ACTIVE_MAP_MANAGER_ADAPTER map3 (table_size); if (functionality_tests) { // Functionality test of the maps. ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nMap Manager functionality test\n"))); functionality_test (map1, iterations); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nHash Map Manager functionality test\n"))); functionality_test (map2, iterations); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nActive Map Manager functionality test\n"))); functionality_test (map3, iterations); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); } // Performance test of the maps. KEY *keys = new KEY[iterations]; // Map Manager performance_test (&insert_test, map1, iterations, keys, table_size, ACE_TEXT ("Map Manager (insert test)")); performance_test (&find_test, map1, iterations, keys, table_size, ACE_TEXT ("Map Manager (find test)")); performance_test (&unbind_test, map1, iterations, keys, table_size, ACE_TEXT ("Map Manager (unbind test)")); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); // Hash Map Manager performance_test (&insert_test, map2, iterations, keys, table_size, ACE_TEXT ("Hash Map Manager (insert test)")); performance_test (&find_test, map2, iterations, keys, table_size, ACE_TEXT ("Hash Map Manager (find test)")); performance_test (&unbind_test, map2, iterations, keys, table_size, ACE_TEXT ("Hash Map Manager (unbind test)")); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); // Active Map Manager performance_test (&insert_test, map3, iterations, keys, table_size, ACE_TEXT ("Active Map Manager (insert test)")); performance_test (&find_test, map3, iterations, keys, table_size, ACE_TEXT ("Active Map Manager (find test)")); performance_test (&unbind_test, map3, iterations, keys, table_size, ACE_TEXT ("Active Map Manager (unbind test)")); delete[] keys; ACE_LOG_MSG->set_flags (ACE_Log_Msg::VERBOSE_LITE); ACE_END_TEST; return 0; } #undef THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL ace-8.0.4+dfsg.orig/tests/DLL_Test.h0000644000175000017500000000241215027201773016113 0ustar sudipsudip// -*- C++ -*- // ================================================================ /** * @file DLL_Test.h * * @author Kirthika Parameswaran */ // ================================================================ #ifndef ACE_TESTS_DLL_TEST_H #define ACE_TESTS_DLL_TEST_H #include "DLL_Test_Parent.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Log_Msg.h" #include "ace/Trace.h" #include "ace/svc_export.h" /** * @class Hello * * @brief Define the interface used by the DLL_Test */ class Hello { public: /// Destructor virtual ~Hello () { ACE_TRACE ("Hello::~Hello"); } /** * @name Methods invoked by the test * * The test invokes four methods, a non-virtual method and a three virtual * methods implemented in the shared library. */ //@{ void say_hello () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Hello\n"))); } virtual void say_next () = 0; virtual ACE_TCHAR *new_info () = 0; virtual ACE_TCHAR *malloc_info () = 0; //@} }; // Used to test dynamic_cast<> in shared libraries. class ACE_Svc_Export Child : public Parent { public: Child (); virtual ~Child (); virtual void test (); }; #endif /* ACE_TESTS_DLL_TEST_H */ ace-8.0.4+dfsg.orig/tests/ACE_Init_Test.rc20000644000175000017500000000061015027201773017310 0ustar sudipsudip// // ACE_INIT_TEST.RC2 - resources Microsoft Visual C++ does not edit directly // #ifdef APSTUDIO_INVOKED #error this file is not editable by Microsoft Visual C++ #endif //APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // Add manually edited resources here... ///////////////////////////////////////////////////////////////////////////// ace-8.0.4+dfsg.orig/tests/Bug_3710_Regression_Test.cpp0000644000175000017500000000125715027201773021430 0ustar sudipsudip/** * @file Bug_3710_Regression_Test.cpp * * Reproduces the problems reported in bug 3710 * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=3710 */ #include "test_config.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_Memory.h" // Main function. int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Bug_3710_Regression_Test")); ACE_TCHAR out_string[64*1024+1]; ACE_OS::memset(out_string,ACE_TEXT('@'),sizeof(out_string)); //I only use ACE_MAXLOGMSGLEN char . out_string[ACE_MAXLOGMSGLEN] = ACE_TEXT('\0'); ACE_DEBUG((LM_ALERT, ACE_TEXT("%s out_string: I love beijing."),out_string)); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/TP_Reactor_Test.h0000644000175000017500000001137515027201773017512 0ustar sudipsudip //============================================================================= /** * @file TP_Reactor_Test.h * * Define class needed for generating templates. * * @author Alexander Libman * @author */ //============================================================================= #ifndef ACE_TESTS_TP_REACTOR_TEST_H #define ACE_TESTS_TP_REACTOR_TEST_H #include "ace/INET_Addr.h" #include "ace/SOCK_Acceptor.h" #include "ace/SOCK_Connector.h" #include "ace/SOCK_Stream.h" #include "ace/Acceptor.h" #include "ace/Connector.h" #include "ace/Svc_Handler.h" #include "ace/Recursive_Thread_Mutex.h" const size_t MAX_SENDERS = 1000; const size_t MAX_RECEIVERS = 1000; // ************************************************************* // Receiver and Acceptor // ************************************************************* // forward declaration class Acceptor; class Receiver : public ACE_Svc_Handler { friend class Acceptor; public: Receiver (Acceptor * acceptor=0, size_t index=MAX_RECEIVERS+1); ~Receiver (); long get_total_snd () { return this->total_snd_; } long get_total_rcv () { return this->total_rcv_; } long get_total_w () { return this->total_w_; } long get_total_r () { return this->total_r_; } // virtual from ACE_Svc_Handler<> virtual int open (void * pVoid); // virtual from ACE_Event_Handler virtual int handle_input (ACE_HANDLE h); virtual int handle_output (ACE_HANDLE h); virtual int handle_close (ACE_HANDLE h , ACE_Reactor_Mask mask); private: int terminate_io (ACE_Reactor_Mask mask); int initiate_io (ACE_Reactor_Mask mask); int check_destroy (); Acceptor * acceptor_; size_t index_; int flg_mask_; ACE_Recursive_Thread_Mutex mutex_; long total_snd_; long total_rcv_; long total_w_; long total_r_; }; // ************************************************************* class Acceptor : public ACE_Acceptor { friend class Receiver; public: size_t get_number_sessions () { return sessions_; } long get_total_snd () { return this->total_snd_; } long get_total_rcv () { return this->total_rcv_; } long get_total_w () { return this->total_w_; } long get_total_r () { return this->total_r_; } Acceptor (); virtual ~Acceptor (); void stop (); int start (const ACE_INET_Addr & addr); // virtual from ACE_Acceptor virtual int make_svc_handler (Receiver * & sh); private: ACE_Recursive_Thread_Mutex mutex_; size_t sessions_; Receiver *list_receivers_[MAX_RECEIVERS]; long total_snd_; long total_rcv_; long total_w_; long total_r_; void on_new_receiver (Receiver & rcvr); void on_delete_receiver (Receiver & rcvr); }; // ******************************************* // Sender // ******************************************* class Connector; class Sender : public ACE_Svc_Handler { friend class Connector; public: Sender (Connector * connector=0, size_t index=MAX_SENDERS+1); ~Sender (); long get_total_snd () { return this->total_snd_; } long get_total_rcv () { return this->total_rcv_; } long get_total_w () { return this->total_w_; } long get_total_r () { return this->total_r_; } // virtual from ACE_Svc_Handler<> virtual int open (void * pVoid); // virtual from ACE_Event_Handler virtual int handle_input (ACE_HANDLE h); virtual int handle_output (ACE_HANDLE h); virtual int handle_close (ACE_HANDLE h , ACE_Reactor_Mask mask); private: int terminate_io (ACE_Reactor_Mask mask); int initiate_io (ACE_Reactor_Mask mask); int initiate_write (); int check_destroy (); Connector * connector_; size_t index_; int flg_mask_; ACE_Recursive_Thread_Mutex mutex_; char send_buf_ [1024]; long total_snd_; long total_rcv_; long total_w_; long total_r_; }; // ************************************************************* class Connector: public ACE_Connector { friend class Sender; public: size_t get_number_sessions () { return sessions_; } long get_total_snd () { return this->total_snd_; } long get_total_rcv () { return this->total_rcv_; } long get_total_w () { return this->total_w_; } long get_total_r () { return this->total_r_; } Connector (); virtual ~Connector (); void stop (); int start (const ACE_INET_Addr & addr , int num); // virtual from ACE_Connector<> virtual int make_svc_handler (Sender * & sh); private: ACE_Recursive_Thread_Mutex mutex_; size_t sessions_; Sender * list_senders_ [MAX_SENDERS]; long total_snd_; long total_rcv_; long total_w_; long total_r_; void on_new_sender (Sender & sndr); void on_delete_sender (Sender & sndr); }; #endif /* ACE_TESTS_TP_REACTOR_TEST_H */ ace-8.0.4+dfsg.orig/tests/Timer_Queue_Reference_Counting_Test.cpp0000644000175000017500000004106315027201773024110 0ustar sudipsudip //============================================================================= /** * @file Timer_Queue_Reference_Counting_Test.cpp * * This test is used to check reference counting of the Event * Handler when it interacts with Timer Queues. * * @author Irfan Pyarali */ //============================================================================= #include "test_config.h" #include "ace/Get_Opt.h" #include "ace/Timer_Queue.h" #include "ace/Timer_Heap.h" #include "ace/Timer_List.h" #include "ace/Timer_Hash.h" #include "ace/Timer_Wheel.h" #include "ace/Reactor.h" #include "ace/Recursive_Thread_Mutex.h" #include "ace/Null_Mutex.h" #include "ace/OS_NS_unistd.h" static int debug = 0; static const char *one_second_timeout = "one second timeout"; static const char *two_second_timeout = "two second timeout"; namespace { inline void WAIT_FOR_NEXT_EVENT (ACE_Timer_Queue &timer_queue) { ACE_Time_Value const earliest_time = timer_queue.earliest_time (); ACE_Time_Value const time_of_day = timer_queue.gettimeofday (); if (earliest_time > time_of_day) { ACE_OS::sleep (earliest_time - time_of_day); } } } class Reference_Counted_Event_Handler : public ACE_Event_Handler { public: Reference_Counted_Event_Handler (int expected_number_of_handle_close_calls); ~Reference_Counted_Event_Handler () override; int handle_timeout (const ACE_Time_Value &, const void *) override; int handle_close (ACE_HANDLE handle, ACE_Reactor_Mask masks) override; int expected_number_of_handle_close_calls_; int number_of_handle_close_calls_; }; Reference_Counted_Event_Handler::Reference_Counted_Event_Handler (int expected_number_of_handle_close_calls) : expected_number_of_handle_close_calls_ (expected_number_of_handle_close_calls), number_of_handle_close_calls_ (0) { this->reference_counting_policy ().value (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); if (debug) ACE_DEBUG ((LM_DEBUG, "Reference count in Reference_Counted_Event_Handler() is %d\n", this->reference_count_.load ())); } Reference_Counted_Event_Handler::~Reference_Counted_Event_Handler () { if (debug) ACE_DEBUG ((LM_DEBUG, "Reference count in ~Reference_Counted_Event_Handler() is %d\n", this->reference_count_.load ())); if (this->expected_number_of_handle_close_calls_ != -1) ACE_TEST_ASSERT (this->number_of_handle_close_calls_ == this->expected_number_of_handle_close_calls_); } int Reference_Counted_Event_Handler::handle_timeout (const ACE_Time_Value &, const void *arg) { if (debug) ACE_DEBUG ((LM_DEBUG, "Reference count in Reference_Counted_Event_Handler::handle_timeout() for arg = %C is %d\n", (const char *) arg, this->reference_count_.load ())); return 0; } int Reference_Counted_Event_Handler::handle_close (ACE_HANDLE handle, ACE_Reactor_Mask masks) { if (debug) ACE_DEBUG ((LM_DEBUG, "Reference_Counted_Event_Handler::handle_close() called with handle = %d and masks = %d. " "Reference count is %d\n", handle, masks, this->reference_count_.load ())); ++this->number_of_handle_close_calls_; return 0; } void cancellation (ACE_Timer_Queue &timer_queue, int repeat_timer, int cancel_handler, int second_timer, int dont_call_handle_close) { int result = 0; int expected_number_of_handle_close_calls = -1; if (!dont_call_handle_close) { if (cancel_handler) expected_number_of_handle_close_calls = 1; else if (second_timer) expected_number_of_handle_close_calls = 2; else expected_number_of_handle_close_calls = 1; } Reference_Counted_Event_Handler *handler = new Reference_Counted_Event_Handler (expected_number_of_handle_close_calls); ACE_Event_Handler_var safe_handler (handler); long first_timer_id = -1; long second_timer_id = -1; if (repeat_timer) { first_timer_id = timer_queue.schedule (handler, one_second_timeout, ACE_Time_Value (1) + timer_queue.gettimeofday (), ACE_Time_Value (1)); ACE_TEST_ASSERT (first_timer_id != -1); } else { first_timer_id = timer_queue.schedule (handler, one_second_timeout, ACE_Time_Value (1) + timer_queue.gettimeofday ()); ACE_TEST_ASSERT (first_timer_id != -1); } if (second_timer) { second_timer_id = timer_queue.schedule (handler, two_second_timeout, ACE_Time_Value (2) + timer_queue.gettimeofday (), ACE_Time_Value (2)); ACE_TEST_ASSERT (second_timer_id != -1); } if (cancel_handler) { result = timer_queue.cancel (handler, dont_call_handle_close); if (second_timer) ACE_TEST_ASSERT (result == 2); else ACE_TEST_ASSERT (result == 1); } else { result = timer_queue.cancel (first_timer_id, 0, dont_call_handle_close); ACE_TEST_ASSERT (result == 1); if (second_timer) { result = timer_queue.cancel (second_timer_id, 0, dont_call_handle_close); ACE_TEST_ASSERT (result == 1); } } } template class cancellation_test { public: cancellation_test (const char *); }; template cancellation_test::cancellation_test (const char *timer_queue_type) { ACE_DEBUG ((LM_DEBUG, "\nCancellation test for %C\n\n", timer_queue_type)); int configs[][4] = { { 0, 0, 0, 0, }, { 0, 0, 0, 1, }, { 0, 0, 1, 0, }, { 0, 0, 1, 1, }, { 0, 1, 0, 0, }, { 0, 1, 0, 1, }, { 0, 1, 1, 0, }, { 0, 1, 1, 1, }, { 1, 0, 0, 0, }, { 1, 0, 0, 1, }, { 1, 0, 1, 0, }, { 1, 0, 1, 1, }, { 1, 1, 0, 0, }, { 1, 1, 0, 1, }, { 1, 1, 1, 0, }, { 1, 1, 1, 1, }, }; for (int i = 0; i < (int) (sizeof configs / (sizeof (int) * 5)); i++) { TIMER_QUEUE timer_queue; cancellation (timer_queue, configs[i][0], configs[i][1], configs[i][2], configs[i][3]); } } using Expire_Function = int (*)(ACE_Timer_Queue &); int invoke_expire (ACE_Timer_Queue &timer_queue) { return timer_queue.expire (); } int invoke_one_upcall (ACE_Timer_Queue &timer_queue) { ACE_Noop_Command command; return timer_queue.expire_single(command); } void expire (ACE_Timer_Queue &timer_queue, Expire_Function expire_function) { int events = 0; int result = 0; Reference_Counted_Event_Handler *handler = new Reference_Counted_Event_Handler (1); ACE_Event_Handler_var safe_handler (handler); long timer_id = timer_queue.schedule (handler, one_second_timeout, ACE_Time_Value (1) + timer_queue.gettimeofday (), ACE_Time_Value (1)); ACE_TEST_ASSERT (timer_id != -1); result = timer_queue.schedule (handler, two_second_timeout, ACE_Time_Value (2) + timer_queue.gettimeofday ()); ACE_TEST_ASSERT (result != -1); events += 4; for (int i = 0; i < events;) { WAIT_FOR_NEXT_EVENT (timer_queue); result = expire_function (timer_queue); ACE_TEST_ASSERT (result >= 0); i += result; } timer_queue.cancel (timer_id, 0, 0); } template class expire_test { public: expire_test (const char *); }; template expire_test::expire_test (const char *timer_queue_type) { ACE_DEBUG ((LM_DEBUG, "\nExpire test for %C\n\n", timer_queue_type)); TIMER_QUEUE timer_queue; expire (timer_queue, invoke_expire); } template class upcall_test { public: upcall_test (const char *); }; template upcall_test::upcall_test (const char *timer_queue_type) { ACE_DEBUG ((LM_DEBUG, "\nOne upcall test for %C\n\n", timer_queue_type)); TIMER_QUEUE timer_queue; expire (timer_queue, invoke_one_upcall); } class Simple_Event_Handler : public ACE_Event_Handler { public: Simple_Event_Handler (); ~Simple_Event_Handler () override; int handle_timeout (const ACE_Time_Value &, const void *) override; int handle_close (ACE_HANDLE, ACE_Reactor_Mask) override; }; Simple_Event_Handler::Simple_Event_Handler () { if (debug) ACE_DEBUG ((LM_DEBUG, "Simple_Event_Handler()\n")); } Simple_Event_Handler::~Simple_Event_Handler () { if (debug) ACE_DEBUG ((LM_DEBUG, "~Simple_Event_Handler()\n")); } int Simple_Event_Handler::handle_timeout (const ACE_Time_Value &, const void *arg) { if (debug) ACE_DEBUG ((LM_DEBUG, "Simple_Event_Handler::handle_timeout() for arg = %C\n", (const char *) arg)); return 0; } int Simple_Event_Handler::handle_close (ACE_HANDLE handle, ACE_Reactor_Mask masks) { if (debug) ACE_DEBUG ((LM_DEBUG, "Simple_Event_Handler::handle_close() called with handle = %d and masks = %d.\n", handle, masks)); delete this; return 0; } void simple (ACE_Timer_Queue &timer_queue) { int events = 0; int result = 0; long timer_id = -1; { Simple_Event_Handler *handler = new Simple_Event_Handler; timer_id = timer_queue.schedule (handler, one_second_timeout, ACE_Time_Value (1) + timer_queue.gettimeofday (), ACE_Time_Value (1)); ACE_TEST_ASSERT (timer_id != -1); result = timer_queue.cancel (timer_id, 0, 0); ACE_TEST_ASSERT (result == 1); } { Simple_Event_Handler *handler = new Simple_Event_Handler; timer_id = timer_queue.schedule (handler, one_second_timeout, ACE_Time_Value (1) + timer_queue.gettimeofday (), ACE_Time_Value (1)); ACE_TEST_ASSERT (timer_id != -1); events += 3; } for (int i = 0; i < events;) { WAIT_FOR_NEXT_EVENT (timer_queue); result = timer_queue.expire (); ACE_TEST_ASSERT (result >= 0); i += result; } timer_queue.cancel (timer_id, 0, 0); } template class simple_test { public: simple_test (const char *); }; template simple_test::simple_test (const char *timer_queue_type) { ACE_DEBUG ((LM_DEBUG, "\nSimple test for %C\n\n", timer_queue_type)); TIMER_QUEUE timer_queue; simple (timer_queue); } static int heap = 1; static int list = 1; static int hash = 1; static int wheel = 1; static int hashheap = 1; static int test_cancellation = 1; static int test_expire = 1; static int test_one_upcall = 1; static int test_simple = 1; static int parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("a:b:c:d:e:l:m:n:o:z:")); int cc; while ((cc = get_opt ()) != -1) { switch (cc) { case 'a': heap = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'b': list = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'c': hash = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'd': wheel = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'e': hashheap = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'l': test_cancellation = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'm': test_expire = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'n': test_one_upcall = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'o': test_simple = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'z': debug = ACE_OS::atoi (get_opt.opt_arg ()); break; default: ACE_ERROR ((LM_ERROR, ACE_TEXT ("\nusage: %s \n\n") ACE_TEXT ("\t[-a heap] (defaults to %d)\n") ACE_TEXT ("\t[-b list] (defaults to %d)\n") ACE_TEXT ("\t[-c hash] (defaults to %d)\n") ACE_TEXT ("\t[-d wheel] (defaults to %d)\n") ACE_TEXT ("\t[-e hashheap] (defaults to %d)\n") ACE_TEXT ("\t[-l test_cancellation] (defaults to %d)\n") ACE_TEXT ("\t[-m test_expire] (defaults to %d)\n") ACE_TEXT ("\t[-n test_one_upcall] (defaults to %d)\n") ACE_TEXT ("\t[-o test_simple] (defaults to %d)\n") ACE_TEXT ("\t[-z debug] (defaults to %d)\n") ACE_TEXT ("\n"), argv[0], heap, list, hash, wheel, hashheap, test_cancellation, test_expire, test_one_upcall, test_simple, debug)); return -1; } } return 0; } int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Timer_Queue_Reference_Counting_Test")); // Validate options. int result = parse_args (argc, argv); if (result != 0) return result; if (test_cancellation) { ACE_DEBUG ((LM_DEBUG, "\nCancellation test...\n\n")); if (heap) { cancellation_test test ("ACE_Timer_Heap"); ACE_UNUSED_ARG (test); } if (list) { cancellation_test test ("ACE_Timer_List"); ACE_UNUSED_ARG (test); } if (hash) { cancellation_test test ("ACE_Timer_Hash"); ACE_UNUSED_ARG (test); } if (wheel) { cancellation_test test ("ACE_Timer_Wheel"); ACE_UNUSED_ARG (test); } if (hashheap) { cancellation_test test ("ACE_Timer_Hash_Heap"); ACE_UNUSED_ARG (test); } } if (test_expire) { ACE_DEBUG ((LM_DEBUG, "\nExpire test...\n\n")); if (heap) { expire_test test ("ACE_Timer_Heap"); ACE_UNUSED_ARG (test); } if (list) { expire_test test ("ACE_Timer_List"); ACE_UNUSED_ARG (test); } if (hash) { expire_test test ("ACE_Timer_Hash"); ACE_UNUSED_ARG (test); } if (wheel) { expire_test test ("ACE_Timer_Wheel"); ACE_UNUSED_ARG (test); } if (hashheap) { expire_test test ("ACE_Timer_Hash_Heap"); ACE_UNUSED_ARG (test); } } if (test_one_upcall) { ACE_DEBUG ((LM_DEBUG, "\nOne upcall at a time test...\n\n")); if (heap) { upcall_test test ("ACE_Timer_Heap"); ACE_UNUSED_ARG (test); } if (list) { upcall_test test ("ACE_Timer_List"); ACE_UNUSED_ARG (test); } if (hash) { upcall_test test ("ACE_Timer_Hash"); ACE_UNUSED_ARG (test); } if (wheel) { upcall_test test ("ACE_Timer_Wheel"); ACE_UNUSED_ARG (test); } if (hashheap) { upcall_test test ("ACE_Timer_Hash_Heap"); ACE_UNUSED_ARG (test); } } if (test_simple) { ACE_DEBUG ((LM_DEBUG, "\nSimple test...\n\n")); if (heap) { simple_test test ("ACE_Timer_Heap"); ACE_UNUSED_ARG (test); } if (list) { simple_test test ("ACE_Timer_List"); ACE_UNUSED_ARG (test); } if (hash) { simple_test test ("ACE_Timer_Hash"); ACE_UNUSED_ARG (test); } if (wheel) { simple_test test ("ACE_Timer_Wheel"); ACE_UNUSED_ARG (test); } if (hashheap) { simple_test test ("ACE_Timer_Hash_Heap"); ACE_UNUSED_ARG (test); } } ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Dirent_Test.cpp0000644000175000017500000002451515027201773017270 0ustar sudipsudip //============================================================================= /** * @file Dirent_Test.cpp * * This is a test of the opendir and readdir emulation provided by the * class ACE_Dirent. It is used to ensure that the emulation code * works properly on platforms that don't support this capability * natively. As the emulation code is not compiled in other * platforms, this test also ensures that there is no impact to * platforms that natively support directory scanning operations. * * @author Phil Mesnier * @author Zvika Ashani * @author Rich Newman * @author and Douglas C. Schmidt */ //============================================================================= #include "test_config.h" #include "ace/Dirent.h" #include "ace/Dirent_Selector.h" #include "ace/OS_NS_sys_stat.h" #include "ace/OS_NS_unistd.h" #include "ace/SString.h" #if defined (ACE_HAS_TCHAR_DIRENT) # define TEST_ENTRY ACE_TEXT ("run_test.lst") #else # define TEST_ENTRY "run_test.lst" #endif /* ACE_HAS_TCHAR_DIRENT */ // Directory to scan - we need to figure it out based on environment. static ACE_TString TestDir; static const int RECURSION_INDENT = 3; // Number of entries in the directory. static int entrycount = 0; extern "C" { static int selector (const ACE_DIRENT *d) { return ACE_OS::strcmp (d->d_name, TEST_ENTRY) == 0; } static int comparator (const ACE_DIRENT **d1, const ACE_DIRENT **d2) { return ACE_OS::alphasort (d1, d2); } } /* extern "C" */ static int dirent_selector_test () { int n; int error = 0; const ACE_TCHAR *test_dir = TestDir.c_str (); ACE_Dirent_Selector sds; // Pass in functions that'll specify the selection criteria. int status = sds.open (test_dir, selector, comparator); if (status == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%s, %p\n"), test_dir, ACE_TEXT ("open")), -1); // We should only have located ourselves! if (sds.length () != 1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("selected %d entries in %s, should be 1\n"), sds.length (), test_dir)); error = 1; } for (n = 0; n < sds.length (); ++n) { #if defined (ACE_HAS_TCHAR_DIRENT) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Sorted: %d: %s\n"), n, sds[n]->d_name)); #else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Sorted: %d: %C\n"), n, sds[n]->d_name)); #endif } status = sds.close (); if (status == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("after selecting, %p\n"), ACE_TEXT ("close"))); error = 1; } ACE_Dirent_Selector ds; // Don't specify any selection criteria. status = ds.open (test_dir); if (status == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%s w/o selection criteria; %p\n"), test_dir, ACE_TEXT ("open"))); error = 1; } // We counted the entries earlier by hand; should be the same here. if (entrycount != ds.length ()) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Counted %d entries in %s but selector says %d\n"), entrycount, test_dir, ds.length ())); error = 1; } for (n = 0; n < ds.length (); ++n) { #if defined (ACE_HAS_TCHAR_DIRENT) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Entry %d: %s\n"), n, ds[n]->d_name)); #else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Entry %d: %C\n"), n, ds[n]->d_name)); #endif } if (ds.close () == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("w/o selection criteria; %p\n"), ACE_TEXT ("close"))); error = 1; } return error ? -1 : 0; } static int dirent_test () { ACE_Dirent dir; if (dir.open (TestDir.c_str ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("open of dir %s failed\n"), TestDir.c_str()), -1); for (ACE_DIRENT *directory = 0; (directory = dir.read ()) != 0; entrycount++) { #if defined (ACE_HAS_TCHAR_DIRENT) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Entry %d: %s\n"), entrycount, directory->d_name)); #else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Entry %d: %C\n"), entrycount, directory->d_name)); #endif } switch (entrycount) { case 0: ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("readdir failed to read anything\n")), -1); /* NOTREACHED */ case 1: ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("readdir failed, only matched directory name\n")), -1); /* NOTREACHED */ default: ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("readdir succeeded, read %d entries\n"), entrycount)); } return 0; } static int dirent_count (const ACE_TCHAR *dir_path, int &dir_count, int &file_count, int recursion_level) { #if !defined (ACE_LACKS_CHDIR) if (ACE_OS::chdir (dir_path) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("chdir: %p\n"), dir_path), -1); #else ACE_UNUSED_ARG (dir_path); #endif /* !ACE_LACKS_CHDIR */ ACE_Dirent dir; if (dir.open (ACE_TEXT (".")) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("open of dir . failed\n")), -1); // Since the dir struct d_name type changes depending on the setting // of ACE_LACKS_STRUCT_DIR, copy each name into a neutral format // array to work on it. size_t const maxnamlen = MAXNAMLEN; ACE_TCHAR tname[maxnamlen + 1]; int entry_count = 0; for (ACE_DIRENT *directory; (directory = dir.read ()) != 0;) { // Skip the ".." and "." files. if (ACE::isdotdir(directory->d_name) == true) continue; ++entry_count; #if defined (ACE_HAS_TCHAR_DIRENT) ACE_OS::strncpy (tname, directory->d_name, maxnamlen); #else ACE_OS::strncpy (tname, ACE_TEXT_CHAR_TO_TCHAR (directory->d_name), maxnamlen); #endif /* ACE_LACKS_STRUCT_DIR */ int local_file_count = 0; int local_dir_count = 0; ACE_stat stat_buf; if (ACE_OS::lstat (directory->d_name, &stat_buf) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), tname), -1); switch (stat_buf.st_mode & S_IFMT) { case S_IFREG: // Either a regular file or an executable. ++file_count; break; case S_IFLNK: // Either a file or directory link, so let's find out. if (ACE_OS::stat (directory->d_name, &stat_buf) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), tname), -1); if ((stat_buf.st_mode & S_IFMT) == S_IFDIR) // Don't recurse through symbolic directory links! ++dir_count; else ++file_count; break; case S_IFDIR: ACE_DEBUG ((LM_DEBUG, "%*sentering subdirectory %s\n", recursion_level * RECURSION_INDENT, ACE_TEXT (""), tname)); if (dirent_count (tname, local_dir_count, local_file_count, recursion_level + 1) != -1) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%*ssubdirectory %s has %d files and %d subdirectories.\n"), recursion_level * RECURSION_INDENT, ACE_TEXT (""), tname, local_file_count, local_dir_count)); ++dir_count; #if !defined (ACE_LACKS_CHDIR) // Move back up a level. if (ACE_OS::chdir (ACE_TEXT ("..")) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("chdir: %p\n"), dir_path), -1); #endif /* !ACE_LACKS_CHDIR */ } break; default: // Must be some other type of file (PIPE/FIFO/device) ++file_count; break; } } return entry_count; } static int dirent_recurse_test () { int total_dirs = 0; int total_files = 0; const ACE_TCHAR *test_dir = TestDir.c_str (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Starting directory recursion test for %s\n"), test_dir)); if (dirent_count (test_dir, total_dirs, total_files, 1) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Directory recursion test failed for %s\n"), test_dir), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Directory recursion test succeeded for %s, read %d files %d dirs\n"), test_dir, total_files, total_dirs)); return 0; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Dirent_Test")); // First, find out where to run most of the scans. If a platform has a // compiled-in setting in TEST_DIR, honor that. Else, look for: // $top_srcdir/tests: The ACE_wrappers dir for autoconf builds // $ACE_ROOT/tests: The ACE_wrappers dir for most other builds // ../test: Last-chance try to hit the right place #if defined (TEST_DIR) TestDir = TEST_DIR; #else const char *root = ACE_OS::getenv ("top_srcdir"); if (root == 0) root = ACE_OS::getenv ("ACE_ROOT"); if (root != 0) { TestDir = ACE_TEXT_CHAR_TO_TCHAR (root); TestDir += ACE_DIRECTORY_SEPARATOR_STR; TestDir += ACE_TEXT ("tests"); } else { TestDir = ACE_TEXT ("../tests"); } #endif /* TEST_DIR */ int status = 0; if (-1 == dirent_test ()) status = -1; if (-1 == dirent_selector_test ()) status = -1; if (-1 == dirent_recurse_test ()) status = -1; ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/Monotonic_Message_Queue_Test.cpp0000644000175000017500000002325015027201773022613 0ustar sudipsudip //============================================================================= /** * @file Monotonic_Message_Queue_Test.cpp * * This is a test that verifies the time policy features of the * ACE_Message_Queue template. * A template instantiation based on the ACE_Monotonic_Time_Policy * is used to demonstrate the ability for making the message queue * timeouts independent from system time changes (time shift). * * @author Martin Corino */ //============================================================================= #include "test_config.h" #include "ace/Reactor.h" #include "ace/Timer_Queue.h" #include "ace/Thread_Manager.h" #include "ace/Message_Queue.h" #include "ace/Monotonic_Time_Policy.h" #include "ace/Synch_Traits.h" #include "ace/Timer_Heap_T.h" #include "ace/Event_Handler_Handle_Timeout_Upcall.h" #include "ace/TP_Reactor.h" #include "ace/Task_T.h" #include "ace/Truncate.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_sys_time.h" #include "ace/OS_NS_time.h" #include "ace/OS_NS_unistd.h" #if defined (ACE_HAS_MONOTONIC_TIME_POLICY) && defined (ACE_HAS_MONOTONIC_CONDITIONS) # if defined (ACE_WIN32) # include "ace/Date_Time.h" # endif # if defined (ACE_HAS_THREADS) using SYNCH_QUEUE = ACE_Message_Queue; // Create timer queue with hr support ACE_Timer_Queue * create_timer_queue () { ACE_Timer_Queue * tmq = 0; using timer_queue_type = ACE_Timer_Heap_T; ACE_NEW_RETURN (tmq, timer_queue_type (), 0); return tmq; } class MyTask : public ACE_Task { public: MyTask () : my_reactor_ (0), my_tq_ (0) {} ~MyTask () override { stop (); } int svc () override; int start (int num_threads); int stop (); ACE_Reactor* get_reactor (); int create_reactor (); private: int delete_reactor (); ACE_SYNCH_RECURSIVE_MUTEX lock_; ACE_Reactor *my_reactor_; ACE_Timer_Queue *my_tq_; }; ACE_Reactor* MyTask::get_reactor () { return my_reactor_; } int MyTask::create_reactor () { ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, monitor, this->lock_, -1); ACE_TEST_ASSERT (this->my_reactor_ == 0); this->my_tq_ = create_timer_queue (); ACE_TP_Reactor * pImpl = 0; ACE_NEW_RETURN (pImpl,ACE_TP_Reactor (0, this->my_tq_), -1); ACE_NEW_RETURN (my_reactor_, ACE_Reactor (pImpl ,1), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%t) Create TP_Reactor\n"))); this->reactor (my_reactor_); return 0; } int MyTask::delete_reactor () { ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, monitor, this->lock_, -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%t) Delete TP_Reactor\n"))); this->reactor (0); delete this->my_reactor_; this->my_reactor_ = 0; delete this->my_tq_; this->my_tq_ = 0; return 0; } int MyTask::start (int num_threads) { if (this->activate (THR_NEW_LWP, num_threads) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p.\n"), ACE_TEXT ("unable to activate thread pool")), -1); return 0; } int MyTask::stop () { if (this->my_reactor_ != 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("End TP_Reactor event loop\n"))); this->my_reactor_->end_reactor_event_loop (); } if (this->wait () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p.\n"), ACE_TEXT ("unable to stop thread pool"))); if (this->delete_reactor () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p.\n"), ACE_TEXT ("unable to delete reactor"))); return 0; } int MyTask::svc () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%P|%t) MyTask started\n"))); while (this->my_reactor_->reactor_event_loop_done () == 0) this->my_reactor_->run_reactor_event_loop (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%t) MyTask finished\n"))); return 0; } class TestHandler : public ACE_Event_Handler { public: TestHandler (ACE_Reactor* reactor, SYNCH_QUEUE &mq) : reactor_ (reactor), mq_ (mq) {} int handle_timeout (const ACE_Time_Value &tv, const void *arg) override; bool trigger_in(const ACE_Time_Value &delay); private: ACE_Reactor* reactor_; SYNCH_QUEUE& mq_; }; int TestHandler::handle_timeout (const ACE_Time_Value &, const void *) { const char S1[] = "message"; ACE_DEBUG ((LM_DEBUG, "(%P|%t) TestHandler::handle_timeout - timeout triggered\n")); ACE_Message_Block* mb1 = new ACE_Message_Block(S1, sizeof S1); this->mq_.enqueue_tail (mb1); return 0; } bool TestHandler::trigger_in(const ACE_Time_Value &delay) { ACE_DEBUG ((LM_DEBUG, "(%P|%t) TestHandler::trigger_in - scheduling timer\n")); return -1 != reactor_->schedule_timer (this, 0, delay, ACE_Time_Value (0)); } void set_system_time(const ACE_Time_Value& tv) { # if defined (ACE_WIN32) ACE_Date_Time curdt (tv); SYSTEMTIME sys_time; sys_time.wDay = ACE_Utils::truncate_cast (curdt.day ()); sys_time.wMonth = ACE_Utils::truncate_cast (curdt.month ()); sys_time.wYear = ACE_Utils::truncate_cast (curdt.year ()); sys_time.wHour = ACE_Utils::truncate_cast (curdt.hour ()); sys_time.wMinute = ACE_Utils::truncate_cast (curdt.minute ()); sys_time.wSecond = ACE_Utils::truncate_cast (curdt.second ()); sys_time.wMilliseconds = ACE_Utils::truncate_cast (curdt.microsec () / 1000); if (!::SetLocalTime (&sys_time)) # else timespec_t curts; curts = tv; if (ACE_OS::clock_settime (CLOCK_REALTIME, &curts) != 0) # endif { ACE_DEBUG((LM_INFO, "(%P|%t) Unable to reset OS time. Insufficient privileges or not supported.\n")); } } // Ensure that the timedout dequeue_head() keeps working in case of timeshift when using monotonic timer. static bool timeout_test () { bool status = true; SYNCH_QUEUE mq; MyTask task1; task1.create_reactor (); task1.start (1); TestHandler test_handler (task1.get_reactor (), mq); // The reactor of taks1 that uses a hrtimer will trigger a timeout in // 5 seconds which will enqueue a message block in the queue. At the // same moment we calculate a timeout for the dequeue operation for // 3 seconds in the future. Than we set the system time 4 seconds back. // The condition should timeout because the queue is empty and the trigger // only fires after the condition has timed out. // Next we start another dequeue for 3 seconds in the future which should // return before timing out because by then the trigger should have fired. // In case of using regular system time policy for message queue and // dequeue timeouts the first dequeue would not have timed out because // between calculating the timeout and starting the dequeue the system time // shifted back 4 sec causing the trigger to fire before the timeout elapsed. // In case timeshifting does not work because of priority problems or such // the test should succeed. if (!test_handler.trigger_in (ACE_Time_Value (5, 0))) ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) Unable to schedule trigger.\n"), false); if (!mq.is_empty ()) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("New queue is not empty!\n"))); status = false; } else { ACE_Message_Block *b = 0; ACE_Time_Value_T tv; tv = (tv.now () + ACE_Time_Value (3,0)); // Now (monotonic time) + 3 sec // shift back in time 4 sec set_system_time (ACE_OS::gettimeofday () - ACE_Time_Value (4, 0)); if (mq.dequeue_head (b, &tv) != -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Dequeued before timeout elapsed!\n"))); status = false; } else if (errno != EWOULDBLOCK) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Dequeue timeout should be EWOULDBLOCK, got"))); status = false; } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("First dequeue timed out: OK\n"))); tv = (tv.now () + ACE_Time_Value (3,0)); // Now (monotonic time) + 3 sec if (mq.dequeue_head (b, &tv) != -1) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Second dequeue succeeded: OK\n"))); delete b; } else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Second dequeue timed out!\n"))); status = false; } } // restore time set_system_time (ACE_OS::gettimeofday () + ACE_Time_Value (4, 0)); } ACE_DEBUG((LM_INFO, "(%P|%t) Asking worker thread to finish.\n")); task1.stop (); ACE_Thread_Manager::instance ()->wait (); return status; } # endif /* ACE_HAS_THREADS */ int run_main (int , ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Monotonic_Message_Queue_Test")); int status = 0; # if defined (ACE_HAS_THREADS) if (!timeout_test ()) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("test failed"))); status = 1; } # endif /* ACE_HAS_THREADS */ ACE_END_TEST; return status; } #else int run_main (int , ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Monotonic_Message_Queue_Test")); ACE_DEBUG((LM_INFO, "(%P|%t) ACE not compiled with monotonic time.\n")); ACE_END_TEST; return 0; } #endif ace-8.0.4+dfsg.orig/tests/Map_Test.h0000644000175000017500000000662015027201773016222 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Map_Test.h * * This file has the class definitions needed for template generation in * Map_Test.cpp. * * @author Irfan Pyarali */ //============================================================================= #ifndef ACE_TESTS_MAP_TEST_H #define ACE_TESTS_MAP_TEST_H #include "ace/OS_NS_string.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Active_Map_Manager.h" #include "ace/Containers.h" // Key data type. typedef ACE_Array KEY; /** * @class Key_Generator * * @brief Defines a key generator. * * This class is used in adapters of maps that do not produce keys. */ class Key_Generator { public: Key_Generator () : counter_ (0) { } int operator() (KEY &key) { // Keep original information in the key intact. size_t original_size = key.size (); // Size of this counter key. const size_t counter_key_size = sizeof this->counter_; // Resize to accommodate both the original data and the new key. key.size (counter_key_size + original_size); // Add new key data. ACE_OS::memcpy (&key[original_size], &++this->counter_, counter_key_size); // Success. return 0; } private: u_long counter_; }; class Hash_Key { public: u_long operator () (const KEY &key) const { // Recover system generated part of key. u_long value; size_t counter_key_size = sizeof (u_long); // Copy system key from user key. ACE_OS::memcpy (&value, &key[key.size () - counter_key_size], sizeof value); // Return the system key value as the hash value. return value; } }; class Key_Adapter { public: int encode (const KEY &original_key, const ACE_Active_Map_Manager_Key &active_key, KEY &modified_key) { // Keep original information in the key intact. modified_key = original_key; size_t original_size = modified_key.size (); // Size of active key. size_t active_key_size = active_key.size (); // Resize to accommodate both the original data and the new active key. modified_key.size (active_key_size + original_size); // Copy active key data into user key. active_key.encode (&modified_key[original_size]); // Success. return 0; } int decode (const KEY &modified_key, ACE_Active_Map_Manager_Key &active_key) { // Read the active key data from the back of the key. size_t active_key_size = active_key.size (); size_t original_size = modified_key.size () - active_key_size; // Read off value of index and generation. active_key.decode (&modified_key[original_size]); // Success. return 0; } int decode (const KEY &modified_key, KEY &original_key) { // Read the original user key data from the front of the // modified key. size_t active_key_size = ACE_Active_Map_Manager_Key::size (); // Copy all the data. original_key = modified_key; // Resize to ignore active key data. original_key.size (original_key.size () - active_key_size); // Success. return 0; } }; #endif /* ACE_TESTS_MAP_TEST_H */ ace-8.0.4+dfsg.orig/tests/Sendfile_Test.cpp0000644000175000017500000002325715027201773017576 0ustar sudipsudip/** * @file Sendfile_Test.cpp * * This is a test of the @c ACE_OS::sendfile() wrapper function. It * is primarily meant to test the case when ACE_HAS_SENDFILE is not * defined, i.e. when sendfile() support is emulated. * * @author * Steve Huston * Ossama Othman */ #include "test_config.h" #include "ace/Lib_Find.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_sys_wait.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_fcntl.h" #include "ace/Thread.h" #include "ace/Thread_Manager.h" #include "ace/Time_Value.h" #include "ace/SOCK_Connector.h" #include "ace/SOCK_Acceptor.h" #include "ace/SOCK_Stream.h" #include "ace/OS_NS_sys_sendfile.h" // Change to non-zero if test fails static int Test_Result = 0; #if !defined (ACE_LACKS_FORK) || defined (ACE_HAS_THREADS) // This test sends a large amount of data. The purpose is to overflow the // TCP send window, causing the sender to block (it's a send_n). This value // is the amount to send. The assumption is that no implementation has a // receive window larger than 128K bytes. If one is found, this is the place // to change it. // For some odd reason, NT will try to send a single large buffer, but not // multiple smaller ones that add up to the large size. const size_t Test3_Send_Size = 4*1024; const size_t Test3_Loops = 10; static void * client (void *arg) { ACE_INET_Addr *remote_addr = reinterpret_cast (arg); ACE_INET_Addr server_addr (remote_addr->get_port_number (), ACE_LOCALHOST); ACE_SOCK_Stream cli_stream; ACE_SOCK_Connector con; ACE_Time_Value timeout (ACE_DEFAULT_TIMEOUT); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Connecting to port %d\n"), server_addr.get_port_number())); // Initiate connection with server; don't wait forever if (con.connect (cli_stream, server_addr, &timeout) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("connection failed"))); Test_Result = 1; return 0; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) connected to %C\n"), server_addr.get_host_name ())); //******************* TEST 1 ****************************** // // Send the 255 byte buffer in 5 chunks. The // server will verify that the correct data is sent, and that there // is no more and no less. u_char buffer[255]; size_t i; ssize_t byte_count = 0; ssize_t len = 0; off_t offset = 0; // The server will verify that this data pattern gets there intact. for (i = 0; i < sizeof buffer; ++i) buffer[i] = static_cast (i); const ACE_TCHAR file[] = ACE_TEXT ("Sendfile_Test_File"); static const size_t file_sz = sizeof (file) / sizeof (file[0]); ACE_TCHAR test_file[MAXPATHLEN + 1]; ACE_HANDLE in_fd = ACE_INVALID_HANDLE; if (ACE::get_temp_dir (test_file, MAXPATHLEN - file_sz) == -1 || ACE_OS::strcat (test_file, file) == 0 || (in_fd = ACE_OS::open (test_file, O_CREAT | O_RDWR | O_TRUNC, ACE_DEFAULT_FILE_PERMS)) == ACE_INVALID_HANDLE) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) open %p\n"), test_file)); Test_Result = 1; goto cleanup; } ACE_OS::unlink (test_file); byte_count = ACE_OS::write (in_fd, buffer, sizeof (buffer)); if (byte_count != static_cast (sizeof (buffer))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) write %p\n"), test_file)); Test_Result = 1; } len = ACE_OS::sendfile (cli_stream.get_handle (), in_fd, &offset, byte_count); if (len == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("Test 1, sendfile failed"))); Test_Result = 1; goto cleanup; } else if (len != 255) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) sendfile len %b; should be 255\n"), len)); //******************* TEST 2 ****************************** // // The same data is coming back - receive it using recv (size_t n, // ...) and compare it to the original data. u_char buffer2[255]; // Give it a chance to get here ACE_OS::sleep (2); #ifndef ACE_LACKS_VA_FUNCTIONS len = cli_stream.recv (4, buffer2, 150, &buffer2[150], 105); #endif if (len != 255) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) recv len is %b, but should be 255!\n"), len)); } for (i = 0; i < static_cast(len); i++) if (buffer2[i] != buffer[i]) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) Test 2, rcvd byte %B is %d, not %d\n"), i, buffer2[i], buffer[i])); Test_Result = 1; } cleanup: cli_stream.close (); if (in_fd != ACE_INVALID_HANDLE) (void) ACE_OS::close (in_fd); return 0; } static void * server (void *arg) { ACE_SOCK_Acceptor *peer_acceptor = (ACE_SOCK_Acceptor *) arg; ACE_SOCK_Stream sock_str; ACE_INET_Addr cli_addr; ACE_Time_Value timeout (ACE_DEFAULT_TIMEOUT); // Accept the connection over which the stream tests will run. // Don't lock up if client doesn't connect if (peer_acceptor->accept (sock_str, &cli_addr, &timeout) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("accept"))); Test_Result = 1; return 0; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) client %C connected from %d\n"), cli_addr.get_host_name (), cli_addr.get_port_number ())); //******************* TEST 1 ****************************** // // Do a iovec recvv - the client should send 255 bytes, which we // will be detected and read into a ACE-allocated buffer. Use a 5 // second timeout to give the client a chance to send it all. ACE_OS::sleep (5); u_char buffer[255]; ssize_t len; int i; len = sock_str.recv (buffer, 255); if (len == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("Test 1, recv failed"))); Test_Result = 1; } if (len != 255) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) recv len is %b, but should be 255!\n"), len)); } for (i = 0; i < static_cast(len); i++) if (buffer[i] != i) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) Test 1, rcvd byte %d is %d, not %d\n"), i, buffer[i], i)); Test_Result = 1; } //******************* TEST 2 ****************************** // // Send the buffer back, using send (size_t n, ...) in 3 pieces. #ifndef ACE_LACKS_VA_FUNCTIONS len = sock_str.send (6, buffer, 42, &buffer[42], 189, &buffer[231], 24); #endif if (len != 255) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) send len is %b, but should be 255!\n"), len)); } sock_str.close(); return 0; } #endif /* !ACE_LACKS_FORK || ACE_HAS_THREADS */ void spawn () { // Acceptor ACE_SOCK_Acceptor peer_acceptor; // Create a server address. ACE_INET_Addr server_addr; // Bind listener to any port and then find out what the port was. if (peer_acceptor.open (ACE_Addr::sap_any) == -1 || peer_acceptor.get_local_addr (server_addr) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("open"))); else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) starting server at port %d\n"), server_addr.get_port_number ())); #if !defined (ACE_LACKS_FORK) switch (ACE_OS::fork (ACE_TEXT ("child"))) { case -1: ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("fork failed"), 1)); ACE_OS::abort (); case 0: client (&server_addr); ACE_OS::exit (0); /* NOTREACHED */ default: server (reinterpret_cast (&peer_acceptor)); ACE_OS::wait (); } #elif defined (ACE_HAS_THREADS) if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (server), reinterpret_cast (&peer_acceptor), THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), ACE_TEXT ("thread create failed"), 1)); if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (client), reinterpret_cast (&server_addr), THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), ACE_TEXT ("thread create failed"), 1)); // Wait for the threads to exit. ACE_Thread_Manager::instance ()->wait (); #else ACE_ERROR ((LM_INFO, ACE_TEXT ("(%P|%t) ") ACE_TEXT ("only one thread may be run ") ACE_TEXT ("in a process on this platform\n"))); #endif /* ACE_HAS_THREADS */ peer_acceptor.close (); } } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Sendfile_Test")); #ifndef ACE_LACKS_ACCEPT spawn (); #endif ACE_END_TEST; return Test_Result; } ace-8.0.4+dfsg.orig/tests/Compiler_Features_22_DLL.h0000644000175000017500000000134515027201773021113 0ustar sudipsudip //============================================================================= /** * @file Compiler_Features_22_DLL.h * * Test DLL export with a template method specialization */ //============================================================================= #ifndef ACE_TESTS_COMPILER_FEATURES_22_DLL_H #define ACE_TESTS_COMPILER_FEATURES_22_DLL_H #include /**/ "ace/pre.h" #include "test_config.h" #include "Compiler_Features_22_DLL_Export.h" class A { public: A () {}; }; typedef A* A_ptr; template inline bool is_nil (T x) { return x == 0; } template<> bool COMPILER_FEATURES_22_DLL_Export is_nil<> (A_ptr) { return false; } #include /**/ "ace/post.h" #endif /* ACE_TESTS_COMPILER_FEATURES_22_DLL_H */ ace-8.0.4+dfsg.orig/tests/Proactor_File_Test.cpp0000644000175000017500000002770215027201773020574 0ustar sudipsudip// ============================================================================ /** * @file Proactor_File_Test.cpp * * This program illustrates how the ACE_Proactor can be used to * implement an application that does asynchronous file IO * operations. * * @author Martin Corino */ // ============================================================================ #include "test_config.h" #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) // This only works on Win32 platforms and on Unix platforms // supporting POSIX aio calls. ////////////////////////////////////////////////////////////////// // This sample application integrates asynch file // read/write operations with the Proactor, using an ACE_FILE_Connector, // ACE_FILE_IO, ACE_Asynch_Read_File, ACE_Asynch_Write_File in an ACE_Handler. // The program sets up asynch read and write on a temporary file, and sends // out 16 16-character bursts of data at timed intervals. #include #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_errno.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_sys_time.h" #include "ace/FILE_Connector.h" #include "ace/FILE_IO.h" #include "ace/Proactor.h" #include "ace/Asynch_Connector.h" #include "ace/Time_Value.h" // How long are our fake serial I/O frames? #define FILE_FRAME_SIZE 16 class FileIOHandler : public ACE_Handler { public: FileIOHandler (); ~FileIOHandler () override; int Connect(); // This method will be called when an asynchronous read // completes on a file. void handle_read_file(const ACE_Asynch_Read_File::Result &result) override; // This method will be called when an asynchronous write // completes on a file. void handle_write_file(const ACE_Asynch_Write_File::Result &result) override; // Callback hook invoked by the Proactor's Timer_Queue. void handle_time_out(const ACE_Time_Value &tv, const void *arg) override; // Our I/O objects; they're public so others can access them ACE_Asynch_Read_File reader_; ACE_Asynch_Write_File writer_; private: int block_count_; #if defined (ACE_WIN32) bool read_pending_; #endif ACE_FILE_IO peer_; ACE_FILE_Connector connector_; }; FileIOHandler::FileIOHandler () : ACE_Handler () , block_count_ (0) #if defined (ACE_WIN32) , read_pending_ (false) #endif { } FileIOHandler::~FileIOHandler () { ACE_FILE_Addr tmp_addr; peer_.get_local_addr (tmp_addr); if (tmp_addr.get_path_name ()) { peer_.remove (); } } //*************************************************************************** // // Method: Connect // // Description: Establishes connection, primes read process // // Inputs: port name, port parameter block // // Returns: none // //*************************************************************************** int FileIOHandler::Connect() { int result = 0; // create an empty temporary file for the test if(connector_.connect(peer_, ACE_sap_any_cast (ACE_FILE_Addr &)) != 0) { ACE_ERROR((LM_ERROR, ACE_TEXT("%p\n"), ACE_TEXT("FileIOHandler connect failed to create file"))); result = -1; } // close opened file but leave it where it is if (peer_.close () != 0) { ACE_ERROR((LM_ERROR, ACE_TEXT("%p\n"), ACE_TEXT("FileIOHandler connect failed to close file"))); peer_.remove (); result = -1; } // get file address ACE_FILE_Addr tmp_addr; peer_.get_local_addr (tmp_addr); // reopen new file for asynch IO if(connector_.connect(peer_, tmp_addr, 0, //timeout ACE_Addr::sap_any, 0, //reuse O_RDWR |FILE_FLAG_OVERLAPPED) != 0) { ACE_ERROR((LM_ERROR, ACE_TEXT("%p\n"), ACE_TEXT("FileIOHandler connect failed to open file"))); peer_.remove (); result = -1; } else // device connected successfully { // keep track of our writes for offset calculations (can't use O_APPEND since // this is not supported for the Win32_Asynch implementation) and data verifications this->block_count_ = 0; // start counting // Set our I/O handle to that of the peer_ object handling our connection handle(peer_.get_handle()); if (writer_.open(*this) != 0 || reader_.open(*this) != 0) { ACE_ERROR( (LM_ERROR, ACE_TEXT("%p\n"), ACE_TEXT("FileIOHandler reader or writer open failed"))); result = -1; } else // reader and writer opened successfully { // Allocate a new message block and initiate a read operation on it // to prime the asynchronous read pipeline // The message block is sized for the largest message we expect ACE_Message_Block *mb; ACE_NEW_NORETURN(mb, ACE_Message_Block(FILE_FRAME_SIZE)); if (reader_.read(*mb, mb->space()) != 0) { int errnr = ACE_OS::last_error (); ACE_DEBUG( (LM_INFO, ACE_TEXT("%p [%d]\n"), ACE_TEXT("FileIOHandler begin read failed"), errnr)); mb->release(); #if defined (ACE_WIN32) // On older Win32 versions (WinXP, Win2003/2008) asynch IO with disk files is not // reliable and may perform sync IO in certain cases like when the read offset denotes // current end of file. Instead of scheduling a write operation the read will immediately // return with an EOF error. // We circumvent that situation here by not reporting an error and scheduling a read operation // later when we are sure data has been written at the offset in question (after the write finishes). if (errnr != ERROR_HANDLE_EOF) #endif result = -1; } #if defined (ACE_WIN32) else { this->read_pending_ = true; } #endif // If read worked, psMsg is now controlled by Proactor framework. } } return result; } //*************************************************************************** // // Method: handle_read_file // // Description: Callback used when a read completes // // Inputs: read file result structure containing message block // // Returns: none // //*************************************************************************** void FileIOHandler::handle_read_file(const ACE_Asynch_Read_File::Result &result) { ACE_Message_Block &mb = result.message_block(); // If the read failed, queue up another one using the same message block if (!result.success() || result.bytes_transferred() == 0) { //ACE_DEBUG((LM_INFO, ACE_TEXT("FileIOHandler receive timeout.\n"))); reader_.read(mb, mb.space(), result.offset () + result.bytes_transferred ()); } else { // We have a message block with some read data in it. Send it onward ACE_DEBUG((LM_INFO, ACE_TEXT("FileIOHandler received %d bytes of data at offset %d\n"), result.bytes_transferred(), result.offset ())); // TODO: Process this data in some meaningful way if (result.offset () != (unsigned long)*reinterpret_cast (mb.rd_ptr ())) { ACE_DEBUG((LM_ERROR, ACE_TEXT("FileIOHandler received incorrect data: got [%u] expected [%u]\n"), *reinterpret_cast (mb.rd_ptr ()), result.offset ())); } // Release the message block when we're done with it mb.release(); if ((result.offset () + result.bytes_transferred ()) < 256) { // Our processing is done; prime the read process again ACE_Message_Block *new_mb; ACE_NEW_NORETURN(new_mb, ACE_Message_Block(FILE_FRAME_SIZE)); if (reader_.read(*new_mb, new_mb->space(), result.offset () + result.bytes_transferred ()) != 0) { int errnr = ACE_OS::last_error (); ACE_DEBUG( (LM_INFO, ACE_TEXT("%p [%d]\n"), ACE_TEXT("FileIOHandler continuing read failed"), errnr)); new_mb->release(); #if defined (ACE_WIN32) this->read_pending_ = false; } else { this->read_pending_ = true; #endif } } else { // we have it all; stop the proactor ACE_Proactor::instance ()->proactor_end_event_loop (); } } } //*************************************************************************** // // Method: handle_write_file // // Description: Callback used when a write completes // // Inputs: write file result structure containing message block // // Returns: none // //*************************************************************************** void FileIOHandler::handle_write_file(const ACE_Asynch_Write_File::Result &result) { ACE_DEBUG((LM_INFO, ACE_TEXT("Finished write\n"))); // When the write completes, we get the message block. It's been sent, // so we just deallocate it. result.message_block().release(); #if defined (ACE_WIN32) // to circumvent problems on older Win32 (see above) we schedule a read here if none // is pending yet. if (!this->read_pending_) { ACE_Message_Block *mb; ACE_NEW_NORETURN(mb, ACE_Message_Block(FILE_FRAME_SIZE)); if (reader_.read(*mb, mb->space(), (this->block_count_ - 1) * FILE_FRAME_SIZE) != 0) { int errnr = ACE_OS::last_error (); ACE_DEBUG( (LM_INFO, ACE_TEXT("%p [%d]\n"), ACE_TEXT("FileIOHandler read after write failed"), errnr)); mb->release(); } else { this->read_pending_ = true; } } #endif } //*************************************************************************** // // Method: handle_time_out // // Description: Hook method called when a timer expires // // Inputs: time value, completion token passed to timer at scheduling // The token tells us which timer we're handling // // Returns: none // //*************************************************************************** void FileIOHandler::handle_time_out(const ACE_Time_Value & /*tv*/, const void * /*act*/) { // do not schedule more than 16 writes if (this->block_count_ < 16) { // In our example, we send a bunch of data every time the timer expires // setup the next payload char payload[FILE_FRAME_SIZE]; for (int i=0; iblock_count_ * FILE_FRAME_SIZE) + i; } ACE_Message_Block *new_mb; ACE_NEW_NORETURN(new_mb, ACE_Message_Block(FILE_FRAME_SIZE)); new_mb->copy(payload, FILE_FRAME_SIZE); // queue up a write (append to end of file) operation, give visual feedback on success or failure. if (this->writer_.write(*new_mb, new_mb->length(), this->block_count_ * FILE_FRAME_SIZE) == 0) { ACE_DEBUG((LM_INFO, ACE_TEXT("Successfully queued write of %d bytes\n"), new_mb->length ())); // success this->block_count_ ++; // next block } else { ACE_DEBUG((LM_ERROR, ACE_TEXT("FAILED to queue write operation\n"))); // failure }; } } int run_main(int /*argc*/, ACE_TCHAR * /*argv*/[]) { ACE_START_TEST (ACE_TEXT ("Proactor_File_Test")); int rc = 0; FileIOHandler fileIOHandler; // Initialize the serial port handler if (0 != fileIOHandler.Connect()) { rc = 1; } else { ACE_DEBUG((LM_INFO, ACE_TEXT(" File I/O Handler connected.\n"))); // start the repeating timer for data transmission ACE_Time_Value repeatTime(0, 50000); // 0.05 second time interval ACE_Proactor::instance()->schedule_repeating_timer(fileIOHandler, (void *) (100), repeatTime); // Run the Proactor ACE_Proactor::instance()->proactor_run_event_loop(); } ACE_END_TEST; return rc; } #else int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Proactor_File_Test")); ACE_DEBUG ((LM_INFO, ACE_TEXT ("Asynchronous IO is unsupported.\n") ACE_TEXT ("Proactor_File_Test will not be run.\n"))); ACE_END_TEST; return 0; } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ ace-8.0.4+dfsg.orig/tests/Thread_Mutex_Test.cpp0000644000175000017500000002170315027201773020430 0ustar sudipsudip //============================================================================= /** * @file Thread_Mutex_Test.cpp * * This test illustrates the functionality of the * ACE_Thread_Mutex. The test acquires and releases mutexes. No * command line arguments are needed to run the test. * * @author Prashant Jain and Douglas C. Schmidt */ //============================================================================= #include "test_config.h" #include "ace/Thread_Manager.h" #include "ace/OS_NS_sys_time.h" #include "ace/OS_NS_time.h" #include "ace/OS_NS_unistd.h" #if defined (ACE_HAS_THREADS) #include "ace/Guard_T.h" // For all platforms except for Windows use the ACE_Thread_Mutex. // Since Windows only supports timed process mutexes and not // timed thread mutexes, use ACE_Process_Mutex. #if defined (ACE_HAS_WTHREADS) # include "ace/Process_Mutex.h" typedef ACE_Process_Mutex ACE_TEST_MUTEX; #else # include "ace/Thread_Mutex.h" using ACE_TEST_MUTEX = ACE_Thread_Mutex; #endif #if !defined (ACE_HAS_MUTEX_TIMEOUTS) static int reported_notsup = 0; #endif /* ACE_HAS_MUTEX_TIMEOUTS */ static void * test (void *args) { ACE_TEST_MUTEX *mutex = (ACE_TEST_MUTEX *) args; ACE_UNUSED_ARG (mutex); // Suppress ghs warning about unused local "mutex". u_int seed = (u_int) ACE_OS::time (0); for (size_t i = 0; i < ACE_MAX_ITERATIONS / 2; i++) { int result = 0; // First attempt to acquire the mutex with a timeout to verify // that mutex timeouts are working. ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) = trying timed acquire on ") ACE_TEXT ("iteration %d\n"), i)); ACE_Time_Value delta (1, 0); // One second timeout ACE_Time_Value timeout = ACE_OS::gettimeofday (); timeout += delta; // Must pass absolute time to acquire(). if (mutex->acquire (timeout) != 0) { if (errno == ETIME) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) = mutex acquisition ") ACE_TEXT ("timed out\n"))); else if (errno == ENOTSUP) { #if !defined (ACE_HAS_MUTEX_TIMEOUTS) if (!reported_notsup) { ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%P|%t) %p, but ACE_HAS_MUTEX_TIMEOUTS is not defined - Ok\n"), ACE_TEXT ("mutex timed acquire"))); reported_notsup = 1; } #else ACE_DEBUG ((LM_ERROR, ACE_TEXT ("(%P|%t) %p - maybe ACE_HAS_MUTEX_TIMEOUTS should not be defined?\n"), ACE_TEXT ("mutex timed acquire"))); #endif /* ACE_HAS_MUTEX_TIMEOUTS */ } else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), ACE_TEXT ("mutex timeout failed\n"))); return 0; } } else { result = mutex->release (); ACE_TEST_ASSERT (result == 0); } // Now try the standard mutex. ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) = trying to acquire on iteration %d\n"), i)); result = mutex->acquire (); ACE_TEST_ASSERT (result == 0); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) = acquired on iteration %d\n"), i)); // Sleep for a random amount of time between 0 and 2 seconds. // Note that it's ok to use rand() here because we are running // within the critical section defined by the Thread_Mutex. ACE_OS::sleep (ACE_OS::rand_r (&seed) % 2); result = mutex->release (); ACE_TEST_ASSERT (result == 0); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) = released on iteration %d\n"), i)); // FUZZ: disable check_for_ACE_Guard // Basic ACE_Guard usage - automatically acquire the mutex on // guard construction and automatically release it on // destruction. { // Construct an ACE_Guard to implicitly acquire the mutex. ACE_Guard guard (*mutex); ACE_TEST_ASSERT (guard.locked () != 0); // Perform some operation which might exit the current scope // prematurely, e.g. by returning or throwing an exception. // ... // ACE_Guard object is destroyed when exiting scope and guard // destructor automatically releases mutex. } // Use an ACE_Guard to automatically acquire a mutex, but release // the mutex early. { // Construct an ACE_Guard to implicitly acquire the mutex. ACE_Guard guard (*mutex); ACE_TEST_ASSERT (guard.locked () != 0); // Perform some operation which might exit the current scope // prematurely, e.g. by returning or throwing an exception. // ... // Release the mutex since we no longer need it. guard.release (); ACE_TEST_ASSERT (guard.locked () == 0); // Do something else which does not require the mutex to be locked. // ... // ACE_Guard object's destructor will not release the mutex. } // Use an ACE_Guard to automatically acquire a mutex, but // relinquish ownership of the lock so that the mutex is not // automatically released on guard destruction. This is useful // when an operation might not release the mutex in some // conditions, in which case responsibility for releasing it is // passed to someone else. { // Construct an ACE_Guard to implicitly acquire the mutex. ACE_Guard guard (*mutex); ACE_TEST_ASSERT (guard.locked () != 0); // Perform some operation which might exit the current scope // prematurely, e.g. by returning or throwing an exception. // ... // Relinquish ownership of the mutex lock. Someone else must // now release it. guard.disown (); ACE_TEST_ASSERT (guard.locked () == 0); // ACE_Guard object's destructor will not release the mutex. } // We are now responsible for releasing the mutex. result = mutex->release (); ACE_TEST_ASSERT (result == 0); // Construct an ACE_Guard without automatically acquiring the lock. { // Construct an ACE_Guard object without automatically // acquiring the mutex or taking ownership of an existing // lock. The third parameter tells the guard that the mutex // has not been locked. ACE_Guard guard (*mutex, 0, 0); ACE_TEST_ASSERT (guard.locked () == 0); // Conditionally acquire the mutex. if (i % 2 == 0) { guard.acquire (); ACE_TEST_ASSERT (guard.locked () != 0); } // Perform some operation that might exit the current scope // prematurely, e.g. by returning or throwing an exception. // ... // ACE_Guard object is destroyed when exiting scope and guard // destructor automatically releases if it was acquired above. } // Use an ACE_Guard to take ownership of a previously acquired // mutex. timeout = ACE_OS::gettimeofday (); timeout += delta; // Must pass absolute time to acquire(). if (mutex->acquire (timeout) == 0) { // Construct an ACE_Guard object without automatically // acquiring the mutex, but instead take ownership of the // existing lock. The third parameter tells the guard that // the mutex has already been locked. ACE_Guard guard (*mutex, 0, 1); ACE_TEST_ASSERT (guard.locked () != 0); // Perform some operation which might exit the current scope // prematurely, e.g. by returning or throwing an exception. // ... // ACE_Guard object is destroyed when exiting scope and guard // destructor automatically releases mutex. } // FUZZ: enable check_for_ACE_Guard } return 0; } #endif /* ACE_HAS_THREADS */ static void spawn () { #if defined (ACE_HAS_THREADS) ACE_TEST_MUTEX mutex; const u_int n_threads = ACE_MAX_THREADS; if (ACE_Thread_Manager::instance ()->spawn_n (n_threads, ACE_THR_FUNC (test), (void *) &mutex, THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n%a"), ACE_TEXT ("thread create failed"))); // Wait for the threads to exit. ACE_Thread_Manager::instance ()->wait (); #else ACE_ERROR ((LM_INFO, ACE_TEXT ("threads not supported on this platform\n"))); #endif /* ACE_HAS_THREADS */ } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Thread_Mutex_Test")); spawn (); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Compiler_Features_09_Test.cpp0000644000175000017500000000415015027201773021754 0ustar sudipsudip/** * @file * * This program checks if the compiler / platform supports the * std::unique_ptr<> correctly. The motivation for this test was a discussion * on the development mailing list, and the documentation was captured * in: * * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=3715 */ #include "test_config.h" // The first part of the test is to compile this line. If the program // does not compile the platform is just too broken. #include #include // For extra challenge, we use the anonymous namespace namespace { /** * @class Base */ class Base { public: Base() { constructors++; } Base(Base const & ) { constructors++; } ~Base() { destructors++; } static int constructors; static int destructors; }; int Base::constructors = 0; int Base::destructors = 0; class Derived : public Base { public: Derived() : Base() {} }; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT("Compiler_Features_09_Test")); // As usual, the exit status from the test is 0 on success, 1 on // failure int status = 0; // ... this works with the ACE version of unique_ptr (well, the // namespace is broken, but you get the idea) ... std::unique_ptr x(new Base); std::unique_ptr y(new Derived); // ... with a compliant implementation of std::unique_ptr<> you should be // able to write: // x = y; x.reset(y.release()); // ... there should be just one destruction so far ... if (Base::destructors != 1) { status = 1; ACE_ERROR((LM_ERROR, ACE_TEXT("Destructor count off, expected 1, found %d\n"), Base::destructors)); } std::unique_ptr z; z = std::move(x); if (Base::destructors != 1) { status = 1; ACE_ERROR((LM_ERROR, ACE_TEXT("Destructor count off, expected 1, found %d\n"), Base::destructors)); } if (x.get()) { status = 1; ACE_ERROR((LM_ERROR, ACE_TEXT("x contents should have been transferred\n") )); } ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/tests.mpc0000644000175000017500000012447515027201773016211 0ustar sudipsudip// -*- MPC -*- project(Test_Output) : acelib, script { libout = . sharedname = Test_Output dynamicflags += TEST_OUTPUT_BUILD_DLL Source_Files { Test_Output.cpp } Header_Files { Test_Output_Export.h test_config.h } Resource_Files { } Script_Files { run_test.lst } } project(Framework Component DLL) : acelib { libout = . sharedname = Framework_Component_DLL dynamicflags += FRAMEWORK_COMPONENT_DLL_BUILD_DLL Source_Files { Framework_Component_DLL.cpp } Header_Files { Framework_Component_DLL.h Framework_Component_DLL_Export.h } Resource_Files { } } project(DLL Test Parent Lib) : acelib { libout = . sharedname = DLL_Test_Parent dynamicflags += DLL_TEST_PARENT_BUILD_DLL Source_Files { DLL_Test_Parent.cpp } Header_Files { DLL_Test_Parent_Export.h test_config.h } Resource_Files { } } project(DLL Test Lib) : acelib, dll_test_parent_lib { libout = . sharedname = DLL_Test_Lib dynamicflags += ACE_SVC_BUILD_DLL Source_Files { DLL_Test_Impl.cpp } Header_Files { test_config.h } Resource_Files { } } project(Based Pointer Test Lib) : acelib { libout = . avoids += ace_for_tao sharedname = Based_Pointer_Test_Lib dynamicflags += ACE_SVC_BUILD_DLL Source_Files { Based_Pointer_Test_Lib.cpp } Header_Files { Based_Pointer_Test_Lib_Export.h } Resource_Files { } } project(Service Config DLL) : acelib { libout = . sharedname = Service_Config_DLL dynamicflags += SERVICE_CONFIG_DLL_BUILD_DLL Source_Files { Service_Config_DLL.cpp } Header_Files { Service_Config_DLL.h Service_Config_DLL_Export.h } Resource_Files { } } project(ACE Init Test) : acemfcexe { requires += mfc macros += _AFXDLL after += Test_Output libs += Test_Output exename = ACE_Init_Test Source_Files { ACE_Init_Test.cpp ACE_Init_TestDlg.cpp } Header_Files { ACE_Init_Test.h ACE_Init_Test_Resource.h ACE_Init_TestDlg.h ACE_Init_TestStdAfx.h } Resource_Files { ACE_Init_Test.ico ACE_Init_Test.rc } Build_Files { tests.mpc tests.mwc } } project(Task Wait Test) : acetest { exename = Task_Wait_Test Source_Files { Task_Wait_Test.cpp } } project(ACE Test) : acetest { exename = ACE_Test Source_Files { ACE_Test.cpp } } project(Aio Platform Test) : acetest { exename = Aio_Platform_Test Source_Files { Aio_Platform_Test.cpp } } project(Arg Shifter Test) : acetest { exename = Arg_Shifter_Test Source_Files { Arg_Shifter_Test.cpp } } project(Stack Trace Test) : acetest { exename = Stack_Trace_Test Source_Files { Stack_Trace_Test.cpp } } project(Array Map Test) : acetest { exename = Array_Map_Test Source_Files { Array_Map_Test.cpp } } project(ARGV Test) : acetest { exename = ARGV_Test Source_Files { ARGV_Test.cpp } } project(Atomic Op Test) : acetest { exename = Atomic_Op_Test Source_Files { Atomic_Op_Test.cpp } } project(Auto Event Test) : acetest { exename = Auto_Event_Test Source_Files { Auto_Event_Test.cpp } } project(Auto IncDec Test) : acetest { exename = Auto_IncDec_Test Source_Files { Auto_IncDec_Test.cpp } } project(Barrier Test) : acetest { exename = Barrier_Test Source_Files { Barrier_Test.cpp } } project(Basic Types Test) : acetest { exename = Basic_Types_Test Source_Files { Basic_Types_Test.cpp } } project(Bound Ptr Test) : acetest { avoids += ace_for_tao exename = Bound_Ptr_Test Source_Files { Bound_Ptr_Test.cpp } } project(Buffer Stream Test) : acetest { exename = Buffer_Stream_Test Source_Files { Buffer_Stream_Test.cpp } } project(Bug_1576_Regression_Test) : acetest { exename = Bug_1576_Regression_Test Source_Files { Bug_1576_Regression_Test.cpp } } project(Bug_1890_Regression_Test) : acetest { exename = Bug_1890_Regression_Test Source_Files { Bug_1890_Regression_Test.cpp } } project(Bug_2368_Regression_Test) : acetest { exename = Bug_2368_Regression_Test Source_Files { Bug_2368_Regression_Test.cpp } } project(Bug_2434_Regression_Test) : acetest { exename = Bug_2434_Regression_Test Source_Files { Bug_2434_Regression_Test.cpp } } project(Bug_2497_Regression_Test) : acetest { exename = Bug_2497_Regression_Test Source_Files { Bug_2497_Regression_Test.cpp } } project(Bug_2540_Regression_Test) : acetest { exename = Bug_2540_Regression_Test Source_Files { Bug_2540_Regression_Test.cpp } } project(Bug_2653_Regression_Test) : acetest { exename = Bug_2653_Regression_Test Source_Files { Bug_2653_Regression_Test.cpp } } project(Bug_2740_Regression_Test) : acetest, threads { exename = Bug_2740_Regression_Test Source_Files { Bug_2740_Regression_Test.cpp } } project(Bug_2772_Regression_Test) : acetest, threads { exename = Bug_2772_Regression_Test Source_Files { Bug_2772_Regression_Test.cpp } } project(Bug_2815_Regression_Test) : acetest { exename = Bug_2815_Regression_Test Source_Files { Bug_2815_Regression_Test.cpp } } project(Bug_2820_Regression_Test) : acetest { exename = Bug_2820_Regression_Test Source_Files { Bug_2820_Regression_Test.cpp } } project(Bug_2975_Regression_Test) : acetest { exename = Bug_2975_Regression_Test Source_Files { Bug_2975_Regression_Test.cpp } } project (Bug_2980_Regression_Test) { // The test uses a non-ACE executable, // which loads an ACE-based DLL. after += Bug_2980_Regression_Dll avoids += uses_wchar includes += $(ACE_ROOT) staticflags += ACE_AS_STATIC_LIBS exename = Bug_2980_Regression_Test Source_Files { Bug_2980_Regression_Test.cpp } Resource_Files { } specific(vxtest) { libs += Bug_2980_Regression ACE } } project (Bug_2980_Regression_Dll): acelib { libout = . sharedname = Bug_2980_Regression dynamicflags += TEST_OUTPUT_BUILD_DLL Source_Files { Test_Output.cpp Bug_2980_Regression_Dll.cpp } Resource_Files { } } project(Bug_3102_Regression_Test) : acetest { exename = Bug_3102_Regression_Test Source_Files { Bug_3102_Regression_Test.cpp } } project(Bug_3319_Regression_Test) : acetest { exename = Bug_3319_Regression_Test Source_Files { Bug_3319_Regression_Test.cpp } } project(Bug_3432_Regression_Test) : acetest { exename = Bug_3432_Regression_Test Source_Files { Bug_3432_Regression_Test.cpp } } project(Bug_3500_Regression_Test) : acetest { exename = Bug_3500_Regression_Test Source_Files { Bug_3500_Regression_Test.cpp } } project(Bug_3505_Regression_Test) : acetest { exename = Bug_3505_Regression_Test Source_Files { Bug_3505_Regression_Test.cpp } } project(Bug_3532_Regression_Test) : acetest { exename = Bug_3532_Regression_Test Source_Files { Bug_3532_Regression_Test.cpp } } project(Bug_3539_Regression_Test) : acetest { exename = Bug_3539_Regression_Test Source_Files { Bug_3539_Regression_Test.cpp } } project(Bug_3541_Regression_Test) : acetest { exename = Bug_3541_Regression_Test Source_Files { Bug_3541_Regression_Test.cpp } } project(Bug_3673_Regression_Test) : acetest { exename = Bug_3673_Regression_Test Source_Files { Bug_3673_Regression_Test.cpp } } project(Bug_3709_Regression_Test) : acetest { exename = Bug_3709_Regression_Test Source_Files { Bug_3709_Regression_Test.cpp } } project(Bug_3710_Regression_Test) : acetest { exename = Bug_3710_Regression_Test Source_Files { Bug_3710_Regression_Test.cpp } } project(Bug_3729_Regression_Test) : acetest { exename = Bug_3729_Regression_Test Source_Files { Bug_3729_Regression_Test.cpp } } project(Bug_3744_Regression_Test) : acetest { exename = Bug_3744_Regression_Test Source_Files { Bug_3744_Regression_Test.cpp } } project(Bug_3758_Regression_Test) : acetest { exename = Bug_3758_Regression_Test Source_Files { Bug_3758_Regression_Test.cpp } } project(Bug_3878_Regression_Test) : acetest { exename = Bug_3878_Regression_Test Source_Files { Bug_3878_Regression_Test.cpp } } project(Bug_3911_Regression_Test) : acetest { avoids += ace_for_tao exename = Bug_3911_Regression_Test Source_Files { Bug_3911_Regression_Test.cpp } } project(Bug_3943_Regression_Test) : acetest { avoids += ace_for_tao exename = Bug_3943_Regression_Test Source_Files { Bug_3943_Regression_Test.cpp } } project(Bug_3974_Regression_Test) : acetest { exename = Bug_3974_Regression_Test Source_Files { Bug_3974_Regression_Test.cpp } } project(Bug_4055_Regression_Test) : acetest, threads { exename = Bug_4055_Regression_Test Source_Files { Bug_4055_Regression_Test.cpp } } project(Bug_4189_Regression_Test) : acetest, threads { avoids += ace_for_tao exename = Bug_4189_Regression_Test Source_Files { Bug_4189_Regression_Test.cpp } } project(Cache Map Manager Test) : acetest { exename = Cache_Map_Manager_Test Source_Files { Cache_Map_Manager_Test.cpp } } project(Memcpy_Test) : acetest { avoids += ace_for_tao exename = Memcpy_Test Source_Files { Memcpy_Test.cpp } } project(Cached Accept Conn Test) : acetest { avoids += ace_for_tao exename = Cached_Accept_Conn_Test Source_Files { Cached_Accept_Conn_Test.cpp } } project(Cached Allocator Test) : acetest { avoids += ace_for_tao exename = Cached_Allocator_Test Source_Files { Cached_Allocator_Test.cpp } } project(Cached Conn Test) : acetest { avoids += ace_for_tao exename = Cached_Conn_Test Source_Files { Cached_Conn_Test.cpp } } project(Capabilities Test) : acetest { avoids += ace_for_tao exename = Capabilities_Test Source_Files { Capabilities_Test.cpp } } project(CDR File Test) : acetest { avoids += ace_for_tao exename = CDR_File_Test Source_Files { CDR_File_Test.cpp } } project(CDR Fixed Test) : acetest { avoids += ace_for_tao exename = CDR_Fixed_Test Source_Files { CDR_Fixed_Test.cpp } } project(CDR Test) : acetest { exename = CDR_Test Source_Files { CDR_Test.cpp } } project(Chrono Test) : acetest { exename = Chrono_Test Source_Files { Chrono_Test.cpp } } project(Collection Test) : acetest { exename = Collection_Test Source_Files { Collection_Test.cpp } } project(Compiler_Features_01_Test) : acetest { exename = Compiler_Features_01_Test Source_Files { Compiler_Features_01_Test.cpp } } project(Compiler_Features_02_Test) : acetest { exename = Compiler_Features_02_Test Source_Files { Compiler_Features_02_Test.cpp } } project(Compiler_Features_03_Test) : acetest { exename = Compiler_Features_03_Test Source_Files { Compiler_Features_03_Test.cpp } } project(Compiler_Features_04_Test) : acetest { exename = Compiler_Features_04_Test Source_Files { Compiler_Features_04_Test.cpp } } project(Compiler_Features_05_Test) : acetest { exename = Compiler_Features_05_Test Source_Files { Compiler_Features_05_Test.cpp } } project(Compiler_Features_06_Test) : acetest { exename = Compiler_Features_06_Test Source_Files { Compiler_Features_06_Test.cpp } } project(Compiler_Features_07_Test) : acetest { exename = Compiler_Features_07_Test Source_Files { Compiler_Features_07_Test.cpp } } project(Compiler_Features_09_Test) : acetest { exename = Compiler_Features_09_Test Source_Files { Compiler_Features_09_Test.cpp } } project(Compiler_Features_10_Test) : acetest { exename = Compiler_Features_10_Test Source_Files { Compiler_Features_10_Test.cpp } } project(Compiler_Features_11_Test) : acetest { exename = Compiler_Features_11_Test Source_Files { Compiler_Features_11_Test.cpp } } project(Compiler_Features_12_Test) : acetest { exename = Compiler_Features_12_Test Source_Files { Compiler_Features_12_Test.cpp } } project(Compiler_Features_13_Test) : acetest { exename = Compiler_Features_13_Test Source_Files { Compiler_Features_13_Test.cpp } } project(Compiler_Features_14_Test) : acetest { exename = Compiler_Features_14_Test Source_Files { Compiler_Features_14_Test.cpp } } project(Compiler_Features_15_Test) : acetest { exename = Compiler_Features_15_Test Source_Files { Compiler_Features_15_Test.cpp } } project(Compiler_Features_16_Test) : acetest { exename = Compiler_Features_16_Test Source_Files { Compiler_Features_16_Test.cpp } specific(prop:microsoft) { macros += NOMINMAX // Don't #define min and max in Win32 headers } } project(Compiler_Features_17_Test) : acetest { exename = Compiler_Features_17_Test Source_Files { Compiler_Features_17_Test.cpp } specific(prop:microsoft) { macros += NOMINMAX // Don't #define min and max in Win32 headers } } project(Compiler_Features_18_Test) : acetest { exename = Compiler_Features_18_Test Source_Files { Compiler_Features_18_Test.cpp } } project(Compiler_Features_19_Test) : acetest { exename = Compiler_Features_19_Test Source_Files { Compiler_Features_19_Test.cpp } } project(Compiler_Features_20_Test) : acelib { libout = . sharedname = Compiler_Features_20 dynamicflags += COMPILER_FEATURES_20_DLL_BUILD_DLL Source_Files { Compiler_Features_20_DLL.cpp } Header_Files { Compiler_Features_20_DLL.h Compiler_Features_20_DLL_Export.h } Resource_Files { } } project(Compiler_Features_21_Test) : acetest { exename = Compiler_Features_21_Test Source_Files { Compiler_Features_21_Test.cpp } } project(Compiler_Features_22_Test) : acelib { libout = . sharedname = Compiler_Features_22 dynamicflags += COMPILER_FEATURES_22_DLL_BUILD_DLL Source_Files { Compiler_Features_22_DLL.cpp } Header_Files { Compiler_Features_22_DLL.h Compiler_Features_22_DLL_Export.h } Resource_Files { } } project(Compiler_Features_23_Test) : acetest { exename = Compiler_Features_23_Test Source_Files { Compiler_Features_23_Test.cpp } } project(Compiler_Features_24_Test) : acetest { exename = Compiler_Features_24_Test Source_Files { Compiler_Features_24_Test.cpp } } project(Compiler_Features_25_Test) : acetest { exename = Compiler_Features_25_Test Source_Files { Compiler_Features_25_Test.cpp } } project(Compiler_Features_26_Test) : acetest { exename = Compiler_Features_26_Test Source_Files { Compiler_Features_26_Test.cpp } } project(Compiler_Features_27_Test) : acetest { exename = Compiler_Features_27_Test Source_Files { Compiler_Features_27_Test.cpp } } project(Compiler_Features_28_Test) : acetest { exename = Compiler_Features_28_Test Source_Files { Compiler_Features_28_Test.cpp } } project(Compiler_Features_29_Test) : acetest { exename = Compiler_Features_29_Test Source_Files { Compiler_Features_29_Test.cpp } } project(Compiler_Features_31_Test) : acetest { exename = Compiler_Features_31_Test Source_Files { Compiler_Features_31_Test.cpp } } project(Compiler_Features_32_Test) : acetest { exename = Compiler_Features_32_Test Source_Files { Compiler_Features_32_Test.cpp } } project(Compiler_Features_33_Test) : acetest { exename = Compiler_Features_33_Test Source_Files { Compiler_Features_33_Test.cpp } } project(Compiler_Features_34_Test) : acetest { exename = Compiler_Features_34_Test Source_Files { Compiler_Features_34_Test.cpp } } project(Compiler_Features_35_Test) : acetest { exename = Compiler_Features_35_Test Source_Files { Compiler_Features_35_Test.cpp } } project(Compiler_Features_36_Test) : acetest { exename = Compiler_Features_36_Test Source_Files { Compiler_Features_36_Test.cpp } } project(Compiler_Features_37_Test) : acetest { exename = Compiler_Features_37_Test Source_Files { Compiler_Features_37_Test.cpp } } project(Compiler_Features_38_Test) : acetest { exename = Compiler_Features_38_Test Source_Files { Compiler_Features_38_Test.cpp } } project(Compiler_Features_39_Test) : acetest { exename = Compiler_Features_39_Test Source_Files { Compiler_Features_39_Test.cpp } } project(Compiler_Features_40_Test) : acetest { exename = Compiler_Features_40_Test Source_Files { Compiler_Features_40_Test.cpp } } project(Compiler_Features_41_Test) : acetest { exename = Compiler_Features_41_Test Source_Files { Compiler_Features_41_Test.cpp } } project(Compiler_Features_42_Test) : acetest { exename = Compiler_Features_42_Test Source_Files { Compiler_Features_42_Test.cpp } // Visual Studio 2019/2022 give an internal compiler error when using C++17 (the default for ACE) specific(vs2019,vs2022) { LanguageStandard = stdcpp20 } } project(Config Test) : acetest { avoids += ace_for_tao exename = Config_Test Source_Files { Config_Test.cpp } Documentation_Files { Config_Test.ini Config_Test_Import_1.ini } } project(Conn Test) : acetest { avoids += ace_for_tao exename = Conn_Test Source_Files { Conn_Test.cpp } } project(Date Time Test) : acetest { avoids += ace_for_tao exename = Date_Time_Test Source_Files { Date_Time_Test.cpp } } project(Dev Poll Reactor Test) : acetest { exename = Dev_Poll_Reactor_Test Source_Files { Dev_Poll_Reactor_Test.cpp } } project(Dev Poll Reactor Echo Test) : acetest { exename = Dev_Poll_Reactor_Echo_Test Source_Files { Dev_Poll_Reactor_Echo_Test.cpp } } project(Dirent Test) : acetest { exename = Dirent_Test Source_Files { Dirent_Test.cpp } } project(DLList Test) : acetest { avoids += ace_for_tao exename = DLList_Test Source_Files { DLList_Test.cpp } } project(DLL Test) : acetest, dll_test_parent_lib { after += DLL_Test_Lib libs += DLL_Test_Lib exename = DLL_Test Source_Files { DLL_Test.cpp } } project(Dynamic Test) : acetest { exename = Dynamic_Test Source_Files { Dynamic_Test.cpp } } project(Enum Interfaces Test) : acetest { exename = Enum_Interfaces_Test Source_Files { Enum_Interfaces_Test.cpp } } project(Env Value Test) : acetest { exename = Env_Value_Test Source_Files { Env_Value_Test.cpp } } project(Future Test) : acetest { avoids += ace_for_tao exename = Future_Test Source_Files { Future_Test.cpp } } project(Future Set Test) : acetest { avoids += ace_for_tao exename = Future_Set_Test Source_Files { Future_Set_Test.cpp } } project(Future Stress Test) : acetest { avoids += ace_for_tao exename = Future_Stress_Test Source_Files { Future_Stress_Test.cpp } } project(Get Opt Test) : acetest { exename = Get_Opt_Test Source_Files { Get_Opt_Test.cpp } } project(Handle Set Test) : acetest { avoids += ace_for_tao exename = Handle_Set_Test Source_Files { Handle_Set_Test.cpp } } project(High Res Timer Test) : acetest { avoids += ace_for_tao exename = High_Res_Timer_Test Source_Files { High_Res_Timer_Test.cpp } } project(NDDS Timer Test) : acetest, nddsexe { exename = NDDS_Timer_Test Source_Files { NDDS_Timer_Test.cpp } } project(Hash Map Manager Test) : acetest { exename = Hash_Map_Manager_Test Source_Files { Hash_Map_Manager_Test.cpp } Template_Files { STL_algorithm_Test_T.cpp } } project(Hash Multi Map Manager Test) : acetest { exename = Hash_Multi_Map_Manager_Test Source_Files { Hash_Multi_Map_Manager_Test.cpp } } project(Hash Map Bucket Iterator Test) : acetest { exename = Hash_Map_Bucket_Iterator_Test Source_Files { Hash_Map_Bucket_Iterator_Test.cpp } } project(INET Addr Test) : acetest { exename = INET_Addr_Test Source_Files { INET_Addr_Test.cpp } } project(Integer_Truncate Test) : acetest { exename = Integer_Truncate_Test Source_Files { Integer_Truncate_Test.cpp } } project(Intrusive Auto Ptr Test) : acetest { exename = Intrusive_Auto_Ptr_Test Source_Files { Intrusive_Auto_Ptr_Test.cpp } } project(IOStream Test) : acetest { exename = IOStream_Test Source_Files { IOStream_Test.cpp } } project(Lazy Map Manager Test) : acetest { exename = Lazy_Map_Manager_Test Source_Files { Lazy_Map_Manager_Test.cpp } } project(Log Msg Test) : acetest { avoids += ace_for_tao exename = Log_Msg_Test Source_Files { Log_Msg_Test.cpp } } project(Log Msg Backend Test) : acetest { avoids += ace_for_tao exename = Log_Msg_Backend_Test Source_Files { Log_Msg_Backend_Test.cpp } } project(Logging Strategy Test) : acetest { exename = Logging_Strategy_Test Source_Files { Logging_Strategy_Test.cpp } } project(Malloc Test) : acetest { avoids += ace_for_tao exename = Malloc_Test Source_Files { Malloc_Test.cpp } } project(Manual_Event Test) : acetest { exename = Manual_Event_Test Source_Files { Manual_Event_Test.cpp } } project(Map Test) : acetest { avoids += ace_for_tao exename = Map_Test Source_Files { Map_Test.cpp } } project(Map Manager Test) : acetest { avoids += ace_for_tao exename = Map_Manager_Test Source_Files { Map_Manager_Test.cpp } } project(Max Default Port Test) : acetest { exename = Max_Default_Port_Test Source_Files { Max_Default_Port_Test.cpp } } project(MEM Stream Test) : acetest { avoids += ace_for_tao exename = MEM_Stream_Test Source_Files { MEM_Stream_Test.cpp } } project(Mem Map Test) : acetest { avoids += ace_for_tao exename = Mem_Map_Test Source_Files { Mem_Map_Test.cpp } } project(MM Shared Memory Test) : acetest { avoids += ace_for_tao exename = MM_Shared_Memory_Test Source_Files { MM_Shared_Memory_Test.cpp } } project(MT Reactor Timer Test) : acetest { exename = MT_Reactor_Timer_Test Source_Files { MT_Reactor_Timer_Test.cpp } } project(MT Reactor Upcall Test) : acetest { exename = MT_Reactor_Upcall_Test Source_Files { MT_Reactor_Upcall_Test.cpp } } project(MT SOCK Test) : acetest { exename = MT_SOCK_Test Source_Files { MT_SOCK_Test.cpp } } project(Message Block Test) : acetest { avoids += ace_for_tao exename = Message_Block_Test Source_Files { Message_Block_Test.cpp } } project(Message Queue Test) : acetest { avoids += ace_for_tao exename = Message_Queue_Test Source_Files { Message_Queue_Test.cpp } } project(Monotonic_Manual_Event Test) : acetest { exename = Monotonic_Manual_Event_Test Source_Files { Monotonic_Manual_Event_Test.cpp } } project(Monotonic_Task Test) : acetest { avoids += ace_for_tao exename = Monotonic_Task_Test Source_Files { Monotonic_Task_Test.cpp } } project(Monotonic_Message Queue Test) : acetest { avoids += ace_for_tao exename = Monotonic_Message_Queue_Test Source_Files { Monotonic_Message_Queue_Test.cpp } } project(Message Queue Test Ex) : acetest { avoids += ace_for_tao exename = Message_Queue_Test_Ex Source_Files { Message_Queue_Test_Ex.cpp } } project(Message Queue Notifications Test) : acetest { exename = Message_Queue_Notifications_Test Source_Files { Message_Queue_Notifications_Test.cpp } } project(Multicast Test) : acetest { exename = Multicast_Test Source_Files { Multicast_Test.cpp } } project(Multicast Interfaces Test) : acetest { exename = Multicast_Interfaces_Test Source_Files { Multicast_Interfaces_Test.cpp } } project(Multihomed INET Addr Test) : acetest { avoids += ace_for_tao exename = Multihomed_INET_Addr_Test Source_Files { Multihomed_INET_Addr_Test.cpp } } project(Network_Adapters_Test) : acetest { avoids += ace_for_tao exename = Network_Adapters_Test Source_Files { Network_Adapters_Test.cpp } } project(New Fail Test) : acetest { exename = New_Fail_Test Source_Files { New_Fail_Test.cpp } } project(Notification Queue Unit Test) : acetest { exename = Notification_Queue_Unit_Test Source_Files { Notification_Queue_Unit_Test.cpp } } project(Notify Performance Test) : acetest { avoids += ace_for_tao exename = Notify_Performance_Test Source_Files { Notify_Performance_Test.cpp } } project(Object Manager Test) : acetest { exename = Object_Manager_Test Source_Files { Object_Manager_Test.cpp } } project(Object Manager Flipping Test) : acetest { exename = Object_Manager_Flipping_Test Source_Files { Object_Manager_Flipping_Test.cpp } } project(Obstack Test) : acetest { exename = Obstack_Test Source_Files { Obstack_Test.cpp } } project(OrdMultiSet Test) : acetest { exename = OrdMultiSet_Test Source_Files { OrdMultiSet_Test.cpp } } project(OS Test) : acetest { exename = OS_Test Source_Files { OS_Test.cpp } } project(Proactor Scatter Gather Test) : acetest { avoids += ace_for_tao exename = Proactor_Scatter_Gather_Test Source_Files { Proactor_Scatter_Gather_Test.cpp } } project(Proactor Test) : acetest { avoids += ace_for_tao exename = Proactor_Test Source_Files { Proactor_Test.cpp } } project(Proactor_File Test) : acetest { avoids += ace_for_tao exename = Proactor_File_Test Source_Files { Proactor_File_Test.cpp } } project(Proactor Timer Test) : acetest { avoids += ace_for_tao exename = Proactor_Timer_Test Source_Files { Proactor_Timer_Test.cpp } } project(Proactor UDP Test) : acetest { avoids += ace_for_tao exename = Proactor_UDP_Test Source_Files { Proactor_UDP_Test.cpp } } project(Process Manual Event Test) : acetest { exename = Process_Manual_Event_Test Source_Files { Process_Manual_Event_Test.cpp } } project(Process Mutex Test) : acetest { avoids += ace_for_tao exename = Process_Mutex_Test Source_Files { Process_Mutex_Test.cpp } } project(Process Semaphore Test) : acetest { avoids += ace_for_tao exename = Process_Semaphore_Test Source_Files { Process_Semaphore_Test.cpp } } project(Process Strategy Test) : acetest { avoids += ace_for_tao // Requires ace/File_Lock exename = Process_Strategy_Test Source_Files { Process_Strategy_Test.cpp } } project(Priority Buffer Test) : acetest { exename = Priority_Buffer_Test Source_Files { Priority_Buffer_Test.cpp } } project(Dynamic Priority Test) : acetest { exename = Dynamic_Priority_Test Source_Files { Dynamic_Priority_Test.cpp } } project(Priority Task Test) : acetest { exename = Priority_Task_Test Source_Files { Priority_Task_Test.cpp } } project(Priority Reactor Test) : acetest { avoids += ace_for_tao exename = Priority_Reactor_Test Source_Files { Priority_Reactor_Test.cpp } } project(Process Test) : acetest { avoids += ace_for_tao exename = Process_Test Source_Files { Process_Test.cpp } } project(Process Manager Test) : acetest { avoids += ace_for_tao exename = Process_Manager_Test Source_Files { Process_Manager_Test.cpp } } project(Pipe Test) : acetest { exename = Pipe_Test Source_Files { Pipe_Test.cpp } } project(RB Tree Test) : acetest { exename = RB_Tree_Test Source_Files { RB_Tree_Test.cpp } } project(Bug_3332_Regression_Test) : acetest { exename = Bug_3332_Regression_Test Source_Files { Bug_3332_Regression_Test.cpp } } project(Reactors Test) : acetest { exename = Reactors_Test Source_Files { Reactors_Test.cpp } } project(Reactor Exceptions Test) : acetest { exename = Reactor_Exceptions_Test Source_Files { Reactor_Exceptions_Test.cpp } } project(Reactor Notify Test) : acetest { avoids += ace_for_tao exename = Reactor_Notify_Test Source_Files { Reactor_Notify_Test.cpp } } project(Reactor Notification Queue Test) : acetest { exename = Reactor_Notification_Queue_Test Source_Files { Reactor_Notification_Queue_Test.cpp } } project(Reactor Dispatch Order Test) : acetest { exename = Reactor_Dispatch_Order_Test Source_Files { Reactor_Dispatch_Order_Test.cpp } } project(Reactor_Dispatch_Order_Test_Dev_Poll) : acetest { exename = Reactor_Dispatch_Order_Test_Dev_Poll Source_Files { Reactor_Dispatch_Order_Test_Dev_Poll.cpp } } project(Reactor Fairness Test) : acetest { exename = Reactor_Fairness_Test Source_Files { Reactor_Fairness_Test.cpp } } project(Reactor Performance Test) : acetest { avoids += ace_for_tao exename = Reactor_Performance_Test Source_Files { Reactor_Performance_Test.cpp } } project(Reactor Remove Resume Test) : acetest { exename = Reactor_Remove_Resume_Test Source_Files { Reactor_Remove_Resume_Test.cpp } } project(Reactor_Remove_Resume_Test_Dev_Poll) : acetest { exename = Reactor_Remove_Resume_Test_Dev_Poll Source_Files { Reactor_Remove_Resume_Test_Dev_Poll.cpp } } project(Reactor Timer Test) : acetest { avoids += ace_for_tao exename = Reactor_Timer_Test Source_Files { Reactor_Timer_Test.cpp } } project(Reader Writer Test) : acetest { exename = Reader_Writer_Test Source_Files { Reader_Writer_Test.cpp } } project(Recursive Condition Bug Test) : acetest { exename = Recursive_Condition_Bug_Test Source_Files { Recursive_Condition_Bug_Test.cpp } } project(Recursive Condition Test) : acetest { exename = Recursive_Condition_Test Source_Files { Recursive_Condition_Test.cpp } } project(Recursive Mutex Test) : acetest { exename = Recursive_Mutex_Test Source_Files { Recursive_Mutex_Test.cpp } } project(Refcounted Auto Ptr Test) : acetest { avoids += ace_for_tao exename = Refcounted_Auto_Ptr_Test Source_Files { Refcounted_Auto_Ptr_Test.cpp } } project(Reverse Lock Test) : acetest { exename = Reverse_Lock_Test Source_Files { Reverse_Lock_Test.cpp } } project(RW Process Mutex Test) : acetest { avoids += ace_for_tao exename = RW_Process_Mutex_Test Source_Files { RW_Process_Mutex_Test.cpp } } project(Semaphore Test) : acetest { avoids += ace_for_tao exename = Semaphore_Test Source_Files { Semaphore_Test.cpp } } project(Sendfile Test) : acetest { exename = Sendfile_Test Source_Files { Sendfile_Test.cpp } } project(Sig Handlers Test) : acetest { exename = Sig_Handlers_Test Source_Files { Sig_Handlers_Test.cpp } } project(Signal Test) : acetest { exename = Signal_Test Source_Files { Signal_Test.cpp } } project(Sigset Ops Test) : acetest { exename = Sigset_Ops_Test Source_Files { Sigset_Ops_Test.cpp } } project(Simple Message Block Test) : acetest { exename = Simple_Message_Block_Test Source_Files { Simple_Message_Block_Test.cpp } } project(Message Block Large Copy Test) : acetest { exename = Message_Block_Large_Copy_Test Source_Files { Message_Block_Large_Copy_Test.cpp } } project(Singleton Test) : acetest { exename = Singleton_Test Source_Files { Singleton_Test.cpp } } project(Singleton Restart Test) : aceexe { exename = Singleton_Restart_Test after += Test_Output libs += Test_Output Source_Files { Singleton_Restart_Test.cpp } Header_Files { } Template_Files { } Resource_Files { } Svc_Conf_Files { } } project(SOCK Acceptor_Test) : acetest { exename = SOCK_Acceptor_Test Source_Files { SOCK_Acceptor_Test.cpp } } project(SOCK Test) : acetest { exename = SOCK_Test Source_Files { SOCK_Test.cpp } } project(SOCK Dgram Test) : acetest { exename = SOCK_Dgram_Test Source_Files { SOCK_Dgram_Test.cpp } } project(SOCK Connector Test) : acetest { exename = SOCK_Connector_Test Source_Files { SOCK_Connector_Test.cpp } } project(SOCK Netlink Test) : acetest { avoids += ace_for_tao exename = SOCK_Netlink_Test Source_Files { SOCK_Netlink_Test.cpp } } project(SOCK Send Recv Test) : acetest { exename = SOCK_Send_Recv_Test Source_Files { SOCK_Send_Recv_Test.cpp } } project(SPIPE Test) : acetest { avoids += ace_for_tao exename = SPIPE_Test Source_Files { SPIPE_Test.cpp } } project(SString Test) : acetest { exename = SString_Test Source_Files { SString_Test.cpp } } project(SV Shared Memory Test) : acetest { avoids += ace_for_tao exename = SV_Shared_Memory_Test Source_Files { SV_Shared_Memory_Test.cpp } } project(Svc Handler Test) : acetest { avoids += ace_for_tao exename = Svc_Handler_Test Source_Files { Svc_Handler_Test.cpp } } project(Task Test) : acetest { exename = Task_Test Source_Files { Task_Test.cpp } } project(Task_Group Test) : acetest { exename = Task_Group_Test Source_Files { Task_Group_Test.cpp } } project(Task_Ex Test) : acetest { exename = Task_Ex_Test Source_Files { Task_Ex_Test.cpp } } project(Thread Manager Test) : acetest { exename = Thread_Manager_Test Source_Files { Thread_Manager_Test.cpp } } project(Thread Attrs Test) : acetest { exename = Thread_Attrs_Test Source_Files { Thread_Attrs_Test.cpp } } project(Thread Mutex Test) : acetest { exename = Thread_Mutex_Test Source_Files { Thread_Mutex_Test.cpp } } project(Thread Pool Test) : acetest { exename = Thread_Pool_Test Source_Files { Thread_Pool_Test.cpp } } project(Thread_Timer_Queue_Adapter_Test) : acetest { exename = Thread_Timer_Queue_Adapter_Test Source_Files { Thread_Timer_Queue_Adapter_Test.cpp } } project(Thread Creation Threshold Test) : acetest { exename = Thread_Creation_Threshold_Test Source_Files { Thread_Creation_Threshold_Test.cpp } } project(Timeprobe Test) : acetest { exename = Timeprobe_Test Source_Files { Timeprobe_Test.cpp } } project(Time Service Test) : acetest { exename = Time_Service_Test Source_Files { Time_Service_Test.cpp } } project(Time Value Test) : acetest { exename = Time_Value_Test Source_Files { Time_Value_Test.cpp } } project(Timer Queue Test) : acetest { avoids += ace_for_tao exename = Timer_Queue_Test Header_Files { randomize.h } Source_Files { Timer_Queue_Test.cpp } } project(Token Strategy Test) : acetest { exename = Token_Strategy_Test Source_Files { Token_Strategy_Test.cpp } } project(TP Reactor Test) : acetest { avoids += ace_for_tao exename = TP_Reactor_Test Source_Files { TP_Reactor_Test.cpp } } project(TSS Test) : acetest { exename = TSS_Test Source_Files { TSS_Test.cpp } } project(TSS Leak Test) : acetest { exename = TSS_Leak_Test Source_Files { TSS_Leak_Test.cpp } } project(TSS Static Test) : acetest { exename = TSS_Static_Test Source_Files { TSS_Static_Test.cpp } } project(Vector Test) : acetest { exename = Vector_Test Source_Files { Vector_Test.cpp } } project(UPIPE SAP Test) : acetest { avoids += ace_for_tao exename = UPIPE_SAP_Test Source_Files { UPIPE_SAP_Test.cpp } } project(Upgradable RW Test) : acetest { avoids += ace_for_tao exename = Upgradable_RW_Test Source_Files { Upgradable_RW_Test.cpp } } project(Naming Test) : acetest { avoids += ace_for_tao exename = Naming_Test requires += ace_other Header_Files { randomize.h } Source_Files { Naming_Test.cpp } } project(Thread Pool Reactor Test) : acetest { exename = Thread_Pool_Reactor_Test requires += ace_other Source_Files { Thread_Pool_Reactor_Test.cpp } } project(Thread Pool Reactor Resume Test) : acetest { exename = Thread_Pool_Reactor_Resume_Test requires += ace_other Source_Files { Thread_Pool_Reactor_Resume_Test.cpp } } project(XtMotifReactor Test) : acetest, ace_xtreactor, ace_motif { exename = XtMotifReactor_Test Source_Files { XtMotifReactor_Test.cpp } } project(XtAthenaReactor Test) : acetest, ace_xtreactor, ace_athena { exename = XtAthenaReactor_Test Source_Files { XtAthenaReactor_Test.cpp } } project(XtAthena3dReactor Test) : acetest, ace_xtreactor, ace_athena3d { exename = XtAthena3dReactor_Test Source_Files { XtAthenaReactor_Test.cpp } } project(FlReactor Test) : acetest, ace_flreactor { exename = FlReactor_Test Source_Files { FlReactor_Test.cpp } } project(TkReactor Test) : acetest,ace_tkreactor { exename = TkReactor_Test Source_Files { TkReactor_Test.cpp } } project(Codecs Test) : acetest { avoids += ace_for_tao exename = Codecs_Test requires += ace_codecs Source_Files { Codecs_Test.cpp } } project(Tokens Test) : acetest { exename = Tokens_Test requires += ace_token Source_Files { Tokens_Test.cpp } } project(CDR Array Test) : acetest { avoids += ace_for_tao exename = CDR_Array_Test Source_Files { CDR_Array_Test.cpp } } project(Service Config Test) : acetest { after += Service_Config_DLL exename = Service_Config_Test Source_Files { Service_Config_Test.cpp } specific(vxtest) { libs += Service_Config_DLL } } project(Framework Component Test) : acetest { after += Framework_Component_DLL exename = Framework_Component_Test Source_Files { Framework_Component_Test.cpp } } project(FIFO Test) : acetest { avoids += ace_for_tao exename = FIFO_Test Source_Files { FIFO_Test.cpp } Header_Files { } } project(WFMO Reactor Test) : acetest { exename = WFMO_Reactor_Test Source_Files { WFMO_Reactor_Test.cpp } Header_Files { } } project(NonBlocking Conn Test) : acetest { exename = NonBlocking_Conn_Test Source_Files { NonBlocking_Conn_Test.cpp } Header_Files { } } project(MT NonBlocking Connect Test) : acetest { exename = MT_NonBlocking_Connect_Test Source_Files { MT_NonBlocking_Connect_Test.cpp } Header_Files { } } project(Reference Counted Event Handler Test) : acetest { exename = Reference_Counted_Event_Handler_Test Source_Files { Reference_Counted_Event_Handler_Test.cpp } Header_Files { } } project(Refcounted_Event_Handler_Test_DevPoll) : acetest { exename = Refcounted_Event_Handler_Test_DevPoll Source_Files { Refcounted_Event_Handler_Test_DevPoll.cpp } Header_Files { } } project(MT Ref Counted Event Handler Test) : acetest { exename = MT_Reference_Counted_Event_Handler_Test Source_Files { MT_Reference_Counted_Event_Handler_Test.cpp } Header_Files { } } project(MT Reference Counted Notify Test) : acetest { exename = MT_Reference_Counted_Notify_Test Source_Files { MT_Reference_Counted_Notify_Test.cpp } Header_Files { } } project(Timer Cancellation Test) : acetest { exename = Timer_Cancellation_Test Source_Files { Timer_Cancellation_Test.cpp } Header_Files { } } project(Timer Queue Reference Counting Test) : acetest { exename = Timer_Queue_Reference_Counting_Test Source_Files { Timer_Queue_Reference_Counting_Test.cpp } Header_Files { } } project(Reactor Registration Test) : acetest { exename = Reactor_Registration_Test Source_Files { Reactor_Registration_Test.cpp } Header_Files { } } project(UUID_Test) : acetest { avoids += ace_for_tao exename = UUID_Test requires += ace_uuid Source_Files { UUID_Test.cpp } } project(Unbounded Set Test) : acetest { exename = Unbounded_Set_Test Source_Files { Unbounded_Set_Test.cpp } } project(INET Addr Test IPV6) : acetest { exename = INET_Addr_Test_IPV6 Source_Files { INET_Addr_Test_IPV6.cpp } } project(Max Default Port Test IPV6) : acetest { exename = Max_Default_Port_Test_IPV6 Source_Files { Max_Default_Port_Test_IPV6.cpp } } project(Multicast Test IPV6) : acetest { exename = Multicast_Test_IPV6 Source_Files { Multicast_Test_IPV6.cpp } } project(Multihomed INET Addr Test IPV6) : acetest { avoids += ace_for_tao exename = Multihomed_INET_Addr_Test_IPV6 Source_Files { Multihomed_INET_Addr_Test_IPV6.cpp } } project(Proactor Test IPV6) : acetest { avoids += ace_for_tao exename = Proactor_Test_IPV6 Source_Files { Proactor_Test_IPV6.cpp } } project(SOCK Send Recv Test IPV6) : acetest { exename = SOCK_Send_Recv_Test_IPV6 Source_Files { SOCK_Send_Recv_Test_IPV6.cpp } } project(SOCK Test IPv6) : acetest { exename = SOCK_Test_IPv6 Source_Files { SOCK_Test_IPv6.cpp } } project(SOCK_Dgram_Bcast_Test) : acetest { avoids += ace_for_tao exename = SOCK_Dgram_Bcast_Test Source_Files { SOCK_Dgram_Bcast_Test.cpp } } project(SOCK_SEQPACK_SCTP_Test) : acetest { avoids += ace_for_tao exename = SOCK_SEQPACK_SCTP_Test Source_Files { SOCK_SEQPACK_SCTP_Test.cpp } } project(QtReactor Test) : acetest, ace_qtreactor { exename = QtReactor_Test MOC_Files { QtReactor_Test.h } Source_Files { QtReactor_Test_moc.cpp QtReactor_Test.cpp } } project(Based Pointer Test) : acetest { avoids += ace_for_tao after += Based_Pointer_Test_Lib exename = Based_Pointer_Test Source_Files { Based_Pointer_Test.cpp } specific(vxtest) { libs += Based_Pointer_Test_Lib } } project(Library Unload): unload_libace { exename = UnloadLibACE staticflags += ACE_AS_STATIC_LIBS Source_Files { Unload_libACE.cpp } Resource_Files { } } project(Bug_2659_Regression_Test) : acetest { exename = Bug_2659_Regression_Test Source_Files { Bug_2659_Regression_Test.cpp } } project(Bug_2609_Regression_Test) : acetest { avoids += ace_for_tao exename = Bug_2609_Regression_Test Source_Files { Bug_2609_Regression_Test.cpp } } project(Bug_2610_Regression_Test) : acetest { avoids += ace_for_tao exename = Bug_2610_Regression_Test Source_Files { Bug_2610_Regression_Test.cpp } } project(Process_Env_Test) : acetest { exename = Process_Env_Test Source_Files { Process_Env_Test.cpp } } project(Log_Thread_Inheritance_Test) : acetest { exename = Log_Thread_Inheritance_Test Source_Files { Log_Thread_Inheritance_Test.cpp } } project(Wild_Match_Test) : acetest { exename = Wild_Match_Test Source_Files { Wild_Match_Test.cpp } } project(Service Config Stream DLL) : acelib { libout = . sharedname = Service_Config_Stream_DLL dynamicflags += SERVICE_CONFIG_STREAM_DLL_BUILD_DLL Source_Files { Service_Config_Stream_DLL.cpp } Header_Files { Service_Config_Stream_DLL.h Service_Config_Stream_DLL_Export.h } Resource_Files { } } project(Service Config Stream Test) : acetest { after += Service_Config_Stream_DLL exename = Service_Config_Stream_Test Source_Files { Service_Config_Stream_Test.cpp } specific(vxtest) { libs += Service_Config_Stream_DLL } } project(Bug_3334_Regression_Test) : acetest { after += Service_Config_Stream_DLL exename = Bug_3334_Regression_Test Source_Files { Bug_3334_Regression_Test.cpp } } project(Bug_3912_Regression_Test) : acetest { after += Service_Config_Stream_DLL exename = Bug_3912_Regression_Test Source_Files { Bug_3912_Regression_Test.cpp } } project(Missing_Svc_Conf_Test) : acetest { exename = Missing_Svc_Conf_Test Source_Files { Missing_Svc_Conf_Test.cpp } } project(UNIX Addr Test) : acetest { avoids += ace_for_tao exename = UNIX_Addr_Test Source_Files { UNIX_Addr_Test.cpp } } ace-8.0.4+dfsg.orig/tests/Cache_Map_Manager_Test.cpp0000644000175000017500000003755215027201773021302 0ustar sudipsudip //============================================================================= /** * @file Cache_Map_Manager_Test.cpp * * This is a test of the and * that illustrates how to use the * forward and reverse iterators, as well as the purging and * caching features. * * @author Kirthika Parameswaran */ //============================================================================= #include "ace/OS_NS_string.h" #include "ace/OS_Memory.h" #include "ace/OS_NS_stdlib.h" #include "ace/OS_NS_time.h" #include "test_config.h" #include "ace/Hash_Cache_Map_Manager_T.h" #include "ace/Map_Manager.h" #include "ace/Caching_Strategies_T.h" #include "ace/Functor.h" #include "ace/Get_Opt.h" #include "Cache_Map_Manager_Test.h" // Hash_Key class defined in here using KEY = size_t; using VALUE = size_t; using ATTR = int; using CACHE_VALUE = std::pair; using COMPARE_KEYS = ACE_Equal_To; using HASH_MAP_MANAGER = ACE_Hash_Map_Manager_Ex, ACE_Null_Mutex>; using HASH_MAP_ITERATOR = ACE_Hash_Map_Iterator_Ex, ACE_Null_Mutex>; using HASH_MAP_REVERSE_ITERATOR = ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Null_Mutex>; using MAP_MANAGER = ACE_Map_Manager; using MAP_ITERATOR = ACE_Map_Iterator; using MAP_REVERSE_ITERATOR = ACE_Map_Reverse_Iterator; using HASH_MAP_CLEANUP = ACLE; using MAP_CLEANUP = ACLE; using HASH_MAP_CACHING_UTILITY = ACE_Pair_Caching_Utility; using MAP_CACHING_UTILITY = ACE_Pair_Caching_Utility; // = Hash_Map_Manager related using HASH_MAP_CACHING_STRATEGY = ACS; using HASH_MAP_LRU = ALRU; using HASH_MAP_LFU = ALFU; using HASH_MAP_FIFO = AFIFO; using HASH_MAP_NULL = ANULL; using HASH_MAP_LRU_ADAPTER = ACSA; using HASH_MAP_LFU_ADAPTER = ACSA; using HASH_MAP_FIFO_ADAPTER = ACSA; using HASH_MAP_NULL_ADAPTER = ACSA; // = Map_Manager related using MAP_CACHING_STRATEGY = ACS; using MAP_LRU = ALRU; using MAP_LFU = ALFU; using MAP_FIFO = AFIFO; using MAP_NULL = ANULL; using MAP_LRU_ADAPTER = ACSA; using MAP_LFU_ADAPTER = ACSA; using MAP_FIFO_ADAPTER = ACSA; using MAP_NULL_ADAPTER = ACSA; using HASH_MAP_CACHE = ACE_Hash_Cache_Map_Manager, HASH_MAP_CACHING_STRATEGY, ATTR>; using MAP_CACHE = ACMM; enum Caching_Strategy_Type { ACE_LFU, ACE_FIFO, ACE_LRU, ACE_NULL, ACE_ALL }; static size_t iterations = ACE_MAX_ITERATIONS; static size_t no_of_lookups = iterations / 2; static int randomize_lookups = 1; static int purge_percent = 10; static int debug = 0; static Caching_Strategy_Type caching_strategy_type = ACE_ALL; static KEY *lookup_array = 0; static void run_iterator_cache (MAP_CACHE &cache) { size_t iterations = cache.current_size (); size_t counter = 0; MAP_CACHE::iterator end = cache.end (); for (MAP_CACHE::iterator iter = cache.begin (); iter != end; ++iter) { // Debugging info. ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d)"), (*iter).first (), (*iter).second ())); ACE_TEST_ASSERT ((*iter).first () == (*iter).second ()); ++counter; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_UNUSED_ARG (iterations); ACE_TEST_ASSERT (counter == iterations); } static void run_iterator_hash_cache (HASH_MAP_CACHE &cache) { size_t iterations = cache.current_size (); size_t counter = 0; HASH_MAP_CACHE::iterator end = cache.end (); for (HASH_MAP_CACHE::iterator iter = cache.begin (); iter != end; ++iter) { // Debugging info. ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d)"), (*iter).first (), (*iter).second ())); ACE_TEST_ASSERT ((*iter).first () == (*iter).second ()); ++counter; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_UNUSED_ARG (iterations); ACE_TEST_ASSERT (counter == iterations); } static void run_reverse_iterator_cache (MAP_CACHE &cache) { size_t counter = cache.current_size (); MAP_CACHE::reverse_iterator rend = cache.rend (); for (MAP_CACHE::reverse_iterator iter = cache.rbegin (); iter != rend; ++iter) { ACE_TEST_ASSERT ((*iter).first () == (*iter).second ()); // Debugging info. if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d)"), (*iter).first (), (*iter).second ())); --counter; } if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (counter == 0); } static void run_reverse_iterator_hash_cache (HASH_MAP_CACHE &cache) { size_t counter = cache.current_size (); HASH_MAP_CACHE::reverse_iterator rend = cache.rend (); for (HASH_MAP_CACHE::reverse_iterator iter = cache.rbegin (); iter != rend; ++iter) { ACE_TEST_ASSERT ((*iter).first () == (*iter).second ()); // Debugging info. if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%d|%d)"), (*iter).first (), (*iter).second ())); --counter; } if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); ACE_TEST_ASSERT (counter == 0); } static void find_test_cache (MAP_CACHE &cache) { for (size_t i = 0; i < no_of_lookups; ++i) { VALUE j = 0; int result = cache.find (lookup_array[i], j); result = cache.find (lookup_array[i]); ACE_TEST_ASSERT (result != -1); ACE_TEST_ASSERT (j == lookup_array[i]); if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%d "), j)); // Once more, with only the key. Test Bugzilla #4029. result = cache.find (lookup_array[i]); ACE_TEST_ASSERT (result != -1); ACE_UNUSED_ARG (result); } if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); } static void find_test_hash_cache (HASH_MAP_CACHE &cache) { for (size_t i = 0; i < no_of_lookups; ++i) { VALUE j = 0; int result = cache.find (lookup_array[i], j); ACE_TEST_ASSERT (result != -1); ACE_TEST_ASSERT (j == lookup_array[i]); if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%d "), j)); ACE_UNUSED_ARG (result); } if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); } static void purge_test_cache (MAP_CACHE &cache) { // Get the number of entries in the container. size_t current_map_size = cache.current_size (); // Find the number of entries which will get purged. size_t entries_to_remove = size_t ((double (purge_percent) / 100 * current_map_size) + 0.5); // Tell the caching strategy how much to purge. cache.caching_strategy ().purge_percent (purge_percent); // Purge from cache. int result = cache.purge (); ACE_TEST_ASSERT (result != -1); ACE_UNUSED_ARG (result); size_t resultant_size = 0; if (caching_strategy_type == ACE_NULL) resultant_size = current_map_size; else resultant_size = current_map_size - entries_to_remove; // Make sure the purge took out the appropriate number of entries. ACE_TEST_ASSERT (cache.current_size () == resultant_size); ACE_UNUSED_ARG (resultant_size); } static void purge_test_hash_cache (HASH_MAP_CACHE &cache) { // Get the number of entries in the container. size_t current_map_size = cache.current_size (); // Find the number of entries which will get purged. size_t entries_to_remove = size_t ((double (purge_percent) / 100 * current_map_size) + 0.5); // Tell the caching strategy how much to purge. cache.caching_strategy ().purge_percent (purge_percent); // Purge from cache. int result = cache.purge (); ACE_TEST_ASSERT (result != -1); ACE_UNUSED_ARG (result); size_t resultant_size = 0; if (caching_strategy_type == ACE_NULL) resultant_size = current_map_size; else resultant_size = current_map_size - entries_to_remove; // Make sure the purge took out the appropriate number of entries. ACE_TEST_ASSERT (cache.current_size () == resultant_size); ACE_UNUSED_ARG (resultant_size); } static void functionality_test_cache (MAP_CACHING_STRATEGY &caching_strategy) { MAP_CACHE cache (caching_strategy); KEY i = 0; VALUE j = 0; // Add it to the map now. for (size_t counter = 0; i < iterations; ++i, ++j) { int result = cache.bind (i, j); ACE_TEST_ASSERT (result == 0); ACE_UNUSED_ARG (result); if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("keys[%d]=%d value=[%d]=%d\n"), i, i, j, j)); ++counter; ACE_TEST_ASSERT (cache.current_size () == counter); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Number of entries in cache before purging: %d\n"), cache.current_size ())); run_iterator_cache (cache); run_reverse_iterator_cache (cache); find_test_cache (cache); purge_test_cache (cache); run_iterator_cache (cache); run_reverse_iterator_cache (cache); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Number of entries in cache after purging: %d\n"), cache.current_size ())); } static void functionality_test_hash_cache (HASH_MAP_CACHING_STRATEGY &caching_strategy) { HASH_MAP_CACHE cache (caching_strategy); KEY i = 0; VALUE j = 0; // Add it to the map now. for (size_t counter = 0; i < iterations; ++i, ++j) { int result = cache.bind (i, j); ACE_TEST_ASSERT (result == 0); ACE_UNUSED_ARG (result); if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("keys[%d]=%d value=[%d]=%d\n"), i, i, j, j)); ++counter; ACE_TEST_ASSERT (cache.current_size () == counter); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Number of entries in cache before purging: %d\n"), cache.current_size ())); run_iterator_hash_cache (cache); run_reverse_iterator_hash_cache (cache); find_test_hash_cache (cache); purge_test_hash_cache (cache); run_iterator_hash_cache (cache); run_reverse_iterator_hash_cache (cache); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Number of entries in cache after purging: %d\n"), cache.current_size ())); } void test_caching_strategy_type () { HASH_MAP_CACHING_STRATEGY *hash_map_caching_strategy = 0; MAP_CACHING_STRATEGY *map_caching_strategy = 0; switch (caching_strategy_type) { case ACE_NULL: ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nNull_Caching_Strategy\n\n"))); ACE_NEW (map_caching_strategy, MAP_NULL_ADAPTER); ACE_NEW (hash_map_caching_strategy, HASH_MAP_NULL_ADAPTER); break; case ACE_LRU: ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nLRU_Caching_Strategy\n\n"))); ACE_NEW (map_caching_strategy, MAP_LRU_ADAPTER); ACE_NEW (hash_map_caching_strategy, HASH_MAP_LRU_ADAPTER); break; case ACE_LFU: ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nLFU_Caching_Strategy\n\n"))); ACE_NEW (map_caching_strategy, MAP_LFU_ADAPTER); ACE_NEW (hash_map_caching_strategy, HASH_MAP_LFU_ADAPTER); break; case ACE_FIFO: ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nFIFO_Caching_Strategy\n\n"))); ACE_NEW (map_caching_strategy, MAP_FIFO_ADAPTER); ACE_NEW (hash_map_caching_strategy, HASH_MAP_FIFO_ADAPTER); break; case ACE_ALL: // Just to remove warnings! break; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("map cache\n"))); functionality_test_cache (*map_caching_strategy); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nhash map cache\n"))); functionality_test_hash_cache (*hash_map_caching_strategy); delete map_caching_strategy; delete hash_map_caching_strategy; } static int parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("c:i:r:f:p:d")); int cc; while ((cc = get_opt ()) != -1) { switch (cc) { case 'c': if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("null")) == 0) caching_strategy_type = ACE_NULL; if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("lru")) == 0) caching_strategy_type = ACE_LRU; if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("lfu")) == 0) caching_strategy_type = ACE_LFU; if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("fifo")) == 0) caching_strategy_type = ACE_FIFO; break; case 'i': iterations = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'f': no_of_lookups = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'r': randomize_lookups = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'p': purge_percent = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'd': debug = 1; break; case '?': case 'h': default: ACE_ERROR ((LM_ERROR, ACE_TEXT ("usage: %s ") ACE_TEXT ("[-c (caching strategy: lru / lfu / fifo / null [default = all])] ") ACE_TEXT ("[-r (randomize lookups)] ") ACE_TEXT ("[-i (iterations)] ") ACE_TEXT ("[-d (debug, i.e., addition printouts)] ") ACE_TEXT ("[-p (purge percent)] ") ACE_TEXT ("[-f (number of lookups)]\n"), ACE_TEXT ("Cache_Map_Manager_Test"))); return -1; } } return 0; } int run_main (int argc, ACE_TCHAR *argv[]) { // Validate options. int result = parse_args (argc, argv); if (result != 0) return result; // Start the test only if options are valid. ACE_START_TEST (ACE_TEXT ("Cache_Map_Manager_Test")); // Remove the extra debugging attributes from Log_Msg output. ACE_LOG_MSG->clr_flags (ACE_Log_Msg::VERBOSE_LITE); // Providing random a unique seed. ACE_OS::srand (static_cast (ACE_OS::time (0))); // Create the lookup array. ACE_NEW_RETURN (lookup_array, KEY[no_of_lookups], -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nLookup sequence: "))); // Initialize the lookup array. for (size_t k = 0; k < no_of_lookups; ++k) { if (randomize_lookups != 0) lookup_array[k] = ACE_OS::rand () % iterations; else lookup_array[k] = k % iterations; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%d "), lookup_array[k])); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n\n"))); // Do we need to test all the strategies. if (caching_strategy_type == ACE_ALL) { caching_strategy_type = ACE_NULL; test_caching_strategy_type (); caching_strategy_type = ACE_LRU; test_caching_strategy_type (); caching_strategy_type = ACE_LFU; test_caching_strategy_type (); caching_strategy_type = ACE_FIFO; test_caching_strategy_type (); } else { test_caching_strategy_type (); } delete[] lookup_array; ACE_LOG_MSG->set_flags (ACE_Log_Msg::VERBOSE_LITE); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/SOCK_Test_IPv6.cpp0000644000175000017500000002207115027201773017441 0ustar sudipsudip// ============================================================================ /** * @file SOCK_Test_IPv6.cpp * * @brief This is a test of the and * classes. * * The test forks two processes or spawns two threads (depending upon * the platform) and then executes client and server allowing them to * connect and exchange data. * * @author Prashant Jain * Doug Schmidt * Brian Buesker */ // ============================================================================ #include "test_config.h" #include "ace/OS_NS_sys_select.h" #include "ace/OS_NS_sys_wait.h" #include "ace/Thread.h" #include "ace/Thread_Manager.h" #include "ace/Time_Value.h" #include "ace/SOCK_Connector.h" #include "ace/SOCK_Acceptor.h" #include "ace/Handle_Set.h" #if !defined (ACE_LACKS_FORK) # include "ace/OS_NS_unistd.h" #endif #if defined (ACE_HAS_IPV6) static const char ACE_ALPHABET[] = "abcdefghijklmnopqrstuvwxyz"; static void * client (void *arg) { ACE_INET_Addr *remote_addr = (ACE_INET_Addr *) arg; ACE_INET_Addr server_addr (remote_addr->get_port_number (), ACE_IPV6_LOCALHOST); ACE_SOCK_Stream cli_stream; ACE_SOCK_Connector con; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) starting non-blocking connect\n"))); // Initiate timed, non-blocking connection with server. // Attempt a non-blocking connect to the server. if (con.connect (cli_stream, server_addr, (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) { if (errno != EWOULDBLOCK) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("connection failed"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) starting timed connect\n"))); // Check if non-blocking connection is in progress, // and wait up to ACE_DEFAULT_TIMEOUT seconds for it to complete. ACE_Time_Value tv (ACE_DEFAULT_TIMEOUT); if (con.complete (cli_stream, &server_addr, &tv) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("connection failed")), 0); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) connected to %C\n"), server_addr.get_host_name ())); } if (cli_stream.disable (ACE_NONBLOCK) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("disable"))); // Send data to server (correctly handles "incomplete writes"). for (const char *c = ACE_ALPHABET; *c != '\0'; c++) if (cli_stream.send_n (c, 1) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("send_n"))); // Explicitly close the writer-side of the connection. if (cli_stream.close_writer () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("close_writer"))); char buf[1]; // Wait for handshake with server. if (cli_stream.recv_n (buf, 1) != 1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("recv_n"))); // Close the connection completely. if (cli_stream.close () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("close"))); return 0; } static void * server (void *arg) { ACE_SOCK_Acceptor *peer_acceptor = (ACE_SOCK_Acceptor *) arg; if (peer_acceptor->enable (ACE_NONBLOCK) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("enable"))); // Keep these objects out here to prevent excessive constructor // calls... ACE_SOCK_Stream new_stream; ACE_INET_Addr cli_addr; ACE_Handle_Set handle_set; const ACE_Time_Value def_timeout (ACE_DEFAULT_TIMEOUT); ACE_Time_Value tv (def_timeout); char buf[BUFSIZ]; const char *t = ACE_ALPHABET; handle_set.reset (); handle_set.set_bit (peer_acceptor->get_handle ()); int select_width; # if defined (ACE_WIN64) // This arg is ignored on Windows and causes pointer truncation // warnings on 64-bit compiles. select_width = 0; # else select_width = int (peer_acceptor->get_handle ()) + 1; # endif /* ACE_WIN64 */ int result = ACE_OS::select (select_width, handle_set, 0, 0, &tv); ACE_TEST_ASSERT (tv == def_timeout); if (result == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("select")), 0); else if (result == 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) select timed out, shutting down\n"))); return 0; } // Create a new ACE_SOCK_Stream endpoint (note automatic restart // if errno == EINTR). while ((result = peer_acceptor->accept (new_stream, &cli_addr)) != -1) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) client %C connected from %d\n"), cli_addr.get_host_name (), cli_addr.get_port_number ())); // Enable non-blocking I/O. if (new_stream.enable (ACE_NONBLOCK) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("enable")), 0); handle_set.reset (); handle_set.set_bit (new_stream.get_handle ()); // Read data from client (terminate on error). int select_width; for (ssize_t r_bytes; ;) { # if defined (ACE_WIN64) // This arg is ignored on Windows and causes pointer truncation // warnings on 64-bit compiles. select_width = 0; # else select_width = int (new_stream.get_handle ()) + 1; # endif /* ACE_WIN64 */ if (ACE_OS::select (select_width, handle_set, 0, 0, 0) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("select")), 0); while ((r_bytes = new_stream.recv (buf, 1)) > 0) { ACE_TEST_ASSERT (*t == buf[0]); t++; } if (r_bytes == 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) reached end of input, connection closed by client\n"))); // Handshake back with client. if (new_stream.send_n ("", 1) != 1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("send_n"))); // Close endpoint. if (new_stream.close () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("close"))); return 0; } else if (r_bytes == -1) { if (errno == EAGAIN || errno == EWOULDBLOCK) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) no input available, going back to reading\n"))); else ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("recv_n")), 0); } } } if (result == -1) { if (errno == EWOULDBLOCK) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) no connections available, shutting down\n"))); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("accept"))); } return 0; } static void spawn () { // Acceptor ACE_SOCK_Acceptor peer_acceptor; // Create a server address. ACE_INET_Addr server_addr; // Bind listener to any port and then find out what the port was. if (peer_acceptor.open (ACE_Addr::sap_any, 0, AF_INET6) == -1 || peer_acceptor.get_local_addr (server_addr) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("open"))); else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) starting server at port %d\n"), server_addr.get_port_number ())); #if !defined (ACE_LACKS_FORK) switch (ACE_OS::fork (ACE_TEXT("child"))) { case -1: ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), ACE_TEXT ("fork failed"), 1)); /* NOTREACHED */ case 0: client (&server_addr); ACE_OS::exit (0); /* NOTREACHED */ default: server ((void *) &peer_acceptor); ACE_OS::wait (); } #elif defined (ACE_HAS_THREADS) if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (server), (void *) &peer_acceptor, THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), ACE_TEXT ("thread create failed"), 1)); if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (client), (void *) &server_addr, THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), ACE_TEXT ("thread create failed"), 1)); // Wait for the threads to exit. ACE_Thread_Manager::instance ()->wait (); #else ACE_ERROR ((LM_INFO, ACE_TEXT ("(%P|%t) ") ACE_TEXT ("only one thread may be run ") ACE_TEXT ("in a process on this platform\n"))); #endif /* ACE_HAS_THREADS */ peer_acceptor.close (); } } #endif /*ACE_HAS_IPV6*/ int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("SOCK_Test_IPv6")); #if defined (ACE_HAS_IPV6) spawn (); #endif /* ACE_HAS_IPV6 */ ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Get_Opt_Test.cpp0000644000175000017500000003121415027201773017376 0ustar sudipsudip// ============================================================================ // // = LIBRARY // tests // // = DESCRIPTION // This program tests both the short and long option support in // , and demonstrates how to use it. // // = AUTHOR // Don Hinton // // ============================================================================ #include "test_config.h" #include "ace/Get_Opt.h" #include "ace/ARGV.h" #include "ace/SString.h" #include "ace/OS_NS_stdlib.h" #include "test_config.h" /* * This is the heart of the test. It sets up the optstring, instantiates * ACE_Get_Opt, add long options, processes them in a loop, and prints out * the results to the log. * * It returns 0 for success and 1 for error so we can keep track of the * total error count. */ static const ACE_TString empty_string (ACE_TEXT ("")); static int parse_args (int test_number, int ordering, const ACE_TCHAR *test_args, int skip_argv = 1, int report_errors = 1, const ACE_TString &opt_prefix = empty_string) { ACE_TString test; ACE_TString optstring (opt_prefix); // Test the skip_argv for the first test only. if (skip_argv > 0) { test = ACE_TEXT ("Test_"); ACE_TCHAR s[20]; test += ACE_OS::itoa (test_number, s, 10); test += ACE_TEXT (" "); } test += test_args; optstring += ACE_TEXT ("fr:o::sW;"); ACE_DEBUG ((LM_INFO, ACE_TEXT (" TEST %d *****************************************") ACE_TEXT ("*******************\n"), test_number)); ACE_DEBUG ((LM_INFO, " Command line: \"%s\"\n", test.c_str ())); ACE_ARGV args (test.c_str ()); ACE_Get_Opt get_opt (args.argc (), args.argv (), optstring.c_str (), skip_argv, report_errors, ordering); // Now add the default long args. if (get_opt.long_option (ACE_TEXT ("flag"), 'f', ACE_Get_Opt::NO_ARG) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add long option 'f'\n")), 1); if (get_opt.long_option (ACE_TEXT ("requires_arg"), 'r', ACE_Get_Opt::ARG_REQUIRED) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add long option 'r'\n")), 1); if (get_opt.long_option (ACE_TEXT ("optional_arg"), 'o', ACE_Get_Opt::ARG_OPTIONAL) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add long option 'o'\n")), 1); if (get_opt.long_option (ACE_TEXT ("long_option"), 'l', ACE_Get_Opt::ARG_OPTIONAL) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add long option 'l'\n")), 1); if (get_opt.long_option (ACE_TEXT ("long_only"), -11, ACE_Get_Opt::ARG_REQUIRED) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add long option ") ACE_TEXT ("\"long_only\"\n")), 1); if (get_opt.long_option (ACE_TEXT ("long_no_arg")) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add long option ") ACE_TEXT ("\"long_no_arg\"\n")), 1); // This is the special case of providing a non-alpha numeric corresponding // short option. This lets you use the corresponding short option in a // switch statement, even thought a meaningful short options isn't available // (afterall, there are only so many alpha numeric characters available). if (get_opt.long_option (ACE_TEXT ("non_alpha-num_short"), -10, ACE_Get_Opt::ARG_OPTIONAL) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" Unable to add long option ") ACE_TEXT ("\"non_alpha_short\"\n")), 1); // We print out the optstring here because adding long_options that // have corresponding short options that aren't yet present, are added. ACE_DEBUG ((LM_INFO, ACE_TEXT (" optstring: \"%s\" skip_argv: %d\n"), get_opt.optstring (), skip_argv)); // Now, let's parse it... int c = 0; while ((c = get_opt ()) != EOF) { switch (c) { case 0: // Long Option. if (!get_opt.long_option ()) ACE_ERROR_RETURN ((LM_ERROR, " Long option doesn't exist.\n"), 1); ACE_DEBUG ((LM_INFO, " Found long option \"%s\" %s %s\n", get_opt.long_option (), get_opt.opt_arg () ? ACE_TEXT ("with argument:") : ACE_TEXT (""), get_opt.opt_arg () ? get_opt.opt_arg () : ACE_TEXT (""))); break; case 'f': // This flag was added in both the optstring in the ctor and with // long_option(). case 's': // This one is only short and has no long option. ACE_DEBUG ((LM_INFO, " Found option flag '%s'\n", get_opt.last_option ())); break; case 'r': // This one has a required argument, we wouldn't be here if the // arg were missing. Note that we call get_opt.opt_arg () to return // the argument, but we could have used get_opt.opt_arg () since // opt_arg () is defined as "opt_arg ()". ACE_DEBUG ((LM_INFO, " Found option '%s' with required argument \"%s\"\n", get_opt.last_option (), get_opt.opt_arg ())); break; case 'o': // This one has an optional argument. case 'l': // This short options was set automatically added to optstring. ACE_DEBUG ((LM_INFO, " Found option '%s' with optional argument \"%s\"\n", get_opt.last_option (), get_opt.opt_arg () ? get_opt.opt_arg () : ACE_TEXT ("default"))); break; case 1: // Non-option when in RETURN_IN_ORDER mode. ACE_DEBUG ((LM_INFO, " Found a non-option argument \"%s\" before finding " "\"--\" (must be in RETURN_IN_ORDER mode).\n", get_opt.opt_arg ())); break; case -10: // we found the short option that isn't alpha numeric. ACE_DEBUG ((LM_INFO, " Found option '%s' with optional argument \"%s\"\n", get_opt.last_option (), get_opt.opt_arg () ? get_opt.opt_arg () : ACE_TEXT ("default"))); break; case -11: // we found the short option that isn't alpha numeric. ACE_DEBUG ((LM_INFO, " Found option '%s' with argument \"%s\"\n", get_opt.last_option (), get_opt.opt_arg ())); break; case ':': // This means an option requiring an argument didn't have one. ACE_DEBUG ((LM_INFO, ACE_TEXT (" Option '%c' (%s) requires an argument ") ACE_TEXT ("but none was supplied\n"), get_opt.opt_opt (), get_opt.last_option ())); break; case '?': // An unrecognized option. default: // This is an error, perhaps you could handle them, but let's // just log it and keep going ACE_DEBUG ((LM_INFO, " Found an unknown option (%s) we couldn't handle.\n", get_opt.last_option ())); } } // Print out the rest of the arguments left in the command line (if any). int index = 0; for (index = get_opt.opt_ind (); index < args.argc (); index++) ACE_DEBUG ((LM_INFO, " Found non-option argument \"%s\"\n", args.argv ()[index])); // Now print them all so we can examine the permuted cmd line. for (index = 0; index < args.argc (); index++) ACE_DEBUG ((LM_INFO, " argv[%u] \"%s\"\n", index, args.argv ()[index])); return 0; } /* * Add new tests cases here. We increment the test number and pass the * type of ordering we want so that each test can be tested with multiple * ordering values in order to demostrate the difference. * * The return value is cumulative, and serves as a failure count that is * returned at the end of all the tests. */ static int run_test (int& test_number, int ordering) { int retval = 0; ACE_DEBUG ((LM_INFO, " ########## Running Tests with ordering = %C ##########\n", ordering == 1 ? "REQUIRE_ORDER" : ordering == 2 ? "PERMUTE_ARGS" : "RETURN_IN_ORDER")); // Basic test, but don't use the program name and don't skip any args. retval += parse_args (test_number++, ordering, ACE_TEXT ("-f -rreq-arg -oopt-arg -lopt-arg --long_only=lo_arg -s arg1 arg2"), 0); // Same, but combining short args that don't take args retval += parse_args (test_number++, ordering, ACE_TEXT ("-fsrreq-arg -oopt-arg -lopt-arg --long_only=lo_arg arg1 arg2")); // Now we use defaults for options with optional args. retval += parse_args (test_number++, ordering, ACE_TEXT ("-fsrreq-arg -o -l --long_only=lo_arg arg1 arg2")); // Let's mix up the options and non-options an see what happens. retval += parse_args (test_number++, ordering, ACE_TEXT ("-fs arg1 -rreq-arg -o arg2 -l --long_only=lo_arg")); // Now we turn off options parsing explicitely by passing "--" in the middle. retval += parse_args (test_number++, ordering, ACE_TEXT ("-fs -rreq-arg -- arg1 -o arg2 -l --long_only=lo_arg")); // Let's try the same thing but mix up the options and non-options. retval += parse_args (test_number++, ordering, ACE_TEXT ("-fs arg1 arg2 -rreq-arg -- arg3 -o")); // One more time but with "-W". retval += parse_args (test_number++, ordering, ACE_TEXT ("-fs arg1 arg2 -rreq-arg -W long_option=opt-arg -- arg3 -o")); // Let's pass some long options. retval += parse_args (test_number++, ordering, ACE_TEXT ("--flag -s --requires_arg=req-arg --optional_arg --long_only lo_arg arg1 arg2")); // And long options without the '='. retval += parse_args (test_number++, ordering, ACE_TEXT ("--flag -s --requires_arg req-arg --optional_arg --long_only=lo_arg arg1 arg2")); // Pass "-W" to cause the next argument to be read as a long option. retval += parse_args (test_number++, ordering, ACE_TEXT ("-fso -W requires_arg=req-arg -Woptional_arg -l arg1 arg2")); // This is the special case of a non-alpha numeric short option. retval += parse_args (test_number++, ordering, ACE_TEXT ("-fso --non_alpha-num_short=xxx arg1 arg2")); // Now, let's test some error conditions (we turn off report_errors since they are // intentional, we don't want to break the test script) int report_errors = 0; // Bad short option. retval += parse_args (test_number++, ordering, ACE_TEXT ("-X"), 1, report_errors); // Short option with missing required arg. ACE_TString report_missing (ACE_TEXT (":")); retval += parse_args (test_number++, ordering, ACE_TEXT ("-r"), 1, report_errors, report_missing); // Short option with missing required arg with trailing "--". // This reads "--" as the arg, but should it? retval += parse_args (test_number++, ordering, ACE_TEXT ("-r --"), 1, report_errors); // Long option with missing required arg. retval += parse_args (test_number++, ordering, ACE_TEXT ("--long_only"), 1, report_errors); // Long option that doesn't take an arg has one. retval += parse_args (test_number++, ordering, ACE_TEXT ("--long_no_arg=bad_arg"), 1, report_errors); // Unknown long option. retval += parse_args (test_number++, ordering, ACE_TEXT ("--unknown"), 1, report_errors); // Ambigous long option. retval += parse_args (test_number++, ordering, ACE_TEXT ("--long"), 1, report_errors); return retval; } int run_main (int, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Get_Opt_Test")); ACE_UNUSED_ARG (argv); int retval = 0; int test_number = 0; // Run the tests for each type of ordering. retval = run_test (test_number, ACE_Get_Opt::PERMUTE_ARGS); retval += run_test (test_number, ACE_Get_Opt::REQUIRE_ORDER); retval += run_test (test_number, ACE_Get_Opt::RETURN_IN_ORDER); ACE_END_TEST; return retval; } ace-8.0.4+dfsg.orig/tests/Bug_3541_Regression_Test.cpp0000644000175000017500000001014115027201773021422 0ustar sudipsudip/** * @file Bug_3541_Regression_Test.cpp * * Reproduces the problems reported in bug 3541: * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=3541 * * @author Bill Rizzi */ #include "ace/Event.h" #include "ace/Mutex.h" #include "ace/Semaphore.h" #include "ace/OS_NS_errno.h" #include "ace/SString.h" #include "test_config.h" int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Bug_3541_Regression_Test")); int ret = 0; #if defined(ACE_WIN32) int lastError; // ACE_OS::event_init() const ACE_TCHAR *eventName = ACE_TEXT ("Bug3541_Event"); ACE_Event event0(0, // int manual_reset = 0 0, // int initial_state = 0 USYNC_PROCESS, // int type = USYNC_THREAD eventName); // const ACE_TCHAR *name = 0 lastError = ACE_OS::last_error(); ACE_event_t eventHandle = event0.handle(); if ((eventHandle == ACE_INVALID_HANDLE) || (lastError != 0)) { ret = -1; ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Event(%s) failed - handle %d lastError %d\n"), eventName, eventHandle, lastError)); } else { ACE_Event event1(0, // int manual_reset = 0 0, // int initial_state = 0 USYNC_PROCESS, // int type = USYNC_THREAD eventName); // const ACE_TCHAR *name = 0 lastError = ACE_OS::last_error(); eventHandle = event1.handle(); if ((eventHandle == ACE_INVALID_HANDLE) || (lastError != ERROR_ALREADY_EXISTS)) { ret = -1; ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Event(%s) failed - handle %d lastError %d\n"), eventName, eventHandle, lastError)); } } // ACE_OS::sema_init const ACE_TCHAR *semaphoreName = ACE_TEXT ("Bug3541_Semaphore"); ACE_Semaphore semaphore0(1, // int count = 1 USYNC_PROCESS, // int type = USYNC_THREAD semaphoreName); // const ACE_TCHAR *name = 0 lastError = ACE_OS::last_error(); const ACE_sema_t &semaphoreLock = semaphore0.lock(); if ((semaphoreLock == ACE_INVALID_HANDLE) || (lastError != 0)) { ret = -1; ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Semaphore(%s) failed - lock %d lastError %d\n"), semaphoreName, semaphoreLock, lastError)); } else { ACE_Semaphore semaphore1(1, // int count = 1 USYNC_PROCESS, // int type = USYNC_THREAD semaphoreName); // const ACE_TCHAR *name = 0 lastError = ACE_OS::last_error(); const ACE_sema_t &semaphoreLock = semaphore1.lock(); if ((semaphoreLock == ACE_INVALID_HANDLE) || (lastError != ERROR_ALREADY_EXISTS)) { ret = -1; ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Semaphore(%s) failed - lock %d lastError %d\n"), semaphoreName, semaphoreLock, lastError)); } } // ACE_OS::mutex_init() const ACE_TCHAR *mutexName = ACE_TEXT ("Bug3541_Mutex"); ACE_Mutex mutex0(USYNC_PROCESS, // int type = USYNC_THREAD mutexName); // const ACE_TCHAR *name = 0 lastError = ACE_OS::last_error(); const ACE_mutex_t &mutexLock = mutex0.lock(); if ((mutexLock.proc_mutex_ == ACE_INVALID_HANDLE) || (lastError != 0)) { ret = -1; ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Mutex(%s) failed - lock %d lastError %d\n"), mutexName, mutexLock, lastError)); } else { ACE_Mutex mutex1(USYNC_PROCESS, // int type = USYNC_THREAD mutexName); // const ACE_TCHAR *name = 0 lastError = ACE_OS::last_error(); const ACE_mutex_t &mutexLock = mutex1.lock(); if ((mutexLock.proc_mutex_ == ACE_INVALID_HANDLE) || (lastError != ERROR_ALREADY_EXISTS)) { ret = -1; ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_Mutex(%s) failed - lock %d lastError %d\n"), mutexName, mutexLock, lastError)); } } #endif ACE_END_TEST; return ret; } ace-8.0.4+dfsg.orig/tests/Bug_3334_Regression_Test.conf0000644000175000017500000000045515027201773021574 0ustar sudipsudip stream dynamic Svc_Conf_Stream STREAM *Service_Config_Stream_DLL:make_stream() active { dynamic Device_Adapter Module *Service_Config_Stream_DLL:make_da() dynamic Event_Analyzer Module *Service_Config_Stream_DLL:make_ea() dynamic Multicast_Router Module *Service_Config_Stream_DLL:make_mr() } ace-8.0.4+dfsg.orig/tests/New_Fail_Test.cpp0000644000175000017500000001253315027201773017524 0ustar sudipsudip //============================================================================= /** * @file New_Fail_Test.cpp * * Checks to be sure that a failed ACE_NEW[_RETURN | _NORETURN] doesn't end * up throwing an exception up to the caller. * * Note that this test doesn't get a real attempt on platforms which: * 1. Are known to throw exceptions when 'new' runs out of resources, * 2. Are built with exceptions disabled. * In these cases, the test puts a message in the log noting that a failed * new will throw an exception, and trust that the user accepts that risk. * * @author Steve Huston */ //============================================================================= #include "test_config.h" #include "ace/Log_Msg.h" #include "ace/OS_Memory.h" #include "ace/CORBA_macros.h" #include "ace/Numeric_Limits.h" // This test allocates all of the heap memory, forcing 'new' to fail // because of a lack of memory. The ACE_NEW macros should prevent an // exception from being thrown past the ACE_NEW. If this test doesn't // wipe out on an alloc exception, it passes. // // If it doesn't ever fail an allocation, there's a warning that something is // wrong. The allocated memory is always freed to avoid masking a leak // somewhere else in the test. // Most we can do, by half. Using max alone gets "invalid allocation size" // messages on stdout on Windows. static const size_t BIG_BLOCK = ACE_Numeric_Limits::max () / 2; // Shouldn't take many "as much as possible" tries to get a failure. static const int MAX_ALLOCS_IN_TEST = 2; static void try_ace_new (char **p) { ACE_NEW (*p, char[BIG_BLOCK]); return; } static char * try_ace_new_return () { char *p {}; ACE_NEW_RETURN (p, char[BIG_BLOCK], nullptr); return p; } static char * try_ace_new_noreturn () { char *p {}; ACE_NEW_NORETURN (p, char[BIG_BLOCK]); return p; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("New_Fail_Test")); int status {}; char *blocks[MAX_ALLOCS_IN_TEST]; int i {}; try { // First part: test ACE_NEW for (i = 0; i < MAX_ALLOCS_IN_TEST; i++) { try_ace_new (&blocks[i]); if (blocks[i] == 0) break; } if (i == MAX_ALLOCS_IN_TEST) { ACE_ERROR ((LM_WARNING, ACE_TEXT ("Test didn't exhaust available memory\n"))); // Back up to valid pointer for deleting. --i; } else { ACE_TEST_ASSERT (blocks[i] == 0); if (errno == ENOMEM) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_NEW failed properly at block %d\n"), i)); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_NEW failed at block %d, but ") ACE_TEXT ("expected ENOMEM, %p (%d)\n"), i, ACE_TEXT ("got"), ACE_ERRNO_GET)); } // Free the memory to try ACE_NEW_RETURN while (i >= 0) delete [] blocks[i--]; // Second part: test ACE_NEW_RETURN for (i = 0; i < MAX_ALLOCS_IN_TEST; i++) { blocks[i] = try_ace_new_return (); if (blocks[i] == 0) break; } if (i == MAX_ALLOCS_IN_TEST) { ACE_ERROR ((LM_WARNING, ACE_TEXT ("Test didn't exhaust available memory\n"))); // Back up to valid pointer. --i; } else { ACE_TEST_ASSERT (blocks[i] == 0); if (errno == ENOMEM) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_NEW_RETURN failed properly at block %d\n"), i)); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_NEW_RETURN failed at block %d, but ") ACE_TEXT ("expected ENOMEM, %p (%d)\n"), i, ACE_TEXT ("got"), ACE_ERRNO_GET)); } while (i >= 0) delete [] blocks[i--]; // Third part: test ACE_NEW_NORETURN for (i = 0; i < MAX_ALLOCS_IN_TEST; i++) { blocks[i] = try_ace_new_noreturn (); if (blocks[i] == 0) break; } if (i == MAX_ALLOCS_IN_TEST) { ACE_ERROR ((LM_WARNING, ACE_TEXT ("Test didn't exhaust available memory\n"))); // Back up to valid pointer. --i; } else { ACE_TEST_ASSERT (blocks[i] == 0); if (errno == ENOMEM) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE_NEW_NORETURN failed properly at block %d\n"), i)); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_NEW_NORETURN failed at block %d, but ") ACE_TEXT ("expected ENOMEM, %p (%d)\n"), i, ACE_TEXT ("got"), ACE_ERRNO_GET)); } while (i >= 0) delete [] blocks[i--]; } catch (...) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Caught exception during test; ") ACE_TEXT ("ACE_bad_alloc not defined correctly\n"))); // Mark test failure status = 1; } ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/Proactor_Scatter_Gather_Test.cpp0000644000175000017500000011547715027201773022623 0ustar sudipsudip// ============================================================================ /** * @file Proactor_Scatter_Gather_Test.cpp * * The test runs on a single thread, and involves a single Sender, * two Receivers and a single Writer. The Sender async-reads * (scattered) from a file into chunks of . It * async-sends (gathered) the odd chunks to the first receiver over a * stream, and the even chunks to the second receiver over a * different stream. The receivers async-read (scattered) from the * socket streams into chunks in size of , and convey the * data to the Writer. The Writer reconstructs the file using * async-write (gathered). Then, the reconstructed file is compared * to the original file to determine test success. So, It covers both * async scatter/gather stream I/O and async scatter/gather file I/O. * The wire transfer protocol is very naive (and totally non * reliable...) - when both connections are closed, EOF is assumed. * The test can be also run in a separated sender and receiver mode, * to test real network influences. * * This test is based upon some building blocks taken from the * Proactor_Test.cpp. * * @author Edan Ayal */ // ============================================================================ #include "test_config.h" #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) // This currently only works on Win32 platforms (NT SP2 and above). // Support for Unix platforms supporting POSIX aio calls should be added in future. #include "ace/Get_Opt.h" #include "ace/Proactor.h" #include "ace/Asynch_Acceptor.h" #include "ace/Asynch_Connector.h" #include "ace/Mem_Map.h" #include "ace/OS_NS_math.h" #include "ace/OS_NS_sys_stat.h" #include "ace/OS_NS_fcntl.h" #include "ace/OS_NS_unistd.h" #include "ace/SOCK_Connector.h" #include // For the Acceptor/Connector handlers maintenance lists static const int SENDERS = 1; static const int RECEIVERS = 2; // Port that we're receiving connections on. static u_short port = ACE_DEFAULT_SERVER_PORT; static const ACE_TCHAR *host = ACE_LOCALHOST; // File that we're sending. static const ACE_TCHAR *input_file = ACE_TEXT("Proactor_Scatter_Gather_Test.cpp"); // Name of the output file. static const ACE_TCHAR *output_file = ACE_TEXT("output"); static int client_only = 0; static int server_only = 0; static size_t chunk_size = 0; enum { ODD = 0, EVEN }; // ************************************************************* // Some chunks chain helper routines // ************************************************************* static int allocate_chunks_chain (ACE_Message_Block *&head_mb, size_t number_of_chunks) { ACE_Message_Block *pre_mb = 0; for (size_t index = 0; index < number_of_chunks; ++index) { #if defined (ACE_WIN32) void *addr = ::VirtualAlloc (0, chunk_size, MEM_COMMIT, PAGE_READWRITE); #else void *addr = new char[chunk_size]; #endif /* ACE_WIN32 */ if (addr) { ACE_Message_Block *mb = new ACE_Message_Block (static_cast (addr), chunk_size); if (!head_mb) head_mb = mb; // chain them together if (pre_mb) pre_mb->cont (mb); pre_mb = mb; } else { ACE_TEST_ASSERT (0); return -1; } } return 0; } static void free_chunks_chain (ACE_Message_Block *&mb) { for (const ACE_Message_Block* msg = mb; msg != 0; msg = msg->cont ()) { #if defined (ACE_WIN32) ::VirtualFree (msg->base (), msg->size (), MEM_DECOMMIT); #else delete [] msg->base (); #endif /* ACE_WIN32 */ } mb->release (); mb = 0; } static int last_chunk (ACE_Message_Block *chain, ACE_Message_Block *&last) { if (!chain) return 0; int index = 1; last = chain; while (0 != last->cont ()) { last = last->cont (); ++index; } return index; } static void merge_odd_even_chains (ACE_Message_Block *odd_mb, ACE_Message_Block *even_mb) { ACE_Message_Block *pre_pre_mb = odd_mb; ACE_Message_Block *pre_mb = even_mb; ACE_Message_Block *curr_mb = odd_mb->cont (); if (even_mb) { for (; curr_mb != 0; curr_mb = pre_pre_mb->cont ()) { pre_pre_mb->cont (pre_mb); // increment history pointers pre_pre_mb = pre_mb; pre_mb = curr_mb; } pre_pre_mb->cont (pre_mb); pre_mb->cont (0); } } static void split_odd_even_chains (ACE_Message_Block *odd_mb, ACE_Message_Block *even_mb) { ACE_Message_Block *pre_pre_mb = odd_mb; ACE_Message_Block *pre_mb = even_mb; ACE_Message_Block *curr_mb = (even_mb ? even_mb->cont () : 0); for (; curr_mb != 0; curr_mb = curr_mb->cont ()) { pre_pre_mb->cont (curr_mb); // increment history pointers pre_pre_mb = pre_mb; pre_mb = curr_mb; } pre_pre_mb->cont (0); if (pre_mb) pre_mb->cont (0); } static void add_to_chunks_chain (ACE_Message_Block *&chunks_chain, ACE_Message_Block *additional_chunks_chain) { if (0 == chunks_chain) chunks_chain = additional_chunks_chain; else { ACE_Message_Block *last = 0; last_chunk (chunks_chain, last); if (last) last->cont (additional_chunks_chain); } } static void remove_empty_chunks (ACE_Message_Block *&chunks_chain) { if (0 == chunks_chain) return; ACE_Message_Block *first_empty = chunks_chain; ACE_Message_Block *pre_mb = 0; while (first_empty->length () > 0 && 0 != first_empty->cont ()) { pre_mb = first_empty; first_empty = first_empty->cont (); } // break the chain there, and release the empty end (might be everything) if (0 == first_empty->length ()) { if (pre_mb) // might be 0, in case it's the entire chain pre_mb->cont (0); if (first_empty == chunks_chain) chunks_chain = 0; free_chunks_chain (first_empty); } } // ************************************************************* // Acceptor, Receiver and Writer // ************************************************************* class Receiver; class Acceptor : public ACE_Asynch_Acceptor { friend class Receiver; public: Acceptor (); virtual ~Acceptor (); void stop (); // Virtual from ACE_Asynch_Acceptor virtual Receiver *make_handler (); int get_number_sessions () { return this->sessions_; } private: void on_new_receiver (Receiver &rcvr); void on_delete_receiver (Receiver &rcvr); int sessions_; Receiver *list_receivers_[RECEIVERS]; }; class Writer; // The first instantiated take the role of the odd receiver class Receiver : public ACE_Service_Handler { friend class Acceptor; friend class Writer; public: Receiver (Acceptor *acceptor = 0, int index = -1); virtual ~Receiver (); //FUZZ: disable check_for_lack_ACE_OS /// This is called after the new connection has been accepted. virtual void open (ACE_HANDLE handle, ACE_Message_Block &message_block); //FUZZ: enable check_for_lack_ACE_OS protected: /// This is called by the framework when asynchronous operation from the /// socket completes. virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result); private: int initiate_read_stream (); void check_destroy (); Acceptor *acceptor_; int index_; // Socket input ACE_Asynch_Read_Stream rs_; ACE_HANDLE socket_handle_; // Writer static Writer* writer_; long io_count_; char odd_; // if we get non-page-size reminder, we will not send it to the writer // until it is full (unless at end) ACE_Message_Block *partial_chunk_; }; class Writer : public ACE_Handler { friend class Receiver; public: Writer (); virtual ~Writer (); //FUZZ: disable check_for_lack_ACE_OS void open (); //FUZZ: enable check_for_lack_ACE_OS // this is *not* a callback from the framework int handle_read_chunks_chain (ACE_Message_Block *mb, int type); // for determining when last receiver dies void on_new_receiver (); void on_delete_receiver (); protected: /// This is called by the framework when an asynchronous to the file /// completes. virtual void handle_write_file (const ACE_Asynch_Write_File::Result &result); private: int initiate_write_file (); private: // Output file ACE_Asynch_Write_File wf_; ACE_HANDLE output_file_handle_; u_long writing_file_offset_; u_long reported_file_offset_; ACE_Message_Block *odd_chain_; ACE_Message_Block *even_chain_; long io_count_; char receiver_count_; }; // ************************************************************* // Receiver Impl // ************************************************************* Writer *Receiver::writer_ = 0; Receiver::Receiver (Acceptor * acceptor, int index) : acceptor_ (acceptor), index_ (index), socket_handle_ (ACE_INVALID_HANDLE), io_count_ (0), partial_chunk_ (0) { // the first one is the odd one this->odd_ = ((0 == index) ? 1 : 0); if (this->odd_) { Receiver::writer_ = new Writer; if (!Receiver::writer_) { ACE_TEST_ASSERT (0); return; } } Receiver::writer_->on_new_receiver (); if (this->acceptor_ != 0) this->acceptor_->on_new_receiver (*this); } Receiver::~Receiver () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Receiver::~Receiver\n"))); if (this->acceptor_ != 0) this->acceptor_->on_delete_receiver (*this); if (this->socket_handle_ != ACE_INVALID_HANDLE) ACE_OS::closesocket (this->socket_handle_); Receiver::writer_->on_delete_receiver (); if (this->partial_chunk_) { ACE_TEST_ASSERT (0); // should not be getting here this->partial_chunk_->release (); } } void Receiver::check_destroy () { if (this->io_count_ <= 0) delete this; } void Receiver::open (ACE_HANDLE handle, ACE_Message_Block &) { this->socket_handle_ = handle; // Open the ACE_Asynch_Read_Stream if (this->rs_.open (*this, this->socket_handle_) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Receiver::ACE_Asynch_Read_Stream::open"))); else { if (this->odd_) Receiver::writer_->open (); this->initiate_read_stream (); } this->check_destroy (); } int Receiver::initiate_read_stream () { if (!Receiver::writer_) return -1; // how many chunks to allocate? size_t number_of_new_chunks = (this->partial_chunk_ ? (ACE_IOV_MAX / RECEIVERS) - 1 : ACE_IOV_MAX / RECEIVERS); // allocate chunks chain ACE_Message_Block *head_mb = 0; if (-1 == allocate_chunks_chain (head_mb, number_of_new_chunks)) { ACE_TEST_ASSERT (0); return -1; } // calculate how many bytes to read // head_mb could be 0 (no new chunks allocated) size_t bytes_to_read = head_mb ? head_mb->total_size () : 0; // add the partial chunk at the front if appropriate, and update // the number of bytes to read if (this->partial_chunk_) { bytes_to_read += this->partial_chunk_->space (); this->partial_chunk_->cont (head_mb); head_mb = this->partial_chunk_; this->partial_chunk_ = 0; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Receiver::initiate_read_stream - (%s) readv %d\n"), this->odd_ ? ACE_TEXT ("ODD ") : ACE_TEXT ("EVEN"), bytes_to_read)); // perform the actual scattered read if (this->rs_.readv (*head_mb, bytes_to_read) == -1) { free_chunks_chain (head_mb); ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Receiver::ACE_Asynch_Stream::read")), -1); } ++this->io_count_; return 0; } void Receiver::handle_read_stream (const ACE_Asynch_Read_Stream::Result &result) { ACE_Message_Block *mb = &result.message_block (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Receiver::handle_read_stream - (%s) read %d\n"), this->odd_ ? ACE_TEXT ("ODD ") : ACE_TEXT ("EVEN"), result.bytes_transferred ())); // Transfer only complete chunks to the writer. // Save last partial chunk for the next call. // On disconnect (error or 0 transferred), transfer whatever we have. // at this stage there should not be anything there ACE_TEST_ASSERT (!this->partial_chunk_); // first, remove the empty chunks remove_empty_chunks (mb); if (mb && Receiver::writer_) { // there's something to write, and who to write to // write everything or only complete chunks? // write everything - when no new bytes were transferred int write_everything = 0; if (!result.bytes_transferred ()) write_everything = 1; if (write_everything) Receiver::writer_->handle_read_chunks_chain (mb, this->odd_ ? ODD : EVEN); else { // filter out the partial chunk at the end (if present) // and save it for later before writing the full chunks // have this->partial_chunk_ point to the last chunk in the chain size_t last_index = last_chunk (mb, this->partial_chunk_); if (this->partial_chunk_ && this->partial_chunk_->length () < chunk_size) { // found partial chunk at end of chain // detach it from the chain if (last_index > 1) // chain bigger than 1 { ACE_Message_Block *pre_last = mb; for (size_t index = 1; index < last_index - 1; ++index) pre_last = pre_last->cont (); // detach partial chunk from chain pre_last->cont (0); } else // chain in length of 1 - so we need to zero mb mb = 0; } else // last is a full chunk, so hand it over with the rest this->partial_chunk_ = 0; // transfer (if there's anything left) if (mb && mb->total_length ()) Receiver::writer_->handle_read_chunks_chain ( mb, this->odd_ ? ODD : EVEN); // initiate more reads only if no error if (!result.error ()) this->initiate_read_stream (); else ACE_TEST_ASSERT (0); } } else if (mb && !Receiver::writer_) // no one to write to free_chunks_chain (mb); --this->io_count_; this->check_destroy (); } // ************************************************************* // Acceptor Impl // ************************************************************* Acceptor::Acceptor () : sessions_ (0) { for (int i = 0; i < RECEIVERS; ++i) this->list_receivers_[i] = 0; } Acceptor::~Acceptor () { this->stop (); } void Acceptor::stop () { // This method can be called only after proactor event loop is done // in all threads. for (int i = 0; i < RECEIVERS; ++i) { delete this->list_receivers_[i]; this->list_receivers_[i] = 0; } } void Acceptor::on_new_receiver (Receiver & rcvr) { ++this->sessions_; this->list_receivers_[rcvr.index_] = &rcvr; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Receiver::CTOR sessions_ = %d\n"), this->sessions_)); } void Acceptor::on_delete_receiver (Receiver & rcvr) { --this->sessions_; if (rcvr.index_ >= 0 && rcvr.index_ < RECEIVERS && this->list_receivers_[rcvr.index_] == &rcvr) this->list_receivers_[rcvr.index_] = 0; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Receiver::~DTOR sessions_ = %d\n"), this->sessions_)); } Receiver * Acceptor::make_handler () { if (this->sessions_ >= RECEIVERS) return 0; for (int i = 0; i < RECEIVERS; ++i) { if (this->list_receivers_[i] == 0) { ACE_NEW_RETURN (this->list_receivers_[i], Receiver (this, i), 0); return this->list_receivers_[i]; } } return 0; } // ************************************************************* // Writer Impl // ************************************************************* Writer::Writer () : output_file_handle_ (ACE_INVALID_HANDLE), writing_file_offset_ (0), reported_file_offset_ (0), odd_chain_ (0), even_chain_ (0), io_count_ (0), receiver_count_ (0) { } Writer::~Writer () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Writer::~Writer\n"))); if (this->output_file_handle_ != ACE_INVALID_HANDLE) ACE_OS::close (this->output_file_handle_); Receiver::writer_ = 0; } void Writer::on_new_receiver () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Writer::on_new_receiver\n"))); ++this->receiver_count_; } void Writer::on_delete_receiver () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Writer::on_delete_receiver\n"))); --this->receiver_count_; if (0 == this->receiver_count_) { if (this->io_count_ <= 0) // no pending io, so do the work oursleves // (if pending io, they'll see the zero receiver count) this->initiate_write_file (); } } void Writer::open () { // Open the file for output if (ACE_INVALID_HANDLE == (this->output_file_handle_ = ACE_OS::open (output_file, O_CREAT | _O_TRUNC | _O_WRONLY |\ FILE_FLAG_OVERLAPPED |\ FILE_FLAG_NO_BUFFERING, ACE_DEFAULT_FILE_PERMS))) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Writer::open::ACE_OS::open"))); // Open the ACE_Asynch_Write_File else if (this->wf_.open (*this, this->output_file_handle_) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Writer::open::ACE_Asynch_Write_File::open"))); } int Writer::handle_read_chunks_chain (ACE_Message_Block *mb, int type) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Writer::handle_read_chunks_chain - (%s) %d bytes\n"), (type == ODD) ? ACE_TEXT ("ODD ") : ACE_TEXT ("EVEN"), mb->total_length ())); add_to_chunks_chain (ODD == type ? this->odd_chain_ : this->even_chain_, mb); this->initiate_write_file (); return 0; } int Writer::initiate_write_file () { // find out how much can we merge ACE_Message_Block *dummy_last = 0; size_t odd_count = last_chunk (this->odd_chain_, dummy_last); size_t even_count = last_chunk (this->even_chain_, dummy_last); size_t merge_size = (std::min) ((std::min) (odd_count, even_count), (size_t) ACE_IOV_MAX); // the options here are as follows: // io_count_ can be zero or greater. // merge_size can be zero or not. // if non zero merge, write the merge. ASSERT receiver_count_ is non zero too. // if zero merge: // if receiver_count_ is non zero, NOOP. // if zero receiver_count_, we should write whatever is left, // and terminate the writer at completion. // if nothing to write, and io_count_ is zero too, terminate here. if (0 == merge_size && 0 != this->receiver_count_) return 0; if (0 == merge_size && 0 == this->receiver_count_ && 0 == odd_count && 0 == even_count && 0 == this->io_count_) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Writer::initiate_write_file") ACE_TEXT (" - ending proactor event loop\n"))); ACE_Proactor::instance ()->end_event_loop (); delete this; return 0; } // if we reached nere and merge_size is zero, we should write whatever is // in the queues (1 to 2 chunks together), so let's force the merge size to 1. if (0 == merge_size) { ACE_TEST_ASSERT (1 == odd_count && 1 >= even_count); merge_size = 1; } // Now that we found out what we want to do, prepare the chain // that will be written, and update the remainders ACE_Message_Block *new_odd_chain_head = this->odd_chain_; ACE_Message_Block *new_even_chain_head = this->even_chain_; // locate the place for detachment in the chains ACE_Message_Block *pre_odd = 0; ACE_Message_Block *pre_even = 0; for (size_t index = 0; index < merge_size; ++index) { pre_odd = new_odd_chain_head; if (new_odd_chain_head) new_odd_chain_head = new_odd_chain_head->cont (); pre_even = new_even_chain_head; if (new_even_chain_head) new_even_chain_head = new_even_chain_head->cont (); } // now detach the chain if (pre_odd) pre_odd->cont (0); if (pre_even) pre_even->cont (0); // perform merge between the two chains merge_odd_even_chains (this->odd_chain_, this->even_chain_); // and now finally perform the write ACE_Message_Block *united_mb = this->odd_chain_; // update the remainders of the chains this->odd_chain_ = new_odd_chain_head; this->even_chain_ = new_even_chain_head; size_t increment_writing_file_offset = united_mb->total_length (); // Reconstruct the file // Write the size, not the length, because we must write in chunks // of ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Writer::initiate_write_file: write %d bytes at %d\n"), united_mb->total_size (), this->writing_file_offset_)); if (this->wf_.writev (*united_mb, united_mb->total_size (), this->writing_file_offset_) == -1) { free_chunks_chain (united_mb); ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Writer::initiate_write_file::ACE_Asynch_Write_Stream::writev")), -1); } // we update now because otherwise, we'd have error when performing // pipelined writing (that is, mulitple calls to write before the callbacks // to handle_x) this->writing_file_offset_ += static_cast (increment_writing_file_offset); ++this->io_count_; return 0; } void Writer::handle_write_file (const ACE_Asynch_Write_File::Result &result) { ACE_Message_Block *mb = &result.message_block (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Writer::handle_write_file at offset %d wrote %d\n"), this->reported_file_offset_, result.bytes_transferred ())); this->reported_file_offset_ += static_cast (result.bytes_transferred ()); // Always truncate as required, // because partial will always be the last write to a file ACE_Message_Block *last_mb = mb; last_chunk (mb, last_mb); if (last_mb->space ()) ACE_OS::truncate (output_file, this->reported_file_offset_ - static_cast (last_mb->space ())); free_chunks_chain (mb); --this->io_count_; // end of process? if (0 == this->receiver_count_ && 0 == this->io_count_) { ACE_TEST_ASSERT (0 == this->odd_chain_ && 0 == this->even_chain_); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Writer::handle_write_file") ACE_TEXT (" - ending proactor event loop\n"))); ACE_Proactor::instance ()->end_event_loop (); delete this; } } // ************************************************************* // Connector and Sender // ************************************************************* class Sender; class Connector : public ACE_Asynch_Connector { friend class Sender; public: Connector (); virtual ~Connector (); // Address to pass to Sender for secondary connect. void set_address (const ACE_INET_Addr &addr); const ACE_INET_Addr &get_address (); void stop (); // Virtual from ACE_Asynch_Connector virtual Sender *make_handler (); private: void on_new_sender (Sender &rcvr); void on_delete_sender (Sender &rcvr); int sessions_; ACE_INET_Addr addr_; Sender *list_senders_[SENDERS]; }; class Sender : public ACE_Service_Handler { friend class Connector; public: Sender (Connector *connector = 0, int index = -1); virtual ~Sender (); //FUZZ: disable check_for_lack_ACE_OS /// This is called after the new connection has been established. virtual void open (ACE_HANDLE handle, ACE_Message_Block &message_block); //FUZZ: enable check_for_lack_ACE_OS // This is called by the framework when asynchronous reads from the // file complete. virtual void handle_read_file (const ACE_Asynch_Read_File::Result &result); // This is called by the framework when asynchronous writes from the // socket complete. virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result); private: void check_destroy (); int initiate_read_file (); int initiate_write_stream (ACE_Message_Block &mb); int index_; Connector * connector_; // File to read from ACE_Asynch_Read_File rf_; ACE_HANDLE input_file_handle_; u_long file_offset_; // Sockets to send to // odd and even socket output streams ACE_Asynch_Write_Stream ws_[RECEIVERS]; ACE_HANDLE socket_handle_[RECEIVERS]; long io_count_; }; // ************************************************************* // Connector Impl // ************************************************************* Connector::Connector () : sessions_ (0) { for (int i = 0; i < SENDERS; ++i) this->list_senders_[i] = 0; } Connector::~Connector () { this->stop (); } // Address to pass to Sender for secondary connect. void Connector::set_address (const ACE_INET_Addr &addr) { this->addr_ = addr; } const ACE_INET_Addr & Connector::get_address () { return this->addr_; } void Connector::stop () { // This method can be called only after proactor event loop is done // in all threads. for (int i = 0; i < SENDERS; ++i) { delete this->list_senders_[i]; this->list_senders_[i] = 0; } } void Connector::on_new_sender (Sender &sndr) { ++this->sessions_; this->list_senders_[sndr.index_] = &sndr; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Sender::CTOR sessions_ = %d\n"), this->sessions_)); } void Connector::on_delete_sender (Sender &sndr) { --this->sessions_; if (sndr.index_ >= 0 && sndr.index_ < SENDERS && this->list_senders_[sndr.index_] == &sndr) this->list_senders_[sndr.index_] = 0; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Sender::~DTOR sessions_ = %d\n"), this->sessions_)); } Sender * Connector::make_handler () { if (this->sessions_ >= SENDERS) return 0; for (int i = 0; i < SENDERS; ++i) { if (this->list_senders_ [i] == 0) { ACE_NEW_RETURN (this->list_senders_[i], Sender (this, i), 0); return this->list_senders_[i]; } } return 0; } // ************************************************************* // Sender Impl // ************************************************************* Sender::Sender (Connector * connector, int index) : index_ (index), connector_ (connector), input_file_handle_ (ACE_INVALID_HANDLE), file_offset_ (0), io_count_ (0) { socket_handle_[ODD] = socket_handle_[EVEN] = ACE_INVALID_HANDLE; if (this->connector_ != 0) this->connector_->on_new_sender (*this); } Sender::~Sender () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Sender::~Sender\n"))); if (this->connector_ != 0) this->connector_->on_delete_sender (*this); if (this->socket_handle_[ODD] != ACE_INVALID_HANDLE) ACE_OS::closesocket (this->socket_handle_[ODD]); if (this->socket_handle_[EVEN] != ACE_INVALID_HANDLE) ACE_OS::closesocket (this->socket_handle_[EVEN]); if (this->input_file_handle_ != ACE_INVALID_HANDLE) ACE_OS::close (this->input_file_handle_); if (client_only) ACE_Proactor::instance ()->end_event_loop (); } // return true if we alive, false we commited suicide void Sender::check_destroy () { if (this->io_count_ <= 0) delete this; } void Sender::open (ACE_HANDLE handle, ACE_Message_Block &) { this->socket_handle_[ODD] = handle; // Open the input file if (ACE_INVALID_HANDLE == (this->input_file_handle_ = ACE_OS::open (input_file, _O_RDONLY |\ FILE_FLAG_OVERLAPPED |\ FILE_FLAG_NO_BUFFERING, ACE_DEFAULT_FILE_PERMS))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Sender::open::ACE_OS::open"))); } else { // Now connect (w/o the connector factory) to the even (=second) // receiver. We don't connect thru the factory in order not to // instantiate another Sender. ACE_SOCK_Connector sock_connector; ACE_SOCK_Stream sock_stream; if (-1 == sock_connector.connect (sock_stream, this->connector_->get_address ())) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Sender::open::ACE_SOCK_Connector::connect"))); else { this->socket_handle_[EVEN] = sock_stream.get_handle (); // Open odd ACE_Asynch_Write_Stream if (this->ws_[ODD].open (*this, this->socket_handle_[ODD]) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Sender::open::ACE_Asynch_Write_Stream::open"))); // Open even ACE_Asynch_Write_Stream else if (this->ws_[EVEN].open (*this, this->socket_handle_[EVEN]) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Sender::open::ACE_Asynch_Write_Stream::open"))); // Open ACE_Asynch_Read_File else if (this->rf_.open (*this, this->input_file_handle_) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Sender::open::ACE_Asynch_Read_File::open"))); else // Start an asynchronous read this->initiate_read_file (); } } this->check_destroy (); } int Sender::initiate_read_file () { ACE_TEST_ASSERT (0 == this->file_offset_ % chunk_size); static const size_t file_size = ACE_OS::filesize (input_file); static const size_t number_of_chunks_needed_for_file = static_cast (ACE_OS::ceil ((double) file_size / chunk_size)); size_t const relevant_number_of_chunks = (std::min) ((size_t)ACE_IOV_MAX, number_of_chunks_needed_for_file - (size_t)(this->file_offset_ / chunk_size)); if (!relevant_number_of_chunks) { ACE_TEST_ASSERT (0); // Just 2 C it coming return 0; } ACE_Message_Block *head_mb = 0; if (-1 == allocate_chunks_chain (head_mb, relevant_number_of_chunks)) { ACE_TEST_ASSERT (0); return -1; } // Inititiate read if (this->rf_.readv (*head_mb, head_mb->total_size (), this->file_offset_) == -1) { free_chunks_chain (head_mb); ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Sender::initiate_read_file::") ACE_TEXT ("ACE_Asynch_Read_Stream::readv")), -1); } ++this->io_count_; return 0; } int Sender::initiate_write_stream (ACE_Message_Block &mb) { // send the odd to the first connection, and the even to the second // connection. ACE_Message_Block *odd_mb = &mb; ACE_Message_Block *even_mb = mb.cont (); split_odd_even_chains (odd_mb, even_mb); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Sender::initiate_write_stream - (ODD ) writev %d\n"), odd_mb->total_length ())); if (this->ws_[ODD].writev (*odd_mb, odd_mb->total_length ()) == -1) { free_chunks_chain (odd_mb); if (even_mb) free_chunks_chain (even_mb); ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Sender::ACE_Asynch_Stream::writev")), -1); } ++this->io_count_; if (even_mb) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Sender::initiate_write_stream - (EVEN) writev %d\n"), even_mb->total_length ())); if (this->ws_[EVEN].writev (*even_mb, even_mb->total_length ()) == -1) { free_chunks_chain (even_mb); ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Sender::ACE_Asynch_Stream::writev")), -1); } ++this->io_count_; } return 0; } void Sender::handle_read_file (const ACE_Asynch_Read_File::Result &result) { ACE_Message_Block *mb = &result.message_block (); if (result.error () == 0 && result.bytes_transferred () != 0) { size_t bytes_transferred = result.bytes_transferred (); size_t chunks_chain_size = mb->total_size (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Sender::handle_read_file, read %d, ") ACE_TEXT ("chain total %d\n"), bytes_transferred, chunks_chain_size)); this->file_offset_ += static_cast (bytes_transferred); this->initiate_write_stream (*mb); // and read more if required if (bytes_transferred == chunks_chain_size) this->initiate_read_file (); } else free_chunks_chain (mb); --this->io_count_; this->check_destroy (); } void Sender::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result) { ACE_Message_Block *mb = &result.message_block (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Sender::handle_write_stream - wrote %d bytes\n"), result.bytes_transferred ())); if (result.error () == 0 && result.bytes_transferred () != 0) // verify sent all ACE_TEST_ASSERT (0 == mb->total_length ()); else ACE_TEST_ASSERT (0); free_chunks_chain (mb); --this->io_count_; this->check_destroy (); } // ************************************************************* // Configuration helpers // ************************************************************* int print_usage (int /* argc */, ACE_TCHAR *argv[]) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("\nusage: %s") ACE_TEXT ("\n-f \n") ACE_TEXT ("\n-c client only (reader-sender)") ACE_TEXT ("\n-s server only (receiver-writer)") ACE_TEXT ("\n-h host to connect to") ACE_TEXT ("\n-p port") ACE_TEXT ("\n-u show this message") ACE_TEXT ("\n"), argv[0] )); return -1; } static int parse_args (int argc, ACE_TCHAR *argv[]) { if (argc == 1) // no arguments , so one button test return 0; ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("f:csh:p:u")); int c; while ((c = get_opt ()) != EOF) { switch (c) { case 'f': input_file = get_opt.opt_arg (); break; case 'c': client_only = 1; server_only = 0; break; case 's': server_only = 1; client_only = 0; break; case 'h': host = get_opt.opt_arg (); break; case 'p': port = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'u': default: return print_usage (argc, argv); } // switch } // while return 0; } int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Proactor_Scatter_Gather_Test")); if (::parse_args (argc, argv) == -1) return -1; chunk_size = ACE_OS::getpagesize (); if (client_only) ACE_DEBUG ((LM_INFO, ACE_TEXT ("Running as client only, page size %d\n"), chunk_size)); else if (server_only) ACE_DEBUG ((LM_INFO, ACE_TEXT ("Running as server only, page size %d\n"), chunk_size)); else ACE_DEBUG ((LM_INFO, ACE_TEXT ("Running as server and client, page size %d\n"), chunk_size)); Acceptor acceptor; Connector connector; ACE_INET_Addr addr (port); if (!client_only) { // Simplify, initial read with zero size if (-1 == acceptor.open (addr, 0, 1)) { ACE_TEST_ASSERT (0); return -1; } } if (!server_only) { if (-1 == connector.open (1, ACE_Proactor::instance ())) { ACE_TEST_ASSERT (0); return -1; } // connect to first destination if (addr.set (port, host, 1, addr.get_type ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), host), -1); connector.set_address (addr); if (-1 == connector.connect (addr)) { ACE_TEST_ASSERT (0); return -1; } } ACE_Proactor::instance ()->run_event_loop (); // As Proactor event loop now is inactive it is safe to destroy all // senders connector.stop (); acceptor.stop (); ACE_Proactor::instance()->close_singleton (); // now compare the files - available only when on same machine int success = 0; if (!client_only && !server_only) { ACE_DEBUG ((LM_INFO, ACE_TEXT ("Comparing the input file and the output file...\n"))); success = -1; // map the two files, then perform memcmp { ACE_Mem_Map original_file (input_file); ACE_Mem_Map reconstructed_file (output_file); if (original_file.addr () && original_file.addr () != MAP_FAILED && reconstructed_file.addr () && reconstructed_file.addr () != MAP_FAILED) { // compare lengths if ((original_file.size () == reconstructed_file.size ()) && // and if same size, compare file data (0 == ACE_OS::memcmp (original_file.addr (), reconstructed_file.addr (), original_file.size ()))) success = 0; } } if (0 == success) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("input file and the output file identical!\n"))); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("input file and the output file are different!\n"))); } if (!client_only) ACE_OS::unlink (output_file); ACE_END_TEST; return success; } #else int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Proactor_Scatter_Gather_Test")); ACE_DEBUG ((LM_INFO, ACE_TEXT ("Asynchronous Scatter/Gather IO is unsupported.\n") ACE_TEXT ("Proactor_Scatter_Gather_Test will not be run.\n"))); ACE_END_TEST; return 0; } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO */ ace-8.0.4+dfsg.orig/tests/DLL_Test_Impl.h0000644000175000017500000000300715027201773017075 0ustar sudipsudip //============================================================================= /** * @file DLL_Test_Impl.h * * @author Kirthika Parameswaran */ //============================================================================= #ifndef ACE_TESTS_DLL_TEST_IMPL_H #define ACE_TESTS_DLL_TEST_IMPL_H #include "DLL_Test.h" #include "ace/OS_Memory.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ /** * @class Hello_Impl * * @brief The Hello class in the dynamically linkable library. * * This class is used in this example to show how a library can * be loaded on demand and its methods called on getting the * symbols from the library. */ class Hello_Impl : public Hello { public: /// Constructor Hello_Impl (); /// Destructor ~Hello_Impl (); /// See the documentation in the base class void say_next () override; /// Uses ACE::strnew() to allocate the returned string. ACE_TCHAR *new_info () override; /// Uses ACE_OS::malloc() to allocate the returned string. ACE_TCHAR *malloc_info () override; // Overload the new/delete opertors so the object will be // created/deleted using the memory allocator associated with the // DLL/SO. void *operator new (size_t bytes); /// Overloaded new operator, nothrow_t variant. void *operator new (size_t bytes, const std::nothrow_t &nt); void operator delete (void *p, const std::nothrow_t&) noexcept; void operator delete (void *ptr); }; #endif /* ACE_TESTS_DLL_TEST_IMPL_H */ ace-8.0.4+dfsg.orig/tests/IOStream_Test.cpp0000644000175000017500000003166515027201773017532 0ustar sudipsudip//============================================================================= /** * @file IOStream_Test.cpp * * This is a simple test of the IOStream class that illustrates * how to use iostream operations on almost arbitrary I/O classes. * * @author James CE Johnson */ //============================================================================= #include "test_config.h" #include "ace/Thread.h" #include "ace/Acceptor.h" #include "ace/SOCK_Connector.h" #include "ace/SOCK_Acceptor.h" #include "ace/IOStream.h" #include "ace/OS_NS_sys_wait.h" #if !defined (ACE_LACKS_ACE_IOSTREAM) # include "ace/OS_NS_unistd.h" # include "ace/OS_NS_ctype.h" // Needed for isspace() function typedef ACE_IOStream ACE_SOCK_IOStream; /* The biggest drawback to an iostream is that it generally eats up whitespace when performing a get (>>) operation. That may be good if you're reading non-textual data but if you're trying to read a stream of words with embedded whitespace, it isn't going to be pleasant. If you've been blessed with the GNU String class, I've already provided a derived class, QuotedString, that makes dealing with strings very easy. If you're stuck with an array of characters then you will probably need somthing like I have below. On the other hand, one of the biggest advantages to an iostream is that it eats up whitespace :-) If you put (<<) your non-textual data to the iostream with any number of whitespace between the data then you can easily get (>>) the data from the iostream without having to worry about delimeters and such. The main thing to keep in mind when using an iostream between peers is that you MUST keep the data "fields" in sync. That is, if the "putter" puts an int followed by a float followed by a double, you must make sure that the "getter" will be attempting to get an int then a float then a double. */ // Since I can't rely on GNU's String class being everywhere (yet), // here's a simple class that will work with quoted strings. Use at // your own risk! It is very incomplete! class qchar { public: qchar () { c_ = '\0'; } qchar (char c) : c_ (c) { }; operator char () const { return c_; } qchar operator= (char c) { return c_ = c; } bool operator== (char c) { return c_ == c; } friend ACE_SOCK_IOStream &operator>> (ACE_SOCK_IOStream & stream, qchar * buf); friend ACE_SOCK_IOStream &operator<< (ACE_SOCK_IOStream & stream, qchar * buf); friend ostream &operator<< (ostream & stream, qchar * buf); private: char c_; }; // This is taken almost directly from the QuotedString object that has // been derived from GNU's String class. The advantage to using // QuotedString is that it is MUCH more robust than qchar will every // be. ACE_SOCK_IOStream & operator>> (ACE_SOCK_IOStream & stream, qchar *buf) { char c; *buf = '\0'; // Initialize the string stream.get (c); if (!stream) // eat space up to the first char return stream; // if we don't have a quote, append until we see space if (c != '"') for (*buf++ = c; (void *) stream.get (c) && !ACE_OS::ace_isspace (c); *buf++ = c) continue; else for (; (void *) stream.get (c) && c != '"'; *buf++ = c) if (c == '\\') { stream.get (c); if (c != '"') *buf++ = '\\'; } *buf = '\0'; return stream; } ACE_SOCK_IOStream & operator<< (ACE_SOCK_IOStream &stream, qchar *buf) { stream.put ('"'); while (*buf) { if (*buf == '"') stream.put ('\\'); stream.put ((char) *buf++); } stream.put ('"'); return stream; } ostream & operator<< (ostream &stream, qchar *buf) { while (*buf) stream.put ((char) *buf++); return stream; } // Our client thread will initiate the test by sending some data to // the server. static void * client (void *arg = 0) { ACE_UNUSED_ARG (arg); // We don't _need_ to dynamically allocate the ACE_SOCK_IOStream. // But if we don't, it doesn't get destroyed on some platforms, // If we manage the storage ourselves, we _will_ destroy it at // the end of this function. ACE_SOCK_IOStream server; ACE_INET_Addr *remote_addr = (ACE_INET_Addr *) arg; ACE_INET_Addr addr (remote_addr->get_port_number (), ACE_DEFAULT_SERVER_HOST); ACE_SOCK_Connector connector; if (connector.connect (server, addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" (%t) %p\n"), ACE_TEXT ("Failed to connect to server thread")), 0); // Send a string to the server which it can interpret as a qchar[] const char *str = "\"This is a test string.\""; ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%P|%t) Client Sending: (%C)\n"), str)); server << str << endl; // Allow the server to get the string and echo it to the user. (The // iostream doesn't need this, but humans do :) ACE_OS::sleep (2); // Send another string but this time the server will read it as a // char[]. Notice how the server's output doesn't include all of // the spaces sent by the client. str = "\"THIS IS A TEST STRING.\""; ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%P|%t) Client Sending: (%s)\n"), str)); server << str << endl; // Again, give the server time to display the happenings to the // user. ACE_OS::sleep (2); // Read from the server an int, float, long, float double. The // iostream will pull them out by using the whitespace provided by // the server. ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%P|%t) Client Receiving\n"))); ACE_Time_Value timeout (2); ACE_Time_Value *timeoutp = &timeout; server >> timeoutp; int i; float f1, f2; long l; double d; while (! (server >> i)) { int eof = server.eof (); if (eof) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%P|%t) Unrecoverable stream error/eof\n"))); break; } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%P|%t) Recoverable stream error/timed out)\n"))); server.clear (0); } } server >> f1; server >> l; server >> f2; server >> d; ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%P|%t) Client Received: int %d float %f long %d float %f double %f\n"), i, f1, (int) l, f2, d)); // Check for proper received values. ACE_TEST_ASSERT (i == 1 && (f1 >= 0.123420 && f1 <= 0.123422) && l == 666555444 && (f2 >= 23.44 && f2 <= 23.46) && (d >= -47.1e+9 && d <= -45.9e+9)); // Reset the precision to limit ourselves to two significant digits. server.precision (2); // Now, make a little change & send 'em back. i *= -1; server << i << " "; f1 *= -1.0; server << f1 << " "; l *= -1; server << l << " "; f2 *= -1.0; server << f2 << " "; d *= -1; server << d << " "; server << endl; // Shut down the test. server.close (); return 0; } // Test the server's ability to receive data from the client and then // begin a two-way conversation. static void * server (void *arg = 0) { // We don't _need_ to dynamically allocate the ACE_SOCK_IOStream. // But if we don't, it doesn't get destroyed on some platforms, // If we manage the storage ourselves, we _will_ destroy it at // the end of this function. ACE_SOCK_IOStream client_handler; ACE_INET_Addr server_addr; ACE_SOCK_Acceptor *acceptor = reinterpret_cast (arg); if (acceptor->get_local_addr (server_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("get_local_addr")), 0); #if defined (ACE_HAS_THREADS) if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (client), (void *) &server_addr, THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" (%t) %p\n"), ACE_TEXT ("spawing client thread")), 0); #endif /* ACE_HAS_THREADS */ if (acceptor->accept (client_handler) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" (%P|%t) Failed to accept new client_handler")), 0); // Read a qbuf[] from the client. Notice that all of the client's // whitespace is preserved. qchar qbuf[BUFSIZ]; ACE_OS::memset (qbuf, 0, sizeof qbuf); client_handler >> qbuf; ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%P|%t) Server Received: (\"%C\")\n"), (char *) qbuf)); // Give the client time to announce the next test to the user. ACE_OS::sleep (2); // Now we try to use a char[] to get a string from the client. // Compared to the method above, this is quite messy. Notice also // that whitespace is lost. ACE_IOStream_String buf; ACE_DEBUG ((LM_DEBUG, " (%P|%t) Server Received: (")); while (client_handler && (buf.length () == 0 || buf[buf.length () - 1] != '"')) { if (! (client_handler >> buf)) break; if (buf.length () > 0) ACE_DEBUG ((LM_DEBUG, "%s ", buf.c_str ())); } ACE_DEBUG ((LM_DEBUG, ")\n")); // Send some non-textual data to the client. We use a single // character to separate the fields but we could have used any valid // whitespace. The data will be sent if the iostream's buffer gets // filled or when we flush it with an explicit client.sync () // command or the implicit <> i >> f1 >> l >> f2 >> d; ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%P|%t) Server Received: int %d float %f long %d float %f double %f\n"), i, f1, (int) l, f2, d)); // check for proper received values ACE_TEST_ASSERT (i == -1 && (f1 >= -0.13 && f1 <= -0.11) && l == -666555444 && (f2 >= -24.0 && f2 <= -22.0) && (d >= 45e+9 && d <= 47e+9)); client_handler.close (); return 0; } static int spawn () { // Acceptor; ACE_SOCK_Acceptor acceptor; if (acceptor.open (ACE_sap_any_cast (const ACE_INET_Addr &)) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT (" (%P|%t) %p\n"), ACE_TEXT ("open")), -1); #if defined (ACE_HAS_THREADS) else if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (server), &acceptor, THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("spawning server thread")), -1); // Wait for the client and server thread to exit. ACE_Thread_Manager::instance ()->wait (); #elif !defined (ACE_LACKS_FORK) switch (ACE_OS::fork ("child")) { case -1: ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n%a"), ACE_TEXT ("fork failed"))); ACE_OS::_exit (-1); case 0: // In child { ACE_APPEND_LOG ("IOStream_Test-children"); ACE_INET_Addr server_addr; if (acceptor.get_local_addr (server_addr) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("get_local_addr"))); else client ((void *) &server_addr); ACE_END_LOG; break; } default: // In parent server (&acceptor); // Allow the client to exit, then remove the Process_Mutex. ACE_OS::wait (); break; } #else ACE_ERROR_RETURN ((LM_INFO, ACE_TEXT ("threads *and* processes not supported on this platform\n")), -1); #endif /* ACE_HAS_THREADS */ acceptor.close (); return 0; } #endif /* !ACE_LACKS_ACE_IOSTREAM */ int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("IOStream_Test")); #if !defined (ACE_LACKS_ACE_IOSTREAM) ACE_INIT_LOG (ACE_TEXT ("IOStream_Test-children")); spawn (); #else ACE_ERROR ((LM_INFO, ACE_TEXT ("ACE_IOSTREAM not supported on this platform\n"))); #endif /* !ACE_LACKS_ACE_IOSTREAM */ ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Priority_Reactor_Test.h0000644000175000017500000000351215027201773021002 0ustar sudipsudip //============================================================================= /** * @file Priority_Reactor_Test.h * * It is only used by Priority_Reactor_Test.cpp. * * @author Carlos O'Ryan */ //============================================================================= #ifndef ACE_TESTS_PRIORITY_REACTOR_TEST_H #define ACE_TESTS_PRIORITY_REACTOR_TEST_H #include "ace/Service_Config.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/SOCK_Stream.h" #include "ace/Svc_Handler.h" /** * @class Read_Handler * * @brief A Svc_Handler with a priority twist. * * This Svc_Handler receives the data sent by the childs or writer * threads; each one sets it own priority to a new level, in a * cyclic manner. The main point is test and exercise the * priority dispatching features of ACE_Priority_Reactor. */ class Read_Handler : public ACE_Svc_Handler { public: /// Set the number of children or writer threads we will be running, /// when they are all gone we terminate the reactor loop. static void set_countdown (int nchildren); /// Get the number of children we are still waiting for. static int get_countdown (); /// The Svc_Handler callbacks. virtual int open (void *); virtual int handle_input (ACE_HANDLE h); private: /// How many writers are we waiting for. static int waiting_; /// How many readers have started. static int started_; }; /** * @class Write_Handler * * @brief A simple writer. * * This Svc_Handler simply connects to a server and sends some * output to it. Its purpose is to feed the test. */ class Write_Handler : public ACE_Svc_Handler { public: virtual int open (void *); virtual int svc (); }; #endif /* ACE_TESTS_PRIORITY_REACTOR_TEST_H */ ace-8.0.4+dfsg.orig/tests/CDR_File_Test.cpp0000644000175000017500000002527715027201773017420 0ustar sudipsudip //============================================================================= /** * @file CDR_File_Test.cpp * * Checks the functionality of the ACE CDR streams used for file * I/O. * * @author Giga Giguashvili and Douglas C. Schmidt */ //============================================================================= #include "test_config.h" #include "ace/OS_Memory.h" #include "ace/OS_NS_stdlib.h" #include "ace/OS_NS_string.h" #include "ace/CDR_Stream.h" #include "ace/FILE_Connector.h" #include #include "ace/Get_Opt.h" #include "ace/ACE.h" #include "ace/Truncate.h" // FUZZ: disable check_for_streams_include #include "ace/streams.h" #if !defined (ACE_LACKS_IOSTREAM_TOTALLY) /** * @class CDR_Test * * @brief Simple class that's used to read and write CDR streams. */ class CDR_Test { /// Output the state of a object to the . friend ostream& operator << (ostream &os, const CDR_Test &t); /// Convert the state of this object into an . friend void operator << (ACE_OutputCDR &os, const CDR_Test &t); /// Convert the into the state of this object. friend void operator >> (ACE_InputCDR &is, CDR_Test &); public: /// Default constructor. CDR_Test (); /// Constructor. CDR_Test (ACE_CDR::Char o, ACE_CDR::Short s, ACE_CDR::Long w, ACE_CDR::ULongLong lw, ACE_CDR::Float f, ACE_CDR::Double d); /// Compare for equality with . bool operator == (const CDR_Test &rhs) const; private: ACE_CDR::Char char_; ACE_CDR::Short word2_; ACE_CDR::Long word4_; ACE_CDR::ULongLong word8_; ACE_CDR::Float fpoint_; ACE_CDR::Double dprec_; }; ostream & operator << (ostream &os, const CDR_Test &t) { os << "Char: " << t.char_ << endl << "Short: " << t.word2_ << endl << "Long: " << t.word4_ << endl; ACE_CDR::ULongLong hi = (t.word8_ >> 32); ACE_CDR::ULongLong lo = (t.word8_ & 0xffffffff); os << "ULongLong 1st half: " << hex << ACE_Utils::truncate_cast (hi) << dec << endl << "ULongLong 2nd half: " << hex << ACE_Utils::truncate_cast (lo) << dec << endl << "Float: " << t.fpoint_ << endl << "Double: " << t.dprec_ << endl; return os; } CDR_Test::CDR_Test () : char_ (0), word2_ (0), word4_ (0), word8_ (0), fpoint_ (0.0), dprec_ (0.0) { } CDR_Test::CDR_Test (ACE_CDR::Char o, ACE_CDR::Short s, ACE_CDR::Long w, ACE_CDR::ULongLong lw, ACE_CDR::Float f, ACE_CDR::Double d) : char_ (o), word2_ (s), word4_ (w), word8_ (lw), fpoint_ (f), dprec_ (d) { } void operator << (ACE_OutputCDR &os, const CDR_Test &t) { os << t.char_; os << t.word2_; os << t.word4_; os << t.word8_; os << t.fpoint_; os << t.dprec_; } void operator >> (ACE_InputCDR &is, CDR_Test &t) { is >> t.char_; is >> t.word2_; is >> t.word4_; is >> t.word8_; is >> t.fpoint_; is >> t.dprec_; } bool CDR_Test::operator == (const CDR_Test &rhs) const { // @@ Workaround bug in egcs-1.1.1 using a single && expression // results in UMR errors in purify. if (this->char_ != rhs.char_) return false; if (this->word2_ != rhs.word2_) return false; if (this->word4_ != rhs.word4_) return false; if (this->word8_ != rhs.word8_) return false; if (!ACE::is_equal (this->fpoint_, rhs.fpoint_)) return false; if (!ACE::is_equal (this->dprec_, rhs.dprec_)) return false; return true; } static int run_test (int write_file, ACE_FILE_IO &file, const ACE_TCHAR *filename, CDR_Test &cdr_test) { if (write_file) { char byte_order = ACE_CDR_BYTE_ORDER; size_t n = file.send (&byte_order, 1); if (n != 1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("send failed on %p\n"), filename), -1); ACE_OutputCDR output_cdr (0, ACE_CDR_BYTE_ORDER, 0, 0, 0, ACE_DEFAULT_CDR_MEMCPY_TRADEOFF, ACE_CDR_GIOP_MAJOR_VERSION, ACE_CDR_GIOP_MINOR_VERSION); // Marshal the object data to the output CDR stream. output_cdr << cdr_test; // Output the data to cout. *ace_file_stream::instance ()->output_file () << cdr_test; // Save the data. const ACE_Message_Block *output_mb = output_cdr.begin (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Writing file %s in %s endian format...\n"), filename, ACE_CDR_BYTE_ORDER ? ACE_TEXT("little") : ACE_TEXT("big"))); n = file.send (output_mb->rd_ptr (), output_mb->length ()); if (n != (size_t) output_mb->length ()) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("send failed on %p\n"), filename), -1); } else // We're reading from the file. { ACE_FILE_Info info; if (file.get_info (info) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("get_info failed on %p\n"), filename), -1); ACE_OFF_T msgsize = info.size_ - 1; // Allocate the input buffer char *buffer = 0; ACE_NEW_RETURN (buffer, char[msgsize], -1); #if defined (ACE_INITIALIZE_MEMORY_BEFORE_USE) ACE_OS::memset(buffer, 0, sizeof (buffer)); #endif /* ACE_INITIALIZE_MEMORY_BEFORE_USE */ // Make sure is released automagically. std::unique_ptr b (buffer); // Move the file pointer back to the beginning of the file. if (file.seek (0, SEEK_SET) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), filename), -1); char byte_order; ssize_t size = file.recv (&byte_order, 1); if (size != 1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Read %d bytes, rather than expected ") ACE_TEXT ("1 bytes\n"), size), -1); // Read the cdr data from the file into the buffer. size = file.recv (buffer, msgsize); if (size != msgsize) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Read %d bytes, rather than expected ") ACE_TEXT ("%d bytes\n"), size, msgsize), -1); // Create message block for the whole file. Ensure that it is // aligned to properly handle the double. ACE_Message_Block mb (ACE_CDR::MAX_ALIGNMENT + msgsize); ACE_CDR::mb_align (&mb); mb.copy (buffer, msgsize); // Create CDR input stream from the message block. ACE_InputCDR input_cdr (&mb); input_cdr.reset_byte_order ((int) byte_order); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Reading file %s in %s endian format...\n"), filename, ACE_CDR_BYTE_ORDER ? ACE_TEXT("little") : ACE_TEXT("big"))); CDR_Test temp; // Demarshal the data from the input CDR stream into the // object. input_cdr >> temp; *ace_file_stream::instance ()->output_file () << temp; if (!(temp == cdr_test)) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Data mismatch across file\n"))); } return 0; } static void usage (const ACE_TCHAR *cmd) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Usage: %s ") ACE_TEXT ("[-f filename [-w|-r]]"), cmd)); ACE_OS::exit (1); } // Main function int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("CDR_File_Test")); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("This is ACE Version %u.%u.%u\n\n"), ACE::major_version (), ACE::minor_version (), ACE::micro_version ())); ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("f:rw")); int opt; int reading = 1; int writing = 1; ACE_TCHAR* fn = 0; while ((opt = get_opt ()) != EOF) { switch (opt) { case 'f': fn = get_opt.opt_arg (); break; case 'r': writing = 0; break; case 'w': reading = 0; break; case '?': default: usage (ACE_TEXT("CDR_File_Test")); } } if ((!reading || !writing) && fn == 0) usage (ACE_TEXT("CDR_File_Test")); if (!reading && !writing) usage (ACE_TEXT("CDR_File_Test")); // Create a temporary filename. ACE_FILE_Addr filename (ACE_sap_any_cast (ACE_FILE_Addr &)); if (fn != 0) filename.set (fn); ACE_FILE_Connector connector; ACE_FILE_IO file; // Open up the file. if (connector.connect (file, filename, 0, ACE_Addr::sap_any, 0, ((writing) ? (O_RDWR | O_CREAT) : O_RDONLY), ACE_DEFAULT_FILE_PERMS) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("connect failed for %p\n"), filename.get_path_name ()), 1); CDR_Test cdr_test ('a', 0x00ff, 0xaabbccdd, 0x01234567, 1.54321f, 1.12345); if (writing) { // write the file. run_test (1, file, filename.get_path_name (), cdr_test); } if (reading) { // read the file. run_test (0, file, filename.get_path_name (), cdr_test); } if (fn == 0) { file.close (); if (file.unlink () == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("unlink failed for %p\n"), filename.get_path_name ()), 1); } ACE_END_TEST; return 0; } #else /* ! ACE_LACKS_IOSTREAM_TOTALLY */ int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("CDR_File_Test")); ACE_ERROR ((LM_INFO, ACE_TEXT ("iostreams not supported on this platform\n"))); ACE_END_TEST; return 0; } #endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ ace-8.0.4+dfsg.orig/tests/Compiler_Features_20_DLL.h0000644000175000017500000000104515027201773021106 0ustar sudipsudip //============================================================================= /** * @file Compiler_Features_20_DLL.h * * Test DLL export with default constructor */ //============================================================================= #ifndef ACE_TESTS_COMPILER_FEATURES_20_DLL_H #define ACE_TESTS_COMPILER_FEATURES_20_DLL_H #include "test_config.h" #include "Compiler_Features_20_DLL_Export.h" class COMPILER_FEATURES_20_DLL_Export UtcT { public: ~UtcT () = default; }; #endif /* ACE_TESTS_COMPILER_FEATURES_20_DLL_H */ ace-8.0.4+dfsg.orig/tests/Compiler_Features_21_Test.cpp0000644000175000017500000000113315027201773021744 0ustar sudipsudip/** * This program checks if the compiler doesn't have a certain bug * that we encountered when testing C++11 features */ #include "test_config.h" template struct A { _T1 a; constexpr A() : a() { } }; struct B { B() : b(new A[0]) {} ~B() { delete [] b; } A *b; }; int xxx() { B local_array; return 0; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT("Compiler_Features_21_Test")); ACE_DEBUG ((LM_INFO, ACE_TEXT ("Compiler Feature 21 Test does compile and run.\n"))); int retval = xxx(); ACE_END_TEST; return retval; } ace-8.0.4+dfsg.orig/tests/Compiler_Features_36_Test.cpp0000644000175000017500000000112315027201773021751 0ustar sudipsudip/** * This program checks if the compiler doesn't have a certain bug * that we encountered when testing C++11 features */ #include "test_config.h" #include template struct non_instantiatable { using type = typename T::THIS_TYPE_CANNOT_BE_INSTANTIATED; }; int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT("Compiler_Features_36_Test")); bool const result = std::is_base_of, void>::value; ACE_UNUSED_ARG (result); ACE_DEBUG ((LM_INFO, ACE_TEXT ("C++11 support ok\n"))); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Thread_Pool_Reactor_Test.h0000644000175000017500000000214615027201773021363 0ustar sudipsudip //============================================================================= /** * @file Thread_Pool_Reactor_Test.h * * It is only used by Thread_Pool_Reactor_Test.cpp. * * @author Irfan Pyarali Nanbor Wang */ //============================================================================= #ifndef ACE_TESTS_THREAD_POOL_REACTOR_TEST_H #define ACE_TESTS_THREAD_POOL_REACTOR_TEST_H #include "ace/SOCK_Stream.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Svc_Handler.h" /** * @class Request_Handler * * @brief This class is the Svc_Handler used by . */ class Request_Handler : public ACE_Svc_Handler { public: /// The default constructor makes sure the right reactor is used. Request_Handler (ACE_Thread_Manager *tm = 0); protected: virtual int handle_input (ACE_HANDLE fd = ACE_INVALID_HANDLE); virtual int handle_close (ACE_HANDLE fd, ACE_Reactor_Mask = 0); private: size_t nr_msgs_rcvd_; }; #endif /* ACE_TESTS_THREAD_POOL_REACTOR_TEST_H */ ace-8.0.4+dfsg.orig/tests/Bug_3758_Regression_Test.cpp0000644000175000017500000000521715027201773021444 0ustar sudipsudip// ============================================================================ // // = LIBRARY // tests // // = DESCRIPTION // This simple test exercises ACE_OS::fileno. // // = AUTHOR // Olli Savia // // ============================================================================ #include "test_config.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_unistd.h" #undef THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL #define THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL(X) \ ((X) \ ? static_cast(0) \ : ACE_VERSIONED_NAMESPACE_NAME::__ace_assert(__FILE__, __LINE__, ACE_TEXT_CHAR_TO_TCHAR (#X))) // Test ACE_OS::fileno() int fileno_test () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing fileno method\n"))); int test_status = 0; ACE_HANDLE fn; fn = ACE_OS::fileno (stdin); if (fn == ACE_INVALID_HANDLE) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("fileno(stdin) returned ACE_INVALID_HANDLE.\n"))); test_status = -1; } else if (fn != ACE_STDIN) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("stdin test failed.\n"))); test_status = -1; } fn = ACE_OS::fileno (stdout); if (fn == ACE_INVALID_HANDLE) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("fileno(stdout) returned ACE_INVALID_HANDLE.\n"))); test_status = -1; } else #if defined (ACE_WIN32) // Check if stdout is not associated with an output stream. // This is not an error. if (fn == reinterpret_cast(-2)) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("fileno(stdout) returned -2.\n"))); } else #endif if (fn != ACE_STDOUT) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("stdout test failed.\n"))); test_status = -1; } fn = ACE_OS::fileno (stderr); if (fn == ACE_INVALID_HANDLE) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("fileno(stderr) returned ACE_INVALID_HANDLE.\n"))); test_status = -1; } else #if defined (ACE_WIN32) // Check if stderr is not associated with an output stream. // This is not an error. if (fn == reinterpret_cast(-2)) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("fileno(stderr) returned -2.\n"))); } else #endif if (fn != ACE_STDERR) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("stderr test failed.\n"))); test_status = -1; } return test_status; } int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Bug_3758_Regression_Test")); int status = 0; int result; if ((result = fileno_test ()) != 0) status = -1; ACE_END_TEST; return status; } #undef THIS_IS_NOT_AN_ASSERT_IT_IS_A_NON_DEBUG_TEST_AS_WELL ace-8.0.4+dfsg.orig/tests/Reactor_Performance_Test.cpp0000644000175000017500000002543515027201773021765 0ustar sudipsudip //============================================================================= /** * @file Reactor_Performance_Test.cpp * * This test is used to time the dispatching mechanisms of the * s. Both the and * can be tested. * * @author Irfan Pyarali */ //============================================================================= #include "test_config.h" #include "Reactor_Performance_Test.h" #include "ace/Acceptor.h" #include #include "ace/Connector.h" #include "ace/Get_Opt.h" #include "ace/Profile_Timer.h" #include "ace/Reactor.h" #include "ace/SOCK_Acceptor.h" #include "ace/SOCK_Connector.h" #include "ace/Select_Reactor.h" #include "ace/WFMO_Reactor.h" #include #if defined (ACE_HAS_THREADS) && !defined ACE_LACKS_ACCEPT static const char ACE_ALPHABET[] = "abcdefghijklmnopqrstuvwxyz"; // Number of client (user) threads static int opt_nconnections = 5; // Number of data exchanges static int opt_nloops = 200; // Use the WFMO_Reactor static int opt_wfmo_reactor = 0; // Use the Select_Reactor static int opt_select_reactor = 0; // Extra debug messages static int opt_debug = 0; int Read_Handler::waiting_ = 0; void Read_Handler::set_countdown (int nconnections) { Read_Handler::waiting_ = nconnections; } // Initialize the Svc_Handler int Read_Handler::open (void *) { if (this->peer ().enable (ACE_NONBLOCK) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) Read_Handler::open, cannot set non blocking mode\n")), -1); if (reactor ()->register_handler (this, READ_MASK) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) Read_Handler::open, cannot register handler\n")), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) created svc_handler for handle %d\n"), get_handle ())); return 0; } // Handle incoming data int Read_Handler::handle_input (ACE_HANDLE handle) { ACE_UNUSED_ARG (handle); char buf[BUFSIZ]; while (1) { ssize_t result = this->peer ().recv (buf, sizeof (buf) - 1); if (result > 0) { if (opt_debug) { buf[result] = 0; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Read_Handler::handle_input: %s\n"), buf)); } } else if (result < 0) { if (errno == EWOULDBLOCK) return 0; else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("handle_input: %p (errno: %d)\n"), ACE_TEXT ("recv"), ACE_ERRNO_GET)); // This will cause handle_close to get called. return -1; } } else // result == 0 { // This will cause handle_close to get called. return -1; } } ACE_NOTREACHED (return 0); } // Handle connection shutdown. int Read_Handler::handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask) { ACE_UNUSED_ARG (handle); ACE_UNUSED_ARG (close_mask); // Reduce count. waiting_--; // If no connections are open. if (waiting_ == 0) ACE_Reactor::instance ()->end_reactor_event_loop (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Read_Handler::handle_close closing down\n"))); // Shutdown this->destroy (); return 0; } int Write_Handler::open (void *) { return 0; } int Write_Handler::send_data () { int send_size = sizeof (ACE_ALPHABET) - 1; if (this->peer ().send_n (ACE_ALPHABET, send_size) != send_size) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("send_n")), -1); return 0; } // Connection factories using CONNECTOR = ACE_Connector; using ACCEPTOR = ACE_Acceptor; // Execute the client tests. void * client (void *arg) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) running client\n"))); ACE_INET_Addr *connection_addr = reinterpret_cast (arg); CONNECTOR connector; int i; // Automagic memory cleanup. Write_Handler **temp_writers = 0; ACE_NEW_RETURN (temp_writers, Write_Handler *[opt_nconnections], 0); std::unique_ptr writers (temp_writers); ACE_TCHAR *temp_failed = 0; ACE_NEW_RETURN (temp_failed, ACE_TCHAR[opt_nconnections], 0); std::unique_ptr failed_svc_handlers (temp_failed); // Automagic memory cleanup. ACE_INET_Addr *temp_addresses; ACE_NEW_RETURN (temp_addresses, ACE_INET_Addr [opt_nconnections], 0); std::unique_ptr addresses (temp_addresses); // Initialize array. for (i = 0; i < opt_nconnections; i++) { writers[i] = 0; addresses[i] = *connection_addr; } // Connection all svc_handlers int result = connector.connect_n (opt_nconnections, writers.get (), addresses.get (), failed_svc_handlers.get ()); if (result == -1) { // Print out the connections that failed... for (i = 0; i < opt_nconnections; i++) if (failed_svc_handlers.get ()[i]) { ACE_INET_Addr failed_addr = addresses.get()[i]; ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) connection failed to %s, %d\n"), failed_addr.get_host_name (), failed_addr.get_port_number ())); } return 0; } // If no connections failed (result == 0) then there should be valid // ACE_Svc_handler pointers in each writers[] position. Iterate to // send data for (int j = 0; j < opt_nloops; j++) for (i = 0; i < opt_nconnections; i++) if (writers[i]->send_data () == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("writer::send_data")), 0); // Cleanup for (i = 0; i < opt_nconnections; i++) writers[i]->destroy (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) finishing client\n"))); return 0; } // Sets up the correct reactor (based on platform and options). void create_reactor () { ACE_Reactor_Impl *impl = 0; if (opt_wfmo_reactor) { #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 == 1) ACE_NEW (impl, ACE_WFMO_Reactor); #endif /* ACE_HAS_WINSOCK2 == 1 */ } else if (opt_select_reactor) ACE_NEW (impl, ACE_Select_Reactor); ACE_Reactor *reactor = 0; ACE_NEW (reactor, ACE_Reactor (impl)); ACE_Reactor::instance (reactor); } // Print stats. void print_results (ACE_Profile_Timer::ACE_Elapsed_Time &et) { const ACE_TCHAR *reactor_type = 0; if (opt_wfmo_reactor) reactor_type = ACE_TEXT ("WFMO_Reactor"); else if (opt_select_reactor) reactor_type = ACE_TEXT ("Select_Reactor"); else reactor_type = ACE_TEXT ("Platform's default Reactor"); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n\tReactor_Performance Test statistics:\n\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\tReactor Type: %s\n"), reactor_type)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\tConnections: %d\n"), opt_nconnections)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\tIteration per connection: %d\n"), opt_nloops)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n\tTiming results:\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\t\treal time = %f secs \n\t\tuser time = %f secs \n\t\tsystem time = %f secs\n\n"), et.real_time, et.user_time, et.system_time)); } int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Reactor_Performance_Test")); //FUZZ: disable check_for_lack_ACE_OS ACE_Get_Opt getopt (argc, argv, ACE_TEXT ("dswc:l:"), 1); for (int c; (c = getopt ()) != -1; ) //FUZZ: enble check_for_lack_ACE_OS switch (c) { case 's': opt_select_reactor = 1; break; case 'w': opt_wfmo_reactor = 1; break; case 'c': opt_nconnections = ACE_OS::atoi (getopt.opt_arg ()); break; case 'l': opt_nloops = ACE_OS::atoi (getopt.opt_arg ()); break; case 'd': opt_debug = 1; break; } // Sets up the correct reactor (based on platform and options). create_reactor (); // Manage memory automagically. std::unique_ptr reactor (ACE_Reactor::instance ()); std::unique_ptr impl; // If we are using other that the default implementation, we must // clean up. if (opt_select_reactor || opt_wfmo_reactor) { std::unique_ptr auto_impl (ACE_Reactor::instance ()->implementation ()); impl = std::move(auto_impl); } Read_Handler::set_countdown (opt_nconnections); // Acceptor ACCEPTOR acceptor; ACE_INET_Addr server_addr; // Bind acceptor to any port and then find out what the port was. ACE_INET_Addr local_addr (ACE_sap_any_cast (const ACE_INET_Addr &)); if (acceptor.open (local_addr) == -1 || acceptor.acceptor ().get_local_addr (server_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("open")), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) starting server at port %d\n"), server_addr.get_port_number ())); ACE_INET_Addr connection_addr (server_addr.get_port_number (), ACE_DEFAULT_SERVER_HOST); if (ACE_Thread_Manager::instance ()->spawn (ACE_THR_FUNC (client), (void *) &connection_addr, THR_NEW_LWP | THR_DETACHED) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("thread create failed"))); ACE_Time_Value run_limit (opt_nloops / 10); ACE_Profile_Timer timer; timer.start (); const int status = ACE_Reactor::instance ()->run_reactor_event_loop (run_limit); timer.stop (); ACE_Profile_Timer::ACE_Elapsed_Time et; timer.elapsed_time (et); // Print results print_results (et); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) waiting for the client thread...\n"))); ACE_Thread_Manager::instance ()->wait (); ACE_END_TEST; return status; } #else int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Reactor_Performance_Test")); ACE_ERROR ((LM_INFO, ACE_TEXT ("threads/accept not supported on this platform\n"))); ACE_END_TEST; return 0; } #endif /* ACE_HAS_THREADS && ! ACE_LACKS_ACCEPT */ ace-8.0.4+dfsg.orig/tests/Compiler_Features_22_DLL_Export.h0000644000175000017500000000466715027201773022466 0ustar sudipsudip // -*- C++ -*- // Definition for Win32 Export directives. // This file is generated automatically by generate_export_file.pl COMPILER_FEATURES_22_DLL // ------------------------------ #ifndef COMPILER_FEATURES_22_DLL_EXPORT_H #define COMPILER_FEATURES_22_DLL_EXPORT_H #include "ace/config-all.h" #if defined (ACE_AS_STATIC_LIBS) && !defined (COMPILER_FEATURES_22_DLL_HAS_DLL) # define COMPILER_FEATURES_22_DLL_HAS_DLL 0 #endif /* ACE_AS_STATIC_LIBS && ! TEST_HAS_DLL */ #if !defined (COMPILER_FEATURES_22_DLL_HAS_DLL) # define COMPILER_FEATURES_22_DLL_HAS_DLL 1 #endif /* ! COMPILER_FEATURES_22_DLL_HAS_DLL */ #if defined (COMPILER_FEATURES_22_DLL_HAS_DLL) && (COMPILER_FEATURES_22_DLL_HAS_DLL == 1) # if defined (COMPILER_FEATURES_22_DLL_BUILD_DLL) # define COMPILER_FEATURES_22_DLL_Export ACE_Proper_Export_Flag # define COMPILER_FEATURES_22_DLL_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) # define COMPILER_FEATURES_22_DLL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) # else /* COMPILER_FEATURES_22_DLL_BUILD_DLL */ # define COMPILER_FEATURES_22_DLL_Export ACE_Proper_Import_Flag # define COMPILER_FEATURES_22_DLL_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) # define COMPILER_FEATURES_22_DLL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) # endif /* COMPILER_FEATURES_22_DLL_BUILD_DLL */ #else /* COMPILER_FEATURES_22_DLL_HAS_DLL == 1 */ # define COMPILER_FEATURES_22_DLL_Export # define COMPILER_FEATURES_22_DLL_SINGLETON_DECLARATION(T) # define COMPILER_FEATURES_22_DLL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) #endif /* COMPILER_FEATURES_22_DLL_HAS_DLL == 1 */ // Set COMPILER_FEATURES_22_DLL_NTRACE = 0 to turn on library specific tracing even if // tracing is turned off for ACE. #if !defined (COMPILER_FEATURES_22_DLL_NTRACE) # if (ACE_NTRACE == 1) # define COMPILER_FEATURES_22_DLL_NTRACE 1 # else /* (ACE_NTRACE == 1) */ # define COMPILER_FEATURES_22_DLL_NTRACE 0 # endif /* (ACE_NTRACE == 1) */ #endif /* !COMPILER_FEATURES_22_DLL_NTRACE */ #if (COMPILER_FEATURES_22_DLL_NTRACE == 1) # define COMPILER_FEATURES_22_DLL_TRACE(X) #else /* (COMPILER_FEATURES_22_DLL_NTRACE == 1) */ # define COMPILER_FEATURES_22_DLL_TRACE(X) ACE_TRACE_IMPL(X) #endif /* (COMPILER_FEATURES_22_DLL_NTRACE == 1) */ #endif /* COMPILER_FEATURES_22_DLL_EXPORT_H */ // End of auto generated file. ace-8.0.4+dfsg.orig/tests/MT_Reactor_Timer_Test.h0000644000175000017500000000475615027201773020654 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file MT_Reactor_Timer_Test.h * * This file contains class definitions needed for template * instantiation in the MT_Reactor_Timer_Test.cpp file. * * @author Steve Huston */ //============================================================================= #ifndef ACE_TESTS_MT_REACTOR_TIMER_TEST_H #define ACE_TESTS_MT_REACTOR_TIMER_TEST_H #include "ace/Reactor.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Task.h" #include "ace/Pipe.h" /** * @class Time_Handler * * @brief Test out the multi-threading features of the Reactor's timer * mechanism. */ class Time_Handler : public ACE_Task { public: Time_Handler (); void setup (); int verify_results(); /// Run by a daemon thread to handle deferred processing. virtual int svc (); virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg); private: enum { TIMER_SLOTS = 10 }; /** * The timer_id_ array holds timer IDs. They also have some other values * that are specific to this test: * -1 the timer has not been set * -2 the timer was set, but has been cancelled * -3 the timer was set, and it already fired */ long timer_id_[TIMER_SLOTS]; enum { TIMER_NOTSET = -1, TIMER_CANCELLED = -2, TIMER_FIRED = -3 }; long prev_timer_; #if defined ACE_HAS_THREADS ACE_Thread_Mutex lock_; #endif /* ACE_HAS_THREADS */ }; /** * @class Dispatch_Count_Handler * * @brief A simple test to ensure that the Reactor counts the number of * dispatches correctly. */ class Dispatch_Count_Handler : public ACE_Event_Handler { public: Dispatch_Count_Handler (); /// Clean up resources from the Reactor. int handle_close (ACE_HANDLE h, ACE_Reactor_Mask m); /// Keep track of the number of timeouts. virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg); /// Keep track of the number of I/O events. virtual int handle_input (ACE_HANDLE); /// Keep track of the number of notifies. virtual int handle_exception (ACE_HANDLE); /// Verify that the expected events did happen. int verify_results (); private: /// Provide something to trigger I/O. ACE_Pipe pipe_; int input_seen_; int notify_seen_; size_t timers_fired_; }; #endif /* ACE_TESTS_MT_REACTOR_TIMER_TEST_H */ ace-8.0.4+dfsg.orig/tests/Config_Test_Import_1.ini0000644000175000017500000000011115027201773021001 0ustar sudipsudip[SectionOne] SomeKey=SomeValue [SectionTwo] SomeOtherKey=SomeOtherValue ace-8.0.4+dfsg.orig/tests/Recursive_Condition_Bug_Test.cpp0000644000175000017500000001412215027201773022606 0ustar sudipsudip //============================================================================= /** * @file Recursive_Condition_Bug_Test.cpp * * This test program validates the functionality of the * ACE_Condition template * specialization when combined with the * ACE_Thread_Timer_Queue_Adapter on Win32 and Posix pthreads. * It was added to test for bugs with the ACE_OS recursive * condition implementation. * * @author Leonid Kvetnyi and Douglas C. Schmidt */ //============================================================================= #include "test_config.h" #include "ace/OS_NS_sys_time.h" #include "ace/Task_T.h" #include "ace/Activation_Queue.h" #include "ace/Timer_Heap.h" #include "ace/Timer_Queue_Adapters.h" #include "ace/Condition_Recursive_Thread_Mutex.h" #if defined (ACE_HAS_THREADS) // Number of iterations for the performance tests. static int max_iterations = 30; using Thread_Timer_Queue = ACE_Thread_Timer_Queue_Adapter; class Test_Handler; class Test_Task : public ACE_Task { public: int svc () override { while (--max_iterations > 0) { // dequeue the next object ACE_Message_Block * mb = 0; if (this->getq (mb) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("getq failed")), -1); Test_Handler *handler = reinterpret_cast (mb->base ()); mb->release (); ACE_Time_Value timeout = ACE_OS::gettimeofday () + ACE_Time_Value (1, 0); if (timer_queue_.schedule (reinterpret_cast (handler), this, timeout) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("schedule failed")), -1); ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%t) %d iteration(s) remain\n"), max_iterations)); } timer_queue_.deactivate (); ACE_DEBUG ((LM_INFO, ACE_TEXT ("(%t) leaving the Test_task\n"))); return 0; } //FUZZ: disable check_for_lack_ACE_OS int open (void * = 0) override { //FUZZ: enable check_for_lack_ACE_OS if (ACE_Task::activate (THR_NEW_LWP, 1) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Test_Task::activate")), -1); if (0 != timer_queue_.activate ()) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Test_Task::queue activate")), -1); return 0; } private: Thread_Timer_Queue timer_queue_; }; class Test_Handler : public ACE_Event_Handler { public: int handle_timeout (const ACE_Time_Value &, const void *arg) override { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Test_Handler::handle_timeout\n"))); void *nc_arg = const_cast (arg); Test_Task *test_task = reinterpret_cast (nc_arg); ACE_Message_Block *mb = 0; ACE_NEW_MALLOC_RETURN (mb, static_cast (ACE_Allocator::instance()->malloc (sizeof (ACE_Message_Block))), ACE_Message_Block (sizeof (*this), // size ACE_Message_Block::MB_DATA, // type 0, // cont (char *) this, // data 0, 0, ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY, ACE_Time_Value::zero, ACE_Time_Value::max_time, 0, ACE_Allocator::instance()), // data -1); test_task->putq (mb); return 0; } }; #endif /* ACE_HAS_THREADS */ int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Recursive_Condition_Bug_Test")); #if defined (ACE_HAS_THREADS) // Timer queue usage. Test_Handler handler; Test_Task task; if (0 != task.open ()) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("open")), -1); ACE_Message_Block *mb = 0; ACE_NEW_MALLOC_RETURN (mb, static_cast (ACE_Allocator::instance()->malloc (sizeof (ACE_Message_Block))), ACE_Message_Block (sizeof (handler), // size ACE_Message_Block::MB_DATA, // type 0, // cont (char *) &handler, 0, 0, ACE_DEFAULT_MESSAGE_BLOCK_PRIORITY, ACE_Time_Value::zero, ACE_Time_Value::max_time, 0, ACE_Allocator::instance()), // data -1); if (-1 == task.putq (mb)) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("putq")), -1); if (ACE_Thread_Manager::instance ()->wait () == -1) ACE_ERROR_RETURN ((LM_ERROR, "wait on Thread_Manager failed"), -1); #else ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE doesn't support recursive condition variables on this platform\n"))); #endif /* ACE_HAS_THREADS */ ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Bug_2497_Regression_Test.cpp0000644000175000017500000000233315027201773021437 0ustar sudipsudip/** * @file Bug_2497_Regression_Test.cpp * * Reproduces the problems reported in bug 2497 * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=2497 * * @author sergant128@mail.ru */ #include "test_config.h" #include "ace/Module.h" #include "ace/Task.h" #include "ace/Stream.h" class Test_Task : public ACE_Task { public: Test_Task( ) : _destructorCalled(0) { } ~Test_Task( ) override { ++_destructorCalled; if (_destructorCalled > 1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Test_Task::~Test_Task() should be called once!!!\n"))); } private: int _destructorCalled; }; class Test_Module : public ACE_Module { public: Test_Module( ) { this->open( ACE_TEXT("Test module"), &_writerTask, &_readerTask, 0, M_DELETE_NONE ); } private: Test_Task _writerTask, _readerTask; }; int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Bug_2497_Regression_Test")); ACE_Stream stream; if (stream.push(new Test_Module()) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error: push failed\n"))); } ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Message_Queue_Test_Ex.h0000644000175000017500000000360515027201773020671 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Message_Queue_Test_Ex.h * * Define class needed for generating templates. * * @author Michael Vitlo * @author Irfan Pyarali * @author David L. Levine * @author Guy Peleg */ //============================================================================= #ifndef ACE_TESTS_MESSAGE_QUEUE_TEST_EX_H #define ACE_TESTS_MESSAGE_QUEUE_TEST_EX_H #include "ace/OS_NS_string.h" // User-defined class used for queue data. class User_Class { public: User_Class (const char inputMsg[]) { ACE_NEW (this->message_, char[ACE_OS::strlen (inputMsg) + 1]); ACE_OS::strcpy (this->message_, inputMsg); } ~User_Class () { delete [] this->message_; } const char *message () const { return this->message_; } // This is for checking the ACE_Message_Queue_Ex_N User_Class *next () const { return this->next_; } void next (User_Class *uc) { this->next_ = uc; } private: char *message_ {}; User_Class *next_ {}; }; // The main tests for the ACE_Message_Queue_Ex_N struct Receive_Messages; class MQ_Ex_N_Tester { public: int single_thread_performance_test (); #if defined (ACE_HAS_THREADS) int performance_test (); /// Sender runs with an autonomous thread static ACE_THR_FUNC_RETURN sender (void *); /// Receiver runs with an autonomous thread static ACE_THR_FUNC_RETURN receiver (void *); /// Multi threaded tests use this queue ACE_Message_Queue_Ex_N mt_queue_; #endif /* ACE_HAS_THREADS */ /// Single threaded tests use this queue ACE_Message_Queue_Ex_N st_queue_; private: /// Helper methods int test_enqueue_head (); int test_enqueue_tail (); }; #endif /* ACE_TESTS_MESSAGE_QUEUE_TEST_EX_H */ ace-8.0.4+dfsg.orig/tests/Compiler_Features_26_Test.cpp0000644000175000017500000000307615027201773021761 0ustar sudipsudip/** * This program checks if the compiler doesn't have a certain bug * that we encountered when testing C++11 features */ #include "test_config.h" #include int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT("Compiler_Features_26_Test")); int retval = 0; std::shared_ptr a,b,c,d; a = std::make_shared (10); b = std::make_shared (10); c = b; if (!(a!=b) || (a==b)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Problem using a!=b\n"))); ++retval; } if (!(b==c) || (b!=c)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Problem using b==c\n"))); ++retval; } if ((c==d) || !(d!=c)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Problem using b==c\n"))); ++retval; } if ((a==nullptr) || !(a!=nullptr)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Problem using a==nullptr\n"))); ++retval; } if ((b==nullptr) || !(b!=nullptr)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Problem using b==nullptr\n"))); ++retval; } if ((c==nullptr) || !(c!=nullptr)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Problem using c==nullptr\n"))); ++retval; } if ((d!=nullptr) || !(d==nullptr)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Problem using d!=nullptr\n"))); ++retval; } if (retval == 0) { ACE_DEBUG ((LM_INFO, ACE_TEXT ("Compiler Feature 26 Test does compile and run.\n"))); } ACE_END_TEST; return retval; } ace-8.0.4+dfsg.orig/tests/Compiler_Features_31_Test.cpp0000644000175000017500000000225615027201773021754 0ustar sudipsudip/** * This program checks if the compiler doesn't have a certain bug * that we encountered when testing C++11 features */ #include "test_config.h" namespace A { namespace C { class AbstractBase; template class abstractbase_reference; template struct abstractbase_traits { using ref_type = abstractbase_reference; static ref_type narrow(abstractbase_reference); static ref_type narrow2(abstractbase_reference); }; }; }; namespace A { namespace C { class AbstractBase { protected: template friend typename C::abstractbase_traits::ref_type C::abstractbase_traits::narrow( C::abstractbase_reference); template friend auto C::abstractbase_traits::narrow2( C::abstractbase_reference) -> ref_type; AbstractBase() = default; }; }; }; int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT("Compiler_Features_31_Test")); ACE_DEBUG ((LM_INFO, ACE_TEXT ("C++11 support ok\n"))); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Refcounted_Auto_Ptr_Test.h0000644000175000017500000000153415027201773021417 0ustar sudipsudip //============================================================================= /** * @file Refcounted_Auto_Ptr_Test.h * * Define class needed for generating templates. IBM C++ requires this to * be in its own file for auto template instantiation. * * @author Steve Huston */ //============================================================================= #ifndef ACE_TESTS_REFCOUNTED_AUTO_PTR_TEST_H #define ACE_TESTS_REFCOUNTED_AUTO_PTR_TEST_H #include "ace/Atomic_Op.h" #include "ace/Synch.h" struct Printer { Printer (const char *message); ~Printer (); void print (); const char *message_; unsigned int which_; static ACE_Atomic_Op current_instance_; static ACE_Atomic_Op instance_count_; }; #endif /* ACE_TESTS_REFCOUNTED_AUTO_PTR_TEST_H */ ace-8.0.4+dfsg.orig/tests/Cached_Accept_Conn_Test.cpp0000644000175000017500000003500615027201773021443 0ustar sudipsudip //============================================================================= /** * @file Cached_Accept_Conn_Test.cpp * * The test illustrates how the works by * showing how you can cache connections on the client using * different caching strategies. Also how connections can be purged * explicitly and implicitly if needed from the connection cache * maintained by the connector. The can also * explicitly purge connections from the process CONNECTION CACHE on * demand. * * @author Kirthika Parameswaran */ //============================================================================= #ifndef CACHED_ACCEPT_CONNECTION_TEST #define CACHED_ACCEPT_CONNECTION_TEST #include "test_config.h" #include "Cached_Accept_Conn_Test.h" #include "ace/OS_NS_string.h" #include "ace/Get_Opt.h" #if defined(_MSC_VER) #pragma warning(disable:4503) #endif /* _MSC_VER */ int connection_accepted = 0; int debug = 0; template Accept_Strategy::Accept_Strategy (CACHED_CONNECT_STRATEGY &caching_connect_strategy) : caching_connect_strategy_ (caching_connect_strategy) { } template int Accept_Strategy::open (const ACE_PEER_ACCEPTOR_ADDR &local_addr, bool restart) { int result = ACCEPT_STRATEGY_BASE::open (local_addr, restart); if (result == 0) return result; // If the error occurred due to the fact that the file descriptor // limit was exhausted, then purge the connection cache of some // entries. result = this->out_of_sockets_handler (); if (result == -1) return -1; // If we are able to purge, try again. return ACCEPT_STRATEGY_BASE::open (local_addr, restart); } template int Accept_Strategy::accept_svc_handler (SVC_HANDLER *svc_handler) { // Stop the event loop. connection_accepted = 1; // Try to find out if the implementation of the reactor that we are // using requires us to reset the event association for the newly // created handle. This is because the newly created handle will // inherit the properties of the listen handle, including its event // associations. int reset_new_handle = this->reactor_->uses_event_associations (); int result = this->acceptor ().accept (svc_handler->peer (), // stream 0, // remote address 0, // timeout 1, // restart reset_new_handle // reset new handler ); if (result == 0) { if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Accept succeeded with handle %d\n"), svc_handler->get_handle ())); return result; } // If the error occurred due to the fact that the file descriptor // limit was exhausted, then purge the connection cache of some // entries. if (0 != this->out_of_sockets_handler ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("out_of_sockets_handler"))); // Close down handler to avoid memory leaks. svc_handler->close (0); return -1; } template int Accept_Strategy::out_of_sockets_handler () { if (ACE::out_of_handles (errno)) { // Close connections which are cached by explicitly purging the // connection cache maintained by the connector. ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Purging connections from Connection Cache...\n"))); return this->caching_connect_strategy_.purge_connections (); } return -1; } using ACCEPT_STRATEGY = Accept_Strategy; Client_Svc_Handler::Client_Svc_Handler (ACE_Thread_Manager *t) : ACE_Svc_Handler (t) { } int Client_Svc_Handler::open (void *) { if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("opening Client_Svc_Handler %@ with handle %d\n"), this, this->peer ().get_handle ())); return 0; } int Client_Svc_Handler::close (u_long flags) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Closing Client_Svc_Handler %@ with handle %d\n"), this, this->peer ().get_handle ())); return ACE_Svc_Handler::close (flags); } Server_Svc_Handler::Server_Svc_Handler (ACE_Thread_Manager *t) : ACE_Svc_Handler (t) { } int Server_Svc_Handler::open (void *) { if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("opening Server_Svc_Handler %@ with handle %d\n"), this, this->peer ().get_handle ())); return this->close (); } enum Caching_Strategy_Type { ACE_LFU, ACE_FIFO, ACE_LRU, ACE_NULL, ACE_ALL }; // Default number of clients/servers. static int listen_once = 1; static int user_has_specified_iterations = 0; static size_t keep_handles_available = 100; static double purge_percentage = 20; static Caching_Strategy_Type caching_strategy_type = ACE_ALL; // On Win32, the handle gobbling doesn't work. Therefore, we need // more iterations to get to the handle limit. #if defined (ACE_WIN32) static int iterations = 2000; #else static int iterations = 200; #endif /* ACE_WIN32 */ static int cached_connect (STRATEGY_CONNECTOR &con, const ACE_INET_Addr &server_addr) { // This will make sure we get the host information correct. ACE_INET_Addr remote_addr (server_addr.get_port_number (), ACE_LOCALHOST); // Perform a blocking connect to the server using the Strategy // Connector with a connection caching strategy. Client_Svc_Handler *svc_handler = 0; int result = con.connect (svc_handler, remote_addr); if (result == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("connection failed")), -1); else if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Connection successful to server at port %d!\n"), remote_addr.get_port_number ())); // Reset Svc_Handler state. svc_handler->recycle_state (ACE_RECYCLABLE_PURGABLE_BUT_NOT_IDLE); return 0; } static void server () { int result = 1; while (connection_accepted == 0) result = ACE_Reactor::instance ()->handle_events (); connection_accepted = 0; ACE_UNUSED_ARG (result); } static void test_connection_management (CACHING_STRATEGY &caching_strategy) { // Configure the Strategy Connector with a strategy that caches // connection. CACHED_CONNECT_STRATEGY caching_connect_strategy (caching_strategy); NULL_CREATION_STRATEGY creation_strategy; NULL_ACTIVATION_STRATEGY activation_strategy; STRATEGY_CONNECTOR strategy_connector (0, &creation_strategy, &caching_connect_strategy, &activation_strategy); // Connect strategy is required by the . ACCEPT_STRATEGY listen_one_time_accept_strategy (caching_connect_strategy); // If is true, only one Acceptor is used for the test. ACCEPTOR listen_one_time_acceptor; ACE_INET_Addr server_addr; int result = listen_one_time_acceptor.open (ACE_sap_any_cast (const ACE_INET_Addr &), ACE_Reactor::instance (), 0, &listen_one_time_accept_strategy); if (result != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("acceptor open"))); return; } result = listen_one_time_acceptor.acceptor ().get_local_addr (server_addr); if (result != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("acceptor getaddr"))); listen_one_time_acceptor.close (); return; } for (int i = 1; i <= iterations; ++i) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%T iteration %d\n"), i)); // Connect strategy is required by the . ACCEPT_STRATEGY listen_multiple_times_accept_strategy (caching_connect_strategy); // If is false, one Acceptor is used for every // iteration. ACCEPTOR listen_multiple_times_acceptor; if (!listen_once) { // Bind acceptor to any port and then find out what the port // was. if (listen_multiple_times_acceptor.open (ACE_sap_any_cast (const ACE_INET_Addr &), ACE_Reactor::instance (), 0, &listen_multiple_times_accept_strategy) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open"))); break; } if (listen_multiple_times_acceptor.acceptor ().get_local_addr (server_addr) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("get_local_addr"))); break; } } if (debug) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("starting server at port %d\n"), server_addr.get_port_number ())); // Run the cached blocking test. if (-1 == cached_connect (strategy_connector, server_addr)) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("cached_connect"))); else server (); } } void test_caching_strategy_type () { CACHING_STRATEGY *caching_strategy = 0; switch (caching_strategy_type) { case ACE_NULL: ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nNull_Caching_Strategy\n\n"))); ACE_NEW (caching_strategy, NULL_CACHING_STRATEGY_ADAPTER); break; case ACE_LRU: ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nLRU_Caching_Strategy\n\n"))); ACE_NEW (caching_strategy, LRU_CACHING_STRATEGY_ADAPTER); break; case ACE_LFU: ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nLFU_Caching_Strategy\n\n"))); ACE_NEW (caching_strategy, LFU_CACHING_STRATEGY_ADAPTER); break; case ACE_FIFO: ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nFIFO_Caching_Strategy\n\n"))); ACE_NEW (caching_strategy, FIFO_CACHING_STRATEGY_ADAPTER); break; case ACE_ALL: // Just to remove warnings! break; } caching_strategy->purge_percent (purge_percentage); test_connection_management (*caching_strategy); delete caching_strategy; } int parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("l:i:p:c:a:d")); int cc; while ((cc = get_opt ()) != -1) switch (cc) { case 'd': debug = 1; break; case 'l': listen_once = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'i': iterations = ACE_OS::atoi (get_opt.opt_arg ()); user_has_specified_iterations = 1; break; case 'p': purge_percentage = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'c': // Note that if null caching strategy is used then this test // will fail if the number of servers exceed number of open // files allowed for the process. if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("null")) == 0) caching_strategy_type = ACE_NULL; if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("lru")) == 0) caching_strategy_type = ACE_LRU; if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("lfu")) == 0) caching_strategy_type = ACE_LFU; if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("fifo")) == 0) caching_strategy_type = ACE_FIFO; break; case 'a': keep_handles_available = ACE_OS::atoi (get_opt.opt_arg ()); break; case '?': case 'h': default: ACE_ERROR ((LM_ERROR, ACE_TEXT ("usage: %s ") ACE_TEXT ("[-t (timeout)] ") ACE_TEXT ("[-c (caching strategy: lru / lfu / fifo / null [default = all])] ") ACE_TEXT ("[-i (iterations)] ") ACE_TEXT ("[-l (listen once)] ") ACE_TEXT ("[-d (addition debugging output)] ") ACE_TEXT ("[-p (purge percent)] ") ACE_TEXT ("[-a (keep handles available)] "), ACE_TEXT ("Cached_Accept_Conn_Test"))); return -1; } return 0; } int run_main (int argc, ACE_TCHAR *argv[]) { // Validate options. int result = parse_args (argc, argv); if (result != 0) return result; #if defined (ACE_WIN32) // Somehow, on Win32, the option allows us to create // more handles. if (!user_has_specified_iterations && listen_once) iterations *= 2; #endif /* ACE_WIN32 */ // Start the test only if options are valid. ACE_START_TEST (ACE_TEXT ("Cached_Accept_Conn_Test")); // Remove the extra debugging attributes from Log_Msg output. ACE_LOG_MSG->clr_flags (ACE_Log_Msg::VERBOSE_LITE); // The reactor's constructor changes the handle limit for the // process. ACE_Reactor::instance (); // Consume all handles in the process, leaving us // to play with. ACE_Handle_Gobbler handle_gobbler; if (0 != handle_gobbler.consume_handles (keep_handles_available)) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("handle_gobbler"))); // Do we need to test all the strategies. Note, that the less // useful null strategy is ignored in this case. if (caching_strategy_type == ACE_ALL) { caching_strategy_type = ACE_LRU; test_caching_strategy_type (); // Default iterations are too many; if the user hasn't specified // otherwise, we'll shrink the iterations for LFU and FIFO. if (!user_has_specified_iterations) iterations /= 100; caching_strategy_type = ACE_LFU; test_caching_strategy_type (); caching_strategy_type = ACE_FIFO; test_caching_strategy_type (); } else { test_caching_strategy_type (); } ACE_LOG_MSG->set_flags (ACE_Log_Msg::VERBOSE_LITE); ACE_END_TEST; return 0; } #endif /* CACHED_ACCEPT_CONNECTION_TEST */ ace-8.0.4+dfsg.orig/tests/Upgradable_RW_Test.cpp0000644000175000017500000002757715027201773020534 0ustar sudipsudip //============================================================================= /** * @file Upgradable_RW_Test.cpp * * This test program verifies the functionality of the ACE_OS * implementation of readers/writer locks on Win32 and Posix * pthreads. Use the RW_Mutex define switch to use * readers/writer mutexes or regular mutexes. * * @author Michael Kircher */ //============================================================================= #include "Upgradable_RW_Test.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_sys_time.h" #include "ace/Atomic_Op.h" #if defined (ACE_HAS_THREADS) // Default number of iterations. static int n_iterations = 50; // Maximum string length used static const size_t MAX_STRING_SIZE = 200; // switch on RW mutexes, else use ordinary mutexes // #define RW_MUTEX 1 // Default number of readers. static u_int n_readers = 10; // Default number of writers. static u_int n_writers = 0; // Number of entries in the hash map static u_int n_entries = 10; // Try to upgrade to a write lock, by default don't try. static u_int use_try_upgrade = 0; // number of readers, which were able to upgrade static u_int upgraded = 0; // count the number of find calls static u_int find_called = 0; // number of readers, failing or not allowed to upgrade static u_int not_upgraded = 0; // Thread creation flags. static long thr_flags = THR_NEW_LWP; // Lock for shared_data (upgraded, not_upgraded, hash_Map) #if defined (RW_MUTEX) static ACE_RW_Thread_Mutex rw_mutex; #else static ACE_Thread_Mutex mutex; #endif /* RW_MUTEX */ // Count of the number of readers and writers. static ACE_Atomic_Op current_readers; static ACE_Atomic_Op current_writers; static Linked_List *linked_list_ptr; // Returns 1 if found, // 0 if not found, // -1 on an error static int find_last () { find_called++; char search_string[MAX_STRING_SIZE]; ACE_OS::snprintf (search_string, MAX_STRING_SIZE, "%d", n_entries - 1); ACE_CString cString (search_string); Element *element_ptr = 0; for (ACE_Double_Linked_List_Iterator iterator (*linked_list_ptr); !iterator.done (); iterator.advance ()) { element_ptr = iterator.next (); if (element_ptr) if (*element_ptr->value () == cString) return 1; } return 0; } // Explain usage and exit. static void print_usage_and_die () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("usage: %n [-r n_readers] [-w n_writers]\n") ACE_TEXT (" [-e max_entries] [-u try update] ") ACE_TEXT ("[-n iteration_count] [-f for FIFO threads]\n"))); ACE_OS::exit (1); } static void parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("e:fr:w:n:u")); int c; while ((c = get_opt ()) != -1) switch (c) { case 'e': n_entries = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'f': thr_flags = THR_BOUND | THR_SCHED_FIFO; break; case 'r': n_readers = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'w': n_writers = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'n': n_iterations = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'u': use_try_upgrade = 1; break; default: print_usage_and_die (); break; } } // Iterate each time checking that nobody modifies the data // while we have a read lock. int Reader_Task::svc () { ACE_Profile_Timer timer; ACE_Profile_Timer::ACE_Elapsed_Time elapsed_time; barrier_.wait (); // Wait at the barrier. // We start an ACE_Profile_Timer here... timer.start (); for (int iterations = 1; iterations <= n_iterations; iterations++) { ACE_Thread::yield (); int result = 0; { #if defined (RW_MUTEX) ACE_READ_GUARD_RETURN (ACE_RW_Thread_Mutex, g, rw_mutex, 1); #else ACE_GUARD_RETURN (ACE_Thread_Mutex, g, mutex, 1); #endif /* RW_MUTEX */ find_last (); #if defined (RW_MUTEX) if (use_try_upgrade) result = rw_mutex.tryacquire_write_upgrade (); #endif /* RW_MUTEX */ // True, when we were able to upgrade. if (result == 0 && use_try_upgrade) { //find_last (); try to find something which is not in //there upgraded++; continue; } } if ((result == -1 && errno == EBUSY) // we tried and failed || !use_try_upgrade) // we did not try at all { #if defined (RW_MUTEX) ACE_WRITE_GUARD (ACE_RW_Thread_Mutex, g, rw_mutex, 1); #else ACE_GUARD_RETURN (ACE_Thread_Mutex, g, mutex, 1); #endif /* RW_MUTEX */ not_upgraded++; find_last (); } else if (result == -1 && errno != EBUSY) { ACE_ERROR ((LM_ERROR, ACE_TEXT (" (%t) failure in upgrading to write lock!\n"), 1)); } } // Stop the timer. timer.stop (); timer.elapsed_time (elapsed_time); this->time_Calculation_.report_time (elapsed_time); return 0; } // Iterate each time modifying the global data and // checking that nobody steps on it while we can write it. int Writer_Task::svc () { ACE_Profile_Timer timer; ACE_Profile_Timer::ACE_Elapsed_Time elapsed_time; barrier_.wait (); // Wait at the barrier // We start an ACE_Profile_Timer here... timer.start (); for (int iterations = 1; iterations <= n_iterations; iterations++) { ACE_Thread::yield (); #if defined (RW_MUTEX) ACE_WRITE_GUARD (ACE_RW_Thread_Mutex, g, rw_mutex, 0); #else ACE_GUARD_RETURN (ACE_Thread_Mutex, g, mutex, 0); #endif /* RW_MUTEX */ find_last (); current_writers--; } // Stop the timer. timer.stop (); timer.elapsed_time (elapsed_time); this->time_Calculation_.report_time (elapsed_time); return 0; } void Time_Calculation::report_time (ACE_Profile_Timer::ACE_Elapsed_Time &elapsed_time) { ACE_GUARD (ACE_Thread_Mutex, g, mutex_); this->times_.real_time += elapsed_time.real_time; this->times_.user_time += elapsed_time.user_time; this->times_.system_time += elapsed_time.system_time; this->reported_times_++; } void Time_Calculation ::print_stats () { ACE_Profile_Timer::ACE_Elapsed_Time elapsed_time = this->times_; u_int iterations = 1; if (iterations > 0) { elapsed_time.real_time *= ACE_ONE_SECOND_IN_MSECS; elapsed_time.user_time *= ACE_ONE_SECOND_IN_MSECS; elapsed_time.system_time *= ACE_ONE_SECOND_IN_MSECS; elapsed_time.real_time /= iterations; elapsed_time.user_time /= iterations; elapsed_time.system_time /= iterations; double tmp = 0.0; if (!ACE::is_equal (elapsed_time.real_time, 0.0)) tmp = 1000 / elapsed_time.real_time; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n") ACE_TEXT ("\treal_time\t = %0.06f ms,\n") ACE_TEXT ("\tuser_time\t = %0.06f ms,\n") ACE_TEXT ("\tsystem_time\t = %0.06f ms,\n") ACE_TEXT ("\t%0.00f calls/second\n"), elapsed_time.real_time < 0.0 ? 0.0 : elapsed_time.real_time, elapsed_time.user_time < 0.0 ? 0.0 : elapsed_time.user_time, elapsed_time.system_time < 0.0 ? 0.0 : elapsed_time.system_time, tmp < 0.0 ? 0.0 : tmp)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Number of reported times: %d\n"), this->reported_times_)); } else ACE_ERROR ((LM_ERROR, ACE_TEXT ("\tNo time stats printed. Zero iterations or error occurred.\n"))); } static int init () { char entry[MAX_STRING_SIZE]; ACE_CString *cString_ptr = 0; Element *element_ptr = 0; ACE_NEW_RETURN (linked_list_ptr, Linked_List, -1); for (u_int i = 0; i < n_entries; i++) { ACE_OS::snprintf (entry, MAX_STRING_SIZE, "%d", i); ACE_NEW_RETURN (cString_ptr, ACE_CString (entry), -1); ACE_NEW_RETURN (element_ptr, Element (cString_ptr), -1); linked_list_ptr->insert_tail (element_ptr); } return 0; } #endif /* ACE_HAS_THREADS */ // Spawn off threads. int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Upgradable_RW_Test")); int status = 0; #if defined (ACE_HAS_THREADS) parse_args (argc, argv); #if !defined (RW_MUTEX) use_try_upgrade = 0; // make sure that we have to acquire the write lock #endif /* RW_MUTEX */ current_readers = 0; // Possibly already done current_writers = 0; // Possibly already done init (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%t) main thread starting\n"))); Time_Calculation time_Calculation; // for the time calculation ACE_Barrier thread_barrier (n_readers + n_writers); // for a nice start of all threads (for much contention) // Initialize the readers. Reader_Task **reader_tasks = 0; ACE_NEW_RETURN (reader_tasks, Reader_Task *[n_readers], -1); u_int i = 0; for (i = 0; i < n_readers; i++) { ACE_NEW_RETURN (reader_tasks[i], Reader_Task (time_Calculation, thread_barrier), -1); reader_tasks[i]->activate (thr_flags, 1, 0, ACE_DEFAULT_THREAD_PRIORITY); } // Create all the writers Writer_Task **writer_tasks = 0; ACE_NEW_RETURN (writer_tasks, Writer_Task *[n_writers], -1); for (i = 0; i < n_writers; i++) { ACE_NEW_RETURN (writer_tasks[i], Writer_Task (time_Calculation, thread_barrier), -1); writer_tasks[i]->activate (thr_flags, 1, 0, ACE_DEFAULT_THREAD_PRIORITY); } // Wait a maximum of 1 second per iteration. const ACE_Time_Value max_wait (n_iterations * 1); const ACE_Time_Value wait_time (ACE_OS::gettimeofday () + max_wait); if (ACE_Thread_Manager::instance ()->wait (&wait_time) == -1) { if (errno == ETIME) ACE_ERROR ((LM_ERROR, ACE_TEXT ("maximum wait time of %d msec exceeded\n"), max_wait.msec ())); else ACE_OS::perror (ACE_TEXT ("wait")); status = -1; } // compute average time. time_Calculation.print_stats (); if (not_upgraded != 0 || upgraded != 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("upgraded to not upgraded ratio = %f\n"), (float) upgraded / (float) (not_upgraded + upgraded))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Number of times, that find was called: %d\n"), find_called)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%t) exiting main thread\n"))); // Delete the memory of the Double_Linked_List ACE_CString *cString_ptr = 0; Element *element_ptr = 0; for (i = 0; i < n_entries; i++) { if (0 != (element_ptr = linked_list_ptr->delete_head ())) { cString_ptr = element_ptr->value (); delete cString_ptr; delete element_ptr; } } delete linked_list_ptr; for (i = 0; i < n_writers; i++) delete writer_tasks[i]; delete [] writer_tasks; for (i = 0; i < n_readers; i++) delete reader_tasks [i]; delete [] reader_tasks; #else ACE_UNUSED_ARG (argc); ACE_UNUSED_ARG (argv); ACE_ERROR ((LM_INFO, ACE_TEXT ("threads not supported on this platform\n"))); #endif /* ACE_HAS_THREADS */ ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/Process_Test.cpp0000644000175000017500000001736615027201773017467 0ustar sudipsudip //============================================================================= /** * @file Process_Test.cpp * * Tests ACE_Process file handle inheritance for UNIX-like systems * * @author Christian Fromme */ //============================================================================= #include "test_config.h" #include "ace/Process.h" #include "ace/Get_Opt.h" #include "ace/Lib_Find.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_sys_stat.h" #include "ace/OS_NS_unistd.h" #include "ace/Dirent.h" #include "ace/SString.h" #include "ace/OS_NS_stdlib.h" // This will only work on Linux. Even UNIX-ish with /proc filesys lacks the // 'self' level and link to the opened file name. static const char *proc_self_fd = "/proc/self/fd/"; int test_setenv () { int status = 0; ACE_Process_Options opts; ACE_TCHAR bigval[5010] = ACE_TEXT (""); for (int i = 0; i < 100; ++i) ACE_OS::strcat (bigval, ACE_TEXT ("01234567890123456789012345678901234567890123456789")); #ifndef ACE_LACKS_VA_FUNCTIONS if (0 != opts.setenv (ACE_TEXT ("A"), ACE_TEXT ("%") ACE_TEXT_PRIs, bigval)) { status = errno; ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("setenv"))); } else { size_t env_len = ACE_OS::strlen (opts.env_buf ()); if (env_len != 5002) { status = 1; ACE_ERROR ((LM_ERROR, ACE_TEXT ("setenv result should be 5002 chars, not %B\n"), env_len)); } } #endif return status; } int check_temp_file (const ACE_TString &tmpfilename) { ACE_DIRENT *dir = 0; ACE_Dirent entr; ACE_stat stat; char filename[MAXPATHLEN + 1]; ACE_OS::memset (&stat, 0, sizeof (stat)); ACE_OS::memset (&entr, 0, sizeof (entr)); // Loop through /proc/self/fs/ if (entr.open (ACE_TEXT_CHAR_TO_TCHAR(proc_self_fd)) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Could not open dir %C\n"), proc_self_fd), -1); while ((dir = entr.read ())) { ACE_CString fullp = proc_self_fd; #if defined (ACE_HAS_TCHAR_DIRENT) fullp += ACE_TEXT_ALWAYS_CHAR(dir->d_name); #else fullp += dir->d_name; #endif if ((ACE_OS::lstat (fullp.c_str (), &stat)) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Stat failed for %C\n"), fullp.c_str ()), -1); if (S_ISLNK (stat.st_mode)) { ssize_t size = 0; if ((size= ACE_OS::readlink (fullp.c_str (), filename, MAXPATHLEN + 1)) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Readlink failed for %C\n"), fullp.c_str ()), -1); filename[size] = '\0'; if (tmpfilename == ACE_TString (ACE_TEXT_CHAR_TO_TCHAR (filename))) return 1; } } return 0; } int run_parent (bool inherit_files) { int status = 0; ACE_TCHAR t[] = ACE_TEXT ("ace_testXXXXXX"); // Create tempfile. This will be tested for inheritance. ACE_TCHAR tempfile[MAXPATHLEN + 1]; if (ACE::get_temp_dir (tempfile, MAXPATHLEN - sizeof (t)) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Could not get temp dir\n"))); ACE_OS::strcat (tempfile, t); ACE_HANDLE file_handle = ACE_OS::mkstemp (tempfile); if (file_handle == ACE_INVALID_HANDLE) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Could not get temp filename\n"))); status = 1; } // Build child options ACE_TString exe_sub_dir; const char *subdir_env = ACE_OS::getenv ("ACE_EXE_SUB_DIR"); if (subdir_env) { exe_sub_dir = ACE_TEXT_CHAR_TO_TCHAR (subdir_env); exe_sub_dir += ACE_DIRECTORY_SEPARATOR_STR; } ACE_Process_Options options; #ifndef ACE_LACKS_VA_FUNCTIONS options.command_line (ACE_TEXT (".") ACE_DIRECTORY_SEPARATOR_STR ACE_TEXT ("%sProcess_Test") ACE_PLATFORM_EXE_SUFFIX ACE_TEXT (" -c -h %d -f %s"), exe_sub_dir.c_str(), (int)inherit_files, tempfile); #endif options.handle_inheritance (inherit_files); /* ! */ // Spawn child ACE_Process child; pid_t result = child.spawn (options); if (result == -1) { status = errno; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Parent could NOT spawn child process\n"))); } else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Parent spawned child process with pid = %d.\n"), child.getpid ())); ACE_exitcode child_status; result = child.wait (&child_status); if (result == -1) { status = errno; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Could NOT wait on child process\n"))); } else if (child_status == 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Child %d finished ok\n"), child.getpid ())); else { status = child_status; ACE_ERROR ((LM_ERROR, ACE_TEXT ("Child %d finished with status %d\n"), child.getpid (), child_status)); } return status; } int run_main (int argc, ACE_TCHAR *argv[]) { int c = 0; int handle_inherit = 0; /* Disable inheritance by default */ bool ischild = false; ACE_TString temp_file_name; ACE_Get_Opt getopt (argc, argv, ACE_TEXT ("ch:f:")); while ((c = getopt ()) != -1) switch ((char) c) { case 'c': ischild = true; break; case 'h': handle_inherit = ACE_OS::atoi (getopt.opt_arg ()); break; case 'f': temp_file_name = getopt.opt_arg (); break; default: // Don't forgive bad options ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Bad option\n")), -1); break; } if (ischild) { ACE_TCHAR lognm[MAXPATHLEN]; int const mypid (ACE_OS::getpid ()); ACE_OS::snprintf (lognm, MAXPATHLEN, ACE_TEXT ("Process_Test-child-%d"), mypid); ACE_START_TEST (lognm); int result = check_temp_file (temp_file_name); // Check descriptor inheritance if (result == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Could not retrieve open files\n")), -1); else if (result == handle_inherit) result = 0; else ACE_ERROR ((LM_ERROR, ACE_TEXT ("Handle inheritance test failed with ") ACE_TEXT ("%d, expected %d\n"), result, handle_inherit)); ACE_END_LOG; return result; } else { ACE_START_TEST (ACE_TEXT ("Process_Test")); int status = test_setenv (); // The rest of this test relies on the ability to get a list of open // files for a process and examine each file descriptor to see which // file is open, matching against an expected opened file name. // Although most systems provide some mechanism to do this, the code // in this test uses Linux-specific techniques. Thus, although it // is possible to add the code for the checks on, for example, // HP-UX (pstat_getproc, pstat_getpathname) #if defined (ACE_LACKS_FORK) || defined (ACE_LACKS_READLINK) || !defined(ACE_LINUX) ACE_ERROR ((LM_INFO, ACE_TEXT ("The remainder of this test is not supported on this platform\n"))); #else // Test handle inheritance set to true if (!status) status = run_parent (true); // ... and set to false if (!status) run_parent (false); #endif /* ! ACE_LACKS_FORK */ ACE_END_TEST; return status; } } ace-8.0.4+dfsg.orig/tests/Priority_Task_Test.cpp0000644000175000017500000001450715027201773020646 0ustar sudipsudip //============================================================================= /** * @file Priority_Task_Test.cpp * * This is a simple test to illustrate the priority mechanism of * ACE Tasks. The test requires no options, but the -d option * enables LM_DEBUG output. * * @author Carlos O'Ryan */ //============================================================================= #include "test_config.h" #include "ace/Task.h" #include "ace/Sched_Params.h" #include "ace/OS_NS_errno.h" #include "ace/OS_NS_string.h" static const ACE_TCHAR *usage = ACE_TEXT ("usage: %s [-d]\n"); #if defined (ACE_HAS_THREADS) /** * @class Priority_Task * * @brief A simple Task that runs itself a different priorities. * * This task uses the void* argument on open to run the svc() * method at a different priority. The point is execise the thread * priority features of ACE. */ class Priority_Task : public ACE_Task { public: /// The constructor Priority_Task (); //FUZZ: disable check_for_lack_ACE_OS /** * Receives the priority and run svc() on a separate thread at that * priority. *FUZZ: enable check_for_lack_ACE_OS */ int open (void *) override; /// Runs on a separate thread an checks the priority. int svc () override; /// Returns 1 if priority was set properly, 0 otherwise. int succeeded () { return error_ == 0; } private: int priority_; u_int error_; }; Priority_Task::Priority_Task () : ACE_Task (ACE_Thread_Manager::instance ()), priority_ (0), error_ (0) { } int Priority_Task::open (void *arg) { this->priority_ = *(int *) arg; long flags = THR_NEW_LWP; // To get FIFO scheduling with PTHREADS. ACE_SET_BITS (flags, THR_SCHED_FIFO); // Become an active object. if (this->activate (flags, 1, 0, this->priority_) == -1) { // On Linux, for example, only the superuser can set the policy // to other than ACE_SCHED_OTHER. But with ACE_SCHED_OTHER, // there is only one thread priority value, for example, 0. So, // let the superuser run an interesting test, but for other // users use the minimum ACE_SCHED_OTHER thread priority. long fallback_priority = ACE_Sched_Params::priority_min (ACE_SCHED_OTHER, ACE_SCOPE_THREAD); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) task activation at priority %d with ") ACE_TEXT ("flags 0x%X failed; retry at priority %d with ") ACE_TEXT ("flags 0x%X (errno is %d%p)\n"), this->priority_, flags, fallback_priority, THR_NEW_LWP, ACE_ERRNO_GET, ACE_TEXT (""))); flags = THR_NEW_LWP; this->priority_ = fallback_priority; if (this->activate (flags, 1, 1, this->priority_) == -1) { if (ACE_OS::last_error () == EPERM) ACE_ERROR_RETURN ((LM_INFO, ACE_TEXT ("Insufficient privilege to run this test.\n")), -1); else ACE_DEBUG ((LM_ERROR, ACE_TEXT ("(%t) task activation at priority %d failed, ") ACE_TEXT ("exiting!\n%a"), this->priority_, -1)); } } return 0; } int Priority_Task::svc () { ACE_hthread_t thr_handle; ACE_Thread::self (thr_handle); int prio; if (ACE_Thread::getprio (thr_handle, prio) == -1) { if (errno == ENOTSUP) { ACE_DEBUG((LM_DEBUG, ACE_TEXT ("getprior not supported on this platform\n") )); return 0; } ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("getprio failed")), -1); } if (prio == this->priority_) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) actual prio of %d equals desired priority\n"), prio)); else { ACE_DEBUG ((LM_ERROR, ACE_TEXT ("(%t) actual prio = %d, desired priority_ = %d!\n"), prio, this->priority_)); ++error_; } return 0; } #endif /* ACE_HAS_THREADS */ int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("Priority_Task_Test")); if (argc <= 1) // Disable LM_DEBUG messages. ACE_Log_Msg::instance ()->priority_mask (ACE_Log_Msg::instance ()->priority_mask () &~ LM_DEBUG); else if (argc == 2) { if (ACE_OS::strcmp (argv[1], ACE_TEXT ("-d")) != 0) ACE_ERROR_RETURN ((LM_ERROR, usage, argv [0]), -1); // else -d option: don't disable LM_DEBUG messages } else ACE_ERROR_RETURN ((LM_ERROR, usage, argv [0]), -1); int status = 0; #if defined (ACE_HAS_THREADS) Priority_Task tasks[ACE_MAX_ITERATIONS]; size_t i; // Spawn off ACE_MAX_ITERATIONS of tasks, passing each one their // iteration number as their priority. ACE_Sched_Priority_Iterator priority (ACE_SCHED_FIFO, ACE_SCOPE_THREAD); for (i = 0; i < ACE_MAX_ITERATIONS; i++) { int p = priority.priority (); if (tasks[i].open ((void *) &p) == -1) break; // Out of enclosing loop. // If there are more priorities get the next one... if (priority.more ()) priority.next (); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) %d tasks spawned, wait for them to exit . . .\n"), ACE_MAX_ITERATIONS)); // Wait for all tasks to exit. ACE_Thread_Manager::instance ()->wait (); for (i = 0; i < ACE_MAX_ITERATIONS; i++) if (!tasks[i].succeeded ()) { ++status; break; } #else ACE_ERROR ((LM_DEBUG, ACE_TEXT ("threads not supported on this platform\n"))); #endif /* ACE_HAS_THREADS */ // Re-enable LM_DEBUG messages. ACE_Log_Msg::instance ()->priority_mask (ACE_Log_Msg::instance ()->priority_mask () | LM_DEBUG); ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/Compiler_Features_42_Test.cpp0000644000175000017500000000155715027201773021761 0ustar sudipsudip/** * This program reproduces an compiler issue with Visual Studio 2022 */ #include "test_config.h" #include #include namespace Test { using arrayofstring = std::array; class unionarrayofstring { public: unionarrayofstring () = default; unionarrayofstring (const unionarrayofstring&) = delete; unionarrayofstring (unionarrayofstring&&) = delete; inline ~unionarrayofstring () {} unionarrayofstring& operator= (const unionarrayofstring&) = delete; unionarrayofstring& operator= (unionarrayofstring&&) = delete; private: union u_type_ { u_type_ () = default; ~u_type_ () {} ::Test::arrayofstring as_{}; } u_{}; }; } int run_main (int, ACE_TCHAR*[]) { ACE_START_TEST (ACE_TEXT ("Compiler_Features_42_Test")); ::Test::unionarrayofstring p; ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/Reverse_Lock_Test.cpp0000644000175000017500000000171415027201773020422 0ustar sudipsudip //============================================================================= /** * @file Reverse_Lock_Test.cpp * * This is a simple test to illustrate the functionality of * ACE_Reverse_Lock. The test acquires and releases mutexes. No * command line arguments are needed to run the test. * * @author Irfan Pyarali */ //============================================================================= #include "test_config.h" #include "ace/Synch_Traits.h" #include "ace/Thread_Mutex.h" #include "ace/Guard_T.h" #include "ace/Reverse_Lock_T.h" using REVERSE_MUTEX = ACE_Reverse_Lock; int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Reverse_Lock_Test")); ACE_SYNCH_MUTEX mutex; REVERSE_MUTEX reverse_mutex (mutex); { ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, monitor, mutex, -1); ACE_GUARD_RETURN (REVERSE_MUTEX, reverse_monitor, reverse_mutex, -1); } ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/ACE_Init_Test.h0000644000175000017500000000263315027201773017060 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file ACE_Init_Test.h * * Main header file for the ACE_INIT_TEST application. * * @author Steve Huston */ //============================================================================= #ifndef AFX_ACE_INIT_TEST_H__64FDC9FE_F7F9_11D2_89B6_00A024CC68DB__INCLUDED_ #define AFX_ACE_INIT_TEST_H__64FDC9FE_F7F9_11D2_89B6_00A024CC68DB__INCLUDED_ #ifndef __AFXWIN_H__ #error include 'stdafx.h' before including this file for PCH #endif #include "ACE_Init_Test_Resource.h" // main symbols /** * @class CACE_Init_TestApp * * @brief See ACE_Init_Test.cpp for the implementation of this class */ class CACE_Init_TestApp : public CWinApp { public: CACE_Init_TestApp (); // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CACE_Init_TestApp) public: ///}}AFX_VIRTUAL virtual BOOL InitInstance(); // Implementation //{{AFX_MSG(CACE_Init_TestApp) // NOTE - the ClassWizard will add and remove member functions here. // DO NOT EDIT what you see in these blocks of generated code ! //}}AFX_MSG DECLARE_MESSAGE_MAP() }; //{{AFX_INSERT_LOCATION}} // Microsoft Developer Studio will insert additional declarations immediately before the previous line. #endif /* !defined(AFX_ACE_INIT_TEST_H__64FDC9FE_F7F9_11D2_89B6_00A024CC68DB__INCLUDED_) */ ace-8.0.4+dfsg.orig/tests/NDDS_Timer_Test.cpp0000644000175000017500000001222615027201773017727 0ustar sudipsudip//============================================================================= /** * @file NDDS_Timer_Test.cpp * * Simple test of NDDS_Timer. Copied from NDDS_Timer_Test. * * @author Marcel Smit */ //============================================================================= #include "test_config.h" #include "ace/Log_Msg.h" #include "ace/Sched_Params.h" #include "ace/Get_Opt.h" #include "ace/OS_NS_unistd.h" #include #include static u_int check (const time_t interval, const time_t measured) { time_t const threshold = 25 /* percent */; time_t const difference = interval > measured ? interval - measured : measured - interval; time_t const percentage_difference = difference * 100 / interval; if (percentage_difference < threshold) return 0; else ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("The measured time of %Q differs from ") ACE_TEXT ("the interval of %Q by %Q percent.\n"), measured, interval, percentage_difference), 1); } // Does a sanity check of the microseconds vs nanoseconds. They're supposed // to represent the same interval. static u_int check_micro_nano (unsigned long long microinterval, unsigned long long nanointerval) { unsigned long long const threshold = 8 /* promille */; microinterval *= 1000u; unsigned long long const difference = (microinterval > nanointerval ? (microinterval - nanointerval) : (nanointerval - microinterval)); if (nanointerval == 0) { nanointerval = 1; // Prevent divide-by-zero } unsigned long long const promille_difference = difference * 1000 / nanointerval; if ((promille_difference < threshold) || (difference < 1500)) { return 0; } else ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("The microseconds * 1000 of %Q ") ACE_TEXT ("differs from the nanoseconds of %Q ") ACE_TEXT (" by %Q promille\n"), microinterval, nanointerval, promille_difference), 1); } static void time_interval (RTIClock *timer, const ACE_Time_Value & interval, RTINtpTime& duration) { struct RTINtpTime start_time; struct RTINtpTime finish_time; RTINtpTime_setZero(&start_time); RTINtpTime_setZero(&finish_time); // Initialize timer->reset(timer); // Run the test timer->getTime(timer, &start_time); ACE_OS::sleep (interval); timer->getTime(timer, &finish_time); // Measure. RTINtpTime_subtract(duration, finish_time, start_time); } static u_int const intervals[] = {0, 1, 10, 100, 1000, 10000, 100000, 1000000, 4000000}; /*usec*/ int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("NDDS_Timer_Test")); RTIClock *timer = RTIHighResolutionClock_new(); u_int errors = 0; u_int iterations = 1; ACE_Get_Opt getoptarg (argc, argv, ACE_TEXT ("i:")); for (int c; (c = getoptarg ()) != -1; ) { switch (c) { case 'i': iterations = ACE_OS::atoi (getoptarg.opt_arg ()); break; } } // We don't check for errors if the interval is shorter than this // value because the OS has a finite resolution anyway. static u_int const TIMER_RESOLUTION = 10000; for (u_int i = 0; i < sizeof intervals / sizeof (u_int); ++i) { for (u_int j = 0; j < iterations; ++j) { ACE_Time_Value const interval (0, intervals[i]); RTINtpTime duration; time_interval (timer, interval, duration); unsigned long long microseconds, nanoseconds; int sec; RTINtpTime_unpackToMicrosec (sec, microseconds, duration); RTINtpTime_unpackToNanosec (sec, nanoseconds, duration); time_t const interval_usec = interval.sec () * ACE_ONE_SECOND_IN_USECS + interval.usec (); time_t const measured_usec = sec * ACE_ONE_SECOND_IN_USECS + microseconds; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("interval: %: usec, measured: %: usec %s\n"), interval_usec, measured_usec, (intervals[i] <= TIMER_RESOLUTION ? ACE_TEXT (" (interval and measured may differ)") : ACE_TEXT ("")))); if (intervals[i] > TIMER_RESOLUTION) { errors += check (interval.sec () * ACE_ONE_SECOND_IN_USECS + interval.usec (), sec * ACE_ONE_SECOND_IN_USECS + microseconds); // Don't check for error for intervals below 10 msec. } errors += check_micro_nano (microseconds, nanoseconds); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("NDDS_Timer usec: %Q, nsec: %Q\n"), microseconds, nanoseconds)); } } ACE_END_TEST; return errors == 0 ? 0 : 1; } ace-8.0.4+dfsg.orig/tests/Compiler_Features_28_Test.cpp0000644000175000017500000000230615027201773021756 0ustar sudipsudip/** * This program checks if the compiler doesn't have a certain bug * that we encountered when testing C++11 features */ #include "test_config.h" #include enum class OPERATIONS { ADD_OBJECT_POLICY, ADD_CURRENT_POLICY, LAST_OPERATION }; /// Using this to iterate over the OPERATIONS enum OPERATIONS operator++(OPERATIONS& x) { return x = static_cast(static_cast(x) + 1); } OPERATIONS operator*(OPERATIONS c) {return c;} OPERATIONS begin(OPERATIONS ) {return OPERATIONS::ADD_OBJECT_POLICY;} OPERATIONS end(OPERATIONS ) {return OPERATIONS::LAST_OPERATION;} int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT("Compiler_Features_28_Test")); int16_t count = 0; for (OPERATIONS op : OPERATIONS ()) { if (op == OPERATIONS::ADD_OBJECT_POLICY && count != 0) ACE_ERROR ((LM_ERROR, "Wrong order when using range based for loop\n")); if (op == OPERATIONS::ADD_CURRENT_POLICY && count != 1) ACE_ERROR ((LM_ERROR, "Wrong order when using range based for loop\n")); if (op == OPERATIONS::LAST_OPERATION && count != 2) ACE_ERROR ((LM_ERROR, "Wrong order when using range based for loop\n")); ++count; } ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/tests/non_mpc_makefile/0000755000175000017500000000000015046037655017626 5ustar sudipsudipace-8.0.4+dfsg.orig/tests/non_mpc_makefile/Bug_3708_Regression.pl0000755000175000017500000000103115027201773023550 0ustar sudipsudipeval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; # This test can't run on Win32 exit if ($^O eq 'MSWin32'); # This test can't be run if "make" is not in the path or if it resolves to # a non-GNU version of make. exit unless (`make --version` =~ /^GNU Make/); print "Running non_mpc_makefile test:\n"; system "make -f CustomMakefile"; print "ERROR: libfoo.a not made\n" unless -r 'libfoo.a'; system "make -f CustomMakefile realclean"; ace-8.0.4+dfsg.orig/tests/non_mpc_makefile/foo.cpp0000644000175000017500000000003315027201773021102 0ustar sudipsudipint foo() { return 42; } ace-8.0.4+dfsg.orig/tests/non_mpc_makefile/CustomMakefile0000644000175000017500000000060115027201773022447 0ustar sudipsudipstatic_libs_only=1 LIB = libfoo.a LSRC = foo.cpp include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU include $(ACE_ROOT)/include/makeinclude/macros.GNU include $(ACE_ROOT)/include/makeinclude/rules.common.GNU include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU include $(ACE_ROOT)/include/makeinclude/rules.local.GNU ace-8.0.4+dfsg.orig/tests/Multihomed_INET_Addr_Test_IPV6.cpp0000644000175000017500000001267215027201773022530 0ustar sudipsudip//============================================================================= /** * @file Multihomed_INET_Addr_Test_IPV6.cpp * * Performs several tests on the Multihomed_ACE_INET_Addr class. * It creates several IPv6 addresses and checks that the * address formed by the class is valid. * * @author Edward Mulholland (emulholl@atl.lmco.com) Brian Buesker (bbuesker@qualcomm.com) - Added testing of ACE_Multihomed_INET_Addr class using IPv6 addresses based on Multihomed_INET_Addr_Test. */ //============================================================================= #include "test_config.h" #include "ace/OS_NS_string.h" #include "ace/Multihomed_INET_Addr.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_arpa_inet.h" int run_main (int argc, ACE_TCHAR *argv[]) { ACE_UNUSED_ARG (argc); ACE_UNUSED_ARG (argv); ACE_START_TEST (ACE_TEXT ("Multihomed_INET_Addr_Test_IPV6")); int status = 0; // Innocent until proven guilty #if defined (ACE_HAS_IPV6) // loop variables size_t i, j; sockaddr_in6 *pointer6; const ACE_TCHAR *primary_ipv6 = ACE_TEXT("3ffe::123:4567:89ab:cdef"); const ACE_TCHAR *secondary_ipv6[] = { ACE_IPV6_LOCALHOST, ACE_TEXT("fe80::0123:4567:89ab:cdef"), ACE_TEXT("fec0::0123:4567:89ab:cdef"), ACE_TEXT("3ffe::1:0123:4567:89ab:cdef"), ACE_TEXT("2002:3e02:5473::") }; // The port will always be this u_short port = 80; // ... and as you can see, there are 5 of them const size_t num_secondaries = 5; // Test subject ACE_Multihomed_INET_Addr addr; // Array of INET_Addrs that will repeatedly be passed into the // get_secondary_addresses accessor of Multihomed_INET_Addr ACE_INET_Addr in_out[5]; // Array of INET_Addrs against which the above array will be tested. ACE_INET_Addr stay_out[5]; // Array of sockaddrs that will repeatedly be passed into the // get_addresses accessor of Multihomed_INET_Addr const size_t num_sockaddrs = 6; sockaddr_in6 in_out_sockaddr6[num_sockaddrs]; for (i = 0; i <= num_secondaries; ++i) { /**** Test set (u_short, const char[], int, int, const char *([]), size_t) ****/ addr.set(port, primary_ipv6, 1, AF_INET6, secondary_ipv6, i); // Check the port number if (addr.get_port_number() != port) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Failed second get_port_number check\n") ACE_TEXT ("%d != %d\n"), addr.get_port_number(), port)); status = 1; } // Check the primary address if (0 != ACE_OS::strcmp (ACE_TEXT_CHAR_TO_TCHAR(addr.get_host_addr()), primary_ipv6)) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%s failed get_host_addr() check\n") ACE_TEXT ("%s != %s\n"), primary_ipv6, addr.get_host_addr (), primary_ipv6)); status = 1; } // Check that the test subject reports the correct number of // secondary addresses. size_t returned_num_secondaries = addr.get_num_secondary_addresses(); if (returned_num_secondaries == i) { // Initialize the stay_out array with the secondary addresses for (j = 0; j < i; ++j) { stay_out[j].set(port, secondary_ipv6[j]); } // Pass the in_out array to the accessor addr.get_secondary_addresses(in_out, i); // Check that the in_out array matches stay_out array for (j = 0; j < i; ++j) { if (in_out[j] != stay_out[j]) { ACE_TCHAR in_out_string[100]; ACE_TCHAR stay_out_string[100]; in_out[j].addr_to_string(in_out_string, 100); stay_out[j].addr_to_string(stay_out_string, 100); ACE_ERROR ((LM_ERROR, ACE_TEXT ("Failed get_secondary_addresses check\n") ACE_TEXT ("%s != %s\n"), in_out_string, stay_out_string)); status = 1; } } // Pass the in_out_sockaddr array to the accessor addr.get_addresses(in_out_sockaddr6, i + 1); // Check that the primary address in the in_out_sockaddr array // matches the primary address reported by the superclass if (ACE_OS::memcmp(in_out_sockaddr6, addr.get_addr(), sizeof(sockaddr_in6))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Failed second get_addresses check ") ACE_TEXT ("(for primary address)\n"))); status = 1; } // Check that the secondary addresses in the in_out_sockaddr // array match the stay_out array for (j = 1, pointer6 = &in_out_sockaddr6[1]; j < i + 1; ++j, ++pointer6) { if (ACE_OS::memcmp(pointer6, stay_out[j-1].get_addr(), sizeof(sockaddr_in6))) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Failed get_addresses check ") ACE_TEXT ("(for secondary addresses)\n"))); status = 1; } } } else { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Failed get_num_secondary_addresses check\n") ACE_TEXT ("%d != %d\n"), returned_num_secondaries, i)); status = 1; } } #endif /* ACE_HAS_IPV6 */ ACE_END_TEST; return status; } ace-8.0.4+dfsg.orig/tests/Hash_Map_Bucket_Iterator_Test.cpp0000644000175000017500000000526715027201773022674 0ustar sudipsudip //============================================================================= /** * @file Hash_Map_Bucket_Iterator_Test.cpp * * This is a simple test of the . * * @author Irfan Pyarali */ //============================================================================= #include "test_config.h" #include "ace/OS_NS_stdlib.h" #include "ace/Hash_Map_Manager.h" #include "ace/Synch_Traits.h" #include "ace/Null_Mutex.h" #include "ace/Get_Opt.h" #include "ace/Functor.h" static ACE_UINT32 iterations = ACE_MAX_ITERATIONS * 10; static ACE_UINT32 table_size = ACE_MAX_ITERATIONS; int parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("t:i:")); int cc; while ((cc = get_opt ()) != -1) switch (cc) { case 't': table_size = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'i': iterations = ACE_OS::atoi (get_opt.opt_arg ()); break; case '?': case 'h': default: ACE_ERROR ((LM_ERROR, ACE_TEXT ("usage: %s ") ACE_TEXT ("[-i (iterations)] ") ACE_TEXT ("[-t (table size)] "), ACE_TEXT ("Hash_Map_Bucket_Iterator_Test"))); return -1; } return 0; } using HASH_MAP = ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_MT_SYNCH::NULL_MUTEX>; using HASH_MAP_BUCKET_ITERATOR = ACE_Hash_Map_Bucket_Iterator, ACE_Equal_To, ACE_MT_SYNCH::NULL_MUTEX>; int run_main (int argc, ACE_TCHAR *argv[]) { // Validate options. int result = parse_args (argc, argv); if (result != 0) return result; // Start the test only if options are valid. ACE_START_TEST (ACE_TEXT ("Hash_Map_Bucket_Iterator_Test")); ACE_LOG_MSG->clr_flags (ACE_Log_Msg::VERBOSE_LITE); ACE_UINT32 i = 0; HASH_MAP map (table_size); for (i = 0; i < iterations; ++i) { int result = map.bind (i, i); ACE_TEST_ASSERT (result == 0); } for (i = 0; i < table_size; ++i) { HASH_MAP_BUCKET_ITERATOR iterator (map, i); HASH_MAP_BUCKET_ITERATOR end (map, i, 1); for (; iterator != end; ++iterator) { ACE_DEBUG ((LM_DEBUG, "%d ", (*iterator).int_id_)); ACE_UINT32 key = (*iterator).ext_id_; ACE_TEST_ASSERT (((key - i) % table_size) == 0); } ACE_DEBUG ((LM_DEBUG, "\n")); } ACE_LOG_MSG->set_flags (ACE_Log_Msg::VERBOSE_LITE); ACE_END_TEST; return 0; } ace-8.0.4+dfsg.orig/ACEXML/0000755000175000017500000000000015046037655014147 5ustar sudipsudipace-8.0.4+dfsg.orig/ACEXML/parser/0000755000175000017500000000000015046037655015443 5ustar sudipsudipace-8.0.4+dfsg.orig/ACEXML/parser/parser/0000755000175000017500000000000015046037655016737 5ustar sudipsudipace-8.0.4+dfsg.orig/ACEXML/parser/parser/ACEXML_Parser.rc0000644000175000017500000000153315027201772021544 0ustar sudipsudip#include "../../../ace/Version.h" 1 VERSIONINFO FILEVERSION ACE_MAJOR_VERSION,ACE_MINOR_VERSION,ACE_MICRO_VERSION,0 PRODUCTVERSION ACE_MAJOR_VERSION,ACE_MINOR_VERSION,ACE_MICRO_VERSION,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x4L FILETYPE 0x1L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904B0" BEGIN VALUE "FileDescription", "ACEXML_Parser\0" VALUE "FileVersion", ACE_VERSION "\0" VALUE "InternalName", "ACEXML_ParserDLL\0" VALUE "LegalCopyright", "\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "ACEXML_Parser.DLL\0" VALUE "ProductName", "ACE\0" VALUE "ProductVersion", ACE_VERSION "\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END ace-8.0.4+dfsg.orig/ACEXML/parser/parser/parser.mpc0000644000175000017500000000051415027201772020724 0ustar sudipsudip// -*- MPC -*- project(ACEXML_Parser): acelib, ace_output, install { avoids += ace_for_tao sharedname = ACEXML_Parser after += ACEXML libs += ACEXML dynamicflags += ACEXML_PARSER_BUILD_DLL specific { install_dir = ACEXML/parser/parser } Pkgconfig_Files { ACEXML_Parser.pc.in } } ace-8.0.4+dfsg.orig/ACEXML/parser/parser/Entity_Manager.cpp0000644000175000017500000000046615027201772022347 0ustar sudipsudip#include "ACEXML/parser/parser/Entity_Manager.h" #if !defined (__ACEXML_INLINE__) # include "ACEXML/parser/parser/Entity_Manager.inl" #endif /* __ACEXML_INLINE__ */ ACEXML_Entity_Manager::ACEXML_Entity_Manager () : entities_ (0) { } ACEXML_Entity_Manager::~ACEXML_Entity_Manager () { this->reset(); } ace-8.0.4+dfsg.orig/ACEXML/parser/parser/ParserContext.h0000644000175000017500000000421515027201772021703 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file ParserContext.h * * @author Krishnakumar B */ //============================================================================= #ifndef ACEXML_PARSER_CONTEXT_H #define ACEXML_PARSER_CONTEXT_H #include /**/ "ace/pre.h" #include "ACEXML/parser/parser/Parser_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/XML_Types.h" #include "ACEXML/common/InputSource.h" #include "ACEXML/common/Locator.h" #include "ACEXML/common/LocatorImpl.h" #include "ace/Functor.h" #include "ace/Containers_T.h" class ACEXML_PARSER_Export ACEXML_Parser_Context { public: /// Default constructor ACEXML_Parser_Context(); /// Constructor which initializes the context ACEXML_Parser_Context (ACEXML_InputSource* instream, ACEXML_LocatorImpl* locator); /// Comparison operator bool operator!= (const ACEXML_Parser_Context& src); /// Destructor virtual ~ACEXML_Parser_Context(); /// Reset the parser context. This does not free up the memory. Only sets /// it to zero. Meant to be called after a context is pushed on to a /// stack. void reset (); /// Get the underlying input source. virtual ACEXML_InputSource* getInputSource(); /// Get the underlying locator. virtual ACEXML_LocatorImpl* getLocator(); /// Set the underlying input source. virtual void setInputSource(ACEXML_InputSource* ip); /// Set the underlying locator. virtual void setLocator(ACEXML_LocatorImpl* locator); private: /// Copy constructor ACEXML_Parser_Context (const ACEXML_Parser_Context& src); /// Assignment operator ACEXML_Parser_Context& operator= (const ACEXML_Parser_Context& src); /// Current input char stream. ACEXML_InputSource *instream_; /// Current Locator which provides line no., column no. systemId and publicId ACEXML_LocatorImpl* locator_; }; #if defined (__ACEXML_INLINE__) # include "ACEXML/parser/parser/ParserContext.inl" #endif /* __ACEXML_INLINE__ */ #include /**/ "ace/post.h" #endif /* ACEXML_PARSER_CONTEXT_H */ ace-8.0.4+dfsg.orig/ACEXML/parser/parser/Parser.inl0000644000175000017500000001342615027201772020675 0ustar sudipsudip//============================================================================= /** * @file Parser.inl * * @author Nanbor Wang */ //============================================================================= ACEXML_INLINE ACEXML_ContentHandler * ACEXML_Parser::getContentHandler () const { return this->content_handler_; } ACEXML_INLINE ACEXML_DTDHandler * ACEXML_Parser::getDTDHandler () const { return this->dtd_handler_; } ACEXML_INLINE ACEXML_EntityResolver * ACEXML_Parser::getEntityResolver () const { return this->entity_resolver_; } ACEXML_INLINE ACEXML_ErrorHandler * ACEXML_Parser::getErrorHandler () const { return this->error_handler_; } ACEXML_INLINE void ACEXML_Parser::setContentHandler (ACEXML_ContentHandler *handler) { this->content_handler_ = handler; } ACEXML_INLINE void ACEXML_Parser::setDTDHandler (ACEXML_DTDHandler *handler) { this->dtd_handler_ = handler; } ACEXML_INLINE void ACEXML_Parser::setEntityResolver (ACEXML_EntityResolver *resolver) { this->entity_resolver_ = resolver; } ACEXML_INLINE void ACEXML_Parser::setErrorHandler (ACEXML_ErrorHandler *handler) { this->error_handler_ = handler; } ACEXML_INLINE int ACEXML_Parser::isChar (ACEXML_UCS4 c) const { return (c == 0x9 || c == 0xA || c == 0xD || (c >= 0x20 && c <= 0xD7FF) || (c >= 0xE000 && c <= 0xFFFD) || (c >= 0x10000 && c <= 0x10FFFF)); } ACEXML_INLINE int ACEXML_Parser::isCharRef (const ACEXML_Char c) const { return ((c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')); } ACEXML_INLINE int ACEXML_Parser::isNormalDigit (const ACEXML_Char c) const { return (c >= '\x30' && c <= '\x39'); } ACEXML_INLINE int ACEXML_Parser::isBasechar (const ACEXML_Char c) const { #if defined (ACE_USES_WCHAR) return ACEXML_ParserInt::isBasechar_i (c); #else return ACEXML_ParserInt::base_char_table_[(int) c]; #endif /* ACE_USES_WCHAR */ } ACEXML_INLINE int ACEXML_Parser::isIdeographic (const ACEXML_Char c) const { #if defined (ACE_USES_WCHAR) return ACEXML_ParserInt::isIdeographic_i (c); #else ACE_UNUSED_ARG (c); return 0; #endif /* ACE_USES_WCHAR */ } ACEXML_INLINE int ACEXML_Parser::isCombiningchar (const ACEXML_Char c) const { #if defined (ACE_USES_WCHAR) return ACEXML_ParserInt::isCombiningchar_i (c); #else ACE_UNUSED_ARG (c); return 0; #endif /* ACE_USES_WCHAR */ } ACEXML_INLINE int ACEXML_Parser::isDigit (const ACEXML_Char c) const { #if defined (ACE_USES_WCHAR) return ACEXML_ParserInt::isDigit_i (c); #else return (this->isNormalDigit (c)); #endif /* ACE_USES_WCHAR */ } ACEXML_INLINE int ACEXML_Parser::isExtender (const ACEXML_Char c) const { #if defined (ACE_USES_WCHAR) return ACEXML_ParserInt::isExtender_i (c); #else return (c == '\xB7'); #endif /* ACE_USES_WCHAR */ } ACEXML_INLINE int ACEXML_Parser::isLetter (const ACEXML_Char c) const { return (this->isBasechar (c) || this->isIdeographic (c)); } ACEXML_INLINE int ACEXML_Parser::isNameChar (const ACEXML_Char c) const { return (this->isLetter (c) || this->isDigit (c) || c == '.' || c == '-' || c == '_' || c == ':' || this->isCombiningchar (c) || this->isExtender (c)); } ACEXML_INLINE int ACEXML_Parser::isPubidChar (const ACEXML_Char c) const { return (c == '\x20' || c == '\x0D' || c == '\x0A' || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '-' || c == '\'' || c == '(' || c == ')' || c == '+' || c == ',' || c == '.' || c == '/' || c == ':' || c == '=' || c == '?' || c == ';' || c == '!' || c == '*' || c == '#' || c == '@' || c == '$' || c == '_' || c == '%'); } ACEXML_INLINE int ACEXML_Parser::is_whitespace (const ACEXML_Char c) const { switch (c) { case '\x0A': case '\x20': case '\x09': case '\x0D': return 1; default: return 0; } } ACEXML_INLINE ACEXML_Char ACEXML_Parser::skip_whitespace () { ACEXML_Char ch = this->get(); while (this->is_whitespace (ch)) ch = this->get (); return ch; } ACEXML_INLINE int ACEXML_Parser::skip_whitespace_count (ACEXML_Char *peeky) { int wscount = 0; ACEXML_Char dummy; ACEXML_Char &forward = (peeky == 0 ? dummy : *peeky); for (;this->is_whitespace ((forward = this->peek ())); ++wscount) this->get (); return wscount; } ACEXML_INLINE int ACEXML_Parser::skip_equal () { if (this->skip_whitespace() != '=') return -1; while (this->is_whitespace (this->peek())) this->get(); return 0; } ACEXML_INLINE ACEXML_Char ACEXML_Parser::get () { ACEXML_Char ch = 0; const ACEXML_InputSource* ip = this->current_->getInputSource(); ACEXML_CharStream* instream = ip->getCharStream(); if (instream->get (ch) != -1) { this->current_->getLocator()->incrColumnNumber(); // Normalize white-space if (ch == '\x0D') { if (instream->peek() == 0x0A) instream->get (ch); ch = '\x0A'; } if (ch == '\x0A') { // Reset column number and increment Line Number. this->current_->getLocator()->incrLineNumber(); this->current_->getLocator()->setColumnNumber (0); } return ch; } return 0; } ACEXML_INLINE ACEXML_Char ACEXML_Parser::peek () { // Using an extra level of indirection so we can // manage document location in the future. ACEXML_Char ch = 0; const ACEXML_InputSource* ip = this->current_->getInputSource(); ACEXML_CharStream* instream = ip->getCharStream(); ch = static_cast (instream->peek ()); return (ch > 0 ? ch : 0); } ACEXML_INLINE int ACEXML_Parser::parse_token (const ACEXML_Char* keyword) { if (keyword == 0) return -1; const ACEXML_Char* ptr = keyword; for (; *ptr != 0 && (this->get() == *ptr); ++ptr) ; if (*ptr == 0) return 0; else return -1; } ace-8.0.4+dfsg.orig/ACEXML/parser/parser/Entity_Manager.inl0000644000175000017500000000304715027201772022345 0ustar sudipsudipACEXML_INLINE int ACEXML_Entity_Manager::add_entity (const ACEXML_Char *ref, const ACEXML_Char *v) { if (!this->entities_ ) ACE_NEW_RETURN (this->entities_, ACEXML_ENTITIES_MANAGER, -1); ACEXML_String name (ref, 0, false); ACEXML_String value (v, 0, false); return this->entities_->bind (name, value); } ACEXML_INLINE const ACEXML_Char* ACEXML_Entity_Manager::resolve_entity (const ACEXML_Char *ref) { if (!this->entities_) return 0; ACEXML_ENTITY_ENTRY *entry = 0; if (this->entities_->find (ACEXML_String (ref, 0, false), entry) == 0) return entry->int_id_.c_str(); return 0; } ACEXML_INLINE int ACEXML_Entity_Manager::resolve_entity (const ACEXML_Char* ref, ACEXML_Char*& systemId, ACEXML_Char*& publicId) { if (!this->entities_) return 0; publicId = systemId = 0; ACEXML_ENTITY_ENTRY_ITERATOR iter (*this->entities_, ref); ACEXML_ENTITY_ENTRY_ITERATOR end (*this->entities_, ref, 1); if (iter != end) { systemId = const_cast ((*iter).int_id_.c_str()); ++iter; if (iter != end) publicId = const_cast ((*iter).int_id_.c_str()); return 0; } return -1; } ACEXML_INLINE int ACEXML_Entity_Manager::reset () { delete this->entities_; this->entities_ = 0; return 0; } ACEXML_INLINE size_t ACEXML_Entity_Manager::size () const { if (!this->entities_) return 0; return this->entities_->current_size(); } ace-8.0.4+dfsg.orig/ACEXML/parser/parser/Parser_export.h0000644000175000017500000000341315027201772021736 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Parser_export.h * * @author Nanbor Wang */ //============================================================================= // Definition for Win32 Export directives. // This file is generated automatically by generate_export_file.pl // ------------------------------ #ifndef ACEXML_PARSER_EXPORT_H #define ACEXML_PARSER_EXPORT_H #include "ace/config-all.h" #if defined (ACE_AS_STATIC_LIBS) && !defined (ACEXML_PARSER_HAS_DLL) # define ACEXML_PARSER_HAS_DLL 0 #endif /* ACE_AS_STATIC_LIBS && ACEXML_PARSER_HAS_DLL */ #if !defined (ACEXML_PARSER_HAS_DLL) # define ACEXML_PARSER_HAS_DLL 1 #endif /* ! ACEXML_PARSER_HAS_DLL */ #if defined (ACEXML_PARSER_HAS_DLL) && (ACEXML_PARSER_HAS_DLL == 1) # if defined (ACEXML_PARSER_BUILD_DLL) # define ACEXML_PARSER_Export ACE_Proper_Export_Flag # define ACEXML_PARSER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) # define ACEXML_PARSER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) # else /* ACEXML_PARSER_BUILD_DLL */ # define ACEXML_PARSER_Export ACE_Proper_Import_Flag # define ACEXML_PARSER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) # define ACEXML_PARSER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) # endif /* ACEXML_PARSER_BUILD_DLL */ #else /* ACEXML_PARSER_HAS_DLL == 1 */ # define ACEXML_PARSER_Export # define ACEXML_PARSER_SINGLETON_DECLARATION(T) # define ACEXML_PARSER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) #endif /* ACEXML_PARSER_HAS_DLL == 1 */ #endif /* ACEXML_PARSER_EXPORT_H */ // End of auto generated file. ace-8.0.4+dfsg.orig/ACEXML/parser/parser/Parser.cpp0000644000175000017500000025354415027201772020704 0ustar sudipsudip#include "ACEXML/parser/parser/Parser.h" #if !defined (__ACEXML_INLINE__) # include "ACEXML/parser/parser/Parser.inl" #endif /* __ACEXML_INLINE__ */ #include "ace/ACE.h" #include "ACEXML/common/Transcode.h" #include "ACEXML/common/AttributesImpl.h" #include "ACEXML/common/StrCharStream.h" #include "ACEXML/common/StreamFactory.h" #include "ACEXML/parser/parser/ParserInternals.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_strings.h" #include static const ACEXML_Char default_attribute_type[] = ACE_TEXT ("CDATA"); static const ACEXML_Char empty_string[] = { 0 }; const ACEXML_Char ACEXML_Parser::simple_parsing_feature_[] = ACE_TEXT ("Simple"); const ACEXML_Char ACEXML_Parser::namespaces_feature_[] = ACE_TEXT ("http://xml.org/sax/features/namespaces"); const ACEXML_Char ACEXML_Parser::namespace_prefixes_feature_[] = ACE_TEXT ("http://xml.org/sax/features/namespace-prefixes"); const ACEXML_Char ACEXML_Parser::validation_feature_[] = ACE_TEXT ("http://xml.org/sax/features/validation"); ACEXML_Parser::ACEXML_Parser () : dtd_handler_ (0), entity_resolver_ (0), content_handler_ (0), error_handler_ (0), doctype_ (0), current_ (0), alt_stack_ (MAXPATHLEN), nested_namespace_ (0), ref_state_ (ACEXML_ParserInt::INVALID), external_subset_ (0), external_entity_ (0), has_pe_refs_ (0), standalone_ (0), external_dtd_ (0), internal_dtd_ (0), simple_parsing_ (0), validate_ (1), namespaces_(1), namespace_prefixes_ (0) { } ACEXML_Parser::~ACEXML_Parser () { } int ACEXML_Parser::initialize(ACEXML_InputSource* input) { // Initialize namespace support if (this->xml_namespace_.init() == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error initializing namespace support\n"))); return -1; } for (int i = 0; i < 5; ++i) { if (this->predef_entities_.add_entity (ACEXML_ParserInt::predef_ent_[i], ACEXML_ParserInt::predef_val_[i]) != 0) { ACE_ERROR ((LM_DEBUG, ACE_TEXT ("Error adding entity %s to Manager\n"), ACEXML_ParserInt::predef_ent_[i])); return -1; } } return this->switch_input (input, input->getSystemId()); } void ACEXML_Parser::parse (const ACEXML_Char *systemId) { ACEXML_InputSource* input = 0; ACE_NEW (input, ACEXML_InputSource (systemId)); this->parse (input); } void ACEXML_Parser::parse (ACEXML_InputSource *input) { if (input == 0) { this->fatal_error(ACE_TEXT ("Invalid input source")); } if (this->content_handler_ == 0) { this->fatal_error (ACE_TEXT ("No content handlers defined. Exiting..")); } if (this->validate_ && this->dtd_handler_ == 0) { this->fatal_error (ACE_TEXT ("No DTD handlers defined. Exiting..")); } if (this->initialize(input) == -1) { this->fatal_error (ACE_TEXT ("Failed to initialize parser state")); } // Set up Locator. this->content_handler_->setDocumentLocator (this->current_->getLocator()); int xmldecl_defined = 0; ACEXML_Char fwd = this->get(); // Consume '<' if (fwd == '<' && this->peek() == '?') { this->get(); // Consume '?' fwd = this->peek(); if (fwd == 'x' && !xmldecl_defined) { this->parse_xml_decl (); xmldecl_defined = 1; } } // We need a XMLDecl in a Valid XML document if (this->validate_ && !xmldecl_defined) { this->fatal_error (ACE_TEXT ("Expecting an XMLDecl at the beginning of") ACE_TEXT (" a valid document")); } this->content_handler_->startDocument (); int doctype_defined = 0; for (int prolog_done = 0; prolog_done == 0; ) { // Expect a '<' only if we have encountered a XMLDecl, or we are // looping through Misc blocks. if (xmldecl_defined) { if (this->skip_whitespace () != '<') { this->fatal_error (ACE_TEXT ("Expecting '<' at the beginning of ") ACE_TEXT ("Misc section")); } fwd = this->peek(); } switch (fwd) { case '?': this->get(); this->parse_processing_instruction (); xmldecl_defined = 1; break; case '!': this->get(); fwd = this->peek (); if (fwd == 'D' && !doctype_defined) // DOCTYPE { // This will also take care of the trailing MISC block if any. this->parse_doctypedecl (); doctype_defined = 1; // Now that we have a DOCTYPE Decl defined, we shouldn't // accept XML Decl any longer xmldecl_defined = 1; } else if (fwd == 'D') { this->fatal_error (ACE_TEXT ("Duplicate DOCTYPE declaration")); } else if (fwd == '-') // COMMENT { if (this->parse_comment () < 0) { this->fatal_error(ACE_TEXT ("Invalid comment in document")); } xmldecl_defined = 1; } break; case 0: this->fatal_error (ACE_TEXT ("Unexpected end-of-file")); break; default: // Root element begins prolog_done = 1; break; } } if (this->validate_ && !doctype_defined) { this->warning (ACE_TEXT ("No doctypeDecl in valid document")); } // Now parse root element. this->parse_element (1); this->content_handler_->endDocument (); // Reset the parser state this->reset(); } int ACEXML_Parser::parse_doctypedecl () { if (this->parse_token (ACE_TEXT ("DOCTYPE")) < 0) { this->fatal_error(ACE_TEXT ("Expecting keyword DOCTYPE in a doctypedecl")); } ACEXML_Char nextch = 0; if (this->skip_whitespace_count (&nextch) == 0) { this->fatal_error(ACE_TEXT ("Expecting a space between DOCTYPE keyword ") ACE_TEXT ("and name")); } this->doctype_ = this->parse_name (); if (this->doctype_ == 0) { this->fatal_error(ACE_TEXT ("Invalid DOCTYPE name")); } int count = this->skip_whitespace_count (&nextch); if (nextch == 'S' || nextch == 'P') // ExternalID defined { if (count == 0) { this->fatal_error(ACE_TEXT ("Expecting a space between DOCTYPE") ACE_TEXT ("keyword and name")); } this->external_dtd_ = 1; this->parse_external_dtd (); } nextch = this->skip_whitespace (); switch (nextch) { case '[': this->internal_dtd_ = 1; // Internal DTD definition this->parse_internal_dtd (); break; case '>': // End of DTD definition // This is an XML document without a doctypedecl. if (this->validate_ && !this->external_dtd_) { this->fatal_error (ACE_TEXT ("No DTD defined")); } return 0; case '0': this->fatal_error (ACE_TEXT ("Unexpected end-of-file")); default: break; } if (this->skip_whitespace() != '>') { this->fatal_error(ACE_TEXT ("Expecting '>' at end of doctypedecl")); } return 0; } int ACEXML_Parser::parse_internal_dtd () { this->ref_state_ = ACEXML_ParserInt::IN_INT_DTD; ACEXML_Char nextch = this->skip_whitespace (); do { switch (nextch) { case '<': nextch = this->get(); switch (nextch) { case '!': this->parse_markup_decl (); break; case '?': this->parse_processing_instruction (); break; default: this->fatal_error (ACE_TEXT ("Invalid internal subset")); break; } break; case '%': this->has_pe_refs_ = 1; this->parse_PE_reference (); break; case ']': // End of internal definitions. return 0; case '&': this->fatal_error (ACE_TEXT ("Invalid Reference in internal DTD")); break; case 0: this->pop_context (0); break; default: this->fatal_error (ACE_TEXT ("Invalid content in internal subset")); }; nextch = this->skip_whitespace (); } while (1); ACE_NOTREACHED (return -1); } int ACEXML_Parser::parse_external_dtd () { this->ref_state_ = ACEXML_ParserInt::IN_EXT_DTD; ACEXML_Char* publicId = 0; ACEXML_Char* systemId = 0; if (this->parse_external_id (publicId, systemId) != 0) { this->fatal_error (ACE_TEXT ("Error in parsing ExternalID")); } if (this->validate_) { ACEXML_Char* uri = this->normalize_systemid (systemId); std::unique_ptr cleanup_uri (uri); ACEXML_InputSource* ip = 0; if (this->entity_resolver_) { ip = this->entity_resolver_->resolveEntity (publicId, (uri ? uri : systemId)); } if (ip) { if (this->switch_input (ip, (uri ? uri : systemId), publicId) != 0) return -1; } else { ACEXML_StreamFactory factory; ACEXML_CharStream* cstream = factory.create_stream (uri ? uri: systemId); if (!cstream) { this->fatal_error (ACE_TEXT ("Invalid input source")); } if (this->switch_input (cstream, systemId, publicId) != 0) return -1; } this->parse_external_subset (); } return 0; } int ACEXML_Parser::parse_external_subset () { this->ref_state_ = ACEXML_ParserInt::IN_EXT_DTD; this->external_subset_ = 1; size_t nrelems = 0; ACEXML_Char nextch = this->skip_whitespace(); do { switch (nextch) { case '<': nextch = this->get(); switch (nextch) { case '!': nextch = this->peek(); if (nextch == '[') this->parse_conditional_section (); else this->parse_markup_decl (); break; case '?': nextch = this->peek(); if (nextch == 'x') this->parse_text_decl (); else this->parse_processing_instruction (); break; default: this->fatal_error (ACE_TEXT ("Invalid content in external DTD")); } break; case '%': this->parse_PE_reference (); break; case 0: nrelems = this->pop_context (0); if (nrelems == 1) return 0; break; default: this->fatal_error (ACE_TEXT ("Invalid content in external DTD")); } nextch = this->skip_whitespace(); } while (1); } int ACEXML_Parser::parse_conditional_section () { ACEXML_Char ch = this->get (); int include = 0; if (ch != '[') { this->fatal_error(ACE_TEXT ("Internal Parser Error")); } ch = this->skip_whitespace(); if (ch == '%') { this->parse_PE_reference (); ch = this->skip_whitespace(); } if (ch == 'I') { ch = this->get(); switch (ch) { case 'N': if (this->parse_token (ACE_TEXT ("CLUDE")) < 0) { this->fatal_error (ACE_TEXT ("Expecting keyword INCLUDE in ") ACE_TEXT ("conditionalSect")); } include = 1; break; case 'G': if (this->parse_token (ACE_TEXT ("GNORE")) < 0) { this->fatal_error (ACE_TEXT ("Expecting keyword IGNORE in ") ACE_TEXT ("conditionalSect")); } include = 0; break; default: this->fatal_error (ACE_TEXT ("Invalid conditionalSect")); } ACEXML_Char fwd = '\xFF'; this->skip_whitespace_count (&fwd); if (fwd == 0) { this->get(); // Consume the 0 this->pop_context (0); } } else { this->fatal_error (ACE_TEXT ("Invalid conditionalSect")); } if (this->skip_whitespace() != '[') { this->fatal_error (ACE_TEXT ("Expecting '[' in conditionalSect")); } if (include) this->parse_includesect (); else this->parse_ignoresect (); return 0; } int ACEXML_Parser::parse_ignoresect () { ACEXML_Char nextch = this->skip_whitespace(); int count = 0; int done = 0; do { switch (nextch) { case '<': if (this->peek() == '!') { this->get(); if (this->peek() == '[') { this->get(); ++count; } } break; case ']': if (this->peek() == ']') { this->get(); if (this->peek() == '>') { this->get(); if (count) { --count; break; } done = 1; } } break; case 0: // [VC: Proper Conditional Section/PE Nesting] if (count != 0) { this->fatal_error (ACE_TEXT ("Invalid Conditional Section/PE ") ACE_TEXT ("Nesting ")); } default: break; } if (done) break; nextch = this->get(); } while (1); return 0; } int ACEXML_Parser::parse_includesect () { ACEXML_Char nextch = this->skip_whitespace(); do { switch (nextch) { case '<': nextch = this->get(); switch (nextch) { case '!': nextch = this->peek(); if (nextch == '[') this->parse_conditional_section (); else this->parse_markup_decl (); break; case '?': nextch = this->peek(); this->parse_processing_instruction (); break; default: this->fatal_error (ACE_TEXT ("Invalid includeSect")); } break; case '%': this->parse_PE_reference (); break; case 0: // [VC: Proper Conditional Section/PE Nesting] this->fatal_error (ACE_TEXT ("Invalid Conditional Section/PE ") ACE_TEXT ("Nesting ")); break; case ']': if (this->peek() == ']') { nextch = this->get(); if (this->peek() == '>') { nextch = this->get(); return 0; } } ACE_FALLTHROUGH; default: this->fatal_error (ACE_TEXT ("Invalid includeSect")); } nextch = this->skip_whitespace(); } while (1); } int ACEXML_Parser::parse_markup_decl () { ACEXML_Char nextch = this->peek (); switch (nextch) { case 'E': // An ELEMENT or ENTITY decl this->get (); nextch = this->peek (); switch (nextch) { case 'L': this->parse_element_decl (); break; case 'N': this->parse_entity_decl (); break; default: this->fatal_error(ACE_TEXT ("Expecting keyword ELEMENT/ENTITY")); } break; case 'A': // An ATTLIST decl this->parse_attlist_decl (); break; case 'N': // A NOTATION decl this->parse_notation_decl (); break; case '-': // a comment. if (this->parse_comment () < 0) { this->fatal_error(ACE_TEXT ("Invalid comment")); } break; case 0: // [VC: Proper Declaration/PE Nesting] this->fatal_error (ACE_TEXT ("Unexpected end-of-file")); break; default: this->fatal_error (ACE_TEXT ("Invalid markupDecl")); } return 0; } int ACEXML_Parser::parse_external_id (ACEXML_Char *&publicId, ACEXML_Char *&systemId) { publicId = systemId = 0; ACEXML_Char nextch = this->get (); ACEXML_Char fwd = 0; switch (nextch) { case 'S': // External SYSTEM id. if (this->parse_token (ACE_TEXT ("YSTEM")) < 0 || this->skip_whitespace_count () < 1) { this->fatal_error(ACE_TEXT ("Expecting keyword SYSTEM")); } if (this->parse_system_literal (systemId) != 0) { this->fatal_error(ACE_TEXT ("Invalid systemLiteral")); } break; case 'P': // External PUBLIC id or previously defined PUBLIC id. if (this->parse_token (ACE_TEXT ("UBLIC")) < 0 || this->skip_whitespace_count () < 1) { this->fatal_error(ACE_TEXT ("Expecting keyword PUBLIC")); } if (this->parse_pubid_literal (publicId) != 0) { this->fatal_error(ACE_TEXT ("Invalid PubidLiteral")); } this->skip_whitespace_count(&fwd); if (fwd == '\'' || fwd == '"') { if (this->parse_system_literal (systemId) != 0) { this->fatal_error(ACE_TEXT ("Invalid systemLiteral")); } } else if (this->ref_state_ != ACEXML_ParserInt::IN_NOTATION) { this->fatal_error(ACE_TEXT ("Expecting systemLiteral after a ") ACE_TEXT ("PUBLIC keyword")); } break; default: this->fatal_error(ACE_TEXT ("Invalid system/public Literal")); } return 0; } ACEXML_Char* ACEXML_Parser::normalize_systemid (const ACEXML_Char* systemId) { if (ACE_OS::strstr (systemId, ACE_TEXT("ftp://")) != 0 || ACE_OS::strstr (systemId, ACE_TEXT ("http://")) != 0 || ACE_OS::strstr (systemId, ACE_TEXT ("file://")) != 0) return 0; else { ACEXML_Char* normalized_uri = 0; const ACEXML_Char* baseURI = this->current_->getLocator()->getSystemId(); ACE_ASSERT (baseURI); const ACEXML_Char* temp = 0; if (ACE_OS::strstr (baseURI, ACE_TEXT ("http://")) != 0) { // baseURI is a HTTP URL and systemId is relative. Note that this // is not compliant with RFC2396. Caveat Emptor ! temp = ACE_OS::strrchr (baseURI, '/'); } else { // baseURI is a local file and systemId is relative // Unlike the HTTP one, this will work always. temp = ACE_OS::strrchr (baseURI, ACE_TEXT ('\\')); if (!temp) { temp = ACE_OS::strrchr (baseURI, ACE_TEXT ('/')); } } if (temp) { size_t pos = temp - baseURI + 1; size_t len = pos + ACE_OS::strlen (systemId) + 1; ACE_NEW_RETURN (normalized_uri, ACEXML_Char[len], 0); ACE_OS::strncpy (normalized_uri, baseURI, pos); ACE_OS::strcpy (normalized_uri + pos, systemId); return normalized_uri; } return 0; } } void ACEXML_Parser::parse_element (int is_root) { // Parse STag. const ACEXML_Char *startname = this->parse_name (); if (startname == 0) { this->fatal_error (ACE_TEXT ("Unexpected end-of-file")); return; } if (is_root && this->doctype_ != 0 && ACE_OS::strcmp (startname, this->doctype_) != 0) { this->fatal_error (ACE_TEXT ("Root element different from DOCTYPE")); return; } ACEXML_AttributesImpl attributes; ACEXML_Char ch; int ns_flag = 0; // Push only one namespace context onto the stack // if there are multiple namespaces declared. const ACEXML_Char* ns_uri = 0; const ACEXML_Char* ns_lname = 0; // namespace URI and localName for (int start_element_done = 0; start_element_done == 0;) { ch = this->skip_whitespace (); switch (ch) { case 0: this->fatal_error(ACE_TEXT ("Internal Parser error")); return; case '/': if (this->get () != '>') { this->fatal_error(ACE_TEXT ("Expecting '>' at end of element ") ACE_TEXT ("definition")); return; } this->xml_namespace_.processName(startname, ns_uri, ns_lname, 0); this->prefix_mapping (this->xml_namespace_.getPrefix(ns_uri), ns_uri, 1); this->content_handler_->startElement(ns_uri, ns_lname, startname, &attributes); this->content_handler_->endElement (ns_uri, ns_lname, startname); this->prefix_mapping (this->xml_namespace_.getPrefix(ns_uri), ns_uri, 0); if (ns_flag) { this->xml_namespace_.popContext (); this->nested_namespace_--; } return; case '>': this->xml_namespace_.processName (startname, ns_uri, ns_lname, 0); this->prefix_mapping (this->xml_namespace_.getPrefix(ns_uri), ns_uri, 1); this->content_handler_->startElement(ns_uri, ns_lname, startname, &attributes); start_element_done = 1; break; default: ACEXML_Char *attvalue = 0; ACEXML_Char *attname = this->parse_name (ch); if (attname == 0 || this->skip_equal () != 0 || this->parse_attvalue (attvalue) != 0) { this->fatal_error(ACE_TEXT ("Error reading attribute value")); return; } // Handling new namespace if any. Notice that the order of // namespace declaration does matter. if (ACE_OS::strncmp (attname, ACE_TEXT("xmlns"), 5) == 0) { if (this->namespaces_) { if (!ns_flag) { this->xml_namespace_.pushContext (); this->nested_namespace_++; ns_flag = 1; } ACEXML_Char* name = ACE_OS::strchr (attname, ':'); const ACEXML_Char* ns_name = (name == 0)? empty_string:name+1; if (this->xml_namespace_.declarePrefix (ns_name, attvalue) == -1) { this->fatal_error(ACE_TEXT ("Duplicate definition of ") ACE_TEXT ("prefix")); return; } } if (this->namespace_prefixes_) { // Namespace_prefixes_feature_ is required. So add the // xmlns:foo to the list of attributes. if (attributes.addAttribute (ACE_TEXT (""), ACE_TEXT (""), attname, default_attribute_type, attvalue) == -1) { this->fatal_error(ACE_TEXT ("Duplicate attribute ") ACE_TEXT ("definition. Hint: Try ") ACE_TEXT ("setting namespace_prefix") ACE_TEXT ("es feature to 0")); return; } } if (!this->namespaces_ && !this->namespace_prefixes_) { this->fatal_error(ACE_TEXT ("One of namespaces or ") ACE_TEXT ("namespace_prefixes should be") ACE_TEXT (" declared")); return; } } else { const ACEXML_Char *uri, *lName; this->xml_namespace_.processName (attname, uri, lName, 1); if (attributes.addAttribute (uri, lName, attname, default_attribute_type, attvalue) == -1) { this->fatal_error(ACE_TEXT ("Duplicate attribute ") ACE_TEXT ("definition")); return; } } break; } } if (this->parse_content (startname, ns_uri, ns_lname, ns_flag) != 0) return; } int ACEXML_Parser::parse_content (const ACEXML_Char* startname, const ACEXML_Char*& ns_uri, const ACEXML_Char*& ns_lname, int ns_flag) { ACEXML_Char *cdata; size_t cdata_length = 0; // Parse element contents. while (1) { ACEXML_Char ch = this->get (); switch (ch) { case 0: this->pop_context (1); break; case '<': // Push out old 'characters' event. if (cdata_length != 0) { cdata = this->obstack_.freeze (); this->content_handler_->characters (cdata, 0, cdata_length); this->obstack_.unwind (cdata); cdata_length = 0; } ch = this->peek(); switch (ch) { case '!': // a comment or a CDATA section. this->get (); // consume '!' ch = this->peek (); if (ch == '-') // a comment { if (this->parse_comment () < 0) { this->fatal_error(ACE_TEXT ("Invalid comment in ") ACE_TEXT ("document")); } } else if (ch == '[') // a CDATA section. { this->parse_cdata (); } else { this->fatal_error(ACE_TEXT ("Expecting a CDATA section ") ACE_TEXT ("or a comment section")); } break; case '?': // a PI. this->get(); // consume the '?' this->parse_processing_instruction (); break; case '/': // an ETag. { this->get (); // consume '/' ACEXML_Char* endname = this->parse_name (); if (endname == 0 || ACE_OS::strcmp (startname, endname) != 0) { this->fatal_error(ACE_TEXT ("Name in ETag doesn't ") ACE_TEXT ("match name in STag")); } if (this->skip_whitespace () != '>') { this->fatal_error(ACE_TEXT ("Expecting '>' at end ") ACE_TEXT ("of element")); return -1; } this->content_handler_->endElement (ns_uri, ns_lname, endname); this->prefix_mapping (this->xml_namespace_.getPrefix(ns_uri), ns_uri, 0); if (this->namespaces_ && ns_flag) { if (this->nested_namespace_ >= 1) { this->xml_namespace_.popContext (); this->nested_namespace_--; } } return 0; } default: // a new nested element? this->parse_element (0); break; } break; case '&': if (this->peek () == '#') { ACEXML_Char buf[7]; size_t len = 0; do { len = sizeof (buf); if (this->parse_char_reference (buf, len) != 0) { // [WFC: Legal Character] this->fatal_error (ACE_TEXT ("Invalid CharRef")); } } while (buf[0] == '&' && this->peek() == '#'); for (size_t j = 0; j < len; ++j) this->obstack_.grow (buf[j]); cdata_length += len; } else { this->ref_state_ = ACEXML_ParserInt::IN_CONTENT; int const length = this->parse_entity_reference(); if (length == 1) ++cdata_length; } break; case '\x20': case '\x0D': case '\x0A': case '\x09': // if (this->validate_) // { // // Flush out any non-whitespace characters // if (cdata_length != 0) // { // cdata = this->obstack_.freeze (); // this->content_handler_->characters(cdata, 0, cdata_length // ACEXML_ENV_ARG_PARAMETER); // ACEXML_CHECK_RETURN (-1); // this->obstack_.unwind (cdata); // cdata_length = 0; // } // ++cdata_length; // this->obstack_.grow (ch); // while (1) // { // ch = this->peek(); // if (ch == '\x20' || ch == '\x0D' || ch == '\x0A' || // ch == '\x09') // { // ch = this->get(); // this->obstack_.grow (ch); // continue; // } // break; // } // cdata = this->obstack_.freeze (); // this->content_handler_->ignorableWhitespace (cdata, 0, // cdata_length // ACEXML_ENV_ARG_PARAMETER); // ACEXML_CHECK_RETURN (-1); // this->obstack_.unwind (cdata); // cdata_length = 0; // break; // } ACE_FALLTHROUGH; default: ++cdata_length; this->obstack_.grow (ch); } } ACE_NOTREACHED (return 0;) } int ACEXML_Parser::parse_cdata () { if (this->parse_token (ACE_TEXT ("[CDATA[")) < 0) { this->fatal_error(ACE_TEXT ("Expecting '[CDATA[' at beginning of CDATA ") ACE_TEXT ("section")); } ACEXML_Char ch; int datalen = 0; ACEXML_Char *cdata = 0; while (1) { ch = this->get (); // Anything goes except the sequence "]]>". if (ch == ']' && this->peek() == ']') { ACEXML_Char temp = ch; ch = this->get(); if (ch == ']' && this->peek() == '>') { ch = this->get(); cdata = this->obstack_.freeze (); this->content_handler_->characters (cdata, 0, datalen); this->obstack_.unwind(cdata); return 0; } this->obstack_.grow (temp); ++datalen; } this->obstack_.grow (ch); ++datalen; }; ACE_NOTREACHED (return -1); } int ACEXML_Parser::parse_entity_decl () { ACEXML_Char nextch = 0; if ((this->parse_token (ACE_TEXT ("NTITY")) < 0) || this->skip_whitespace_count (&nextch) == 0) { this->fatal_error (ACE_TEXT ("Expecting keyword ENTITY followed by a ") ACE_TEXT ("space")); } int is_GEDecl = 1; if (nextch == '%') // This is a PEDecl. { is_GEDecl = 0; this->get (); // consume the '%' if (this->skip_whitespace_count (&nextch) == 0) { this->fatal_error (ACE_TEXT ("Expecting space between % and ") ACE_TEXT ("entity name")); } } ACEXML_Char *entity_name = this->parse_name (); if (entity_name == 0) { this->fatal_error (ACE_TEXT ("Invalid entity name")); } if (this->skip_whitespace_count (&nextch) == 0) { this->fatal_error (ACE_TEXT ("Expecting space between entity name and ") ACE_TEXT ("entityDef")); } int retval = 0; if (nextch == '\'' || nextch == '"') { ACEXML_Char *entity_value = 0; if (this->parse_entity_value (entity_value) != 0) { this->fatal_error(ACE_TEXT ("Invalid EntityValue")); } if (is_GEDecl) retval = this->internal_GE_.add_entity (entity_name, entity_value); else retval = this->internal_PE_.add_entity (entity_name, entity_value); if (retval < 0) { this->fatal_error (ACE_TEXT ("Internal Parser Error in adding") ACE_TEXT ("Entity to map")); } else if (retval == 1) { this->warning (ACE_TEXT ("Duplicate entity found")); } } else { ACEXML_Char *systemid = 0, *publicid = 0; this->parse_external_id (publicid, systemid); if (systemid == 0) { this->fatal_error(ACE_TEXT ("Invalid SystemLiteral")); } this->skip_whitespace_count (&nextch); if (nextch == 'N') // NDATA section followed { if (is_GEDecl == 0) { this->fatal_error(ACE_TEXT ("Invalid NDataDecl in PEDef")); } if ((this->parse_token (ACE_TEXT ("NDATA")) < 0) || this->skip_whitespace_count (&nextch) == 0) { this->fatal_error(ACE_TEXT ("Expecting keyword NDATA followed ") ACE_TEXT ("by a space")); } ACEXML_Char *ndata = this->parse_name (); if (this->validate_) // [VC: Notation Declared] { if (!this->notations_.resolve_entity (ndata)) { this->fatal_error (ACE_TEXT ("Undeclared Notation name")); } this->dtd_handler_->unparsedEntityDecl(entity_name, publicid, systemid, ndata); } } else { if (is_GEDecl) retval = this->external_GE_.add_entity (entity_name, systemid); else retval = this->external_PE_.add_entity (entity_name, systemid); if (retval < 0) { this->fatal_error(ACE_TEXT ("Internal Parser Error")); } else if (retval == 1) this->warning(ACE_TEXT ("Duplicate external entity")); if (is_GEDecl) retval = this->external_GE_.add_entity (entity_name, publicid); else retval = this->external_PE_.add_entity (entity_name, publicid); if (retval < 0) { this->fatal_error(ACE_TEXT ("Internal Parser Error")); } else if (retval == 1) this->warning (ACE_TEXT ("Duplicate entity definition")); } } // End of ENTITY definition if (this->skip_whitespace() != '>') { this->fatal_error(ACE_TEXT ("Expecting '>' at end of entityDef")); } return 0; } int ACEXML_Parser::parse_attlist_decl () { if (this->parse_token (ACE_TEXT ("ATTLIST")) < 0) { this->fatal_error(ACE_TEXT ("Expecting keyword 'ATTLIST'")); } int count = check_for_PE_reference (); if (!count) { this->fatal_error(ACE_TEXT ("Expecting space between ATTLIST and ") ACE_TEXT ("element name")); } ACEXML_Char *element_name = this->parse_name (); if (element_name == 0) { this->fatal_error(ACE_TEXT ("Invalid element Name in attlistDecl")); } ACEXML_Char fwd = 0; count = this->skip_whitespace_count (&fwd); // Parse AttDef* while (fwd != '>') { if (!this->check_for_PE_reference () && !count) this->fatal_error(ACE_TEXT ("Expecting space between element ") ACE_TEXT ("name and AttDef")); this->skip_whitespace_count (&fwd); if (fwd == '>') break; count = this->check_for_PE_reference (); this->parse_attname (); count = this->check_for_PE_reference (); if (!count) { this->fatal_error(ACE_TEXT ("Expecting space between AttName and ") ACE_TEXT ("AttType")); } this->parse_atttype (); count = this->check_for_PE_reference (); if (!count) { this->fatal_error(ACE_TEXT ("Expecting space between AttType and") ACE_TEXT (" DefaultDecl")); } this->parse_defaultdecl (); count = this->check_for_PE_reference (); this->skip_whitespace_count(&fwd); } this->get (); // consume closing '>' return 0; } int ACEXML_Parser::check_for_PE_reference () { ACEXML_Char fwd = '\xFF'; // Skip any leading whitespaces and store the number of such chars skipped int count = this->skip_whitespace_count (&fwd); if (fwd == 0) { this->get(); // Consume the 0 this->pop_context (0); fwd = this->peek(); } if (fwd == '%') { this->get(); // Consume the % if (this->external_subset_) { this->parse_PE_reference (); } else { this->fatal_error(ACE_TEXT ("Illegal PERef within markupDecl")); } } if (count) { // We have atleast one whitespace. So just skip any more whitespaces // and return the count this->skip_whitespace_count(); return count; } return this->skip_whitespace_count(); } ACEXML_Char* ACEXML_Parser::parse_attname () { // Parse attribute name ACEXML_Char *att_name = this->parse_name (); if (att_name == 0) { this->fatal_error(ACE_TEXT ("Invalid AttName")); } return att_name; } int ACEXML_Parser::parse_defaultdecl () { // DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue) ACEXML_Char nextch = this->peek (); ACEXML_Char *fixed_attr = 0; switch (nextch) { case '#': this->get (); // consume the '#' switch (this->get ()) { case 'R': if (this->parse_token (ACE_TEXT ("EQUIRED")) < 0) { this->fatal_error(ACE_TEXT ("Expecting keyword REQUIRED")); } // We now know this attribute is required // @@ Set up the validator as such. break; case 'I': if (this->parse_token (ACE_TEXT ("MPLIED")) < 0) { this->fatal_error(ACE_TEXT ("Expecting keyword IMPLIED")); } // We now know this attribute is implied. // @@ Set up the validator as such. break; case 'F': if (this->parse_token (ACE_TEXT ("IXED")) < 0 || this->skip_whitespace_count () == 0) { this->fatal_error(ACE_TEXT ("Expecting keyword FIXED")); } // We now know this attribute is fixed. if (this->parse_attvalue (fixed_attr) != 0) { this->fatal_error(ACE_TEXT ("Invalid Default AttValue")); } // @@ set up validator break; default: this->fatal_error (ACE_TEXT ("Invalid DefaultDecl")); } break; case '\'': case '"': if (this->parse_attvalue (fixed_attr) != 0) { this->fatal_error(ACE_TEXT ("Invalid AttValue")); } // @@ set up validator break; default: this->fatal_error (ACE_TEXT ("Invalid DefaultDecl")); break; } return 0; } int ACEXML_Parser::parse_tokenized_type () { ACEXML_Char ch = this->get(); switch (ch) { case 'I': if (this->get () == 'D') { if (this->peek() != 'R' && this->is_whitespace (this->peek())) { // We have successfully identified the type of the // attribute as ID // @@ Set up validator as such. break; } if (this->parse_token (ACE_TEXT ("REF")) == 0) { if (this->peek() != 'S' && this->is_whitespace (this->peek())) { // We have successfully identified the type of // the attribute as IDREF // @@ Set up validator as such. break; } else if (this->peek() == 'S' && this->get() // consume the 'S' && this->is_whitespace (this->peek())) { // We have successfully identified the type of // the attribute as IDREFS // @@ Set up validator as such. break; } } } // Admittedly, this error message is not precise enough this->fatal_error(ACE_TEXT ("Expecting keyword `ID', `IDREF', or") ACE_TEXT ("`IDREFS'")); break; case 'E': // ENTITY or ENTITIES if (this->parse_token (ACE_TEXT ("NTIT")) == 0) { ACEXML_Char nextch = this->get (); if (nextch == 'Y') { // We have successfully identified the type of // the attribute as ENTITY // @@ Set up validator as such. } else if (this->parse_token (ACE_TEXT ("IES")) == 0) { // We have successfully identified the type of // the attribute as ENTITIES // @@ Set up validator as such. } if (this->is_whitespace (this->peek())) { // success break; } } // Admittedly, this error message is not precise enough this->fatal_error(ACE_TEXT ("Expecting keyword `ENTITY', or") ACE_TEXT ("`ENTITIES'")); break; case 'M': if (this->parse_token (ACE_TEXT ("TOKEN")) == 0) { if (this->is_whitespace (this->peek())) { // We have successfully identified the type of // the attribute as NMTOKEN // @@ Set up validator as such. break; } else if (this->peek() == 'S' && this->get() && this->is_whitespace (this->peek())) { // We have successfully identified the type of // the attribute as NMTOKENS // @@ Set up validator as such. break; } } this->fatal_error(ACE_TEXT ("Expecting keyword `NMTOKEN' or `NMTO") ACE_TEXT ("KENS'")); break; default: this->fatal_error (ACE_TEXT ("Internal Parser Error")); break; } return 0; } /** * AttType ::= StringType | TokenizedType | EnumeratedType * StringType ::= 'CDATA' * TokenizedType ::= 'ID' [VC: ID] * [VC: One ID per Element Type] * [VC: ID Attribute Default] * | 'IDREF' [VC: IDREF] * | 'IDREFS' [VC: IDREF] * | 'ENTITY' [VC: Entity Name] * | 'ENTITIES' [VC: Entity Name] * | 'NMTOKEN' [VC: Name Token] * | 'NMTOKENS' * * EnumeratedType ::= NotationType | Enumeration * NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')' * [VC: Notation Attributes] * [VC: One Notation Per Element Type] * [VC: No Notation on Empty Element] * Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')' * [VC: Enumeration] */ int ACEXML_Parser::parse_atttype () { ACEXML_Char nextch = this->peek(); switch (nextch) { case 'C': // CDATA if (this->parse_token (ACE_TEXT ("CDATA")) < 0) { this->fatal_error(ACE_TEXT ("Expecting keyword 'CDATA'")); } // Else, we have successfully identified the type of the // attribute as CDATA // @@ Set up validator appropriately here. break; case 'I': case 'E': // ID, IDREF, IDREFS, ENTITY or ENTITIES this->parse_tokenized_type (); break; case 'N': // NMTOKEN, NMTOKENS, or NOTATION this->get(); nextch = this->peek(); if (nextch != 'M' && nextch != 'O') { this->fatal_error (ACE_TEXT ("Expecting keyword 'NMTOKEN', ") ACE_TEXT ("'NMTOKENS' or 'NOTATION'")); } if (nextch == 'M') { this->parse_tokenized_type (); break; } else // NOTATION { if (this->parse_token (ACE_TEXT ("OTATION")) < 0) { this->fatal_error(ACE_TEXT ("Expecting keyword `NOTATION'")); } int count = this->check_for_PE_reference (); if (!count) { this->fatal_error (ACE_TEXT ("Expecting space between keyword ") ACE_TEXT ("NOTATION and '('")); } if (this->get () != '(') { this->fatal_error(ACE_TEXT ("Expecting '(' in NotationType")); } this->check_for_PE_reference (); do { this->skip_whitespace_count(); ACEXML_Char *notation_name = this->parse_name (); if (notation_name == 0) { this->fatal_error(ACE_TEXT ("Invalid notation name")); } // @@ get another notation name, set up validator as such this->check_for_PE_reference (); nextch = this->get(); } while (nextch == '|'); if (nextch != ')') { this->fatal_error (ACE_TEXT ("Expecting a ')' after a ") ACE_TEXT ("NotationType declaration")); } } break; case '(': // EnumeratedType - Enumeration this->get(); this->check_for_PE_reference (); do { this->skip_whitespace_count(); ACEXML_Char *token_name = this->parse_nmtoken (); if (token_name == 0) { this->fatal_error(ACE_TEXT ("Invalid enumeration name")); } // @@ get another nmtoken, set up validator as such this->check_for_PE_reference (); nextch = this->get(); } while (nextch == '|'); if (nextch != ')') { this->fatal_error (ACE_TEXT ("Expecting a ')' after a ") ACE_TEXT ("Enumeration declaration")); } break; default: { this->fatal_error(ACE_TEXT ("Invalid AttType")); } ACE_NOTREACHED (break); } return 0; } int ACEXML_Parser::parse_notation_decl () { if (this->parse_token (ACE_TEXT ("NOTATION")) < 0) { this->fatal_error(ACE_TEXT ("Expecting Keyword 'NOTATION'")); } int count = this->check_for_PE_reference (); if (!count) { this->fatal_error (ACE_TEXT ("Expecting a space between keyword NOTATION") ACE_TEXT (" and notation name")); } ACEXML_Char *notation = this->parse_name (); if (notation == 0) { this->fatal_error(ACE_TEXT ("Invalid Notation name")); } count = this->check_for_PE_reference (); if (!count) { this->fatal_error (ACE_TEXT ("Expecting a space between notation name ") ACE_TEXT ("and ExternalID/PublicID")); } ACEXML_Char *systemid, *publicid; // Gross hack but otherwise we need to go around a lot of loops to parse, // When the ExternalID starts with 'PUBLIC' we cannot distinguish a // PublicId from a ExternalID by looking using a one character read-ahead ACEXML_ParserInt::ReferenceState temp = this->ref_state_; this->ref_state_ = ACEXML_ParserInt::IN_NOTATION; this->parse_external_id (publicid, systemid); // Restore the original value. this->ref_state_ = temp; // [VC: Unique Notation Name] if (systemid && this->notations_.add_entity (notation, systemid) != 0 && this->validate_) { this->fatal_error(ACE_TEXT ("Internal Parser Error")); } if (publicid) { int retval = this->notations_.add_entity (notation, publicid); if (retval != 0 && !systemid && this->validate_) { this->fatal_error(ACE_TEXT ("Internal Parser Error")); } } if (this->skip_whitespace() != '>') { this->fatal_error(ACE_TEXT ("Expecting '>' at end of NotationDecl")); } if (this->validate_ && this->dtd_handler_) { this->dtd_handler_->notationDecl (notation, publicid, systemid); } return 0; } int ACEXML_Parser::parse_element_decl () { if (this->parse_token (ACE_TEXT ("LEMENT")) < 0) { this->fatal_error (ACE_TEXT ("Expecting keyword ELEMENT")); } int count = this->check_for_PE_reference (); if (!count) { this->fatal_error (ACE_TEXT ("Expecting a space between keyword ELEMENT") ACE_TEXT (" and element name")); } ACEXML_Char *element_name = this->parse_name (); if (element_name == 0) { this->fatal_error (ACE_TEXT ("Invalid element name")); } count = this->check_for_PE_reference (); if (!count) { this->fatal_error (ACE_TEXT ("Expecting a space between element name ") ACE_TEXT ("and element definition")); } ACEXML_Char nextch = this->peek(); switch (nextch) { case 'E': // EMPTY if (this->parse_token (ACE_TEXT ("EMPTY")) < 0) { this->fatal_error (ACE_TEXT ("Expecting keyword EMPTY")); } break; case 'A': // ANY if (this->parse_token (ACE_TEXT ("ANY")) < 0) { this->fatal_error (ACE_TEXT ("Expecting keyword ANY")); } break; case '(': // children this->parse_children_definition (); break; default: // error this->fatal_error (ACE_TEXT ("Invalid element definition")); } count = this->check_for_PE_reference (); if (this->skip_whitespace () != '>') { this->fatal_error (ACE_TEXT ("Expecting '>' after element definition")); } return 0; } int ACEXML_Parser::parse_children_definition () { this->get (); // consume the '(' this->check_for_PE_reference (); int subelement_number = 0; ACEXML_Char nextch = this->peek(); switch (nextch) { case '#': // Mixed element, if (this->parse_token (ACE_TEXT ("#PCDATA")) < 0) { this->fatal_error(ACE_TEXT ("Expecting keyword '#PCDATA'")); } this->check_for_PE_reference (); nextch = this->get(); while (nextch == '|') { this->check_for_PE_reference (); ACEXML_Char *name = this->parse_name (); // @@ name will be used in the Validator later. ACE_UNUSED_ARG (name); ++subelement_number; // @@ Install Mixed element name into the validator. this->check_for_PE_reference (); nextch = this->skip_whitespace(); } if (nextch != ')' || (subelement_number && this->get () != '*')) { this->fatal_error(ACE_TEXT ("Expecing ')' or ')*' at end of Mixed") ACE_TEXT (" element")); } // @@ close the element definition in the validator. break; default: int status = this->parse_child (1); if (status != 0) return -1; } // Check for trailing '?', '*', '+' nextch = this->peek (); switch (nextch) { case '?': // @@ Consume the character and inform validator as such, this->get (); break; case '*': // @@ Consume the character and inform validator as such, this->get (); break; case '+': // @@ Consume the character and inform validator as such, this->get (); break; default: break; // not much to do. } return 0; } int ACEXML_Parser::parse_child (int skip_open_paren) { // Conditionally consume the open paren. if (skip_open_paren == 0 && this->get () != '(') { this->fatal_error(ACE_TEXT ("Expecting '(' at beginning of children")); } ACEXML_Char node_type = 0; ACEXML_Char nextch = 0; do { this->check_for_PE_reference (); this->skip_whitespace_count (&nextch); switch (nextch) { case '(': this->check_for_PE_reference (); this->parse_child (0); break; default: this->check_for_PE_reference (); // must be an element name here. ACEXML_Char *subelement = this->parse_name (); if (subelement == 0) { this->fatal_error(ACE_TEXT ("Invalid subelement name")); } // Check for trailing '?', '*', '+' nextch = this->peek (); switch (nextch) { case '?': // @@ Consume the character and inform validator as such, this->get (); break; case '*': // @@ Consume the character and inform validator as such, this->get (); break; case '+': // @@ Consume the character and inform validator as such, this->get (); break; default: break; // not much to do. } // @@ Inform validator of the new element here. break; } this->check_for_PE_reference (); this->skip_whitespace_count (&nextch); switch (nextch) { case '|': switch (node_type) { case 0: node_type = '|'; // @@ inform validator of this new type?? break; case '|': break; default: this->fatal_error (ACE_TEXT ("Expecting `,', `|', or `)' ") ACE_TEXT ("while defining an element")); } break; case ',': switch (node_type) { case 0: node_type = ','; // @@ inform validator of this new type?? break; case ',': break; default: this->fatal_error (ACE_TEXT ("Expecting `,', `|', or `)' ") ACE_TEXT ("while defining an element")); } break; case ')': break; default: this->fatal_error (ACE_TEXT ("Expecting `,', `|', or `)' ") ACE_TEXT ("while defining an element")); } nextch = this->get(); // Consume the `,' or `|' or `)' if (nextch == ')') break; this->check_for_PE_reference (); this->skip_whitespace_count (&nextch); } while (nextch != ')'); // Check for trailing '?', '*', '+' nextch = this->peek (); switch (nextch) { case '?': // @@ Consume the character and inform validator as such, this->get (); break; case '*': // @@ Consume the character and inform validator as such, this->get (); break; case '+': // @@ Consume the character and inform validator as such, this->get (); break; default: break; // not much to do. } return 0; } int ACEXML_Parser::parse_char_reference (ACEXML_Char *buf, size_t& len) { if (len < 7) // Max size of a CharRef plus terminating '\0' return -1; ACEXML_Char ch = this->get(); if (ch != '#') // Internal error. return -1; int hex = 0; ch = this->peek(); if (ch == 'x') { hex = 1; this->get (); } size_t i = 0; int more_digit = 0; ch = this->get (); for ( ; i < len && (this->isNormalDigit (ch) || (hex ? this->isCharRef(ch): 0)); ++i) { buf[i] = ch; ch = this->get(); ++more_digit; } if (ch != ';' || !more_digit) return -1; buf[i] = 0; ACEXML_UCS4 sum = (ACEXML_UCS4) ACE_OS::strtol (buf, 0, (hex ? 16 : 10)); // [WFC: Legal Character] if (!this->isChar (sum)) return -1; int clen; #if defined (ACE_USES_WCHAR) # if (ACE_SIZEOF_WCHAR == 2) // UTF-16 if ((clen = ACEXML_Transcoder::ucs42utf16 (sum, buf, len)) < 0) return -1; # elif (ACE_SIZEOF_WCHAR == 4) // UCS 4 buf [0] = sum; buf [1] = 0; clen = 2; # endif /* ACE_SIZEOF_WCHAR */ #else // or UTF-8 if ((clen = ACEXML_Transcoder::ucs42utf8 (sum, buf, len)) < 0) return -1; #endif buf [clen] = 0; len = clen; return 0; } ACEXML_Char* ACEXML_Parser::parse_reference_name () { ACEXML_Char ch = this->get (); if (!this->isLetter (ch) && (ch != '_' && ch != ':')) return 0; while (ch) { this->alt_stack_.grow (ch); ch = this->peek (); if (!this->isNameChar (ch)) break; ch = this->get (); }; if (ch != ';') return 0; ch = this->get(); return this->alt_stack_.freeze (); } int ACEXML_Parser::parse_attvalue (ACEXML_Char *&str) { ACEXML_Char quote = this->get (); if (quote != '\'' && quote != '"') // Not a quoted string. return -1; ACEXML_Char ch = this->get (); while (1) { if (ch == quote) { ACEXML_Char* temp = this->obstack_.freeze (); // If the attribute type is not CDATA, then the XML processor // must further process the normalized attribute value by // discarding any leading and trailing space (#x20) characters, // and by replacing sequences of space (#x20) characters by a // single space (#x20) character. // if (atttype != CDATA) { // ACEXML_Char* start = temp; // ACEXML_Char* end = temp + ACE_OS::strlen (temp); // while (*start == '\x20') // start++; // if (start == end) // String which is all spaces // str = start; // while (*start != 0) // { // this->obstack_.grow (*start); // start++; // while (*start == '\x20') // start++; // } // str = this->obstack_.freeze(); // } str = temp; return 0; } switch (ch) { case '&': if (this->peek () == '#') { ACEXML_Char buf[7]; size_t len = sizeof (buf); if (this->parse_char_reference (buf, len) != 0) { // [WFC: Legal Character] this->fatal_error (ACE_TEXT ("Invalid CharacterRef")); } for (size_t j = 0; j < len; ++j) this->obstack_.grow (buf[j]); } else { this->ref_state_ = ACEXML_ParserInt::IN_ATT_VALUE; this->parse_entity_reference (); } break; case '\x20': case '\x0D': case '\x0A': case '\x09': this->obstack_.grow ('\x20'); break; case '<': // [WFC: No < in Attribute Values] this->fatal_error (ACE_TEXT ("Illegal '<' in AttValue")); break; case 0: this->pop_context (1); break; default: this->obstack_.grow (ch); break; } ch = this->get(); } } int ACEXML_Parser::parse_entity_reference () { ACEXML_Char* replace = this->parse_reference_name (); if (replace == 0) { this->fatal_error (ACE_TEXT ("Invalid Reference name")); } // [WFC: Parsed Entity] if (this->unparsed_entities_.resolve_entity (replace)) { this->fatal_error (ACE_TEXT ("EntityRef refers to unparsed entity")); } // Look in the internal general entities set first. const ACEXML_Char* entity = this->internal_GE_.resolve_entity(replace); // Look in the predefined entities. if (!entity) { entity = this->predef_entities_.resolve_entity (replace); if (entity) { // Special case to return the length in case of predefined entities this->obstack_.grow (*entity); return 1; } } if (!this->validate_) { if (this->standalone_) { // [WFC: Entity Declared] this->fatal_error (ACE_TEXT ("Undeclared Entity reference")); } else { this->content_handler_->skippedEntity (replace); return 0; } } // No match in internal subset if (!entity // or No DTDs && (!(this->internal_dtd_ || this->external_dtd_) // or Only Internal DTD and no parameter entity references || (this->internal_dtd_ && !this->external_dtd_ && !this->has_pe_refs_) // or Standalone = 'yes' || this->standalone_)) { // [WFC: Entity Declared] this->fatal_error (ACE_TEXT ("Undeclared Entity reference")); } ACEXML_Char* systemId = 0; ACEXML_Char* publicId = 0; if (!entity) { if (this->external_GE_.resolve_entity (replace, systemId, publicId) < 0) { this->fatal_error (ACE_TEXT ("Undeclared Entity reference")); } if (this->ref_state_ == ACEXML_ParserInt::IN_ATT_VALUE) { this->fatal_error (ACE_TEXT ("External EntityRef in Attribute Value")); } this->external_entity_++; } // [WFC: No Recursion] ACEXML_Char* ref_name = replace; int present = this->GE_reference_.insert (ref_name); if (present == 1 || present == -1) { while (this->GE_reference_.pop(ref_name) != -1) ; this->fatal_error (ACE_TEXT ("Recursion in resolving entity")); } if (!this->external_entity_) { ACEXML_StrCharStream* str = 0; ACE_NEW_RETURN (str, ACEXML_StrCharStream, -1); if (str->open (entity, replace) < 0 || this->switch_input (str, replace) != 0) { this->fatal_error (ACE_TEXT ("Unable to create internal input ") ACE_TEXT ("stream")); } return 0; } else { ACEXML_Char* uri = this->normalize_systemid (systemId); std::unique_ptr cleanup_uri (uri); ACEXML_InputSource* ip = 0; if (this->entity_resolver_) { ip = this->entity_resolver_->resolveEntity (publicId, (uri ? uri : systemId)); if (ip) { if (this->switch_input (ip, (uri ? uri : systemId), publicId) != 0) { this->fatal_error (ACE_TEXT ("Internal Parser Error")); } return 0; } } ACEXML_StreamFactory factory; ACEXML_CharStream* cstream = factory.create_stream (uri ? uri: systemId); if (!cstream) { this->fatal_error (ACE_TEXT ("Invalid input source")); } if (this->switch_input (cstream, systemId, publicId) != 0) { this->fatal_error (ACE_TEXT ("Internal Parser Error")); } } return 0; } int ACEXML_Parser::parse_PE_reference () { ACEXML_Char* replace = this->parse_reference_name (); if (replace == 0) { this->fatal_error (ACE_TEXT ("Invalid PEReference name")); } // Look in the internal general entities set first. const ACEXML_Char* entity = this->internal_PE_.resolve_entity(replace); if (!entity && // No match in internal (!this->external_dtd_ || // or No External DTDs this->standalone_)) // or Standalone { // [VC: Entity Declared] this->fatal_error (ACE_TEXT ("Undefined Internal PEReference")); } ACEXML_Char* systemId = 0; ACEXML_Char* publicId = 0; if (!entity && this->validate_) { if (this->external_PE_.resolve_entity (replace, systemId, publicId) < 0) { this->fatal_error (ACE_TEXT ("Undefined PEReference")); } this->external_entity_++; } // [WFC: No Recursion] ACEXML_Char* ref_name = replace; int present = this->PE_reference_.insert (ref_name); if (present == 1 || present == -1) { while (this->PE_reference_.pop(ref_name) != -1) ; this->fatal_error (ACE_TEXT ("Recursion in resolving entity")); } if (entity && !this->external_entity_) { ACEXML_StrCharStream* sstream = 0; ACEXML_String str (entity); if (this->ref_state_ != ACEXML_ParserInt::IN_ENTITY_VALUE) { const ACEXML_Char* ch = ACE_TEXT (" "); str = ch + str + ch; } // ACE_DEBUG ((LM_DEBUG, // ACE_TEXT ("Entity is %s\n Replacement Text is : %s\n"), // replace, str.c_str())); ACE_NEW_RETURN (sstream, ACEXML_StrCharStream, -1); if (sstream->open (str.c_str(), replace) < 0 || this->switch_input (sstream, replace) != 0) { this->fatal_error (ACE_TEXT ("Error in switching InputSource")); } return 0; } else if (this->external_entity_ && this->validate_) { ACEXML_Char* uri = this->normalize_systemid (systemId); std::unique_ptr cleanup_uri (uri); ACEXML_InputSource* ip = 0; if (this->entity_resolver_) { ip = this->entity_resolver_->resolveEntity (publicId, (uri ? uri : systemId)); } if (ip) { if (this->switch_input (ip, (uri ? uri : systemId), publicId) != 0) { this->fatal_error (ACE_TEXT ("Error in switching InputSource")); } return 0; } else { ACEXML_StreamFactory factory; ACEXML_CharStream* cstream = factory.create_stream (uri ? uri: systemId); if (!cstream) { this->fatal_error (ACE_TEXT ("Invalid input source")); } if (this->switch_input (cstream, systemId, publicId) != 0) { this->fatal_error (ACE_TEXT ("Error in switching InputSource")); } if (this->ref_state_ == ACEXML_ParserInt::IN_ENTITY_VALUE) { ACEXML_Char less, mark; if (this->peek() == '<') { less = this->get(); if (this->peek() == '?') { mark = this->get(); if (this->peek() == 'x') { this->parse_text_decl (); } else { this->obstack_.grow (less); this->obstack_.grow (mark); } } this->obstack_.grow (less); } } return 0; } } this->fatal_error (ACE_TEXT ("Undefined PEReference")); return -1; } int ACEXML_Parser::parse_entity_value (ACEXML_Char *&str) { ACEXML_ParserInt::ReferenceState temp = this->ref_state_; ACEXML_Char quote = this->get (); if (quote != '\'' && quote != '"') // Not a quoted string. return -1; ACEXML_Char ch = this->get (); while (1) { if (ch == quote) { str = this->obstack_.freeze (); this->ref_state_ = temp; return 0; } switch (ch) { case '&': if (this->peek () == '#') { if (!this->external_entity_) { ACEXML_Char buf[7]; size_t len = sizeof (buf); if (this->parse_char_reference (buf, len) != 0) { // [WFC: Legal Character] this->fatal_error (ACE_TEXT ("Invalid character ") ACE_TEXT ("reference")); return -1; } for (size_t j = 0; j < len; ++j) this->obstack_.grow (buf[j]); break; } } this->obstack_.grow (ch); break; case '%': if (!this->external_entity_) { this->ref_state_ = ACEXML_ParserInt::IN_ENTITY_VALUE; this->parse_PE_reference(); break; } this->obstack_.grow (ch); break; case 0: this->pop_context (0); break; default: this->obstack_.grow (ch); break; } ch = this->get(); } } ACEXML_Char * ACEXML_Parser::parse_name (ACEXML_Char ch) { if (ch == 0) ch = this->get (); if (!this->isLetter (ch) && ch != '_' && ch != ':') return 0; while (ch) { this->obstack_.grow (ch); ch = this->peek (); if (!this->isNameChar (ch)) break; ch = this->get (); }; return this->obstack_.freeze (); } ACEXML_Char* ACEXML_Parser::parse_nmtoken (ACEXML_Char ch) { if (ch == 0) ch = this->get (); if (!this->isNameChar (ch)) return 0; while (ch) { this->obstack_.grow (ch); ch = this->peek (); if (!this->isNameChar (ch)) break; ch = this->get (); }; return this->obstack_.freeze (); } int ACEXML_Parser::parse_version_num (ACEXML_Char*& str) { ACEXML_Char quote = this->get (); if (quote != '\'' && quote != '"') // Not a quoted string. return -1; int numchars = 0; while (1) { ACEXML_Char ch = this->get (); if (ch == quote && !numchars) return -1; else if (ch == quote) { str = this->obstack_.freeze (); return 0; } // [26] VersionNum ::= ([a-zA-Z0-9_.:] | '-')+ if (ch == '-' || ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || (ch == '_' || ch == '.' || ch == ':'))) { this->obstack_.grow (ch); numchars++; } else return -1; } } int ACEXML_Parser::parse_system_literal (ACEXML_Char*& str) { const ACEXML_Char quote = this->get(); if (quote != '\'' && quote != '"') // Not a quoted string. return -1; while (1) { ACEXML_Char ch = this->get (); if (ch == quote) { str = this->obstack_.freeze (); return 0; } switch (ch) { case '\x00': case '\x01': case '\x02': case '\x03': case '\x04': case '\x05': case '\x06': case '\x07': case '\x08': case '\x09': case '\x0A': case '\x0B': case '\x0C': case '\x0D': case '\x0E': case '\x0F': case '\x10': case '\x11': case '\x12': case '\x13': case '\x14': case '\x15': case '\x16': case '\x17': case '\x18': case '\x19': case '\x1A': case '\x1B': case '\x1C': case '\x1D': case '\x1E': case '\x1F': case '\x7F': case '\x20': case '<': case '>': case '#': case '%': ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invalid char %c in SystemLiteral\n"), ch)); return -1; default: this->obstack_.grow (ch); } } } int ACEXML_Parser::parse_pubid_literal (ACEXML_Char*& str) { const ACEXML_Char quote = this->get(); if (quote != '\'' && quote != '"') // Not a quoted string. return -1; while (1) { ACEXML_Char ch = this->get (); if (ch == quote) { str = this->obstack_.freeze (); return 0; } else if (this->isPubidChar (ch)) this->obstack_.grow (ch); else return -1; } } int ACEXML_Parser::parse_encname (ACEXML_Char*& str) { const ACEXML_Char quote = this->get (); if (quote != '\'' && quote != '"') // Not a quoted string. return -1; int numchars = 0; while (1) { ACEXML_Char ch = this->get (); if (ch == quote && !numchars) return -1; else if (ch == quote) { str = this->obstack_.freeze (); return 0; } // [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')* if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) && !numchars) return -1; if (ch == '-' || ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || (ch == '_' || ch == '.'))) { this->obstack_.grow (ch); numchars++; } else return -1; } } int ACEXML_Parser::parse_sddecl (ACEXML_Char*& str) { ACEXML_Char quote = this->get (); if (quote != '\'' && quote != '"') // Not a quoted string. return -1; int numchars = 0; while (1) { ACEXML_Char ch = this->get (); if (ch == quote && numchars < 2) return -1; else if (ch == quote) { str = this->obstack_.freeze (); return 0; } // [32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'") // | ('"' ('yes' | 'no') '"')) switch (ch) { case 'y': case 'e': case 's': case 'n': case 'o': this->obstack_.grow (ch); numchars++; break; default: return -1; } } } void ACEXML_Parser::prefix_mapping (const ACEXML_Char* prefix, const ACEXML_Char* uri, int start) { if (this->namespaces_) { const ACEXML_Char* temp = (prefix == 0) ? empty_string : prefix; if (start) { this->content_handler_->startPrefixMapping (temp, uri); } else { this->content_handler_->endPrefixMapping(temp); } } } int ACEXML_Parser::switch_input (ACEXML_CharStream* cstream, const ACEXML_Char* systemId, const ACEXML_Char* publicId) { ACEXML_InputSource* input = 0; ACE_NEW_RETURN (input, ACEXML_InputSource (cstream), -1); return this->switch_input (input, systemId, publicId); } int ACEXML_Parser::switch_input (ACEXML_InputSource* input, const ACEXML_Char* systemId, const ACEXML_Char* publicId) { ACEXML_LocatorImpl* locator = 0; if (!systemId) systemId = input->getSystemId(); ACE_NEW_RETURN (locator, ACEXML_LocatorImpl (systemId, publicId), -1); ACEXML_Parser_Context* new_context = 0; ACE_NEW_RETURN (new_context, ACEXML_Parser_Context(input, locator), -1); if (this->push_context (new_context) != 0) { ACE_ERROR ((LM_ERROR, "Unable to switch input streams")); delete new_context; return -1; } this->current_ = new_context; this->content_handler_->setDocumentLocator (this->current_->getLocator()); return 0; } int ACEXML_Parser::push_context (ACEXML_Parser_Context* context) { if (this->ctx_stack_.push (context) < 0) { ACE_ERROR ((LM_ERROR, "Unable to push input source onto the stack")); return -1; } return 0; } size_t ACEXML_Parser::pop_context (int GE_ref) { size_t nrelems = this->ctx_stack_.size(); if (nrelems <= 1) { this->fatal_error(ACE_TEXT ("Unexpected end-of-file")); } ACEXML_Parser_Context* temp = 0; int retval = this->ctx_stack_.pop (temp); if (retval != 0) { this->fatal_error (ACE_TEXT ("Unable to pop element of the input stack")); } delete temp; if (this->ctx_stack_.top (this->current_) != 0) { this->fatal_error (ACE_TEXT ("Unable to read top element of input stack")); } ACEXML_Char* reference = 0; if (GE_ref == 1 && this->GE_reference_.size() > 0) { if (this->GE_reference_.pop (reference) < 0) { this->fatal_error (ACE_TEXT ("Internal Parser Error")); } } else if (GE_ref == 0 && this->PE_reference_.size() > 0) { if (this->PE_reference_.pop (reference) < 0) { this->fatal_error (ACE_TEXT ("Internal Parser Error")); } } nrelems = this->ctx_stack_.size(); if (this->external_entity_ && (GE_ref == 0 || GE_ref == 1)) this->external_entity_--; this->content_handler_->setDocumentLocator (this->current_->getLocator()); return nrelems; } int ACEXML_Parser::getFeature (const ACEXML_Char *name) { if (ACE_OS::strcmp (name, ACEXML_Parser::simple_parsing_feature_) == 0) { return this->simple_parsing_; } else if (ACE_OS::strcmp (name, ACEXML_Parser::namespaces_feature_) == 0) { return this->namespaces_; } else if (ACE_OS::strcmp (name, ACEXML_Parser::namespace_prefixes_feature_) == 0) { return this->namespace_prefixes_; } else if (ACE_OS::strcmp (name, ACEXML_Parser::validation_feature_) == 0) { return this->validate_; } throw ACEXML_SAXNotRecognizedException (name); } void ACEXML_Parser::setFeature (const ACEXML_Char *name, int boolean_value) { if (ACE_OS::strcmp (name, ACEXML_Parser::simple_parsing_feature_) == 0) { this->simple_parsing_ = (boolean_value == 0 ? 0 : 1); return; } else if (ACE_OS::strcmp (name, ACEXML_Parser::namespaces_feature_) == 0) { this->namespaces_ = (boolean_value == 0 ? 0 : 1); return; } else if (ACE_OS::strcmp (name, ACEXML_Parser::namespace_prefixes_feature_) == 0) { this->namespace_prefixes_ = (boolean_value == 0 ? 0 : 1); return; } else if (ACE_OS::strcmp (name, ACEXML_Parser::validation_feature_) == 0) { this->validate_ = (boolean_value == 0 ? 0 : 1); return; } throw ACEXML_SAXNotRecognizedException (name); } void * ACEXML_Parser::getProperty (const ACEXML_Char *name) { throw ACEXML_SAXNotSupportedException (name); } void ACEXML_Parser::setProperty (const ACEXML_Char *name, void *) { throw ACEXML_SAXNotSupportedException (name); } void ACEXML_Parser::error (const ACEXML_Char* msg) { ACEXML_SAXParseException exception(msg); if (this->error_handler_) this->error_handler_->error (exception); else throw exception; } void ACEXML_Parser::warning (const ACEXML_Char* msg) { ACEXML_SAXParseException exception(msg); if (this->error_handler_) this->error_handler_->warning (exception); } void ACEXML_Parser::fatal_error (const ACEXML_Char* msg) { ACEXML_SAXParseException exception(msg); if (this->error_handler_) this->error_handler_->fatalError (exception); this->reset(); throw exception; } void ACEXML_Parser::parse_version_info () { ACEXML_Char* astring; if (this->parse_token (ACE_TEXT("ersion")) < 0 || this->skip_equal () != 0 || this->parse_version_num (astring) != 0) { this->fatal_error (ACE_TEXT ("Invalid VersionInfo specification")); return; } if (ACE_OS::strcmp (astring, ACE_TEXT ("1.0")) != 0) { this->fatal_error (ACE_TEXT ("ACEXML Parser supports XML version 1.0 ") ACE_TEXT ("documents only")); } } void ACEXML_Parser::parse_encoding_decl () { ACEXML_Char* astring = 0; if ((this->parse_token (ACE_TEXT("ncoding")) < 0) || this->skip_equal () != 0 || this->parse_encname (astring) != 0) { this->fatal_error (ACE_TEXT ("Invalid EncodingDecl specification")); } const ACEXML_Char* encoding = this->current_->getInputSource()->getEncoding(); if (encoding != 0 && ACE_OS::strcasecmp (astring, encoding) != 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Detected Encoding is %s ") ACE_TEXT (": Declared Encoding is %s\n"), encoding, astring)); this->warning (ACE_TEXT ("Declared encoding differs from detected ") ACE_TEXT ("encoding")); } } int ACEXML_Parser::parse_text_decl () { // Read xml if (this->parse_token (ACE_TEXT("xml")) < 0) { this->fatal_error(ACE_TEXT ("Expecting keyword 'xml' in TextDecl")); } ACEXML_Char fwd = this->skip_whitespace(); // Read version if (fwd == 'v') { this->parse_version_info (); fwd = this->skip_whitespace(); } if (fwd == 'e') { this->parse_encoding_decl (); fwd = this->skip_whitespace(); } else { this->fatal_error (ACE_TEXT ("Missing encodingDecl in TextDecl")); } if (fwd == '?' && this->get() == '>') return 0; // All the rules fail. So return an error. this->fatal_error (ACE_TEXT ("Invalid TextDecl")); return -1; } void ACEXML_Parser::parse_xml_decl () { // Read parse_token (ACE_TEXT("xml")) < 0) { this->fatal_error(ACE_TEXT ("Expecting keyword xml in XMLDecl")); } ACEXML_Char fwd = this->skip_whitespace(); // Read version if (fwd != 'v') { this->fatal_error (ACE_TEXT ("Expecting VersionInfo declaration")); } this->parse_version_info (); fwd = this->skip_whitespace(); if (fwd != '?') { if (fwd == 'e') { this->parse_encoding_decl (); fwd = this->skip_whitespace(); } if (fwd == 's') { ACEXML_Char* astring; if ((this->parse_token (ACE_TEXT("tandalone")) == 0) && this->skip_equal () == 0 && this->parse_sddecl (astring) == 0) { if (ACE_OS::strcmp (astring, ACE_TEXT ("yes")) == 0) this->standalone_ = 1; fwd = this->skip_whitespace(); } } } if (fwd == '?' && this->get() == '>') return; // All the rules fail. So return an error. this->fatal_error (ACE_TEXT ("Invalid XMLDecl declaration")); } int ACEXML_Parser::parse_comment () { int state = 0; if (this->get () != '-' || // Skip the opening "'. Notice that // according to the spec, '--->' is not a valid closing comment // sequence. But we'll let it pass anyway. { ACEXML_Char fwd = this->get (); if ((fwd == '-' && state < 2) || (fwd == '>' && state == 2)) state += 1; else state = 0; // Reset parse state. } return 0; } int ACEXML_Parser::parse_processing_instruction () { const ACEXML_Char *pitarget = this->parse_name (); ACEXML_Char *instruction = 0; if (!ACE_OS::strcasecmp (ACE_TEXT ("xml"), pitarget)) { // Invalid PITarget name. this->fatal_error(ACE_TEXT ("PI can't have 'xml' in PITarget")); } int state = 0; ACEXML_Char ch = this->skip_whitespace(); while (state < 2) { switch (ch) { case '?': if (state == 0) state = 1; break; case '>': if (state == 1) { instruction = this->obstack_.freeze (); this->content_handler_->processingInstruction (pitarget, instruction); this->obstack_.unwind (const_cast (pitarget)); return 0; } break; case 0x0A: ACE_FALLTHROUGH; default: if (state == 1) this->obstack_.grow ('?'); this->obstack_.grow (ch); state = 0; } ch = this->get (); } return -1; } void ACEXML_Parser::reset () { this->doctype_ = 0; if (this->ctx_stack_.pop (this->current_) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Mismatched push/pop of Context stack"))); if (this->current_) { this->current_->getInputSource()->getCharStream()->rewind(); this->current_->setInputSource (0); delete this->current_; this->current_ = 0; } ACEXML_Char* temp = 0; while (this->GE_reference_.pop (temp) != -1) ; while (this->PE_reference_.pop (temp) != -1) ; this->obstack_.release(); this->alt_stack_.release(); this->xml_namespace_.reset(); this->nested_namespace_ = 0; this->internal_GE_.reset(); this->external_GE_.reset(); this->unparsed_entities_.reset(); this->predef_entities_.reset(); this->internal_PE_.reset(); this->external_PE_.reset(); this->notations_.reset(); this->ref_state_ = ACEXML_ParserInt::INVALID; this->external_subset_ = 0; this->external_entity_ = 0; this->has_pe_refs_ = 0; this->standalone_ = 0; this->external_dtd_ = 0; this->internal_dtd_ = 0; } ace-8.0.4+dfsg.orig/ACEXML/parser/parser/Parser.h0000644000175000017500000005434215027201772020344 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Parser.h * * @author Nanbor Wang * @author Krishnakumar B */ //============================================================================= #ifndef _ACEXML_BASIC_PARSER_H_ #define _ACEXML_BASIC_PARSER_H_ #include /**/ "ace/pre.h" #include "ACEXML/parser/parser/Parser_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/XMLReader.h" #include "ACEXML/common/LocatorImpl.h" #include "ACEXML/common/NamespaceSupport.h" #include "ACEXML/common/CharStream.h" #include "ace/Obstack.h" #include "ace/Functor.h" #include "ace/SString.h" #include "ace/Hash_Map_Manager.h" #include "ace/Unbounded_Set.h" #include "ace/Containers_T.h" #include "ACEXML/parser/parser/Entity_Manager.h" #include "ACEXML/parser/parser/ParserInternals.h" #include "ACEXML/parser/parser/ParserContext.h" /** * @class ACEXML_Parser Parser.h "ACEXML/parser/parser/Parser.h" * * @brief A SAX based parser. */ class ACEXML_PARSER_Export ACEXML_Parser : public ACEXML_XMLReader { public: /// Default constructor. ACEXML_Parser (); /// Destructor. virtual ~ACEXML_Parser (); /** * Initialize the parser state. * * @retval 0 if parser was initialized correctly else -1. */ int initialize (ACEXML_InputSource* input); /** * Return the current content handler. */ virtual ACEXML_ContentHandler *getContentHandler () const; /* * Return the current DTD handler. */ virtual ACEXML_DTDHandler *getDTDHandler () const; /* * Return the current entity resolver. */ virtual ACEXML_EntityResolver *getEntityResolver () const; /* * Return the current error handler. */ virtual ACEXML_ErrorHandler *getErrorHandler () const; /** * Look up the value of a feature. This method allows * programmers to check whether a specific feature has been * activated in the parser. */ virtual int getFeature (const ACEXML_Char *name); /** * Activating or deactivating a feature. */ virtual void setFeature (const ACEXML_Char *name, int boolean_value); /* * Look up the value of a property. */ virtual void * getProperty (const ACEXML_Char *name); /* * Set the value of a property. */ virtual void setProperty (const ACEXML_Char *name, void *value); /* * Parse an XML document. */ virtual void parse (ACEXML_InputSource *input); /* * Parse an XML document from a system identifier (URI). */ virtual void parse (const ACEXML_Char *systemId) ; /* * Allow an application to register a content event handler. */ virtual void setContentHandler (ACEXML_ContentHandler *handler); /* * Allow an application to register a DTD event handler. */ virtual void setDTDHandler (ACEXML_DTDHandler *handler); /* * Allow an application to register an entity resolver. */ virtual void setEntityResolver (ACEXML_EntityResolver *resolver); /* * Allow an application to register an error event handler. */ virtual void setErrorHandler (ACEXML_ErrorHandler *handler); protected: /** * Parse XML Prolog. */ void parse_xml_prolog (); /** * Parse VersionInfo declaration. * */ void parse_version_info (); /** * Parse a EncodingDecl declaration. * */ void parse_encoding_decl (); /** * Parse a XMLDecl declaration. * */ void parse_xml_decl (); /** * Parse a TextDecl declaration. */ int parse_text_decl (); /** * Parse a PI statement. The first character encountered * should always be '?' in the PI prefix "@doctype_. * * @todo Instead of simply checking for the root element based on the * argument @a is_root, we should instead either pass in some sort * of validator or allow the function to return the element name so it * can be used in a validator. */ void parse_element (int is_root); /** * Parse a content declaration. * */ int parse_content (const ACEXML_Char* startname, const ACEXML_Char*& ns_uri, const ACEXML_Char*& ns_lname, int ns_flag); /** * Parse a character reference, i.e., " " or "". The first * character encountered should be the '#' char. * * @param buf points to a character buffer for the result. * * @param len In/out argument which initially specifies the size of the * buffer and is later set to the no. of characters in the reference. * * @retval 0 on success and -1 otherwise. */ int parse_char_reference (ACEXML_Char *buf, size_t& len); /** * Parse a reference name, i.e., foo in "&foo;" or "%foo;". The first * character encountered should be the character following '&' or '%'. * Effectively the same as @sa parse_name but we don't use the parser's * obstack. Caller is responsible for deleting the memory. * * @retval A pointer to name of reference, 0 otherwise. */ ACEXML_Char* parse_reference_name (); /** * Parse a CDATA section. The first character should always be the first * '[' in CDATA definition. * * @retval 0 on success. * @retval -1 if fail. */ int parse_cdata (); /** * Parse a "markupdecl" section, this includes both "markupdecl" and * "DeclSep" sections in XML specification */ int parse_internal_dtd (); /** * Skip over a comment. The first character encountered should always be * the first '-' in the comment prefix "@<@!--". */ int parse_comment (); /** * Parse an "ELEMENT" decl. The first character this method * expects is always the 'L' (the second char) in the word * "ELEMENT". * * @retval 0 on success, -1 otherwise. */ int parse_element_decl (); /** * Parse an "ENTITY" decl. The first character this method expects * is always the 'N' (the second char) in the word "ENTITY". * * @retval 0 on success, -1 otherwise. */ int parse_entity_decl (); /** * Parse an "ATTLIST" decl. Thse first character this method * expects is always the 'A' (the first char) in the word * "ATTLIST". * * @retval 0 on success, -1 otherwise. */ int parse_attlist_decl (); /** * Parse a AttType declaration. * */ int parse_atttype (); /** *Parse a "NOTATION" decl. The first character this method * expects is always the 'N' (the first char) in the word * "NOTATION". * * @retval 0 on success, -1 otherwise. */ int parse_notation_decl (); /** * Parse an ExternalID or a reference to PUBLIC ExternalID. * Possible cases are in the forms of: * * SYSTEM 'quoted string representing system resource' * PUBLIC 'quoted name of public ID' 'quoted resource' * PUBLIC 'quoted name we are referring to' * * * The first character this function sees must be either 'S' or 'P'. * When the function finishes parsing, the input stream points * at the first non-whitespace character. * * @param publicId returns the unquoted publicId read. If none * is available, it will be reset to 0. * @param systemId returns the unquoted systemId read. If none * is available, it will be reset to 0. * * @retval 0 on success, -1 otherwise. */ int parse_external_id (ACEXML_Char *&publicId, ACEXML_Char *&systemId); /** * Parse an external DTD. * */ int parse_external_dtd (); /** * Parse an external subset. This does the actual parsing of an external * subset and is called by @sa parse_external_dtd. * */ int parse_external_subset (); /** * Parse a markupDecl section. * */ int parse_markup_decl (); /** * Parse a conditionalSect declaration. * */ int parse_conditional_section (); /** * Parse a includeSect declaration. * */ int parse_includesect (); /** * * Parse a ignoreSect declaration. */ int parse_ignoresect (); /** * Parse a PEReference. * */ int parse_PE_reference (); /** * Parse a Reference. * */ int parse_entity_reference (); /** * Parse an entityValue. * */ int parse_entity_value (ACEXML_Char *&str); /** * Parse a DefaultDecl specification. * */ int parse_defaultdecl (); /** * Parse the "children" and "Mixed" non-terminals in contentspec. * * The first character this function sees must be the first * open paren '(' in children. * * @retval 0 on success, -1 otherwise. */ int parse_children_definition (); /** * Parse a @c cp non-terminal. @c cp can either be a @c seq or a @c choice. * This function calls itself recursively. * * @param skip_open_paren when non-zero, it indicates that the open paren of * the @c seq or @c choice has already been removed from the input * stream. * * @retval 0 on success, -1 otherwise. */ int parse_child (int skip_open_paren); /** * Parse a name from the input CharStream. If @a ch @!= 0, then we have * already consumed the first name character from the input CharStream, * otherwise, parse_name will use this->get() to acquire the initial * character. * * @return A pointer to the string in the obstack, 0 if it's not a * valid name. */ ACEXML_Char *parse_name (ACEXML_Char ch = 0); /** * Parse a NMTOKEN from the input stream. * * @return A pointer to the string in the obstack, 0 if it's not a valid * NMTOKEN. */ ACEXML_Char* parse_nmtoken (ACEXML_Char ch = 0); /** * Parse the version string in an XML Prolog section. * * @param str String containing the version number if successful. * @return 0 if the string was read successfully, 0 otherwise. */ int parse_version (ACEXML_Char*& str); /** * Parse the version number in a VersionInfo declaration. */ int parse_version_num (ACEXML_Char*& str); /** * Parse the encoding name in an XML Prolog section. * * @param str String containing the encoding name if successful. * @return 0 if the string was read successfully, 0 otherwise. */ int parse_encname (ACEXML_Char*& str); /** * Parse a SDDecl string. * * @param str String containing the encoding name if successful. * @return 0 if the string was read successfully, -1 otherwise. */ int parse_sddecl (ACEXML_Char*& str); /** * Parse an attribute name. * * @retval str String containing the value of the attribute name * if successful. * @retval 0 otherwise. */ ACEXML_Char* parse_attname (); /** * Parse an attribute value. * * @param str String containing the value of the attribute if successful. * @return 0 if attribute value was read successfully, -1 otherwise. */ int parse_attvalue (ACEXML_Char*& str); /** * Parse a tokenized type attribute. * * @return 0 if attribute type was read successfully, -1 otherwise. */ int parse_tokenized_type (); /** * Parse a SystemLiteral. * * @param str String containing the SystemLiteral if successful. * @return 0 if the string was read successfully, 0 otherwise. */ int parse_system_literal (ACEXML_Char*& str); /** * Parse a PubidLiteral. * * @param str String containing the PubidLiteral if successful. * @return 0 if the string was read successfully, 0 otherwise. */ int parse_pubid_literal (ACEXML_Char*& str); /** * Check if a character @a c is a whitespace. * * @retval 1 if @a c is a valid white space character. 0 otherwise. */ int is_whitespace (const ACEXML_Char c) const; /** * Check if a character @a c is a valid Char. * * @retval 1 if @a c is a valid character. 0 otherwise. */ int isChar (ACEXML_UCS4 c) const; /** * Check if a character @a c is a valid CharRef character. * * @retval 1 if @a c is a valid character reference character, 0 otherwise. */ int isCharRef (const ACEXML_Char c) const; /** * Check if a character @a c is a BaseChar. * * @retval 1 if @a c is a valid BaseChar character, 0 otherwise. */ int isBasechar (const ACEXML_Char c) const; /** * Check if a character @a c is a Ideographic. * * @retval 1 if @a c is a valid Ideographic character, 0 otherwise. */ int isIdeographic (const ACEXML_Char c) const; /** * Check if a character @a c is a CombiningChar. * * @retval 1 if @a c is a valid CombiningChar character, 0 otherwise. */ int isCombiningchar (const ACEXML_Char c) const; /** * Check if a character @a c is a Digit. * * @retval 1 if @a c is a valid Digit character, 0 otherwise. */ int isDigit (const ACEXML_Char c) const; /** * Check if a character @a c is an Extender. * * @retval 1 if @a c is a valid Extender character, 0 otherwise. */ int isExtender (const ACEXML_Char c) const; /** * Check if a character @a c is a Letter. * * @retval 1 if @a c is a valid Letter character, 0 otherwise. */ int isLetter (const ACEXML_Char c) const; /** * Check if a character is an acceptable NameChar. * * @retval 1 if @a c is a valid NameChar character, 0 otherwise. */ int isNameChar (const ACEXML_Char c) const; /** * Check if a character is a PubidChar. * * @retval 1 if @a c is a valid PubidChar character, 0 otherwise. */ int isPubidChar (const ACEXML_Char c) const; /// Get a character. virtual ACEXML_Char get (); /// Peek a character. virtual ACEXML_Char peek (); private: // *** Helper functions for parsing XML /** * Skip any whitespaces encountered until the first non-whitespace * character is encountered. * * @return The next non-whitespace character from the CharStream. * * @sa skip_whitespace_count */ ACEXML_Char skip_whitespace (); /** * Skip any whitespaces encountered until the first non-whitespace * character. The first non-whitespace character is not consumed. * This method does peek into the input CharStream and therefore * is more expensive than @ref skip_whitespace. * * @param peek If non-null, @a peek points to a ACEXML_Char where * skip_whitespace_count stores the first non-whitespace * character it sees (character is not removed from the stream.) * * @return The number of whitespace characters consumed. * * @sa skip_whitespace */ int skip_whitespace_count (ACEXML_Char *peek = 0); /** * Skip an equal sign. * * @retval 0 when succeeds, -1 if no equal sign is found. */ int skip_equal (); /** * Get a quoted string. Quoted strings are used to specify * attribute values and this routine will replace character and * entity references on-the-fly. Parameter entities are not allowed * (or replaced) in this function. (But regular entities are.) * * @param str returns the un-quoted string. * * @retval 0 on success, -1 otherwise. */ int get_quoted_string (ACEXML_Char *&str); /** * Check if a character @a c is a Digit. * * @retval 1 if @a c is a valid Digit character, 0 otherwise. */ int isNormalDigit (const ACEXML_Char c) const; /** * Dispatch errors to ErrorHandler. * */ void error (const ACEXML_Char* msg); /** * Dispatch warnings to ErrorHandler. * */ void warning (const ACEXML_Char* msg); /** * Dispatch fatal errors to ErrorHandler. * */ void fatal_error (const ACEXML_Char* msg); /** * Dispatch prefix mapping calls to the ContentHandler. * * @param prefix Namespace prefix * @param uri Namespace URI * @param name Local name * @param start 1 => startPrefixMapping 0 => endPrefixMapping */ void prefix_mapping (const ACEXML_Char* prefix, const ACEXML_Char* uri, int start); /** * Parse a keyword. */ int parse_token (const ACEXML_Char* keyword); /** * Push the current context on to the stack. * */ int push_context (ACEXML_Parser_Context* context); /** * Pop the top element in the stack and replace current context with that. */ size_t pop_context (int GE_ref); /** * Create a new ACEXML_CharStream from @a systemId and @a publicId and * replace the current input stream with the newly created stream. */ virtual int switch_input (ACEXML_CharStream* cstream, const ACEXML_Char* systemId, const ACEXML_Char* publicId = 0); /** * Create a new ACEXML_InputSource from @a systemId and @a publicId and * replace the current input source with the newly created InputSource. */ virtual int switch_input (ACEXML_InputSource* input, const ACEXML_Char* systemId, const ACEXML_Char* publicId = 0); /** * Check for a parameter entity reference. This is used to check for the * occurrence of a PE Reference withing markupDecl. Additionally this * function consumes any leading or trailing whitespace around the PE * Reference. * * @retval Number of whitespace characters skipped. */ int check_for_PE_reference (); /** * Reset the parser state. * */ void reset (); /** * Very trivial, non-conformant normalization of a systemid. * */ ACEXML_Char* normalize_systemid (const ACEXML_Char* systemId); // Feature names: /** * \addtogroup acexml_parser_features * @{ */ /** * @var simple_parsing_feature_ * * This constant string defines the name of "simple XML parsing" * feature. When this feature is enabled, ACEXML parser is allowed * to parse a simple XML stream without mandated XML prolog * and no DTD definition. */ static const ACEXML_Char simple_parsing_feature_[]; /** * @var namespaces_feature_ * * This constant string defines the SAX XML Namespace feature. When this * feature is enabled, ACEXML parser allows access by namespace qualified * names. */ static const ACEXML_Char namespaces_feature_[]; /** * @var namespace_prefixes_feature_ * * This constant string defines the SAX XML Namespace prefixes feature. * Normally the list of attributes returned by the parser will not * contain attributes used as namespace declarations (xmlns*). When this * feature is enabled, the list of attributes contains the namespace * declarations also. */ static const ACEXML_Char namespace_prefixes_feature_[]; /** * @var validation_feature_ * * This constant string defines the SAX XML Validation feature. When * this feature is enabled, the parser validates the document in * addition to checking for well-formedness. */ static const ACEXML_Char validation_feature_[]; /* @} */ /// Keeping track of the handlers. We do not manage the memory for /// handlers. ACEXML_DTDHandler *dtd_handler_; ACEXML_EntityResolver *entity_resolver_; ACEXML_ContentHandler *content_handler_; ACEXML_ErrorHandler *error_handler_; /// Document Type ACEXML_Char *doctype_; /// Current parser context ACEXML_Parser_Context* current_; /// Stack used to hold the Parser_Context ACE_Unbounded_Stack ctx_stack_; /* * The following two are essentially chains of references and is used by * the parser to determine if there is any recursion. We keep two of * these one for general entities and one for parameter entities, as they * both fall under different namespaces. * */ /// Set used to hold the general entity references that are active. ACE_Unbounded_Stack GE_reference_; /// Set used to hold the parameter entity references that are active. ACE_Unbounded_Stack PE_reference_; /// Obstack used by the parser to hold all the strings parsed ACE_Obstack_T obstack_; /// Alternative obstack used to hold any strings when the original is in use ACE_Obstack_T alt_stack_; /// Namespace stack used by the parser to implement support for Namespaces ACEXML_NamespaceSupport xml_namespace_; /// T => We are processing a nested namespace int nested_namespace_; /// Set of internal parsed general entities in the document ACEXML_Entity_Manager internal_GE_; /// Set of external parsed general entities in the document ACEXML_Entity_Manager external_GE_; /// Set of unparsed entities in the document ACEXML_Entity_Manager unparsed_entities_; /// Set of predefined entities used by the parser ACEXML_Entity_Manager predef_entities_; /// Set of internal parsed parameter entities in the document ACEXML_Entity_Manager internal_PE_; /// Set of external parsed parameter entities in the document ACEXML_Entity_Manager external_PE_; /// Set of notations declared in the document ACEXML_Entity_Manager notations_; /// State of the parser when it encounters a reference. ACEXML_ParserInt::ReferenceState ref_state_; /// T => We are parsing an external subset int external_subset_; /// T => We are parsing an external entity value int external_entity_; /// T => Internal DTD has parameter entity references int has_pe_refs_; /// If set, the document is a standalone XML document int standalone_; /// If set, the document has an external DTD subset int external_dtd_; /// If set, the document has an internal DTD int internal_dtd_; /// Feature flags /// If set, the parser should parse a document without a prolog int simple_parsing_; /// If set, the parser should also validate int validate_; /// If set, the parser should allow access by namespace qualified names. int namespaces_; /// If set, the parser should include namespace declarations in the list /// of attributes of an element. int namespace_prefixes_; }; #if defined (__ACEXML_INLINE__) # include "ACEXML/parser/parser/Parser.inl" #endif /* __ACEXML_INLINE__ */ #include /**/ "ace/post.h" #endif /* _ACEXML_BASIC_PARSER_H_ */ ace-8.0.4+dfsg.orig/ACEXML/parser/parser/ParserContext.cpp0000644000175000017500000000047215027201772022237 0ustar sudipsudip#include "ACEXML/parser/parser/ParserContext.h" #if !defined (__ACEXML_INLINE__) # include "ACEXML/parser/parser/ParserContext.inl" #endif /* __ACEXML_INLINE__ */ ACEXML_Parser_Context::~ACEXML_Parser_Context() { delete this->instream_; this->instream_ = 0; delete this->locator_; this->locator_ = 0; } ace-8.0.4+dfsg.orig/ACEXML/parser/parser/ACEXML_Parser.pc.in0000644000175000017500000000035115027201772022144 0ustar sudipsudipprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: ACEXML_Parser Description: ACE XML Parser Library Requires: ACEXML Version: @VERSION@ Libs: -L${libdir} -lACEXML_Parser Cflags: -I${includedir} ace-8.0.4+dfsg.orig/ACEXML/parser/parser/Entity_Manager.h0000644000175000017500000000606015027201772022010 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Entity_Manager.h * * @author Nanbor Wang * @author Krishnakumar B */ //============================================================================= #ifndef ACEXML_ENTITY_MANAGER_H #define ACEXML_ENTITY_MANAGER_H #include /**/ "ace/pre.h" #include "ACEXML/parser/parser/Parser_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/XML_Types.h" #include "ace/Hash_Map_Manager.h" #include "ace/Null_Mutex.h" typedef ACE_Hash_Map_Entry ACEXML_ENTITY_ENTRY; typedef ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_Null_Mutex> ACEXML_ENTITIES_MANAGER; typedef ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, ACE_Null_Mutex> ACEXML_ENTITIES_MANAGER_ITER; typedef ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, ACE_Null_Mutex> ACEXML_ENTITIES_MANAGER_REVERSE_ITER; typedef ACE_Hash_Map_Bucket_Iterator, ACE_Equal_To, ACE_Null_Mutex> ACEXML_ENTITY_ENTRY_ITERATOR; /** * @class ACEXML_Entity_Manager Entity_Manager.h "ACEXML/parser/parser/Entity_Manager.h" * * @brief Class to manage and resolve entity references. * * @todo Fill in details for this class. */ class ACEXML_PARSER_Export ACEXML_Entity_Manager { public: /// Default constructor. ACEXML_Entity_Manager (); /// Destructor. ~ACEXML_Entity_Manager (); /// Add a new entity declaration. int add_entity (const ACEXML_Char *ref, const ACEXML_Char *value); /// Resolve an entity reference. const ACEXML_Char* resolve_entity (const ACEXML_Char *ref); /// Resolve an entity reference and return the tuple of @c systemId and /// @c publicId int resolve_entity (const ACEXML_Char* ref, ACEXML_Char*& systemId, ACEXML_Char*& publicId); /// Number of items in the Entity Manager size_t size() const; /// Reset the state int reset (); private: ACEXML_ENTITIES_MANAGER* entities_; // bool init_; }; #if defined (__ACEXML_INLINE__) # include "ACEXML/parser/parser/Entity_Manager.inl" #endif /* __ACEXML_INLINE__ */ #include /**/ "ace/post.h" #endif /* ACEXML_ENTITY_MANAGER_H */ ace-8.0.4+dfsg.orig/ACEXML/parser/parser/ParserInternals.h0000644000175000017500000000516115027201772022217 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file ParserInternals.h * * @author Krishnakumar B */ //============================================================================= #ifndef _ACEXML_PARSER_INTERNALS_H_ #define _ACEXML_PARSER_INTERNALS_H_ #include /**/ "ace/pre.h" #include "ACEXML/parser/parser/Parser_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/XML_Types.h" /** * @class ACEXML_ParserInt ParserInternals.h "ACEXML/parser/parser/ParserInternals.h" * * @brief A class to hide some of the internal implementation details of * the parser. */ class ACEXML_PARSER_Export ACEXML_ParserInt { public: #if defined (ACE_USES_WCHAR) /** * Check if a character @a c is a BaseChar. This method checks for the * complete set of characters allowed when WCHAR support is enabled. * * @retval 1 if @a c is a valid XML Character, 0 otherwise. */ static int isBasechar_i (const ACEXML_Char c); /** * Check if a character @a c is a Ideographic. This method checks for the * complete set of characters allowed when WCHAR support is enabled. * * @retval 1 if @a c is a valid XML Character, 0 otherwise. */ static int isIdeographic_i (const ACEXML_Char c); /** * Check if a character @a c is a CombiningChar. This method checks for the * complete set of characters allowed when WCHAR support is enabled. * * @retval 1 if @a c is a valid XML Character, 0 otherwise. */ static int isCombiningchar_i (const ACEXML_Char c); /** * Check if a character @a c is a Digit. This method checks for the * complete set of characters allowed when WCHAR support is enabled. * * @retval 1 if @a c is a valid XML Character, 0 otherwise. */ static int isDigit_i (const ACEXML_Char c); /** * Check if a character @a c is an Extender. This method checks for the * complete set of characters allowed when WCHAR support is enabled. * * @retval 1 if @a c is a valid XML Character, 0 otherwise. */ static int isExtender_i (const ACEXML_Char c); #endif /* ACE_USES_WCHAR */ static const ACEXML_Char base_char_table_[256]; static const ACEXML_Char* predef_ent_[]; static const ACEXML_Char* predef_val_[]; // Enum describing the position in a document when a reference occurs. enum ReferenceState { IN_CONTENT, IN_ATT_VALUE, AS_ATT_VALUE, IN_ENTITY_VALUE, IN_INT_DTD, IN_EXT_DTD, IN_NOTATION, INVALID = -1 }; }; #include /**/ "ace/post.h" #endif /* _ACEXML_PARSER_INTERNALS_H_ */ ace-8.0.4+dfsg.orig/ACEXML/parser/parser/ParserInternals.cpp0000644000175000017500000003513415027201772022555 0ustar sudipsudip#include "ACEXML/parser/parser/ParserInternals.h" const ACEXML_Char* ACEXML_ParserInt::predef_ent_[] = { ACE_TEXT ("amp"), ACE_TEXT ("lt"), ACE_TEXT ("gt"), ACE_TEXT ("apos"), ACE_TEXT ("quot") }; const ACEXML_Char* ACEXML_ParserInt::predef_val_[] = { ACE_TEXT ("&"), ACE_TEXT ("<"), ACE_TEXT (">"), ACE_TEXT ("'"), ACE_TEXT ("\"") }; // Optimize away the most common cases. Any compiler worth it's salt should // give generate a single memory access. const ACEXML_Char ACEXML_ParserInt::base_char_table_[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0000 - 0x000F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0010 - 0x001F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0020 - 0x002F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0030 - 0x003F */ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x0040 - 0x004F */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* 0x0050 - 0x005F */ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x0060 - 0x006F */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* 0x0070 - 0x007F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0080 - 0x008F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0090 - 0x009F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00A0 - 0x00AF */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00B0 - 0x00BF */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x00C0 - 0x00CF */ 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x00D0 - 0x00DF */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x00E0 - 0x00EF */ 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x00F0 - 0x00FF */ }; #if defined (ACE_USES_WCHAR) int ACEXML_ParserInt::isBasechar_i (const ACEXML_Char c) { if (c < 0x0100) return ACEXML_ParserInt::base_char_table_[c]; else if (c < 0x0905) return ((c >= 0x0100 && c <= 0x0131) || (c >= 0x0134 && c <= 0x013E) || (c >= 0x0141 && c <= 0x0148) || (c >= 0x014A && c <= 0x017E) || (c >= 0x0180 && c <= 0x01C3) || (c >= 0x01CD && c <= 0x01F0) || (c >= 0x01F4 && c <= 0x01F5) || (c >= 0x01FA && c <= 0x0217) || (c >= 0x0250 && c <= 0x02A8) || (c >= 0x02BB && c <= 0x02C1) || (c == 0x0386) || (c >= 0x0388 && c <= 0x038A) || (c == 0x038C) || (c >= 0x038E && c <= 0x03A1) || (c >= 0x03A3 && c <= 0x03CE) || (c >= 0x03D0 && c <= 0x03D6) || (c == 0x03DA) || (c == 0x03DC) || (c == 0x03DE) || (c == 0x03E0) || (c >= 0x03E2 && c <= 0x03F3) || (c >= 0x0401 && c <= 0x040C) || (c >= 0x040E && c <= 0x044F) || (c >= 0x0451 && c <= 0x045C) || (c >= 0x045E && c <= 0x0481) || (c >= 0x0490 && c <= 0x04C4) || (c >= 0x04C7 && c <= 0x04C8) || (c >= 0x04CB && c <= 0x04CC) || (c >= 0x04D0 && c <= 0x04EB) || (c >= 0x04EE && c <= 0x04F5) || (c >= 0x04F8 && c <= 0x04F9) || (c >= 0x0531 && c <= 0x0556) || (c == 0x0559) || (c >= 0x0561 && c <= 0x0586) || (c >= 0x05D0 && c <= 0x05EA) || (c >= 0x05F0 && c <= 0x05F2) || (c >= 0x0621 && c <= 0x063A) || (c >= 0x0641 && c <= 0x064A) || (c >= 0x0671 && c <= 0x06B7) || (c >= 0x06BA && c <= 0x06BE) || (c >= 0x06C0 && c <= 0x06CE) || (c >= 0x06D0 && c <= 0x06D3) || (c == 0x06D5) || (c >= 0x06E5 && c <= 0x06E6)); else if (c < 0x10A0) return ((c >= 0x0905 && c <= 0x0939) || (c == 0x093D) || (c >= 0x0958 && c <= 0x0961) || (c >= 0x0985 && c <= 0x098C) || (c >= 0x098F && c <= 0x0990) || (c >= 0x0993 && c <= 0x09A8) || (c >= 0x09AA && c <= 0x09B0) || (c == 0x09B2) || (c >= 0x09B6 && c <= 0x09B9) || (c >= 0x09DC && c <= 0x09DD) || (c >= 0x09DF && c <= 0x09E1) || (c >= 0x09F0 && c <= 0x09F1) || (c >= 0x0A05 && c <= 0x0A0A) || (c >= 0x0A0F && c <= 0x0A10) || (c >= 0x0A13 && c <= 0x0A28) || (c >= 0x0A2A && c <= 0x0A30) || (c >= 0x0A32 && c <= 0x0A33) || (c >= 0x0A35 && c <= 0x0A36) || (c >= 0x0A38 && c <= 0x0A39) || (c >= 0x0A59 && c <= 0x0A5C) || (c == 0x0A5E) || (c >= 0x0A72 && c <= 0x0A74) || (c >= 0x0A85 && c <= 0x0A8B) || (c == 0x0A8D) || (c >= 0x0A8F && c <= 0x0A91) || (c >= 0x0A93 && c <= 0x0AA8) || (c >= 0x0AAA && c <= 0x0AB0) || (c >= 0x0AB2 && c <= 0x0AB3) || (c >= 0x0AB5 && c <= 0x0AB9) || (c == 0x0ABD || c == 0x0AE0) || (c >= 0x0B05 && c <= 0x0B0C) || (c >= 0x0B0F && c <= 0x0B10) || (c >= 0x0B13 && c <= 0x0B28) || (c >= 0x0B2A && c <= 0x0B30) || (c >= 0x0B32 && c <= 0x0B33) || (c >= 0x0B36 && c <= 0x0B39) || (c == 0x0B3D) || (c >= 0x0B5C && c <= 0x0B5D) || (c >= 0x0B5F && c <= 0x0B61) || (c >= 0x0B85 && c <= 0x0B8A) || (c >= 0x0B8E && c <= 0x0B90) || (c >= 0x0B92 && c <= 0x0B95) || (c >= 0x0B99 && c <= 0x0B9A) || (c == 0x0B9C) || (c >= 0x0B9E && c <= 0x0B9F) || (c >= 0x0BA3 && c <= 0x0BA4) || (c >= 0x0BA8 && c <= 0x0BAA) || (c >= 0x0BAE && c <= 0x0BB5) || (c >= 0x0BB7 && c <= 0x0BB9) || (c >= 0x0C05 && c <= 0x0C0C) || (c >= 0x0C0E && c <= 0x0C10) || (c >= 0x0C12 && c <= 0x0C28) || (c >= 0x0C2A && c <= 0x0C33) || (c >= 0x0C35 && c <= 0x0C39) || (c >= 0x0C60 && c <= 0x0C61) || (c >= 0x0C85 && c <= 0x0C8C) || (c >= 0x0C8E && c <= 0x0C90) || (c >= 0x0C92 && c <= 0x0CA8) || (c >= 0x0CAA && c <= 0x0CB3) || (c >= 0x0CB5 && c <= 0x0CB9) || (c == 0x0CDE) || (c >= 0x0CE0 && c <= 0x0CE1) || (c >= 0x0D05 && c <= 0x0D0C) || (c >= 0x0D0E && c <= 0x0D10) || (c >= 0x0D12 && c <= 0x0D28) || (c >= 0x0D2A && c <= 0x0D39) || (c >= 0x0D60 && c <= 0x0D61) || (c >= 0x0E01 && c <= 0x0E2E) || (c == 0x0E30) || (c >= 0x0E32 && c <= 0x0E33) || (c >= 0x0E40 && c <= 0x0E45) || (c >= 0x0E81 && c <= 0x0E82) || (c == 0x0E84) || (c >= 0x0E87 && c <= 0x0E88) || (c == 0x0E8A || c == 0x0E8D) || (c >= 0x0E94 && c <= 0x0E97) || (c >= 0x0E99 && c <= 0x0E9F) || (c >= 0x0EA1 && c <= 0x0EA3) || (c == 0x0EA5 || c == 0x0EA7) || (c >= 0x0EAA && c <= 0x0EAB) || (c >= 0x0EAD && c <= 0x0EAE) || (c == 0x0EB0) || (c >= 0x0EB2 && c <= 0x0EB3) || (c == 0x0EBD) || (c >= 0x0EC0 && c <= 0x0EC4) || (c >= 0x0F40 && c <= 0x0F47) || (c >= 0x0F49 && c <= 0x0F69)); else return ((c >= 0x10A0 && c <= 0x10C5) || (c >= 0x10D0 && c <= 0x10F6) || (c == 0x1100) || (c >= 0x1102 && c <= 0x1103) || (c >= 0x1105 && c <= 0x1107) || (c == 0x1109) || (c >= 0x110B && c <= 0x110C) || (c >= 0x110E && c <= 0x1112) || (c == 0x113C || c == 0x113E || c == 0x1140) || (c == 0x114C || c == 0x114E || c == 0x1150) || (c >= 0x1154 && c <= 0x1155) || (c == 0x1159) || (c >= 0x115F && c <= 0x1161) || (c == 0x1163) || (c == 0x1165) || (c == 0x1167) || (c == 0x1169) || (c >= 0x116D && c <= 0x116E) || (c >= 0x1172 && c <= 0x1173) || (c == 0x1175) || (c == 0x119E) || (c == 0x11A8) || (c == 0x11AB) || (c >= 0x11AE && c <= 0x11AF) || (c >= 0x11B7 && c <= 0x11B8) || (c == 0x11BA) || (c >= 0x11BC && c <= 0x11C2) || (c == 0x11EB) || (c == 0x11F0) || (c == 0x11F9) || (c >= 0x1E00 && c <= 0x1E9B) || (c >= 0x1EA0 && c <= 0x1EF9) || (c >= 0x1F00 && c <= 0x1F15) || (c >= 0x1F18 && c <= 0x1F1D) || (c >= 0x1F20 && c <= 0x1F45) || (c >= 0x1F48 && c <= 0x1F4D) || (c >= 0x1F50 && c <= 0x1F57) || (c == 0x1F59) || (c == 0x1F5B) || (c == 0x1F5D) || (c >= 0x1F5F && c <= 0x1F7D) || (c >= 0x1F80 && c <= 0x1FB4) || (c >= 0x1FB6 && c <= 0x1FBC) || (c == 0x1FBE) || (c >= 0x1FC2 && c <= 0x1FC4) || (c >= 0x1FC6 && c <= 0x1FCC) || (c >= 0x1FD0 && c <= 0x1FD3) || (c >= 0x1FD6 && c <= 0x1FDB) || (c >= 0x1FE0 && c <= 0x1FEC) || (c >= 0x1FF2 && c <= 0x1FF4) || (c >= 0x1FF6 && c <= 0x1FFC) || (c == 0x2126) || (c >= 0x212A && c <= 0x212B) || (c == 0x212E) || (c >= 0x2180 && c <= 0x2182) || (c >= 0x3041 && c <= 0x3094) || (c >= 0x30A1 && c <= 0x30FA) || (c >= 0x3105 && c <= 0x312C) || (c >= 0xAC00 && c <= 0xD7A3)); }; int ACEXML_ParserInt::isIdeographic_i (const ACEXML_Char c) { return ((c >= 0x4E00 && c <= 0x9FA5) || (c == 3007) || (c >= 0x3021 && c <= 0x3029)); } int ACEXML_ParserInt::isCombiningchar_i (const ACEXML_Char c) { if (c < 0x0901) return ((c >= 0x0300 && c <= 0x0345) || (c >= 0x0360 && c <= 0x0361) || (c >= 0x0483 && c <= 0x0486) || (c >= 0x0591 && c <= 0x05A1) || (c >= 0x05A3 && c <= 0x05B9) || (c >= 0x05BB && c <= 0x05BD) || (c == 0x05BF) || (c >= 0x05C1 && c <= 0x05C2) || (c == 0x05C4) || (c >= 0x064B && c <= 0x0652) || (c == 0x0670) || (c >= 0x06D6 && c <= 0x06DC) || (c >= 0x06DD && c <= 0x06DF) || (c >= 0x06E0 && c <= 0x06E4) || (c >= 0x06E7 && c <= 0x06E8) || (c >= 0x06EA && c <= 0x06ED)); else return ((c >= 0x0901 && c <= 0x0903) || (c == 0x093C) || (c >= 0x093E && c <= 0x094C) || (c == 0x094D) || (c >= 0x0951 && c <= 0x0954) || (c >= 0x0962 && c <= 0x0963) || (c >= 0x0981 && c <= 0x0983) || (c == 0x09BC) || (c == 0x09BE) || (c == 0x09BF) || (c >= 0x09C0 && c <= 0x09C4) || (c >= 0x09C7 && c <= 0x09C8) || (c >= 0x09CB && c <= 0x09CD) || (c == 0x09D7) || (c >= 0x09E2 && c <= 0x09E3) || (c == 0x0A02) || (c == 0x0A3C) || (c == 0x0A3E) || (c == 0x0A3F) || (c >= 0x0A40 && c <= 0x0A42) || (c >= 0x0A47 && c <= 0x0A48) || (c >= 0x0A4B && c <= 0x0A4D) || (c >= 0x0A70 && c <= 0x0A71) || (c >= 0x0A81 && c <= 0x0A83) || (c == 0x0ABC) || (c >= 0x0ABE && c <= 0x0AC5) || (c >= 0x0AC7 && c <= 0x0AC9) || (c >= 0x0ACB && c <= 0x0ACD) || (c >= 0x0B01 && c <= 0x0B03) || (c == 0x0B3C) || (c >= 0x0B3E && c <= 0x0B43) || (c >= 0x0B47 && c <= 0x0B48) || (c >= 0x0B4B && c <= 0x0B4D) || (c >= 0x0B56 && c <= 0x0B57) || (c >= 0x0B82 && c <= 0x0B83) || (c >= 0x0BBE && c <= 0x0BC2) || (c >= 0x0BC6 && c <= 0x0BC8) || (c >= 0x0BCA && c <= 0x0BCD) || (c == 0x0BD7) || (c >= 0x0C01 && c <= 0x0C03) || (c >= 0x0C3E && c <= 0x0C44) || (c >= 0x0C46 && c <= 0x0C48) || (c >= 0x0C4A && c <= 0x0C4D) || (c >= 0x0C55 && c <= 0x0C56) || (c >= 0x0C82 && c <= 0x0C83) || (c >= 0x0CBE && c <= 0x0CC4) || (c >= 0x0CC6 && c <= 0x0CC8) || (c >= 0x0CCA && c <= 0x0CCD) || (c >= 0x0CD5 && c <= 0x0CD6) || (c >= 0x0D02 && c <= 0x0D03) || (c >= 0x0D3E && c <= 0x0D43) || (c >= 0x0D46 && c <= 0x0D48) || (c >= 0x0D4A && c <= 0x0D4D) || (c == 0x0D57) || (c == 0x0E31) || (c >= 0x0E34 && c <= 0x0E3A) || (c >= 0x0E47 && c <= 0x0E4E) || (c == 0x0EB1) || (c >= 0x0EB4 && c <= 0x0EB9) || (c >= 0x0EBB && c <= 0x0EBC) || (c >= 0x0EC8 && c <= 0x0ECD) || (c >= 0x0F18 && c <= 0x0F19) || (c == 0x0F35) || (c == 0x0F37) || (c == 0x0F39) || (c == 0x0F3E) || (c == 0x0F3F) || (c >= 0x0F71 && c <= 0x0F84) || (c >= 0x0F86 && c <= 0x0F8B) || (c >= 0x0F90 && c <= 0x0F95) || (c == 0x0F97) || (c >= 0x0F99 && c <= 0x0FAD) || (c >= 0x0FB1 && c <= 0x0FB7) || (c == 0x0FB9) || (c >= 0x20D0 && c <= 0x20DC) || (c == 0x20E1) || (c >= 0x302A && c <= 0x302F) || (c == 0x3099) || (c == 0x309A)); } int ACEXML_ParserInt::isDigit_i (const ACEXML_Char c) { if (c < 0x0040) return (c >= 0x0030 && c <= 0x0039); else return ((c >= 0x0660 && c <= 0x0669) || (c >= 0x06F0 && c <= 0x06F9) || (c >= 0x0966 && c <= 0x096F) || (c >= 0x09E6 && c <= 0x09EF) || (c >= 0x0A66 && c <= 0x0A6F) || (c >= 0x0AE6 && c <= 0x0AEF) || (c >= 0x0B66 && c <= 0x0B6F) || (c >= 0x0BE7 && c <= 0x0BEF) || (c >= 0x0C66 && c <= 0x0C6F) || (c >= 0x0CE6 && c <= 0x0CEF) || (c >= 0x0D66 && c <= 0x0D6F) || (c >= 0x0E50 && c <= 0x0E59) || (c >= 0x0ED0 && c <= 0x0ED9) || (c >= 0x0F20 && c <= 0x0F29)); } int ACEXML_ParserInt::isExtender_i (const ACEXML_Char c) { // The compiler should generate a jump table and index into it directly. switch (c) { case 0x00B7: case 0x02D0: case 0x02D1: case 0x0387: case 0x0640: case 0x0E46: case 0x0EC6: case 0x3005: case 0x3031: case 0x3032: case 0x3033: case 0x3034: case 0x3035: case 0x309D: case 0x309E: case 0x30FC: case 0x30FD: case 0x30FE: return 1; default: return 0; } } #endif /* ACE_USES_WCHAR */ ace-8.0.4+dfsg.orig/ACEXML/parser/parser/ParserContext.inl0000644000175000017500000000270515027201772022240 0ustar sudipsudip// -*- C++ -*- #include ACEXML_INLINE ACEXML_Parser_Context::ACEXML_Parser_Context() : instream_ (0), locator_ (0) { } ACEXML_INLINE ACEXML_Parser_Context::ACEXML_Parser_Context (ACEXML_InputSource* instream, ACEXML_LocatorImpl* locator) : instream_ (instream), locator_ (locator) { } ACEXML_INLINE ACEXML_Parser_Context::ACEXML_Parser_Context (const ACEXML_Parser_Context& src) : instream_ (src.instream_), locator_ (src.locator_) { } ACEXML_INLINE bool ACEXML_Parser_Context::operator!= (const ACEXML_Parser_Context& src) { return (this->instream_ != src.instream_ && this->locator_ != src.locator_); } ACEXML_INLINE ACEXML_Parser_Context& ACEXML_Parser_Context::operator= (const ACEXML_Parser_Context& src) { ACEXML_Parser_Context tmp (src); std::swap (this->instream_, tmp.instream_); std::swap (this->locator_, tmp.locator_); return *this; } ACEXML_INLINE ACEXML_InputSource* ACEXML_Parser_Context::getInputSource () { return this->instream_; } ACEXML_INLINE ACEXML_LocatorImpl* ACEXML_Parser_Context::getLocator () { return this->locator_; } ACEXML_INLINE void ACEXML_Parser_Context::setInputSource (ACEXML_InputSource* ip) { this->instream_ = ip; } ACEXML_INLINE void ACEXML_Parser_Context::setLocator (ACEXML_LocatorImpl* locator) { this->locator_ = locator; } ACEXML_INLINE void ACEXML_Parser_Context::reset () { this->instream_ = 0; this->locator_ = 0; } ace-8.0.4+dfsg.orig/ACEXML/parser/debug_validator/0000755000175000017500000000000015046037655020576 5ustar sudipsudipace-8.0.4+dfsg.orig/ACEXML/parser/debug_validator/Debug_Attributes_Builder.cpp0000644000175000017500000001062515027201772026200 0ustar sudipsudip#include "ACEXML/common/SAXExceptions.h" #include "ACEXML/parser/debug_validator/Debug_Attributes_Builder.h" ACEXML_Debug_Attribute_Builder::ACEXML_Debug_Attribute_Builder () : type_ (ERROR_TYPE), default_decl_ (INVALID) { } ACEXML_Debug_Attribute_Builder::ACEXML_Debug_Attribute_Builder (const ACEXML_Debug_Attribute_Builder &rhs) : name_ (rhs.name_), type_ (rhs.type_), default_decl_ (rhs.default_decl_), default_value_ (rhs.default_value_), att_value_queue_ (rhs.att_value_queue_) { } ACEXML_Debug_Attribute_Builder::~ACEXML_Debug_Attribute_Builder () { } int ACEXML_Debug_Attribute_Builder::setName (const ACEXML_Char *n) { this->name_.set (n, 0); return 0; } const ACEXML_Char * ACEXML_Debug_Attribute_Builder::getName () { return this->name_.fast_rep (); } int ACEXML_Debug_Attribute_Builder::setAttType (const ATT_TYPE type) { if (this->type_ == ERROR_TYPE) { this->type_ = type; return 0; } ACEXML_THROW_RETURN (ACEXML_SAXParseException (ACE_TEXT("Attribute type redefinition in Debug Validator")), -1); } int ACEXML_Debug_Attribute_Builder::insertList (const ACEXML_Char *n) { ACEXML_String str (n, 0, 0); this->att_value_queue_.enqueue_tail (str); return 0; } int ACEXML_Debug_Attribute_Builder::setDefault (const DEFAULT_DECL def, const ACEXML_Char *value) { this->default_decl_ = def; this->default_value_.set (value, 0); return 0; } int ACEXML_Debug_Attribute_Builder::validAttr () { // @@ Not implemented. Always return 1 (true) for now. return 1; } void ACEXML_Debug_Attribute_Builder::dump () { cout << this->name_ << " "; switch (this->type_) { case CDATA: cout << "CDATA "; break; case ID: cout << "ID "; break; case IDREF: cout << "IDREF "; break; case IDREFS: cout << "IDREFS "; break; case ENTITY: cout << "ENTITY "; break; case ENTITIES: cout << "ENTITIES "; break; case NMTOKEN: cout << "NMTOKEN "; break; case NMTOKENS: cout << "NMTOKENS "; break; case NOTATION: cout << "NOTATION "; // Fall thru case ENUMERATION: { cout << "("; ACEXML_STRING_QUEUE_ITERATOR iter (this->att_value_queue_); ACEXML_String *n = 0; while (iter.advance () != 0) { if (n == 0) cout << " | "; iter.next (n); cout << *n; } cout << ") "; } break; default: cout << "*** UNKNOWN TYPE ***"; break; } switch (this->default_decl_) { case REQUIRED: cout << "#REQUIRED"; break; case IMPLIED: cout << "#IMPLIED"; break; case FIXED: cout << "#FIXED " << this->default_value_; break; default: cout << "**** UNDEFINED DEFAULT DECL ****"; break; } } // ======================================== ACEXML_Debug_Attributes_Builder::ACEXML_Debug_Attributes_Builder () { } ACEXML_Debug_Attributes_Builder::~ACEXML_Debug_Attributes_Builder () { } int ACEXML_Debug_Attributes_Builder::setElement (const ACEXML_Char *, const ACEXML_Char *, const ACEXML_Char *qName) { this->element_name_.set (qName, 0); return 0; } ACEXML_Attribute_Def_Builder * ACEXML_Debug_Attributes_Builder::getAttribute_Def_Builder () { ACEXML_Attribute_Def_Builder *tmp; ACE_NEW_RETURN (tmp, ACEXML_Debug_Attribute_Builder (), 0); return tmp; } int ACEXML_Debug_Attributes_Builder::insertAttribute ( ACEXML_Attribute_Def_Builder *def) { ACEXML_Attribute_Def_Builder::VAR ptr (def); if (def != 0) { ACEXML_String attname (def->getName (), 0, 0); ACEXML_Debug_Attribute_Builder *ptr = dynamic_cast (def); this->attributes_.bind (attname, *ptr); return 0; } ACEXML_THROW_RETURN (ACEXML_SAXParseException (ACE_TEXT("ACEXML_Debug_Attributes_Builder internal error")), -1); } void ACEXML_Debug_Attributes_Builder::dump () { // @@ Print print. cout << "element_name_ << endl; ACEXML_ATT_MAP_ITER iter (this->attributes_); ACEXML_ATT_MAP_ENTRY *item; while (iter.advance () != 0) { iter.next (item); cout << "\n\t"; item->int_id_.dump (); } cout << ">" << endl; } ace-8.0.4+dfsg.orig/ACEXML/parser/debug_validator/Element_Tree.inl0000644000175000017500000000336415027201772023650 0ustar sudipsudipACEXML_INLINE ACEXML_Element_Tree_Node::ACEXML_Element_Tree_Node () : next_ (0) { } ACEXML_INLINE ACEXML_Element_Tree_Node * ACEXML_Element_Tree_Node::next () { return this->next_; } ACEXML_INLINE void ACEXML_Element_Tree_Node::next (ACEXML_Element_Tree_Node * n) { this->next_ = n; } ACEXML_INLINE ACEXML_Element_Tree_Name_Node::ACEXML_Element_Tree_Name_Node (const ACEXML_Char *name, int release) : name_ (name, 0, release) { } ACEXML_INLINE void ACEXML_Element_Tree_Name_Node::set (const ACEXML_Char *name, int release) { this->name_.set (name, release); } ACEXML_INLINE ACEXML_Element_Tree_List_Node::ACEXML_Element_Tree_List_Node () : type_ (SEQUENCE), head_ (0), tail_ (0), pop_next_ (0) { } ACEXML_INLINE ACEXML_Element_Tree_List_Node::LIST_TYPE ACEXML_Element_Tree_List_Node::get () { return this->type_; } ACEXML_INLINE int ACEXML_Element_Tree_List_Node::set (ACEXML_Element_Tree_List_Node::LIST_TYPE type) { this->type_ = type; return 0; } ACEXML_INLINE ACEXML_Element_Tree_List_Stack::ACEXML_Element_Tree_List_Stack () : top_ (0) { } ACEXML_INLINE ACEXML_Element_Tree_List_Node * ACEXML_Element_Tree_List_Stack::top () { return this->top_; } ACEXML_INLINE void ACEXML_Element_Tree_List_Stack::push (ACEXML_Element_Tree_List_Node *n) { n->pop_next_ = this->top_; this->top_ = n; } ACEXML_INLINE ACEXML_Element_Tree_List_Node * ACEXML_Element_Tree_List_Stack::pop () { if (this->top_ != 0) { ACEXML_Element_Tree_List_Node *ptr = this->top_; this->top_ = this->top_->pop_next_; return ptr; } return 0; } ACEXML_INLINE int ACEXML_Element_Tree_List_Stack::empty () { return this->top_ == 0; } ace-8.0.4+dfsg.orig/ACEXML/parser/debug_validator/Debug_DTD_Manager_Export.h0000644000175000017500000000350315027201772025454 0ustar sudipsudip // -*- C++ -*- // Definition for Win32 Export directives. // This file is generated automatically by generate_export_file.pl -s ACEXML_DEBUG_DTD_MANAGER // ------------------------------ #ifndef ACEXML_DEBUG_DTD_MANAGER_EXPORT_H #define ACEXML_DEBUG_DTD_MANAGER_EXPORT_H #include "ace/config-all.h" #if defined (ACE_AS_STATIC_LIBS) && !defined (ACEXML_DEBUG_DTD_MANAGER_HAS_DLL) # define ACEXML_DEBUG_DTD_MANAGER_HAS_DLL 0 #endif /* ACE_AS_STATIC_LIBS && ACEXML_DEBUG_DTD_MANAGER_HAS_DLL */ #if !defined (ACEXML_DEBUG_DTD_MANAGER_HAS_DLL) # define ACEXML_DEBUG_DTD_MANAGER_HAS_DLL 1 #endif /* ! ACEXML_DEBUG_DTD_MANAGER_HAS_DLL */ #if defined (ACEXML_DEBUG_DTD_MANAGER_HAS_DLL) && (ACEXML_DEBUG_DTD_MANAGER_HAS_DLL == 1) # if defined (ACEXML_DEBUG_DTD_MANAGER_BUILD_DLL) # define ACEXML_DEBUG_DTD_MANAGER_Export ACE_Proper_Export_Flag # define ACEXML_DEBUG_DTD_MANAGER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) # define ACEXML_DEBUG_DTD_MANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) # else /* ACEXML_DEBUG_DTD_MANAGER_BUILD_DLL */ # define ACEXML_DEBUG_DTD_MANAGER_Export ACE_Proper_Import_Flag # define ACEXML_DEBUG_DTD_MANAGER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) # define ACEXML_DEBUG_DTD_MANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) # endif /* ACEXML_DEBUG_DTD_MANAGER_BUILD_DLL */ #else /* ACEXML_DEBUG_DTD_MANAGER_HAS_DLL == 1 */ # define ACEXML_DEBUG_DTD_MANAGER_Export # define ACEXML_DEBUG_DTD_MANAGER_SINGLETON_DECLARATION(T) # define ACEXML_DEBUG_DTD_MANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) #endif /* ACEXML_DEBUG_DTD_MANAGER_HAS_DLL == 1 */ #endif /* ACEXML_DEBUG_DTD_MANAGER_EXPORT_H */ // End of auto generated file. ace-8.0.4+dfsg.orig/ACEXML/parser/debug_validator/Element_Tree.h0000644000175000017500000000725215027201772023315 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Element_Tree.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_ELEMENT_TREE_H_ #define _ACEXML_ELEMENT_TREE_H_ #include /**/ "ace/pre.h" #include "ACEXML/parser/debug_validator/Debug_DTD_Manager_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/XML_Types.h" /** * @class ACEXML_Element_Tree_Node Element_Tree.h "parser/debug_validator/Element_Tree.h" * * @brief An abstract base class for describing DTD child element definition. * * @sa ACEXML_Element_Tree_Name_Node, ACEXML_Element_Tree_List_Node */ class ACEXML_DEBUG_DTD_MANAGER_Export ACEXML_Element_Tree_Node { public: /// Default constructor. ACEXML_Element_Tree_Node (); /// Destructor virtual ~ACEXML_Element_Tree_Node (); /// Accessor for next element in chain ACEXML_Element_Tree_Node *next (); void next (ACEXML_Element_Tree_Node *n); /// Displaying the content. virtual void dump () = 0; ACE_ALLOC_HOOK_DECLARE; protected: ACEXML_Element_Tree_Node *next_; }; /** * @class ACEXML_Element_Tree_Name_Node Element_Tree.h "parser/debug_validator/Element_Tree.h" * * @brief An abstract base class for describing a name node in a DTD child * element definition. * * @sa ACEXML_Element_Tree_Node, ACEXML_Element_Tree_List_Node */ class ACEXML_DEBUG_DTD_MANAGER_Export ACEXML_Element_Tree_Name_Node : public ACEXML_Element_Tree_Node { public: /// Constructor. ACEXML_Element_Tree_Name_Node (const ACEXML_Char *name, int release = 1); /// Change the name of this node. void set (const ACEXML_Char *name, int release = 1); virtual void dump (); ACE_ALLOC_HOOK_DECLARE; protected: ACEXML_String name_; }; class ACEXML_Element_Tree_List_Stack; /** * @class ACEXML_Element_Tree_List_Node Element_Tree.h "parser/debug_validator/Element_Tree.h" * * @brief An abstract base class for describing a node list in a DTD child * element definition. * * @sa ACEXML_Element_Tree_Node, ACEXML_Element_Tree_Name_Node */ class ACEXML_DEBUG_DTD_MANAGER_Export ACEXML_Element_Tree_List_Node : public ACEXML_Element_Tree_Node { public: friend class ACEXML_Element_Tree_List_Stack; typedef enum { SEQUENCE, CHOICE } LIST_TYPE; /// Default constructor. ACEXML_Element_Tree_List_Node (); /// Destructor. virtual ~ACEXML_Element_Tree_List_Node (); /// Insert a new ACEXML_Element_Tree_Node into the list. int insert (ACEXML_Element_Tree_Node *node); /// Get/set the type of list. LIST_TYPE get (); int set (LIST_TYPE type); virtual void dump (); ACE_ALLOC_HOOK_DECLARE; protected: LIST_TYPE type_; ACEXML_Element_Tree_Node *head_; ACEXML_Element_Tree_Node *tail_; ACEXML_Element_Tree_List_Node *pop_next_; }; /** * @class ACEXML_Element_Tree_List_Stack Element_Tree.h "parser/debug_validator/Element_Tree.h" * * @brief A class for managing a stack of ACEXML_Element_Tree_List_Node's. * * @sa ACEXML_Element_Tree_List_Node */ class ACEXML_DEBUG_DTD_MANAGER_Export ACEXML_Element_Tree_List_Stack { public: ACEXML_Element_Tree_List_Stack (); void push (ACEXML_Element_Tree_List_Node *n); ACEXML_Element_Tree_List_Node *pop (); ACEXML_Element_Tree_List_Node *top (); int empty (); ACE_ALLOC_HOOK_DECLARE; protected: ACEXML_Element_Tree_List_Node *top_; }; #if defined (__ACEXML_INLINE__) # include "ACEXML/parser/debug_validator/Element_Tree.inl" #endif /* __ACEXML_INLINE__ */ #include /**/ "ace/post.h" #endif /* _ACEXML_ELEMENT_TREE_H_ */ ace-8.0.4+dfsg.orig/ACEXML/parser/debug_validator/Debug_DTD_Manager.cpp0000644000175000017500000000323115027201772024444 0ustar sudipsudip// -*- C++ -*- #include "ACEXML/common/SAXExceptions.h" #include "ACEXML/parser/debug_validator/Debug_DTD_Manager.h" #include "ACEXML/parser/debug_validator/Debug_Element_Builder.h" #include "ACEXML/parser/debug_validator/Debug_Attributes_Builder.h" ACEXML_Debug_DTD_Manager::ACEXML_Debug_DTD_Manager () { } ACEXML_Debug_DTD_Manager::~ACEXML_Debug_DTD_Manager () { } ACEXML_Element_Def_Builder * ACEXML_Debug_DTD_Manager::getElement_Def_Builder () { return new ACEXML_Debug_Element_Builder (); } int ACEXML_Debug_DTD_Manager::insertElement_Definition (ACEXML_Element_Def_Builder *def) { ACEXML_Element_Def_Builder::VAR ptr (def); if (def != 0) { ptr->dump (); return 0; } ACEXML_THROW_RETURN (ACEXML_SAXParseException (ACE_TEXT("ACEXML_Debug_Attributes_Builder internal error")), -1); } ACEXML_Attributes_Def_Builder * ACEXML_Debug_DTD_Manager::getAttribute_Def_Builder () { ACEXML_Attributes_Def_Builder *tmp; ACE_NEW_RETURN (tmp, ACEXML_Debug_Attributes_Builder (), 0); return tmp; } int ACEXML_Debug_DTD_Manager::insertAttributes_Definition (ACEXML_Attributes_Def_Builder *def) { ACEXML_Attributes_Def_Builder::VAR ptr (def); if (def != 0) { ptr->dump (); return 0; } ACEXML_THROW_RETURN (ACEXML_SAXParseException (ACE_TEXT("ACEXML_Debug_Attributes_Builder internal error")), -1); } ACEXML_Validator * ACEXML_Debug_DTD_Manager::getValidator (const ACEXML_Char *, const ACEXML_Char *, const ACEXML_Char *) { ACEXML_THROW_RETURN (ACEXML_SAXNotSupportedException (ACE_TEXT ("getValidator()")), 0); } ace-8.0.4+dfsg.orig/ACEXML/parser/debug_validator/Debug_Element_Builder.cpp0000644000175000017500000000627115027201772025445 0ustar sudipsudip#include "ACEXML/common/SAXExceptions.h" #include "ACEXML/parser/debug_validator/Debug_Element_Builder.h" ACEXML_Debug_Element_Builder::ACEXML_Debug_Element_Builder () : type_ (UNDEFINED), root_ (0) { } ACEXML_Debug_Element_Builder::~ACEXML_Debug_Element_Builder () { delete this->root_; } int ACEXML_Debug_Element_Builder::setElementName (const ACEXML_Char *, const ACEXML_Char *, const ACEXML_Char *qName) { this->element_.set (qName, 0); return 0; } int ACEXML_Debug_Element_Builder::setContentType (CONTENT_TYPE type) { if (this->type_ == UNDEFINED) { this->type_ = type; return 0; } ACEXML_THROW_RETURN (ACEXML_SAXParseException (ACE_TEXT("Element type redefinition in Debug_Validator.")), -1); } int ACEXML_Debug_Element_Builder::insertMixedElement (const ACEXML_Char *, const ACEXML_Char *, const ACEXML_Char *qName) { ACEXML_Element_Tree_Name_Node *node = 0; // @@ We should "throw" an exception here instead of returning -1. ACE_NEW_RETURN (node, ACEXML_Element_Tree_Name_Node (qName), -1); if (this->root_ == 0) // @@ Memory leak if fail? ACE_NEW_RETURN (this->root_, ACEXML_Element_Tree_List_Node (), -1); return this->root_->insert (node); } int ACEXML_Debug_Element_Builder::startChildGroup () { ACEXML_Element_Tree_List_Node *lnode = 0; ACE_NEW_RETURN (lnode, ACEXML_Element_Tree_List_Node (), -1); if (this->root_ == 0) { this->root_ = lnode; } else { // @@ check error? this->root_->insert (lnode); } this->active_list_.push (lnode); return 0; } int ACEXML_Debug_Element_Builder::endChildGroup (CARDINALITY ) { this->active_list_.pop (); return 0; } int ACEXML_Debug_Element_Builder::setChoice () { this->active_list_.top ()->set (ACEXML_Element_Tree_List_Node::CHOICE); return 0; } int ACEXML_Debug_Element_Builder::setSequence () { this->active_list_.top ()->set (ACEXML_Element_Tree_List_Node::SEQUENCE); return 0; } int ACEXML_Debug_Element_Builder::insertElement (const ACEXML_Char *, const ACEXML_Char *, const ACEXML_Char *qName) { ACEXML_Element_Tree_Name_Node *node = 0; // @@ We should "throw" an exception here instead of returning -1. ACE_NEW_RETURN (node, ACEXML_Element_Tree_Name_Node (qName), -1); return this->active_list_.top ()->insert (node); } void ACEXML_Debug_Element_Builder::dump () { cout << "element_; // @@ Also dump element contentspec here. switch (this->type_) { case EMPTY: cout << "EMPTY"; break; case ANY: cout << "ANY"; break; case MIXED: case CHILDREN: // @@ Dump the content of this->root_ cout << "*** not implemented ***"; break; default: cout << "*** Unidentified element type ***"; break; } cout << ">" << endl; } ace-8.0.4+dfsg.orig/ACEXML/parser/debug_validator/Debug_Element_Builder.h0000644000175000017500000000600015027201772025100 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Debug_Element_Builder.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_DEBUG_ELEMENT_BUILDER_H_ #define _ACEXML_DEBUG_ELEMENT_BUILDER_H_ #include /**/ "ace/pre.h" #include "ACEXML/parser/debug_validator/Debug_DTD_Manager_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/Element_Def_Builder.h" #include "ACEXML/parser/debug_validator/Element_Tree.h" /** * @class ACEXML_Debug_Element_Builder Debug_Element_Builder.h "parser/debug_validator/Debug_Element_Builder.h" * * This class prints out the element definition for debugging purpose. * * @todo This class is not namespace-aware. */ class ACEXML_DEBUG_DTD_MANAGER_Export ACEXML_Debug_Element_Builder : public ACEXML_Element_Def_Builder { public: ACEXML_Debug_Element_Builder (); virtual ~ACEXML_Debug_Element_Builder (); /** * Define the name of the element. * * @retval 0 if valid, -1 otherwise. */ virtual int setElementName (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName); /** * Define the content type of the element. * * @retval 0 if valid, -1 otherwise. */ virtual int setContentType (CONTENT_TYPE type); /** * Insert one more element into Mixed definition. */ virtual int insertMixedElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName); /** * Start a new group of children. */ virtual int startChildGroup (); /** * End a new group of children. * * @retval 0 on success. */ virtual int endChildGroup (CARDINALITY card); /** * Set the type of current child group to Choice. * * @retval 0 on success, -1 if the type of the child group has * already been set and this action conflicts with the previous * setting. */ virtual int setChoice (); /** * Set the type of current child group to Sequence. * * @retval 0 on success, -1 if the type of the child group has * already been set and this action conflicts with the previous * setting. */ virtual int setSequence (); /** * Insert an new element into the current child group. * * @retval 0 on success, -1 otherwise. */ virtual int insertElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName) ; /** * Dump the content of the attribute definition. */ virtual void dump (); private: CONTENT_TYPE type_; ACEXML_String element_; ACEXML_Element_Tree_List_Node *root_; ACEXML_Element_Tree_List_Stack active_list_; }; #include /**/ "ace/post.h" #endif /* _ACEXML_DEBUG_ELEMENT_BUILDER_H_ */ ace-8.0.4+dfsg.orig/ACEXML/parser/debug_validator/Element_Tree.cpp0000644000175000017500000000243415027201772023645 0ustar sudipsudip#include "ACEXML/parser/debug_validator/Element_Tree.h" #if !defined (__ACEXML_INLINE__) # include "ACEXML/parser/debug_validator/Element_Tree.inl" #endif /* __ACEXML_INLINE__ */ ACEXML_Element_Tree_Node::~ACEXML_Element_Tree_Node () { delete this->next_; } ACE_ALLOC_HOOK_DEFINE (ACEXML_Element_Tree_Node) void ACEXML_Element_Tree_Name_Node::dump () { cout << this->name_; } ACE_ALLOC_HOOK_DEFINE (ACEXML_Element_Tree_Name_Node) ACEXML_Element_Tree_List_Node::~ACEXML_Element_Tree_List_Node () { delete this->head_; } int ACEXML_Element_Tree_List_Node::insert (ACEXML_Element_Tree_Node *node) { if (this->head_ == 0) { this->tail_ = this->head_ = node; } else { this->tail_->next (node); this->tail_ = node; } return 0; } void ACEXML_Element_Tree_List_Node::dump () { ACEXML_Element_Tree_Node *ptr = this->head_; const ACEXML_Char *separator = (this->type_ == SEQUENCE) ? ACE_TEXT(" , ") : ACE_TEXT(" | "); cout << "("; if (ptr != 0) { ptr->dump (); ptr = ptr->next (); while (ptr != 0) { cout << separator; ptr->dump (); ptr->next (); } } cout << ")"; } ACE_ALLOC_HOOK_DEFINE (ACEXML_Element_Tree_List_Node) ACE_ALLOC_HOOK_DEFINE (ACEXML_Element_Tree_List_Stack) ace-8.0.4+dfsg.orig/ACEXML/parser/debug_validator/Debug_Attributes_Builder.h0000644000175000017500000001122215027201772025637 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Debug_Attributes_Builder.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_DEBUG_ATTRIBUTES_BUILDER_H_ #define _ACEXML_DEBUG_ATTRIBUTES_BUILDER_H_ #include /**/ "ace/pre.h" #include "ACEXML/parser/debug_validator/Debug_DTD_Manager_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/Attributes_Def_Builder.h" #include "ace/Hash_Map_Manager.h" #include "ace/Unbounded_Queue.h" typedef ACE_Unbounded_Queue ACEXML_STRING_QUEUE; typedef ACE_Unbounded_Queue_Iterator ACEXML_STRING_QUEUE_ITERATOR; /** * @class ACEXML_Debug_Attribute_Builder Debug_Attributes_Builder.h "parser/debug_validator/Debug_Attributes_Builder.h" * * This class prints out the Attribute definition for debugging purpose. */ class ACEXML_DEBUG_DTD_MANAGER_Export ACEXML_Debug_Attribute_Builder : public ACEXML_Attribute_Def_Builder { public: ACEXML_Debug_Attribute_Builder (); ACEXML_Debug_Attribute_Builder (const ACEXML_Debug_Attribute_Builder &rhs); virtual ~ACEXML_Debug_Attribute_Builder (); /** * Specify the name of the attribute. */ virtual int setName (const ACEXML_Char *n); virtual const ACEXML_Char *getName (); /** * Set the attribute type. */ virtual int setAttType (const ATT_TYPE type); /** * Insert an element for NOTATION or ENUMERATION type attribute. */ virtual int insertList (const ACEXML_Char *Name); /** * Set default attribute declaration. */ virtual int setDefault (const DEFAULT_DECL def, const ACEXML_Char *value); /** * Check validity of the current attribute definition being built. * * @retval 0 if the attribute is not a valid combo. */ virtual int validAttr (); /** * Dump the content of the attribute definition. */ virtual void dump (); private: /// Attribute name. ACEXML_String name_; /// Type of attribute. ATT_TYPE type_; /// Default value type. DEFAULT_DECL default_decl_; /// Default attribute value. ACEXML_String default_value_; /// Holds a queue of enumerated attribute values. ACEXML_STRING_QUEUE att_value_queue_; }; typedef ACE_Hash_Map_Entry ACEXML_ATT_MAP_ENTRY; typedef ACE_Hash_Map_Manager_Ex , ACE_Equal_To, ACE_Null_Mutex> ACEXML_ATT_MAP; typedef ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, ACE_Null_Mutex> ACEXML_ATT_MAP_ITER; typedef ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, ACE_Null_Mutex> ACEXML_ATT_MAP_REVERSE_ITER; /** * @class ACEXML_Debug_Attributes_Builder Debug_Attributes_Builder.h "parser/debug_validator/Debug_Attributes_Builder.h" * * This class prints out Attribute definitions for debugging purpose. */ class ACEXML_DEBUG_DTD_MANAGER_Export ACEXML_Debug_Attributes_Builder : public ACEXML_Attributes_Def_Builder { public: ACEXML_Debug_Attributes_Builder (); virtual ~ACEXML_Debug_Attributes_Builder (); /** * Set the element name that the attribute builder applies. * * @retval 0 if valid, -1 otherwise. */ virtual int setElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName ACEXML_ENV_ARG_DECL) ; /** * Acquire an Attribute_Builder. */ virtual ACEXML_Attribute_Def_Builder *getAttribute_Def_Builder (); /** * Add a definition for one attribute. */ virtual int insertAttribute (ACEXML_Attribute_Def_Builder *def ACEXML_ENV_ARG_DECL); /** * Dump the content of the attribute definition. */ virtual void dump (); protected: /// The name of the element type these attributes applied. ACEXML_String element_name_; /// Collection of attributes. ACEXML_ATT_MAP attributes_; }; #include /**/ "ace/post.h" #endif /* _ACEXML_DEBUG_ATTRIBUTES_BUILDER_H_ */ ace-8.0.4+dfsg.orig/ACEXML/parser/debug_validator/Debug_DTD_Manager.h0000644000175000017500000000426115027201772024115 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Debug_DTD_Manager.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_DEBUG_DTD_Manager_H_ #define _ACEXML_DEBUG_DTD_Manager_H_ #include /**/ "ace/pre.h" #include "ACEXML/parser/debug_validator/Debug_DTD_Manager_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/DTD_Manager.h" class ACEXML_DEBUG_DTD_MANAGER_Export ACEXML_Debug_DTD_Manager : public ACEXML_DTD_Manager { public: ACEXML_Debug_DTD_Manager (); virtual ~ACEXML_Debug_DTD_Manager (); /** * Acquire a pointer to an element definition builder. The XML parser use * this interface to acquire the definition builder and use the builder * to create the DTD element definition. The resulting builder is then * registered with the DTD Manager or destroyed if error occurred when the * builder encountered errors. * * @retval 0 if error occurs creating the builder. */ virtual ACEXML_Element_Def_Builder *getElement_Def_Builder (); /** * Insert a new element definition into the DTD Manager. * * @retval 0 if success, -1 if error. */ virtual int insertElement_Definition (ACEXML_Element_Def_Builder *def); /** * Acquire a pointer to an attributes definition builder. * */ virtual ACEXML_Attributes_Def_Builder *getAttribute_Def_Builder (); /** * Insert a new attributes definition into the DTD Manager. * * @retval 0 if success, -1 otherwise. */ virtual int insertAttributes_Definition (ACEXML_Attributes_Def_Builder *def); /** * Acquire an element validator to validate an XML element. * * @todo I haven't figured out what memory management scheme * we should use for the acquired validator. */ virtual ACEXML_Validator *getValidator (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName); }; #include /**/ "ace/post.h" #endif /* _ACEXML_DTD_Manager_H_ */ ace-8.0.4+dfsg.orig/ACEXML/tests/0000755000175000017500000000000015046037655015311 5ustar sudipsudipace-8.0.4+dfsg.orig/ACEXML/tests/ContentHandler_Test.cpp0000644000175000017500000000522315027201772021716 0ustar sudipsudip//============================================================================= /** * @file ContentHandler_Test.cpp * * @author Steve Huston */ //============================================================================= #include "ACEXML/common/DefaultHandler.h" #include "ACEXML/common/InputSource.h" #include "ACEXML/common/StrCharStream.h" #include "ACEXML/parser/parser/Parser.h" #include "ace/OS_NS_string.h" #include "ace/OS_main.h" class Basic_Content_Tester : public ACEXML_DefaultHandler { public: /** * Receive notification of character data. */ virtual void characters (const ACEXML_Char *ch, size_t start, size_t length); const ACEXML_Char *get_test_string () { return Basic_Content_Tester::test_string_; } private: static const ACEXML_Char *test_string_; }; const ACEXML_Char * Basic_Content_Tester::test_string_ = ACE_TEXT ("") ACE_TEXT ("Example\n") ACE_TEXT ("d'internationalisation"); void Basic_Content_Tester::characters (const ACEXML_Char *ch, size_t start, size_t length) { static bool already_called = false; static const ACEXML_Char *expect = ACE_TEXT ("Example\nd'internationalisation"); if (already_called) { throw ACEXML_SAXException (ACE_TEXT ("characters() called too much\n")); } already_called = true; size_t const expected_len = ACE_OS::strlen (expect); if (length != expected_len) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("characters() expected len %u (%*s); ") ACE_TEXT ("got %u (%*s)\n"), expected_len, expected_len, ch + start, length, length, ch + start)); throw ACEXML_SAXException (ACE_TEXT ("Functionality failure")); } } int ACE_TMAIN (int, ACE_TCHAR *[]) { int status = 0; Basic_Content_Tester tester; ACEXML_StrCharStream *test_stream = 0; ACE_NEW_RETURN (test_stream, ACEXML_StrCharStream, -1); if (test_stream->open (tester.get_test_string (), ACE_TEXT ("test_stream")) < 0) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Unable to create input stream\n"))); return -1; } ACEXML_InputSource input (test_stream); ACEXML_Parser parser; parser.setContentHandler (&tester); try { parser.setFeature (ACE_TEXT ("http://xml.org/sax/features/validation"), 0); parser.parse (&input); } catch (const ACEXML_SAXException& ex) { ex.print(); status = 1; } return status; } ace-8.0.4+dfsg.orig/ACEXML/tests/util/0000755000175000017500000000000015046037655016266 5ustar sudipsudipace-8.0.4+dfsg.orig/ACEXML/tests/util/util.mpc0000644000175000017500000000005515027201772017734 0ustar sudipsudipproject: aceexe, acexml { exename = test } ace-8.0.4+dfsg.orig/ACEXML/tests/util/test.cpp0000644000175000017500000000660515027201772017750 0ustar sudipsudip// A simple test for performance of the ACEXML_escape_string() function #include "ACEXML/common/XML_Util.h" #include "ace/OS_main.h" #include "ace/Time_Value.h" #include "ace/OS_NS_sys_time.h" #include "ace/Log_Msg.h" const int MAX_ITERATIONS = 100 * 1000; const int NUM_TEST_STRS = 6; static bool is_escaped(const ACEXML_String& s) { if (s[0] != ACE_TEXT('&')) return false; if (s[s.length() - 1] != ACE_TEXT(';')) return false; return true; } static int run_tests(ACEXML_String test_strings[NUM_TEST_STRS], int iterations) { // Test 1 - Escape the strings using a new temporary string each iteration. ACE_Time_Value start = ACE_OS::gettimeofday(); int i = 0; for (i = 0; i < iterations; ++i) { ACEXML_String tmp = ACEXML_escape_string(test_strings[i % NUM_TEST_STRS]); if (! is_escaped(tmp)) { ACE_ERROR((LM_ERROR, "Error: Failed to escape string\n")); return 1; } } ACE_DEBUG((LM_DEBUG, "Test1 took %dms\n", (ACE_OS::gettimeofday() - start).msec())); // Test 2 - Escape the strings using a shared temporary string. This shouldn't // be any faster than Test 1 as long as the compiler has return value optimization. ACEXML_String tmp; start = ACE_OS::gettimeofday(); for (i = 0; i < iterations; ++i) { tmp = ACEXML_escape_string(test_strings[i % NUM_TEST_STRS]); if (! is_escaped(tmp)) { ACE_ERROR((LM_ERROR, "Error: Failed to escape string\n")); return 1; } } ACE_DEBUG((LM_DEBUG, "Test2 took %dms\n", (ACE_OS::gettimeofday() - start).msec())); // Test 3 - Escape the strings using a shared temporary string. This time, we use // the alternate form of ACEXML_escape_string() so that our temporary buffer is reused. tmp.clear(1); start = ACE_OS::gettimeofday(); for (i = 0; i < iterations; ++i) { ACEXML_escape_string(test_strings[i % NUM_TEST_STRS], tmp); if (! is_escaped(tmp)) { ACE_ERROR((LM_ERROR, "Error: Failed to escape string\n")); return 1; } } ACE_DEBUG((LM_DEBUG, "Test3 took %dms\n", (ACE_OS::gettimeofday() - start).msec())); // Test 4 - Same as Test 3, except that the tmp buffer shouldn't have to resize. start = ACE_OS::gettimeofday(); for (i = 0; i < iterations; ++i) { ACEXML_escape_string(test_strings[i % NUM_TEST_STRS], tmp); if (! is_escaped(tmp)) { ACE_ERROR((LM_ERROR, "Error: Failed to escape string\n")); return 1; } } ACE_DEBUG((LM_DEBUG, "Test4 took %dms\n", (ACE_OS::gettimeofday() - start).msec())); return 0; } int ACE_TMAIN (int, ACE_TCHAR *[]) { ACEXML_String test_strings[NUM_TEST_STRS] = { ACE_TEXT("\"xxxxx\"xxxxxxxx xx\"xxxxxx xxxxxx\"xxxxxxxxxx xxxxxxxx\"xxxxxx\""), ACE_TEXT("'xxxxx\'xxxxxxxx' xxxxxxxx xx'xxxxxxxx'xxxxxx xxxxxxx'xxxxxxx'"), ACE_TEXT("&xxxx&xxxxxxxxx &xxxxxxxx xxxxx&xxxxxxxxxxx xxxx&xxxxxxxxxx&"), ACE_TEXT(">xx>xxxxxxxxxxx >xxxxxxxx xxxxx>xxxxxxxxxxx xxxxx>xxxxxxxxx>"), ACE_TEXT("xxxxxxx xx\"xxxxxxxxxxxx>"), }; if (run_tests(test_strings, MAX_ITERATIONS) != 0) return 1; ACE_DEBUG((LM_DEBUG, "Rerun tests with larger strings\n")); for (int i = 0; i < NUM_TEST_STRS; ++i) { for (int j = 0; j < 5; ++j) { test_strings[i] += test_strings[i]; } } if (run_tests(test_strings, MAX_ITERATIONS / 10) != 0) return 1; return 0; } ace-8.0.4+dfsg.orig/ACEXML/tests/HttpCharStream_Test.cpp0000644000175000017500000000157515027201772021705 0ustar sudipsudip#include "ACEXML/common/HttpCharStream.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_main.h" int ACE_TMAIN (int, ACE_TCHAR *[]) { const ACEXML_Char* test = ACE_TEXT("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"); const ACEXML_Char* simple = ACE_TEXT("http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent"); ACEXML_HttpCharStream first; ACEXML_HttpCharStream second; ACEXML_Char ch; if (first.open (test) != -1) { while (first.get (ch) != -1) ACE_OS::printf ("%c", ch); } else { first.close(); ACE_ERROR ((LM_ERROR, "Error in opening stream : %m\n")); } if (second.open (simple) != -1) { while (second.get (ch) != -1) ACE_OS::printf ("%c", ch); } else { second.close(); ACE_ERROR ((LM_ERROR, "Error in opening stream : %m\n")); } first.close(); second.close(); return 0; } ace-8.0.4+dfsg.orig/ACEXML/tests/NamespaceSupport_Test.cpp0000644000175000017500000001231015027201772022272 0ustar sudipsudip#include "ACEXML/common/NamespaceSupport.h" #include "ace/OS_main.h" int ACE_TMAIN (int, ACE_TCHAR *[]) { ACEXML_NamespaceSupport xmlns; if (xmlns.init() == -1) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Error in initializing namespace support."))); return 1; } xmlns.pushContext(); xmlns.declarePrefix(ACE_TEXT (""), ACE_TEXT ("http://www.w3.org/1999/xhtml")); xmlns.declarePrefix(ACE_TEXT ("dc"), ACE_TEXT ("http://www.purl.org/dc#")); xmlns.declarePrefix(ACE_TEXT ("xc"), ACE_TEXT ("http://www.purl.org/dc#")); const ACEXML_Char *lName, *uri; const ACEXML_Char *n1 = ACE_TEXT ("p"); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("*** Checking processName:\n"))); if (xmlns.processName (n1, uri, lName, 0) != 0) ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Fail to resolve namespace name %s\n"), n1)); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Namespace URI: %s\nLocal name: %s\nRaw name: %s\n"), uri, lName, n1)); const ACEXML_Char *n2 = ACE_TEXT ("dc:title"); if (xmlns.processName(n2, uri, lName, 0) != 0) ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Fail to resolve namespace name %S\n"), n2)); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Namespace URI: %s\nLocal name: %s\nRaw name: %s\n"), uri, lName, n2)); const ACEXML_Char *n3 = ACE_TEXT ("xml:title"); if (xmlns.processName(n3, uri, lName, 0) != 0) ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Fail to resolve namespace name %S\n"), n3)); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Namespace URI: %s\nLocal name: %s\nRaw name: %s\n"), uri, lName, n3)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n*** Checking getDeclaredPrefixes\n"))); ACEXML_STR_LIST prefixes; if (xmlns.getDeclaredPrefixes (prefixes) != 0) ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Fail to get a list of declared prefixes\n"))); else { ACEXML_STR_LIST::ITERATOR iter = prefixes.begin (); const ACEXML_Char **prefix = 0; for (; iter.next (prefix);iter.advance ()) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("prefix: \"%s\"\n"), *prefix)); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n*** Checking getPrefix\n"))); const ACEXML_Char *prefix = 0; if ((prefix = xmlns.getPrefix (ACE_TEXT ("http://www.purl.org/dc#"))) == 0) ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Fail to get prefix of http://www.purl.org/dc#\n"))); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Prefix of http://www.purl.org/dc# is %s\n"), prefix)); if ((prefix = xmlns.getPrefix (ACE_TEXT ("http://www.w3.org/1999/xhtml"))) == 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Fail to get prefix of http://www.w3.org/1999/xhtml which is okay\n"))); else ACE_DEBUG ((LM_ERROR, ACE_TEXT ("ERROR: Prefix of http://www.w3.org/1999/xhtml is %s\n"), prefix)); if ((prefix = xmlns.getPrefix (ACE_TEXT ("http://www.w3.org/XML/1998/namespace"))) == 0) ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Fail to get prefix of http://www.w3.org/XML/1998/namespace\n"))); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Prefix of http://www.w3.org/XML/1998/namespace is %s\n"), prefix)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n*** Checking getPrefixes with known URI\n"))); prefixes.reset (); if (xmlns.getPrefixes (ACE_TEXT ("http://www.purl.org/dc#"), prefixes) != 0) ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Fail to getPrefixes based on known URI\n"))); else { ACEXML_STR_LIST::ITERATOR iter = prefixes.begin (); const ACEXML_Char **prefix = 0; for (; iter.next (prefix);iter.advance ()) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("prefix: \"%s\"\n"), *prefix)); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n*** Checking getPrefixes\n"))); prefixes.reset (); if (xmlns.getPrefixes (prefixes) != 0) ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Fail to getPrefixes\n"))); else { ACEXML_STR_LIST::ITERATOR iter = prefixes.begin (); const ACEXML_Char **prefix = 0; for (; iter.next (prefix);iter.advance ()) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("prefix: \"%s\"\n"), *prefix)); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n*** Checking getURI\n"))); const ACEXML_Char *URI = 0; if ((URI = xmlns.getURI (ACE_TEXT ("dc"))) == 0) ACE_DEBUG((LM_ERROR, ACE_TEXT ("Fail to get URI for \"dc\"\n"))); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("URI for \"dc\" is %s\n"), URI)); if ((URI = xmlns.getURI (ACE_TEXT ("xc"))) == 0) ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Fail to get URI for \"xc\"\n"))); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("URI for \"xc\" is %s\n"), URI)); if ((URI = xmlns.getURI (ACE_TEXT ("xml"))) == 0) ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Fail to get URI for \"xml\"\n"))); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("URI for \"xml\" is %s\n"), URI)); if ((URI = xmlns.getURI (ACE_TEXT (""))) == 0) ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Fail to get default namespace URI\n"))); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("URI for default namespace is %s\n"), URI)); xmlns.popContext(); return 0; } ace-8.0.4+dfsg.orig/ACEXML/tests/Transcoder_Test.cpp0000644000175000017500000000313115027201772021106 0ustar sudipsudip// -*- C++ -*- #include "ACEXML/common/Transcode.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_string.h" #include "ace/OS_main.h" void dump_utf16 (const ACEXML_UTF16 *data, size_t len) { size_t ptr = 0; while (1) { ACE_DEBUG ((LM_DEBUG, "%04x", data[ptr])); if (++ptr >= len) break; if (ptr % 4 == 0) ACE_DEBUG ((LM_DEBUG, "\n")); else ACE_DEBUG ((LM_DEBUG, " ")); } ACE_DEBUG ((LM_DEBUG, "\n")); return; } int ACE_TMAIN (int, ACE_TCHAR*[]) { ACEXML_UTF16 org [18]; // = { 1, 2, 4, 8, 0x10, 0x20, 0x40, // 0x80, // 0x100, 0x200, 0x400, // 0x800, 0x801, 0x802, 0x804, 0x808, 0x810, 0x820, // 0x840, 0x880, 0x900, 0xa00, 0xc00, // 0x1000, 0x2000, 0x4000, 0x8000, 0 } ACEXML_UCS4 temp = 1; ACE_OS::memset (org, 0, sizeof org); size_t x; for (x = 0; temp < 0x10000; x++, temp <<= 1) { org[x] = static_cast (temp); } ACE_DEBUG ((LM_DEBUG, "Original UTF16 string:\n")); dump_utf16 (org, x); ACE_DEBUG ((LM_DEBUG, "\n\n")); ACEXML_UTF8 decoded [MAXPATHLEN]; ACE_OS::memset (decoded, 0, sizeof decoded); ACEXML_Transcoder::utf16s2utf8s (org, decoded, MAXPATHLEN); ACE_DEBUG ((LM_DEBUG, "Transcoded UTF8 string:\n")); ACE_HEX_DUMP ((LM_DEBUG, decoded, ACE_OS::strlen (decoded) + 1)); ACE_DEBUG ((LM_DEBUG, "\n\n")); ACEXML_UTF16 after [18]; ACE_OS::memset (after, 0, sizeof after); ACEXML_Transcoder::utf8s2utf16s (decoded, after, 18); ACE_DEBUG ((LM_DEBUG, "Restored UTF16 string:\n")); dump_utf16 (after, x); ACE_DEBUG ((LM_DEBUG, "\n\n")); return 0; } ace-8.0.4+dfsg.orig/ACEXML/tests/tests.mpc0000644000175000017500000000102515027201772017142 0ustar sudipsudip// -*- MPC -*- project(Transcoder_Test): aceexe, acexml { exename = Transcoder_Test Source_Files { Transcoder_Test.cpp } } project(NamespaceSupport_Test): aceexe, acexml { exename = NamespaceSupport_Test Source_Files { NamespaceSupport_Test.cpp } } project(HttpCharStream_Test): aceexe, acexml { exename = HttpCharStream_Test Source_Files { HttpCharStream_Test.cpp } } project(ContentHandler_Test): aceexe, acexml { exename = ContentHandler_Test Source_Files { ContentHandler_Test.cpp } } ace-8.0.4+dfsg.orig/ACEXML/apps/0000755000175000017500000000000015046037655015112 5ustar sudipsudipace-8.0.4+dfsg.orig/ACEXML/apps/svcconf/0000755000175000017500000000000015046037655016553 5ustar sudipsudipace-8.0.4+dfsg.orig/ACEXML/apps/svcconf/ACEXML_XML_Svc_Conf_Parser.pc.in0000644000175000017500000000042715027201772024264 0ustar sudipsudipprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: ACEXML_XML_Svc_Conf_Parser Description: ACE XML Service Configurator Parser Requires: ACEXML_Parser Version: @VERSION@ Libs: -L${libdir} -lACEXML_XML_Svc_Conf_Parser Cflags: -I${includedir} ace-8.0.4+dfsg.orig/ACEXML/apps/svcconf/Svcconf.h0000644000175000017500000000164615027201772020324 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Svcconf.h * * @author Nanbor Wang */ //============================================================================= #ifndef ACEXML_SVCCONF_H #define ACEXML_SVCCONF_H #include /**/ "ace/pre.h" #include "ace/XML_Svc_Conf.h" #include "ACEXML/parser/parser/Parser.h" #include "Svcconf_Handler.h" #if (ACE_USES_CLASSIC_SVC_CONF == 0) class ACEXML_Svcconf_Parser : public ACE_XML_Svc_Conf { public: ACEXML_Svcconf_Parser (); virtual ~ACEXML_Svcconf_Parser (); virtual int parse_file (const ACE_TCHAR file[]); virtual int parse_string (const ACE_TCHAR str[]); protected: ACEXML_Parser parser_; ACEXML_Svcconf_Handler svcconf_handler_; ACEXML_InputSource input_stream_; }; #endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */ #include /**/ "ace/post.h" #endif /* ACEXML_SVCCONF_H */ ace-8.0.4+dfsg.orig/ACEXML/apps/svcconf/svcconf.dtd0000644000175000017500000000470615027201772020710 0ustar sudipsudip ace-8.0.4+dfsg.orig/ACEXML/apps/svcconf/Svcconf.cpp0000644000175000017500000000510715027201772020653 0ustar sudipsudip #include "Svcconf.h" #include "ACEXML/common/FileCharStream.h" #include "ACEXML/common/StrCharStream.h" #include "ACEXML/parser/parser/Parser.h" #if (ACE_USES_CLASSIC_SVC_CONF == 0) extern "C" ACE_Proper_Export_Flag ACE_XML_Svc_Conf * _ACEXML_create_XML_Svc_Conf_Object () { ACE_XML_Svc_Conf *retp = 0; ACE_NEW_RETURN (retp, ACEXML_Svcconf_Parser (), 0); return retp; } ACEXML_Svcconf_Parser::ACEXML_Svcconf_Parser () { this->parser_.setContentHandler (&this->svcconf_handler_); this->parser_.setDTDHandler (&this->svcconf_handler_); this->parser_.setErrorHandler (&this->svcconf_handler_); this->parser_.setEntityResolver (&this->svcconf_handler_); try { this->parser_.setFeature (ACE_TEXT ("http://xml.org/sax/features/validation"), 0); } catch (const ACEXML_SAXException& ex) { ex.print (); // Can't do much except printing the error. } } ACEXML_Svcconf_Parser::~ACEXML_Svcconf_Parser () { } int ACEXML_Svcconf_Parser::parse_file (const ACE_TCHAR file[]) { if (file == 0) ACE_ERROR_RETURN ((LM_ERROR, "ACEXML_Svcconf_Parser: No filename specified\n"), -1); ACEXML_FileCharStream *fstm = 0; ACE_NEW_RETURN (fstm, ACEXML_FileCharStream (), 1); if (fstm->open (file) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("ACEXML_Svcconf_Parser: Fail to open XML file: %s\n"), file), -1); this->input_stream_.setCharStream (fstm); try { this->parser_.parse (&this->input_stream_); } catch (const ACEXML_SAXException& ex) { ex.print (); return -1; } return 0; } int ACEXML_Svcconf_Parser::parse_string (const ACE_TCHAR str[]) { if (str == 0) ACE_ERROR_RETURN ((LM_ERROR, "ACEXML_Svcconf_Parser: Can't parse a null string\n"), -1); ACEXML_StrCharStream *stm = 0; ACE_NEW_RETURN (stm, ACEXML_StrCharStream, -1); if (stm->open (str, ACE_TEXT ("Svcconf")) < 0) ACE_ERROR_RETURN ((LM_ERROR, "ACEXML_Svcconf_Parser: Unable to create " "input stream.\n"), -1); this->input_stream_.setCharStream (stm); try { this->parser_.parse (&this->input_stream_); } catch (const ACEXML_SAXException& ex) { // If there was a problem parsing the stream, set the errno // to EINVAL to indicate to upper levels that the stream was // invalid. ACE_OS::last_error (EINVAL); ex.print (); return -1; } return 0; } #endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */ ace-8.0.4+dfsg.orig/ACEXML/apps/svcconf/ACEXML_XML_Svc_Conf_Parser.rc0000644000175000017500000000160215027201772023655 0ustar sudipsudip#include "../../../ace/Version.h" 1 VERSIONINFO FILEVERSION ACE_MAJOR_VERSION,ACE_MINOR_VERSION,ACE_MICRO_VERSION,0 PRODUCTVERSION ACE_MAJOR_VERSION,ACE_MINOR_VERSION,ACE_MICRO_VERSION,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x4L FILETYPE 0x1L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904B0" BEGIN VALUE "FileDescription", "ACEXML_XML_Svc_Conf_Parser\0" VALUE "FileVersion", ACE_VERSION "\0" VALUE "InternalName", "ACEXML_XML_Svc_Conf_ParserDLL\0" VALUE "LegalCopyright", "\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "ACEXML_XML_Svc_Conf_Parser.DLL\0" VALUE "ProductName", "ACE\0" VALUE "ProductVersion", ACE_VERSION "\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END ace-8.0.4+dfsg.orig/ACEXML/apps/svcconf/Svcconf_Handler.cpp0000644000175000017500000006151515027201772022315 0ustar sudipsudip#include "Svcconf_Handler.h" #include "ace/ACE.h" #include "ace/Log_Msg.h" #include "ace/Service_Config.h" #include "ace/Service_Types.h" #include "ace/Service_Repository.h" #include "ace/Service_Gestalt.h" #include "ace/DLL.h" #include "ace/ARGV.h" #include "ace/Module.h" #include "ace/OS_NS_strings.h" #include "ace/SString.h" #if (ACE_USES_CLASSIC_SVC_CONF == 0) #if !defined (__ACEXML_INLINE__) # include "Svcconf_Handler.inl" #endif /* __ACEXML_INLINE__ */ ACEXML_Svcconf_Handler::ACEXML_Svcconf_Handler () : in_stream_def_ (0), in_module_ (0), stream_svc_type_ (0), stream_ (0) { } ACEXML_Svcconf_Handler::~ACEXML_Svcconf_Handler () { } void ACEXML_Svcconf_Handler::characters (const ACEXML_Char *, int, int) { } void ACEXML_Svcconf_Handler::endDocument () { } void ACEXML_Svcconf_Handler::endElement (const ACEXML_Char *, const ACEXML_Char *, const ACEXML_Char *qName) { if (ACE_OS::strcmp (qName, ACE_TEXT ("dynamic")) == 0) { ACE_Parsed_Info *active_info = (this->in_stream_def_ == 0 ? &this->parsed_info_ : &this->stream_info_); // We must allocate a string here to ensure that the // name is still available by the time the // ACE_Service_Type_Dynamic_Guard is destructed. ACE_TString name = active_info->name (); ACE_Service_Type_Dynamic_Guard dummy ( *ACE_Service_Config::current ()->current_service_repository (), name.c_str ()); ACE_DLL svc_dll; if (svc_dll.open (active_info->path ()) == -1) { // build the error message ACE_TString msg (ACE_TEXT ("Cannot locate DLL: '")); msg += ACE_TString (active_info->path ()); msg += ACE_TString (ACE_TEXT ("' for entity '")); msg += ACE_TString (active_info->name ()); msg += ACE_TString (ACE_TEXT ("'\n")); throw ACEXML_SAXException (msg.c_str ()); } void *(*func) (ACE_Service_Object_Exterminator *) = 0; ACE_Service_Object_Exterminator gobbler = 0; void *symbol = 0; long temp_ptr = reinterpret_cast (svc_dll.symbol (active_info->init_func ())); func = reinterpret_cast (temp_ptr); if (func == 0) { // build the error message ACE_TString msg (ACE_TEXT ("Cannot locate init function: '")); msg += ACE_TString (active_info->init_func ()); msg += ACE_TString (ACE_TEXT ("' for entity '")); msg += ACE_TString (active_info->name ()); msg += ACE_TString (ACE_TEXT ("'\n")); throw ACEXML_SAXException (msg.c_str ()); } symbol = (*func)(&gobbler); // target object created in the loaded DLL. ACE_Service_Type_Impl *stp = ACE_Service_Config::create_service_type_impl (active_info->name (), active_info->service_type (), symbol, ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, gobbler); if (this->in_stream_def_) { // ACE_DEBUG ((LM_INFO, ACE_TEXT ("Create dynamic %s for stream\n"), // this->stream_info_.name ())); if (active_info->service_type () == ACE_Service_Type::STREAM) { this->stream_ = (ACE_Stream_Type *) stp; } else { // We will not retain this stream delete stp; // build the error message ACE_TString msg (ACE_TEXT ("Expecting Stream type in stream header")); msg += ACE_TString (ACE_TEXT (" for entity '")); msg += ACE_TString (active_info->name ()); msg += ACE_TString (ACE_TEXT ("'\n")); throw ACEXML_SAXException (msg.c_str ()); } this->stream_svc_type_ = ACE_Service_Config::create_service_type (this->stream_info_.name (), this->stream_, svc_dll, this->stream_info_.active ()); } else { if (this->in_module_) { ACE_ARGV args (active_info->init_params ()); ACE_Module_Type *mt = (ACE_Module_Type *) stp; ACE_Module *mp = (ACE_Module *) mt->object (); if (ACE_OS::strcmp (mp->name (), active_info->name ()) != 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("warning: assigning Module_Type name %s to Module %s since names differ\n"), active_info->name (), mp->name ())); mp->name (active_info->name ()); } if (mt->init (args.argc (), args.argv ()) == -1 || this->stream_->push (mt) == -1) { // build the error message ACE_TString msg (ACE_TEXT ("Error initializing module")); msg += ACE_TString (ACE_TEXT (" for entity '")); msg += ACE_TString (active_info->name ()); msg += ACE_TString (ACE_TEXT ("'\n")); throw ACEXML_SAXException (msg.c_str ()); } // ACE_DEBUG ((LM_INFO, ACE_TEXT ("Push dynamic %s into stream %s\n"), // this->parsed_info_.name (), // this->stream_info_.name ())); } else { ACE_Service_Type *stype = ACE_Service_Config::create_service_type (active_info->name (), stp, svc_dll, active_info->active ()); // @@ Check error here. // ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply dynamic %s\n"), // this->parsed_info_.name ())); if (ACE_Service_Config::initialize (stype, active_info->init_params ()) == -1) { // If it did not initialize correctly, the // ACE_Service_Config doesn't own this object delete stype; // build the error message ACE_TString msg (ACE_TEXT ("Failed to initialize dynamic service")); msg += ACE_TString (ACE_TEXT (" for entity '")); msg += ACE_TString (active_info->name ()); msg += ACE_TString (ACE_TEXT ("'\n")); throw ACEXML_SAXException (msg.c_str ()); } } this->parsed_info_.reset (); } } else if (ACE_OS::strcmp (qName, ACE_TEXT ("static")) == 0) { if (this->in_stream_def_) { // @@ Couldn't make sense out of the original Svc_Conf.y. ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Create static %s for stream\n"), this->stream_info_.name ())); } else { if (this->in_module_) { // @@ Couldn't make sense out of the original Svc_Conf.y. ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Push static %s into stream %s\n"), this->parsed_info_.name (), this->stream_info_.name ())); } else { // ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply static %s\n"), // this->parsed_info_.name ())); if (ACE_Service_Config::initialize (this->parsed_info_.name (), this->parsed_info_.init_params ()) == -1) { // build the error message ACE_TString msg (ACE_TEXT ("Failed to initialize static service")); msg += ACE_TString (ACE_TEXT (" for entity '")); msg += ACE_TString (this->parsed_info_.name ()); msg += ACE_TString (ACE_TEXT ("'\n")); throw ACEXML_SAXException (msg.c_str ()); } } this->parsed_info_.reset (); } } else if (ACE_OS::strcmp (qName, ACE_TEXT ("module")) == 0) { this->in_module_ = 0; } else if (ACE_OS::strcmp (qName, ACE_TEXT ("streamdef")) == 0) { // ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply stream %s of type %s\n"), // this->stream_info_.name (), // this->stream_info_.name ())); ACE_Service_Config::initialize (this->stream_svc_type_, this->stream_info_.init_params ()); this->stream_info_.reset (); this->stream_svc_type_ = 0; this->stream_ = 0; } else if (ACE_OS::strcmp (qName, ACE_TEXT ("stream")) == 0) { // ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply stream %s of type %s\n"), // this->stream_info_.name (), // this->stream_info_.name ())); this->stream_info_.reset (); } else { } } void ACEXML_Svcconf_Handler::endPrefixMapping (const ACEXML_Char *) { } void ACEXML_Svcconf_Handler::ignorableWhitespace (const ACEXML_Char *, int, int) { } void ACEXML_Svcconf_Handler::processingInstruction (const ACEXML_Char *, const ACEXML_Char *) { } void ACEXML_Svcconf_Handler::setDocumentLocator (ACEXML_Locator* locator) { this->locator_ = locator; } void ACEXML_Svcconf_Handler::skippedEntity (const ACEXML_Char *) { } void ACEXML_Svcconf_Handler::startDocument () { } void ACEXML_Svcconf_Handler::startElement (const ACEXML_Char *, const ACEXML_Char *, const ACEXML_Char *qName, ACEXML_Attributes *alist) { if (ACE_OS::strcmp (qName, ACE_TEXT ("dynamic")) == 0) { this->get_dynamic_attrs (alist); } else if (ACE_OS::strcmp (qName, ACE_TEXT ("initializer")) == 0) { this->get_initializer_attrs (alist); } else if (ACE_OS::strcmp (qName, ACE_TEXT ("static")) == 0) { this->get_static_attrs (alist); } else if (ACE_OS::strcmp (qName, ACE_TEXT ("stream")) == 0) { this->get_stream_id (alist); if (ACE_Service_Repository::instance()->find (this->stream_info_.name (), (const ACE_Service_Type **) &this->stream_svc_type_) == -1) { // build the error message ACE_TString msg (ACE_TEXT ("Cannot find stream '")); msg += ACE_TString (this->stream_info_.name ()); msg += ACE_TString (ACE_TEXT ("'\n")); throw ACEXML_SAXException (msg.c_str ()); } this->stream_ = this->stream_svc_type_ == 0 ? 0 : dynamic_cast (const_cast (this->stream_svc_type_->type ())); // ACE_DEBUG ((LM_INFO, ACE_TEXT ("Retrieve stream %s from repository\n"), // this->stream_info_.name ())); } else if (ACE_OS::strcmp (qName, ACE_TEXT ("streamdef")) == 0) { this->in_stream_def_ = 1; // @@ Set up stream service object } else if (ACE_OS::strcmp (qName, ACE_TEXT ("module")) == 0) { this->in_stream_def_ = 0; this->in_module_ = 1; } else if (ACE_OS::strcmp (qName, ACE_TEXT ("resume")) == 0) { this->get_id (alist); if (this->in_module_) { // ACE_DEBUG ((LM_INFO, ACE_TEXT ("Resume %s in stream %s\n"), // this->parsed_info_.name (), // this->stream_info_.name ())); ACE_Module_Type *mt = (this->stream_ == 0) ? 0 : this->stream_->find (this->parsed_info_.name ()); if (mt == 0) { // build the error message ACE_TString msg (ACE_TEXT ("Can't locate module '")); msg += ACE_TString (this->parsed_info_.name ()); msg += ACE_TString (ACE_TEXT ("'\n")); throw ACEXML_SAXException (msg.c_str ()); } mt->resume (); } else { // ACE_DEBUG ((LM_INFO, ACE_TEXT ("Resume %s\n"), // this->parsed_info_.name ())); if (ACE_Service_Config::resume (this->parsed_info_.name ()) == -1) { // build the error message ACE_TString msg (ACE_TEXT ("Resume failed")); msg += ACE_TString (ACE_TEXT (" for entity '")); msg += ACE_TString (this->parsed_info_.name ()); msg += ACE_TString (ACE_TEXT ("'\n")); throw ACEXML_SAXException (msg.c_str ()); } } this->parsed_info_.reset (); } else if (ACE_OS::strcmp (qName, ACE_TEXT ("suspend")) == 0) { this->get_id (alist); if (this->in_module_) { // ACE_DEBUG ((LM_INFO, ACE_TEXT ("Suspend %s in stream %s\n"), // this->parsed_info_.name (), // this->stream_info_.name ())); ACE_Module_Type *mt = (this->stream_ == 0) ? 0 : this->stream_->find (this->parsed_info_.name ()); if (mt == 0) { // build the error message ACE_TString msg (ACE_TEXT ("Can't locate module '")); msg += ACE_TString (this->parsed_info_.name ()); msg += ACE_TString (ACE_TEXT ("'\n")); throw ACEXML_SAXException (msg.c_str ()); } mt->suspend (); } else { // ACE_DEBUG ((LM_INFO, ACE_TEXT ("Suspend %s\n"), // this->parsed_info_.name ())); if (ACE_Service_Config::suspend (this->parsed_info_.name ()) == -1) { // build the error message ACE_TString msg (ACE_TEXT ("Suspend failed")); msg += ACE_TString (ACE_TEXT (" for entity '")); msg += ACE_TString (this->parsed_info_.name ()); msg += ACE_TString (ACE_TEXT ("'\n")); throw ACEXML_SAXException (msg.c_str ()); } } this->parsed_info_.reset (); } else if (ACE_OS::strcmp (qName, ACE_TEXT ("remove")) == 0) { this->get_id (alist); if (this->in_module_) { // ACE_DEBUG ((LM_INFO, ACE_TEXT ("Remove %s in stream %s\n"), // this->parsed_info_.name (), // this->stream_info_.name ())); ACE_Module_Type *mt = (this->stream_ == 0) ? 0 : this->stream_->find (this->parsed_info_.name ()); if (mt == 0) { // build the error message ACE_TString msg (ACE_TEXT ("Can't locate module '")); msg += ACE_TString (this->parsed_info_.name ()); msg += ACE_TString (ACE_TEXT ("'\n")); throw ACEXML_SAXException (msg.c_str ()); } this->stream_->remove (mt); } else { // ACE_DEBUG ((LM_INFO, ACE_TEXT ("Remove %s\n"), // this->parsed_info_.name ())); if (ACE_Service_Config::remove (this->parsed_info_.name ()) == -1) { // build the error message ACE_TString msg (ACE_TEXT ("Remove failed")); msg += ACE_TString (ACE_TEXT (" for entity '")); msg += ACE_TString (this->parsed_info_.name ()); msg += ACE_TString (ACE_TEXT ("'\n")); throw ACEXML_SAXException (msg.c_str ()); } } this->parsed_info_.reset (); } else if (ACE_OS::strcmp (qName, ACE_TEXT ("ACE_Svc_Conf")) == 0) { // Main document tag. no-op. // ACE_DEBUG ((LM_INFO, ACE_TEXT ("ACE_Svc_Conf tag\n"))); } else { // @@ Error. Perhaps we should relay to user event handler here, if available. } return; } void ACEXML_Svcconf_Handler::startPrefixMapping (const ACEXML_Char *, const ACEXML_Char *) { // No-op. } // *** Methods inherit from ACEXML_DTDHandler. void ACEXML_Svcconf_Handler::notationDecl (const ACEXML_Char *, const ACEXML_Char *, const ACEXML_Char *) { // No-op. } void ACEXML_Svcconf_Handler::unparsedEntityDecl (const ACEXML_Char *, const ACEXML_Char *, const ACEXML_Char *, const ACEXML_Char *) { // No-op. } // Methods inherit from ACEXML_EnitityResolver. ACEXML_InputSource * ACEXML_Svcconf_Handler::resolveEntity (const ACEXML_Char *, const ACEXML_Char *) { // No-op. return 0; } // Methods inherit from ACEXML_ErrorHandler. /* * Receive notification of a recoverable error. */ void ACEXML_Svcconf_Handler::error (ACEXML_SAXParseException& ex) { ACE_DEBUG ((LM_DEBUG, "%s: line :%d col: %d ", this->locator_->getSystemId(), this->locator_->getLineNumber(), this->locator_->getColumnNumber())); ex.print(); } void ACEXML_Svcconf_Handler::fatalError (ACEXML_SAXParseException& ex) { ACE_DEBUG ((LM_DEBUG, "%s: line :%d col: %d ", this->locator_->getSystemId(), this->locator_->getLineNumber(), this->locator_->getColumnNumber())); ex.print(); } void ACEXML_Svcconf_Handler::warning (ACEXML_SAXParseException& ex) { ACE_DEBUG ((LM_DEBUG, "%s: line :%d col: %d ", this->locator_->getSystemId(), this->locator_->getLineNumber(), this->locator_->getColumnNumber())); ex.print(); } int ACEXML_Svcconf_Handler::get_stream_id (ACEXML_Attributes *alist) { if (alist != 0) for (size_t i = 0; i < alist->getLength (); ++i) { if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0) { this->stream_info_.name (alist->getValue (i)); } else { // build the error message ACE_TString msg (ACE_TEXT ("Invalid stream attribute '")); msg += ACE_TString (alist->getQName (i)); msg += ACE_TString (ACE_TEXT ("' for entity '")); msg += ACE_TString (this->stream_info_.name ()); msg += ACE_TString (ACE_TEXT ("'\n")); throw ACEXML_SAXException (msg.c_str ()); } } return 0; } int ACEXML_Svcconf_Handler::get_id (ACEXML_Attributes *alist) { if (alist != 0) for (size_t i = 0; i < alist->getLength (); ++i) { if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0) { this->parsed_info_.name (alist->getValue (i)); } else { // build the error message ACE_TString msg (ACE_TEXT ("Invalid attribute '")); msg += ACE_TString (alist->getQName (i)); msg += ACE_TString (ACE_TEXT ("', expecting 'id'")); msg += ACE_TString (ACE_TEXT (" for entity '")); msg += ACE_TString (this->parsed_info_.name ()); msg += ACE_TString (ACE_TEXT ("'\n")); throw ACEXML_SAXException (msg.c_str ()); } } return 0; } int ACEXML_Svcconf_Handler::get_dynamic_attrs (ACEXML_Attributes *alist) { if (alist != 0) { ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ? &this->parsed_info_ : &this->stream_info_); for (size_t i = 0; i < alist->getLength (); ++i) { if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0) { info->name (alist->getValue (i)); } else if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("status")) == 0) { if (ACE_OS::strcmp (alist->getValue (i), ACE_TEXT ("inactive")) == 0) { info->active (0); } else if (ACE_OS::strcmp (alist->getValue (i), ACE_TEXT ("active")) == 0) { info->active (1); } else { // build the error message ACE_TString msg (ACE_TEXT ("Invalid attribute value '")); msg += ACE_TString (alist->getQName (i)); msg += ACE_TString (ACE_TEXT ("', expecting 'active' or 'inactive'")); msg += ACE_TString (ACE_TEXT (" for entity '")); msg += ACE_TString (info->name ()); msg += ACE_TString (ACE_TEXT ("'\n")); throw ACEXML_SAXException (msg.c_str ()); } } else if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("type")) == 0) { if (ACE_OS::strcasecmp (alist->getValue (i), ACE_TEXT ("service_object")) == 0) { info->service_type (ACE_Service_Type::SERVICE_OBJECT); } else if (ACE_OS::strcasecmp (alist->getValue (i), ACE_TEXT ("stream")) == 0) { info->service_type (ACE_Service_Type::STREAM); } else if (ACE_OS::strcasecmp (alist->getValue (i), ACE_TEXT ("module")) == 0) { info->service_type (ACE_Service_Type::MODULE); } else { // build the error message ACE_TString msg (ACE_TEXT ("Invalid Service_Object attribute value'")); msg += ACE_TString (alist->getQName (i)); msg += ACE_TString (ACE_TEXT ("' for entity '")); msg += ACE_TString (info->name ()); msg += ACE_TString (ACE_TEXT ("'\n")); throw ACEXML_SAXException (msg.c_str ()); } } else { // build the error message ACE_TString msg (ACE_TEXT ("Invalid attribute'")); msg += ACE_TString (alist->getQName (i)); msg += ACE_TString (ACE_TEXT ("' for entity '")); msg += ACE_TString (info->name ()); msg += ACE_TString (ACE_TEXT ("'\n")); throw ACEXML_SAXException (msg.c_str ()); } } } return 0; } int ACEXML_Svcconf_Handler::get_initializer_attrs (ACEXML_Attributes *alist) { if (alist != 0) { ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ? &this->parsed_info_ : &this->stream_info_); for (size_t i = 0; i < alist->getLength (); ++i) { if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("init")) == 0) { info->init_func (alist->getValue (i)); } else if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("path")) == 0) { info->path (alist->getValue (i)); } else if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("params")) == 0) { info->init_params (alist->getValue (i)); } else { // build the error message ACE_TString msg (ACE_TEXT ("Invalid initializer attribute'")); msg += ACE_TString (alist->getQName (i)); msg += ACE_TString (ACE_TEXT ("' for entity '")); msg += ACE_TString (info->name ()); msg += ACE_TString (ACE_TEXT ("'\n")); throw ACEXML_SAXException (msg.c_str ()); } } } return 0; } int ACEXML_Svcconf_Handler::get_static_attrs (ACEXML_Attributes *alist) { if (alist != 0) { ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ? &this->parsed_info_ : &this->stream_info_); for (size_t i = 0; i < alist->getLength (); ++i) { if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0) { info->name (alist->getValue (i)); } else if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("params")) == 0) { info->init_params (alist->getValue (i)); } else { // build the error message ACE_TString msg (ACE_TEXT ("Invalid static attribute '")); msg += ACE_TString (alist->getQName (i)); msg += ACE_TString (ACE_TEXT ("' for entity '")); msg += ACE_TString (info->name ()); msg += ACE_TString (ACE_TEXT ("'\n")); throw ACEXML_SAXException (msg.c_str ()); } } } return 0; } #endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */ ace-8.0.4+dfsg.orig/ACEXML/apps/svcconf/README0000644000175000017500000000013615027201772017423 0ustar sudipsudip This directory implement a DLL that contains the parser for XML based service configurator. ace-8.0.4+dfsg.orig/ACEXML/apps/svcconf/Svcconf_Handler.inl0000644000175000017500000000407315027201772022311 0ustar sudipsudip// -*- C++ -*- ACE_INLINE ACE_Parsed_Info::ACE_Parsed_Info () : name_ (0), service_type_ (ACE_Service_Type::INVALID_TYPE), active_ (1), path_ (0), init_func_ (0), init_params_ (0) { } ACE_INLINE ACE_Parsed_Info::~ACE_Parsed_Info () { delete[] this->name_; delete[] this->path_; delete[] this->init_func_; delete[] this->init_params_; } ACE_INLINE int ACE_Parsed_Info::name (const ACEXML_Char *n) { if (this->name_ == 0) { this->name_ = ACE::strnew (n); return 0; } return -1; } ACE_INLINE const ACEXML_Char * ACE_Parsed_Info::name () { return this->name_; } ACE_INLINE int ACE_Parsed_Info::service_type (int type) { if (this->service_type_ == -1) { this->service_type_ = type; return 0; } return -1; } ACE_INLINE int ACE_Parsed_Info::service_type () { return this->service_type_; } ACE_INLINE int ACE_Parsed_Info::active (int a) { this->active_ = a; return 0; } ACE_INLINE int ACE_Parsed_Info::active () { return this->active_; } ACE_INLINE int ACE_Parsed_Info::path (const ACEXML_Char *p) { if (this->path_ == 0) { this->path_ = ACE::strnew (p); return 0; } return -1; } ACE_INLINE const ACEXML_Char * ACE_Parsed_Info::path () { return this->path_; } ACE_INLINE int ACE_Parsed_Info::init_func (const ACEXML_Char *n) { if (this->init_func_ == 0) { this->init_func_ = ACE::strnew (n); return 0; } return -1; } ACE_INLINE const ACEXML_Char * ACE_Parsed_Info::init_func () { return this->init_func_; } ACE_INLINE int ACE_Parsed_Info::init_params (const ACEXML_Char *n) { if (this->init_params_ == 0) { this->init_params_ = ACE::strnew (n); return 0; } return -1; } ACE_INLINE const ACEXML_Char * ACE_Parsed_Info::init_params () { return this->init_params_; } ACE_INLINE void ACE_Parsed_Info::reset () { delete[] this->name_; this->name_ = 0; this->service_type_ = -1; delete[] this->path_; this->path_ = 0; delete[] this->init_func_; this->init_func_ = 0; delete[] this->init_params_; this->init_params_ = 0; } ace-8.0.4+dfsg.orig/ACEXML/apps/svcconf/svcconf.mpc0000644000175000017500000000030015027201772020676 0ustar sudipsudip// -*- MPC -*- project(ACEXML_XML_Svc_Conf_Parser): ace_output, acelib, acexml, install { sharedname = ACEXML_XML_Svc_Conf_Parser specific { install_dir = ACEXML/apps/svcconf } } ace-8.0.4+dfsg.orig/ACEXML/apps/svcconf/Svcconf_Handler.h0000644000175000017500000001414115027201772021753 0ustar sudipsudip//============================================================================= /** * @file Svcconf_Handler.h * * @author Nanbor Wang */ //============================================================================= #ifndef ACEXML_SVCCONF_HANDLER_H #define ACEXML_SVCCONF_HANDLER_H #include "ACEXML/common/DefaultHandler.h" #include "ace/Service_Types.h" #if (ACE_USES_CLASSIC_SVC_CONF == 0) class ACE_Parsed_Info { public: ACE_Parsed_Info (); ~ACE_Parsed_Info (); /** * Set/get name of a parsed entity. */ int name (const ACEXML_Char *n); const ACEXML_Char *name (); /** * Set/get type of a dynamic node. */ int service_type (int type); int service_type (); /** * Set/Get active status. */ int active (int a); int active (); /** * Set/get initializer path. */ int path (const ACEXML_Char *n); const ACEXML_Char *path (); /** * Set/get initializer init function. */ int init_func (const ACEXML_Char *n); const ACEXML_Char *init_func (); /** * Set/get initializer init parameter. */ int init_params (const ACEXML_Char *n); const ACEXML_Char *init_params (); /** * Reset Parsed_Info. */ void reset (); protected: ACEXML_Char *name_; int service_type_; int active_; ACEXML_Char *path_; ACEXML_Char *init_func_; ACEXML_Char *init_params_; }; /** * @class ACEXML_Svcconf_Handler * * @brief ACEXML_Svcconf_Handler is an example SAX event handler. * * This SAX event handler try to regenerate the XML document it * reads with correct indentation. */ class ACEXML_Svcconf_Handler : public ACEXML_DefaultHandler { public: /* * Default constructor. */ ACEXML_Svcconf_Handler (); /* * Default destructor. */ virtual ~ACEXML_Svcconf_Handler (); // Methods inherit from ACEXML_ContentHandler. /* * Receive notification of character data. */ virtual void characters (const ACEXML_Char *ch, int start, int length); /* * Receive notification of the end of a document. */ virtual void endDocument (); /* * Receive notification of the end of an element. */ virtual void endElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName); /* * End the scope of a prefix-URI mapping. */ virtual void endPrefixMapping (const ACEXML_Char *prefix); /* * Receive notification of ignorable whitespace in element content. */ virtual void ignorableWhitespace (const ACEXML_Char *ch, int start, int length); /* * Receive notification of a processing instruction. */ virtual void processingInstruction (const ACEXML_Char *target, const ACEXML_Char *data); /* * Receive an object for locating the origin of SAX document events. */ virtual void setDocumentLocator (ACEXML_Locator *locator) ; /* * Receive notification of a skipped entity. */ virtual void skippedEntity (const ACEXML_Char *name); /* * Receive notification of the beginning of a document. */ virtual void startDocument () ; /* * Receive notification of the beginning of an element. */ virtual void startElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName, ACEXML_Attributes *atts); /* * Begin the scope of a prefix-URI Namespace mapping. */ virtual void startPrefixMapping (const ACEXML_Char *prefix, const ACEXML_Char *uri); // *** Methods inherit from ACEXML_DTDHandler. /* * Receive notification of a notation declaration event. */ virtual void notationDecl (const ACEXML_Char *name, const ACEXML_Char *publicId, const ACEXML_Char *systemId); /* * Receive notification of an unparsed entity declaration event. */ virtual void unparsedEntityDecl (const ACEXML_Char *name, const ACEXML_Char *publicId, const ACEXML_Char *systemId, const ACEXML_Char *notationName); // Methods inherit from ACEXML_EnitityResolver. /* * Allow the application to resolve external entities. */ virtual ACEXML_InputSource *resolveEntity (const ACEXML_Char *publicId, const ACEXML_Char *systemId); // Methods inherit from ACEXML_ErrorHandler. /* * Receive notification of a recoverable error. */ virtual void error (ACEXML_SAXParseException &exception); /* * Receive notification of a non-recoverable error. */ virtual void fatalError (ACEXML_SAXParseException &exception); /* * Receive notification of a warning. */ virtual void warning (ACEXML_SAXParseException &exception); protected: /** * Get the only attribute in or . */ int get_stream_id (ACEXML_Attributes *alist); /** * Get the only attribute in , , */ int get_id (ACEXML_Attributes *alist); /** * Get the dynamic tag attributes. */ int get_dynamic_attrs (ACEXML_Attributes *alist); /** * Get the initializer tag attributes. */ int get_initializer_attrs (ACEXML_Attributes *alist); /** * Get the static tag attributes. */ int get_static_attrs (ACEXML_Attributes *alist); private: /// We are parsing a stream definition int in_stream_def_; /// We are defining a steam module int in_module_; /// @a stream_ holds the actually Stream_Type object managed by @a stream_svc_type_. ACE_Service_Type *stream_svc_type_; ACE_Stream_Type *stream_; //ACE_SHLIB_HANDLE dll_handle_; ACE_Parsed_Info parsed_info_; ACE_Parsed_Info stream_info_; ACEXML_Locator* locator_; }; #if defined (__ACEXML_INLINE__) # include "Svcconf_Handler.inl" #endif /* __ACEXML_INLINE__ */ #endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */ #endif /* ACEXML_SVCCONF_HANDLER_H */ ace-8.0.4+dfsg.orig/ACEXML/examples/0000755000175000017500000000000015046037655015765 5ustar sudipsudipace-8.0.4+dfsg.orig/ACEXML/examples/SAXPrint/0000755000175000017500000000000015046037655017435 5ustar sudipsudipace-8.0.4+dfsg.orig/ACEXML/examples/SAXPrint/ns.svc.conf.xml0000644000175000017500000000251615027201772022311 0ustar sudipsudip -d -p 4911 A &lt; -p 3000 -p 3001 ace-8.0.4+dfsg.orig/ACEXML/examples/SAXPrint/SAXPrint_Handler.cpp0000644000175000017500000001263515027201772023245 0ustar sudipsudip// -*- C++ -*- #include "SAXPrint_Handler.h" #include "ace/ACE.h" #include "ace/Log_Msg.h" #if !defined (__ACEXML_INLINE__) # include "SAXPrint_Handler.inl" #endif /* __ACEXML_INLINE__ */ ACEXML_SAXPrint_Handler::ACEXML_SAXPrint_Handler (const ACEXML_Char* filename) : indent_ (0), fileName_(ACE::strnew (filename)), locator_ (0) { } ACEXML_SAXPrint_Handler::~ACEXML_SAXPrint_Handler () { delete [] this->fileName_; } void ACEXML_SAXPrint_Handler::characters (const ACEXML_Char *cdata, size_t, size_t) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s"), cdata)); } void ACEXML_SAXPrint_Handler::endDocument () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); } void ACEXML_SAXPrint_Handler::endElement (const ACEXML_Char *, const ACEXML_Char *, const ACEXML_Char *qName) { this->dec_indent (); this->print_indent (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (""), qName)); } void ACEXML_SAXPrint_Handler::endPrefixMapping (const ACEXML_Char *) { // ACE_DEBUG ((LM_DEBUG, // ACE_TEXT ("* Event endPrefixMapping (%s) ***************\n"), // prefix)); } void ACEXML_SAXPrint_Handler::ignorableWhitespace (const ACEXML_Char * cdata, int, int) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s"), cdata)); // ACE_DEBUG ((LM_DEBUG, // ACE_TEXT ("* Event ignorableWhitespace () ***************\n"))); } void ACEXML_SAXPrint_Handler::processingInstruction (const ACEXML_Char *target, const ACEXML_Char *data) { this->print_indent (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"), target, data)); } void ACEXML_SAXPrint_Handler::setDocumentLocator (ACEXML_Locator * locator) { this->locator_ = locator; //ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("* Event setDocumentLocator () ***************\n"))); } void ACEXML_SAXPrint_Handler::skippedEntity (const ACEXML_Char *name) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("* Event skippedEntity (%s) ***************\n"), name)); } void ACEXML_SAXPrint_Handler::startDocument () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("* Event startDocument () ***************\n"))); } void ACEXML_SAXPrint_Handler::startElement (const ACEXML_Char *, const ACEXML_Char *, const ACEXML_Char *qName, ACEXML_Attributes *alist) { this->print_indent (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("<%s"), qName)); if (alist != 0) for (size_t i = 0; i < alist->getLength (); ++i) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" %s = \"%s\""), alist->getQName (i), alist->getValue (i))); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT (">"))); this->inc_indent (); } void ACEXML_SAXPrint_Handler::startPrefixMapping (const ACEXML_Char * , const ACEXML_Char *) { // ACE_DEBUG ((LM_DEBUG, // ACE_TEXT ("* Event startPrefixMapping () ***************\n"))); // ACE_DEBUG ((LM_DEBUG, // ACE_TEXT ("Prefix = %s, URI = %s\n"), prefix, uri)); } // *** Methods inherited from ACEXML_DTDHandler. void ACEXML_SAXPrint_Handler::notationDecl (const ACEXML_Char *, const ACEXML_Char *, const ACEXML_Char *) { // No-op. } void ACEXML_SAXPrint_Handler::unparsedEntityDecl (const ACEXML_Char *, const ACEXML_Char *, const ACEXML_Char *, const ACEXML_Char *) { // No-op. } // Methods inherited from ACEXML_EnitityResolver. ACEXML_InputSource * ACEXML_SAXPrint_Handler::resolveEntity (const ACEXML_Char *, const ACEXML_Char *) { // No-op. return 0; } // Methods inherited from ACEXML_ErrorHandler. /* * Receive notification of a recoverable error. */ void ACEXML_SAXPrint_Handler::error (ACEXML_SAXParseException & ex) { ACE_DEBUG ((LM_DEBUG, "%s: line: %d col: %d ", (this->locator_->getSystemId() == 0 ? this->fileName_ : this->locator_->getSystemId()), this->locator_->getLineNumber(), this->locator_->getColumnNumber())); ex.print(); } void ACEXML_SAXPrint_Handler::fatalError (ACEXML_SAXParseException & ex) { ACE_DEBUG ((LM_DEBUG, "%s: line: %d col: %d ", (this->locator_->getSystemId() == 0 ? this->fileName_ : this->locator_->getSystemId()), this->locator_->getLineNumber(), this->locator_->getColumnNumber())); ex.print(); } void ACEXML_SAXPrint_Handler::warning (ACEXML_SAXParseException & ex) { ACE_DEBUG ((LM_DEBUG, "%s: line: %d col: %d ", (this->locator_->getSystemId() == 0 ? this->fileName_ : this->locator_->getSystemId()), this->locator_->getLineNumber(), this->locator_->getColumnNumber())); ex.print(); } void ACEXML_SAXPrint_Handler::print_indent () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); for (size_t i = 0; i < this->indent_; ++i) ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" "))); } ace-8.0.4+dfsg.orig/ACEXML/examples/SAXPrint/SAXPrint_Handler.h0000644000175000017500000001045715027201772022712 0ustar sudipsudip//============================================================================= /** * @file SAXPrint_Handler.h * * @author Nanbor Wang */ //============================================================================= #ifndef ACEXML_SAXPRINT_HANDLER_H #define ACEXML_SAXPRINT_HANDLER_H #include "ACEXML/common/DefaultHandler.h" /** * @class ACEXML_SAXPrint_Handler * * @brief ACEXML_SAXPrint_Handler is an example SAX event handler. * * This SAX event handler try to regenerate the XML document it * reads with correct indentation. */ class ACEXML_SAXPrint_Handler : public ACEXML_DefaultHandler { public: /* * Default constructor. */ ACEXML_SAXPrint_Handler (const ACEXML_Char* name); /* * Default destructor. */ virtual ~ACEXML_SAXPrint_Handler (); // Methods inherit from ACEXML_ContentHandler. /* * Receive notification of character data. */ virtual void characters (const ACEXML_Char *ch, size_t start, size_t length) ; /* * Receive notification of the end of a document. */ virtual void endDocument () ; /* * Receive notification of the end of an element. */ virtual void endElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName); /* * End the scope of a prefix-URI mapping. */ virtual void endPrefixMapping (const ACEXML_Char *prefix); /* * Receive notification of ignorable whitespace in element content. */ virtual void ignorableWhitespace (const ACEXML_Char *ch, int start, int length); /* * Receive notification of a processing instruction. */ virtual void processingInstruction (const ACEXML_Char *target, const ACEXML_Char *data); /* * Receive an object for locating the origin of SAX document events. */ virtual void setDocumentLocator (ACEXML_Locator *locator); /* * Receive notification of a skipped entity. */ virtual void skippedEntity (const ACEXML_Char *name); /* * Receive notification of the beginning of a document. */ virtual void startDocument (); /* * Receive notification of the beginning of an element. */ virtual void startElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName, ACEXML_Attributes *atts); /* * Begin the scope of a prefix-URI Namespace mapping. */ virtual void startPrefixMapping (const ACEXML_Char *prefix, const ACEXML_Char *uri); // *** Methods inherit from ACEXML_DTDHandler. /* * Receive notification of a notation declaration event. */ virtual void notationDecl (const ACEXML_Char *name, const ACEXML_Char *publicId, const ACEXML_Char *systemId); /* * Receive notification of an unparsed entity declaration event. */ virtual void unparsedEntityDecl (const ACEXML_Char *name, const ACEXML_Char *publicId, const ACEXML_Char *systemId, const ACEXML_Char *notationName); // Methods inherit from ACEXML_EnitityResolver. /* * Allow the application to resolve external entities. */ virtual ACEXML_InputSource *resolveEntity (const ACEXML_Char *publicId, const ACEXML_Char *systemId); // Methods inherit from ACEXML_ErrorHandler. /* * Receive notification of a recoverable error. */ virtual void error (ACEXML_SAXParseException &exception); /* * Receive notification of a non-recoverable error. */ virtual void fatalError (ACEXML_SAXParseException &exception); /* * Receive notification of a warning. */ virtual void warning (ACEXML_SAXParseException &exception); void inc_indent (); void dec_indent (); void print_indent (); private: size_t indent_; ACEXML_Char* fileName_; ACEXML_Locator* locator_; }; #if defined (__ACEXML_INLINE__) # include "SAXPrint_Handler.inl" #endif /* __ACEXML_INLINE__ */ #endif /* ACEXML_SAXPRINT_HANDLER_H */ ace-8.0.4+dfsg.orig/ACEXML/examples/SAXPrint/simple.svcconf.xml0000644000175000017500000000224715027201772023105 0ustar sudipsudip A & ace-8.0.4+dfsg.orig/ACEXML/examples/SAXPrint/broken.xml0000644000175000017500000000024415027201772021427 0ustar sudipsudip kid ace-8.0.4+dfsg.orig/ACEXML/examples/SAXPrint/namespaces.xml0000644000175000017500000001201315027201772022263 0ustar sudipsudip Vignesh Blogs Here http://primates.ximian.com/~ravi/BoozeLog/ en-us 2002-10-11T00:50:42-06:00 2002-10-12T20:19:57-06:00 Happy Birthday Vidya Today is Vidya's birthday ! Happy Birthday Vidya! We had a midnight party,as usual, at Swapna's place, though I dont... http://primates.ximian.com/~ravi/BoozeLog/archives/000025.html Blog entry Booze 2002-10-11T00:50:42-06:00 Way to go, Shaastra! On Flash Back mode now: Shaastra is the technical festival at my alma mater, IIT Madras, that replaced the old,... http://primates.ximian.com/~ravi/BoozeLog/archives/000024.html Blog entry Booze 2002-10-10T11:52:02-06:00 Back and Forth in Time The blog is going to be a little skewed in time for the next coupla days.. Inspite of my laziness,... http://primates.ximian.com/~ravi/BoozeLog/archives/000023.html Blog entry Booze 2002-10-09T23:47:19-06:00 Frisco Rocks! If there be any reason the blog hasnt been updated,it is simply because I am enjoying my trip to San... http://primates.ximian.com/~ravi/BoozeLog/archives/000020.html Blog entry Booze 2002-10-03T23:53:16-06:00 Think but not make thoughts your aim A line from Rudyard Kipling's IF : would sum up my feelings for today, a lot of thinking from morning... http://primates.ximian.com/~ravi/BoozeLog/archives/000013.html Blog entry Booze 2002-09-28T22:48:09-06:00 New ARM but... ARM stands for Advanced Recording Model, a simulation software that I use for my work, and I have been tinkering... http://primates.ximian.com/~ravi/BoozeLog/archives/000012.html Blog entry Booze 2002-09-27T22:36:28-06:00 A much needed break Slowly got over the hangover of Sandhya's departure and moved to more mundane things in life : assignments, submissions and... http://primates.ximian.com/~ravi/BoozeLog/archives/000011.html Blog entry Booze 2002-09-26T23:05:46-06:00 Here we go ! My first attempts at Blogging, the idea was introduced to me by Ravi Pratap. MoveableType really makes it easy and... http://primates.ximian.com/~ravi/BoozeLog/archives/000008.html Blog entry Booze 2002-09-25T19:27:22-06:00 ace-8.0.4+dfsg.orig/ACEXML/examples/SAXPrint/Print_Handler.h0000644000175000017500000001011415027201772022324 0ustar sudipsudip//============================================================================= /** * @file Print_Handler.h * * @author Nanbor Wang */ //============================================================================= #ifndef ACEXML_PRINT_HANDLER_H #define ACEXML_PRINT_HANDLER_H #include "ACEXML/common/DefaultHandler.h" /** * @class ACEXML_Print_Handler * * @brief ACEXML_Print_Handler is an example SAX event handler. * * This SAX event handler prints out a detailed event report * on every event it receives. */ class ACEXML_Print_Handler : public ACEXML_DefaultHandler { public: /* * Default constructor. */ ACEXML_Print_Handler (ACEXML_Char* fileName); /* * Default destructor. */ virtual ~ACEXML_Print_Handler (); // Methods inherited from ACEXML_ContentHandler. /* * Receive notification of character data. */ virtual void characters (const ACEXML_Char *ch, size_t start, size_t length); /* * Receive notification of the end of a document. */ virtual void endDocument (); /* * Receive notification of the end of an element. */ virtual void endElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName); /* * End the scope of a prefix-URI mapping. */ virtual void endPrefixMapping (const ACEXML_Char *prefix); /* * Receive notification of ignorable whitespace in element content. */ virtual void ignorableWhitespace (const ACEXML_Char *ch, int start, int length); /* * Receive notification of a processing instruction. */ virtual void processingInstruction (const ACEXML_Char *target, const ACEXML_Char *data); /* * Receive an object for locating the origin of SAX document events. */ virtual void setDocumentLocator (ACEXML_Locator *locator) ; /* * Receive notification of a skipped entity. */ virtual void skippedEntity (const ACEXML_Char *name); /* * Receive notification of the beginning of a document. */ virtual void startDocument (); /* * Receive notification of the beginning of an element. */ virtual void startElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName, ACEXML_Attributes *atts); /* * Begin the scope of a prefix-URI Namespace mapping. */ virtual void startPrefixMapping (const ACEXML_Char *prefix, const ACEXML_Char *uri); // *** Methods inherit from ACEXML_DTDHandler. /* * Receive notification of a notation declaration event. */ virtual void notationDecl (const ACEXML_Char *name, const ACEXML_Char *publicId, const ACEXML_Char *systemId); /* * Receive notification of an unparsed entity declaration event. */ virtual void unparsedEntityDecl (const ACEXML_Char *name, const ACEXML_Char *publicId, const ACEXML_Char *systemId, const ACEXML_Char *notationName); // Methods inherit from ACEXML_EnitityResolver. /* * Allow the application to resolve external entities. */ virtual ACEXML_InputSource *resolveEntity (const ACEXML_Char *publicId, const ACEXML_Char *systemId); // Methods inherit from ACEXML_ErrorHandler. /* * Receive notification of a recoverable error. */ virtual void error (ACEXML_SAXParseException &exception); /* * Receive notification of a non-recoverable error. */ virtual void fatalError (ACEXML_SAXParseException &exception); /* * Receive notification of a warning. */ virtual void warning (ACEXML_SAXParseException &exception); private: ACEXML_Char* fileName_; ACEXML_Locator* locator_; }; #endif /* ACEXML_PRINT_HANDLER_H */ ace-8.0.4+dfsg.orig/ACEXML/examples/SAXPrint/main.cpp0000644000175000017500000001200115027201772021047 0ustar sudipsudip#include "ACEXML/common/FileCharStream.h" #include "ACEXML/common/HttpCharStream.h" #include "ACEXML/common/StrCharStream.h" #include "ACEXML/common/ZipCharStream.h" #include "ACEXML/parser/parser/Parser.h" #include "Print_Handler.h" #include "SAXPrint_Handler.h" #include "ace/Get_Opt.h" #include "ace/Log_Msg.h" #include "ace/OS_main.h" static const ACEXML_Char *test_string = ACE_TEXT (" A " "); static void usage (const ACE_TCHAR* program) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Usage: %s [-sl] [-f | -u | -z ]\n") ACE_TEXT (" -s: Use SAXPrint_Handler (Default is Print_Handler)\n") ACE_TEXT (" -l: Parse the internal strings (test the StrCharStream class)\n") ACE_TEXT (" -f: Specify the filename when -l is not specified\n") ACE_TEXT (" -z: Specify that the file is inside a ZIP archive\n") ACE_TEXT (" -u: URL specifying the path to the file\n"), program)); } int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { ACEXML_Char* filename = 0; int sax = 0; // Use SAXPrint handler or not. int str = 0; #ifdef USE_ZZIP int zip = 0; #endif ACEXML_Char* url = 0; ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("sf:lu:z")); int c; while ((c = get_opt ()) != EOF) { switch (c) { case 's': sax = 1; break; case 'l': str = 1; break; case 'f': filename = get_opt.opt_arg (); break; case 'u': url = get_opt.opt_arg(); break; case 'z': #ifndef USE_ZZIP ACE_ERROR ((LM_ERROR, ACE_TEXT ("ZZIPLIB support has not been") ACE_TEXT (" compiled in. Refer to ") ACE_TEXT ("$ACE_ROOT/ACEXML/README for more ") ACE_TEXT ("information.\n"))); return -1; #else zip = 1; break; #endif /* USE_ZZIP */ default: usage(argv[0]); return -1; } } if (str == 0 && filename == 0 && url == 0) { usage(argv[0]); return -1; } ACEXML_DefaultHandler *handler = 0; ACEXML_CharStream *stm = 0; ACEXML_FileCharStream *fstm = 0; ACEXML_HttpCharStream *ustm = 0; ACEXML_StrCharStream* sstm = 0; #ifdef USE_ZZIP ACEXML_ZipCharStream* zstm = 0; #endif /* USE_ZZIP */ if (filename != 0) { #ifdef USE_ZZIP if (zip) { ACE_NEW_RETURN (zstm, ACEXML_ZipCharStream(), -1); if (zstm->open (filename) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Failed to open XML file: %s\n"), filename), -1); stm = zstm; } else { #endif /* USE_ZZIP */ ACE_NEW_RETURN (fstm, ACEXML_FileCharStream (), -1); if (fstm->open (filename) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Failed to open XML file: %s\n"), filename), -1); stm = fstm; #ifdef USE_ZZIP } #endif /* USE_ZZIP */ } else if (url != 0) { ACE_NEW_RETURN (ustm, ACEXML_HttpCharStream (), -1); if (ustm->open (url) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Failed to open URL : %s\n"), url), -1); stm = ustm; } else { ACE_NEW_RETURN (sstm, ACEXML_StrCharStream, -1); if (sstm->open (test_string, ACE_TEXT ("test_string")) < 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Failed to open string : %s\n"), test_string), -1); stm = sstm; } ACEXML_Char* name = (filename == 0) ? url : filename; if (sax == 0) ACE_NEW_RETURN (handler, ACEXML_Print_Handler (name), -1); else ACE_NEW_RETURN (handler, ACEXML_SAXPrint_Handler (name), -1); std::unique_ptr cleanup_handler (handler); ACEXML_Parser parser; ACEXML_InputSource input (stm); parser.setContentHandler (handler); parser.setDTDHandler (handler); parser.setErrorHandler (handler); parser.setEntityResolver (handler); try { parser.parse (&input); } catch (const ACEXML_Exception& ex) { ex.print(); ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Exception occurred. Exiting...\n"))); } try { parser.parse (&input); } catch (const ACEXML_SAXException& ex) { ex.print(); ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Exception occurred. Exiting...\n"))); return 1; } return 0; } ace-8.0.4+dfsg.orig/ACEXML/examples/SAXPrint/Print_Handler.cpp0000644000175000017500000001400515027201772022662 0ustar sudipsudip// -*- C++ -*- #include "Print_Handler.h" #include "ace/ACE.h" #include "ace/Log_Msg.h" ACEXML_Print_Handler::ACEXML_Print_Handler (ACEXML_Char* fileName) : fileName_(ACE::strnew (fileName)), locator_ (0) { } ACEXML_Print_Handler::~ACEXML_Print_Handler () { delete[] this->fileName_; } void ACEXML_Print_Handler::characters (const ACEXML_Char *cdata, size_t start, size_t length) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("* Event characters () ** start: %u end: %u ***************\n%s\n- End event characters () ---------------\n"), start, length, cdata)); } void ACEXML_Print_Handler::endDocument () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("* Event endDocument () ***************\n"))); } void ACEXML_Print_Handler::endElement (const ACEXML_Char *uri, const ACEXML_Char *name, const ACEXML_Char *qName) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("* Event endElement (%s, %s, %s) ***************\n"), uri, name, qName)); } void ACEXML_Print_Handler::endPrefixMapping (const ACEXML_Char *prefix) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("* Event endPrefixMapping (%s) ***************\n"), prefix)); } void ACEXML_Print_Handler::ignorableWhitespace (const ACEXML_Char *, int, int) { // ACE_DEBUG ((LM_DEBUG, // ACE_TEXT ("* Event ignorableWhitespace () ***************\n"))); } void ACEXML_Print_Handler::processingInstruction (const ACEXML_Char *target, const ACEXML_Char *data) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("* Event processingInstruction (%s, %s) ***************\n"), target, data)); } void ACEXML_Print_Handler::setDocumentLocator (ACEXML_Locator * locator) { this->locator_ = locator; // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("* Event setDocumentLocator () ***************\n"))); } void ACEXML_Print_Handler::skippedEntity (const ACEXML_Char *name) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("* Event skippedEntity (%s) ***************\n"), name)); } void ACEXML_Print_Handler::startDocument () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("* Event startDocument () ***************\n"))); } void ACEXML_Print_Handler::startElement (const ACEXML_Char *uri, const ACEXML_Char *name, const ACEXML_Char *qName, ACEXML_Attributes *alist) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("* Event startElement (%s, %s, %s) ***************\n"), uri, name, qName)); if (alist != 0) for (size_t i = 0; i < alist->getLength (); ++i) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" %s = \"%s\"\n"), alist->getQName (i), alist->getValue (i))); } } void ACEXML_Print_Handler::startPrefixMapping (const ACEXML_Char * prefix, const ACEXML_Char * uri) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("* Event startPrefixMapping () ***************\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Prefix = %s, URI = %s\n"), prefix, uri)); } // *** Methods inherit from ACEXML_DTDHandler. void ACEXML_Print_Handler::notationDecl (const ACEXML_Char *name, const ACEXML_Char *publicID, const ACEXML_Char *systemID) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("* Event notationDecl: (%s) "), name)); if (publicID == 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("SYSTEM %s\n"), systemID)); else if (systemID == 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("PUBLIC %s\n"), publicID)); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("PUBLIC %s %s\n"), publicID, systemID)); } void ACEXML_Print_Handler::unparsedEntityDecl (const ACEXML_Char *name, const ACEXML_Char *publicID, const ACEXML_Char *systemID, const ACEXML_Char *notationName) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("* Unparsed Entity: %s"), name)); if (publicID == 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" SYSTEM %s"), systemID)); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" PUBLIC %s %s"), publicID, systemID)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" NDATA %s\n"), notationName)); } // Methods inherit from ACEXML_EnitityResolver. ACEXML_InputSource * ACEXML_Print_Handler::resolveEntity (const ACEXML_Char *, const ACEXML_Char *) { // No-op. return 0; } // Methods inherit from ACEXML_ErrorHandler. /* * Receive notification of a recoverable error. */ void ACEXML_Print_Handler::error (ACEXML_SAXParseException & ex) { ACE_DEBUG ((LM_DEBUG, "%s: line: %d col: %d ", (this->locator_->getSystemId() == 0 ? this->fileName_ : this->locator_->getSystemId()), this->locator_->getLineNumber(), this->locator_->getColumnNumber())); ex.print(); } void ACEXML_Print_Handler::fatalError (ACEXML_SAXParseException& ex) { ACE_DEBUG ((LM_DEBUG, "%s: line: %d col: %d ", (this->locator_->getSystemId() == 0 ? this->fileName_ : this->locator_->getSystemId()), this->locator_->getLineNumber(), this->locator_->getColumnNumber())); ex.print(); } void ACEXML_Print_Handler::warning (ACEXML_SAXParseException & ex) { ACE_DEBUG ((LM_DEBUG, "%s: line: %d col: %d ", (this->locator_->getSystemId() == 0 ? this->fileName_ : this->locator_->getSystemId()), this->locator_->getLineNumber(), this->locator_->getColumnNumber())); ex.print(); } ace-8.0.4+dfsg.orig/ACEXML/examples/SAXPrint/SAXPrint.mpc0000644000175000017500000000011515027201772021573 0ustar sudipsudip// -*- MPC -*- project(SAXPrint): aceexe, acexml { exename = SAXPrint } ace-8.0.4+dfsg.orig/ACEXML/examples/SAXPrint/SAXPrint_Handler.inl0000644000175000017500000000027115027201772023236 0ustar sudipsudip// -*- C++ -*- ACEXML_INLINE void ACEXML_SAXPrint_Handler::inc_indent () { this->indent_ += 1; } ACEXML_INLINE void ACEXML_SAXPrint_Handler::dec_indent () { this->indent_ -= 1; } ace-8.0.4+dfsg.orig/ACEXML/examples/SAXPrint/svc.conf.xml0000644000175000017500000000367715027201772021703 0ustar sudipsudip ]> A & ace-8.0.4+dfsg.orig/ACEXML/docs/0000755000175000017500000000000015046037655015077 5ustar sudipsudipace-8.0.4+dfsg.orig/ACEXML/docs/parser_features.txt0000644000175000017500000000143415027201772021024 0ustar sudipsudip/** -*- HTML-Helper -*- @defgroup acexml_parser_features Configurable Special Features of ACEXML Parser @{ There are special features in ACEXML Parser that can be activated/deactivated thru @c setFeature. Likewise, whether a feature has been activated or not can be queried using @c getFeature. @sa ACEXML_XMLReader::setFeature @sa ACEXML_XMLReader::getFeature Here is a list of supported features:
  1. namespaces - When this feature is enabled, ACEXML parser allows access by namespace qualified names.
  2. namespace_prefixes - Normally the list of attributes returned by the parser will not contain attributes used as namespace declarations (xmlns:foo="bar"). When this feature is enabled, the list of attributes contains the namespace declarations also.
@} */ ace-8.0.4+dfsg.orig/ACEXML/docs/TODO.txt0000644000175000017500000000050615027201772016376 0ustar sudipsudip/** @page acexml_todo ACEXML TO-DO List
  • Add Schema parsing ability.
  • Add support for resolving external entities, such as a schema/namespace definition located on the web.
  • Add parameterized entity management class. See above.
  • Define validator building/calling interfaces.
*/ ace-8.0.4+dfsg.orig/ACEXML/docs/bugs.txt0000644000175000017500000000060115027201772016565 0ustar sudipsudip/** @page acexml_bugs ACEXML Known Bugs
  • ACEXML currently do not validate an XML files. The validator hooks have not fully integrated into the parser yet.
  • Need to verify predefined entities are working correctly. Check out the SAXPrint example.
  • Currently, replacement of parameterized reference (PEReference) is not working.
*/ ace-8.0.4+dfsg.orig/ACEXML/docs/readme.txt0000644000175000017500000000253015027201772017065 0ustar sudipsudip/** -*- HTML-Helper -*- @mainpage ACEXML - A Small and Portable XML Parser @section acexml_synopsis Synopsis ACEXML is a small footprint and portable framework for integrating XML parsing ability into user applications. The framework is based on the Simple API for XML (SAX 2.0) by David Megginson. A simple non-conformant XML parser is also included in the framework. Since our original motivation was to use the parser for specifying software composition and configuration descriptors, at the current stage, the parser does not fully support all the features specified in the XML specification. We do, however, plan to add more features to the parser and will either release a more versatile parser or allow the current parser to dynamically load in the extra features in the future. @section acexml_features Features of ACEXML
  • ACEXML only recognize UNICODE documents, although they can be in various different encoding, such as UTF-8, UTF-16, or UCS-4. Therefore, it might be a problem to handle document containing multi-byte charatersets. They can, however, be translated into UNICODE before being parsed by ACEXML parser.
@section acexml_others Other Topics
  1. @ref acexml_parser_features
  2. @ref acexml_guides
  3. @ref acexml_bugs
  4. @ref acexml_todo
*/ ace-8.0.4+dfsg.orig/ACEXML/docs/guidelines.txt0000644000175000017500000000321715027201772017763 0ustar sudipsudip// -*- HTML-Helper -*- /** @page acexml_guides ACEXML Programming Guidelines
  • A lot of class names under @c $(ACE_ROOT)/ACEXML/common do not follow the naming convention suggested in ACE-guidelines.html. The reason for that is because those classes were derived from the SAX2 API and we would like to keep them as similar as possible.
  • Character encoding: The default character encoding for ACEXML can be set at compile time. ACEXML uses UTF-8 encoding in most platforms where ACEXML_Char maps to char in this case. When ACE is configured to use wchar and UNICODE, ACEXML uses UTF-16 encoding and ACEXML_Char maps to wchar_t. Notice that ACEXML assume sizeof (wchar_t) is of 2-byte long. For platforms using 4-byte wchar_t, ACEXML will not work correctly, but it should be trivial to fix.

  • Currently, there's only an example showing how to use the parser under @c $(ACE_ROOT)/ACEXML/examples/SAXPrint/.
  • (Not supported yet) To develop a new validator, one must create a DLL implementing @c ACEXML_Attributes_Def_Builder, @c ACEXML_Attribute_Def_Builder, @c ACEXML_Element_Def_Builder, @c ACEXML_Validator, and @c ACEXML_DTD_Manager. The DLL should also export a traditional C function called @c create_dtd_manager. The XML parser itself should also be modified to support and dynamically link with the new validator. See @c $(ACE_ROOT)/ACEXML/parser/debug_validator/ for an example.
*/ ace-8.0.4+dfsg.orig/ACEXML/common/0000755000175000017500000000000015046037655015437 5ustar sudipsudipace-8.0.4+dfsg.orig/ACEXML/common/XML_Codecs.cpp0000644000175000017500000000343015027201772020053 0ustar sudipsudip// -*- C++ -*- #include "ace/OS_Memory.h" #include "ace/OS_NS_string.h" #include "ACEXML/common/XML_Codecs.h" #include ACEXML_Char* ACEXML_Base64::encode (const ACEXML_Char* input, size_t* output_len) { if (!input) return 0; size_t len = ACE_OS::strlen (input); ACE_Byte* buf = 0; ACE_NEW_RETURN (buf, ACE_Byte[len], 0); std::unique_ptr cleanup_buf (buf); for (size_t i = 0; i < len; ++i) buf[i] = (ACE_Byte)input[i]; buf[len] = 0; size_t encode_len = 0; ACE_Byte* encodedBuf = ACE_Base64::encode (buf, len, &encode_len); if (!encodedBuf) return 0; ACEXML_Char* result = 0; ACE_NEW_RETURN (result, ACEXML_Char[encode_len+1], 0); for (size_t j = 0; j < encode_len; ++j) result[j] = (ACEXML_Char)encodedBuf[j]; result[encode_len] = 0; *output_len = encode_len; delete[] encodedBuf; return result; } ACEXML_Char* ACEXML_Base64::decode (const ACEXML_Char* input, size_t* output_len) { if (!input) return 0; size_t len = ACE_OS::strlen (input); ACE_Byte* buf = 0; ACE_NEW_RETURN (buf, ACE_Byte[len], 0); std::unique_ptr cleanup (buf); for (size_t i = 0; i < len; ++i) buf[i] = (ACE_Byte)input[i]; buf[len] = 0; size_t decode_len = 0; ACE_Byte* decodedBuf = ACE_Base64::decode (buf, &decode_len); if (!decodedBuf) return 0; ACEXML_Char* result = 0; ACE_NEW_RETURN (result, ACEXML_Char[decode_len+1], 0); for (size_t j = 0; j < decode_len; ++j) result[j] = (ACEXML_Char)decodedBuf[j]; result[decode_len] = 0; *output_len = decode_len; delete[] decodedBuf; return result; } ace-8.0.4+dfsg.orig/ACEXML/common/common.mpc0000644000175000017500000000120115027201772017412 0ustar sudipsudip// -*- MPC -*- project(ACEXML): acelib, ace_output, codecs, install, zzip, zlib { avoids += ace_for_tao sharedname = ACEXML dynamicflags += ACEXML_BUILD_DLL specific { install_dir = ACEXML/common } Source_Files { // This file will only be added if the ace_codecs feature is enabled. // See codecs.mpb for more information. !XML_Codecs.cpp } Header_Files { ACEXML_Export.h Attributes.h ContentHandler.h DTDHandler.h EntityResolver.h ErrorHandler.h Locator.h XMLFilter.h XMLReader.h XML_Types.h XML_Util.h } Pkgconfig_Files { ACEXML.pc.in } } ace-8.0.4+dfsg.orig/ACEXML/common/NamespaceSupport.h0000644000175000017500000001563715027201772021105 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file NamespaceSupport.h * * @author Nanbor Wang */ //============================================================================= #ifndef ACEXML_NAMESPACESUPPORT_H #define ACEXML_NAMESPACESUPPORT_H #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/XML_Types.h" #include "ace/Functor.h" #include "ace/Hash_Map_Manager.h" #include "ace/Containers_T.h" #include "ace/Null_Mutex.h" typedef ACE_Hash_Map_Entry ACEXML_NS_CONTEXT_ENTRY; typedef ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_Null_Mutex> ACEXML_NS_CONTEXT; typedef ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, ACE_Null_Mutex> ACEXML_NS_CONTEXT_ITER; typedef ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, ACE_Null_Mutex> ACEXML_NS_CONTEXT_REVERSE_ITER; typedef ACE_Unbounded_Queue ACEXML_STR_LIST; /** * @class ACEXML_Namespace_Context_Stack * * @brief ACEXML_Namespace_Context_Stack implements a simple stack * that ACEXML_NamespaceSupport uses to keep track of namespace scopes. * * @sa ACEXML_NamespaceSupport */ class ACEXML_Export ACEXML_Namespace_Context_Stack { public: /// Default constructor. ACEXML_Namespace_Context_Stack (); /// Destructor. ~ACEXML_Namespace_Context_Stack (); /// Push the old namespace before entering into a new namespace scope. int push (ACEXML_NS_CONTEXT * old); /// Pop the old namespace when exiting a namespace scope. ACEXML_NS_CONTEXT *pop (); private: /// Internal stack structure to hold namespace context. ACE_Unbounded_Stack stack_; }; /** * @class ACEXML_NamespaceSupport NamespaceSupport.h "ACEXML/common/NamespaceSupport.h" * * @brief ACEXML_NamespaceSupport provides namespace management * operation for an XML parser. * * This class encapsulates the logic of Namespace processing: it * tracks the declarations currently in force for each context and * automatically processes qualified XML 1.0 names into their * Namespace parts; it can also be used in reverse for generating XML * 1.0 from Namespaces. * * Namespace support objects are reusable, but the reset method must * be invoked between each session. * * Here is a simple session (in Java :-p): * @code * String parts[] = new String[3]; * NamespaceSupport support = new NamespaceSupport(); * * support.pushContext(); * support.declarePrefix("", "http://www.w3.org/1999/xhtml"); * support.declarePrefix("dc", "http://www.purl.org/dc#"); * * String parts[] = support.processName("p", parts, false); * System.out.println("Namespace URI: " + parts[0]); * System.out.println("Local name: " + parts[1]); * System.out.println("Raw name: " + parts[2]); * * String parts[] = support.processName("dc:title", parts, false); * System.out.println("Namespace URI: " + parts[0]); * System.out.println("Local name: " + parts[1]); * System.out.println("Raw name: " + parts[2]); * * support.popContext(); * @endcode * * Note that this class is optimized for the use case where most * elements do not contain Namespace declarations: if the same * prefix/URI mapping is repeated for each context (for example), this * class will be somewhat less efficient. * * @sa ACEXML_Exception */ class ACEXML_Export ACEXML_NamespaceSupport { public: /** * Default constructor. */ ACEXML_NamespaceSupport (); /** * Default destructor. */ ~ACEXML_NamespaceSupport (); /** * Initialize the namespace support object */ int init(); /** * XMLNS default prefix and URI strings. */ static const ACEXML_Char *XMLNS_PREFIX; static const ACEXML_Char *XMLNS; /** * Declare a Namespace prefix. Return -1 if the prefix was illegal * or an internal error occurred. Return 0 if the prefix gets declared * successfully, 1 if the prefix replaces an existing prefix definition. */ int declarePrefix (const ACEXML_Char *prefix, const ACEXML_Char *uri); /** * Return all prefixes declared in current context in * the user-supplied list @a prefixes. It is user's reponsibility * to ensure the list was empty originally. */ int getDeclaredPrefixes (ACEXML_STR_LIST &prefixes) const; /** * Return one of the prefixes mapped to a Namespace URI. */ const ACEXML_Char *getPrefix (const ACEXML_Char *uri) const; /** * Return all prefixes currently declared in the user-supplied list. * @@ Known bug: This function should only return user-defined prefixes. */ int getPrefixes (ACEXML_STR_LIST &prefixes) const; /** * Return all prefixes currently declared for a URI in the * user-supplied list. */ int getPrefixes (const ACEXML_Char *uri, ACEXML_STR_LIST &prefixes) const; /** * Look up a prefix and get the currently-mapped Namespace URI. */ const ACEXML_Char *getURI (const ACEXML_Char *prefix) const; /** * Revert to the previous namespace context. */ int popContext (); /** * Process a raw XML 1.0 name. * @a qName is the raw XML name we want to parse, * @a uri contains the URI string of the raw name. It points to a null * string if the namespace is not valid or there's no namespace defined. * @a name contains the original name without the prefix. * @a is_attribute specifies whether the name is an attribute or not. * Attributes have different scoping rules from elements. */ int processName (const ACEXML_Char *qName, const ACEXML_Char *&uri, const ACEXML_Char *&name, int is_attribute) const; /** * Start a new Namespace context. Prefixes defined in previous * context are copied over to the new context. */ int pushContext (); /** * Reset this Namespace support object for reuse. * */ int reset (); private: /** * Namespace Context stack. When we entering a new namespace * context, the old context is duplicated and pushed into * this stack. */ ACEXML_Namespace_Context_Stack ns_stack_; /** * The effective namespace context. */ ACEXML_NS_CONTEXT *effective_context_; }; #include /**/ "ace/post.h" #endif /* ACEXML_NAMESPACESUPPORT_H */ ace-8.0.4+dfsg.orig/ACEXML/common/URL_Addr.inl0000644000175000017500000000307515027201772017534 0ustar sudipsudip// -*- C++ -*- #include "ace/ACE.h" #include "ace/INET_Addr.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_string.h" ACE_INLINE size_t ACEXML_URL_Addr::calculate_length (int ipaddr_format) const { return ACE_OS::strlen (ipaddr_format == 0 ? this->get_host_name () : this->get_host_addr ()) + ACE_OS::strlen ("65536") // Assume the max port number. + ACE_OS::strlen (this->get_path_name ()) + sizeof (':') + sizeof ('/') + sizeof ('\0'); // For trailing '\0'. } ACE_INLINE void ACEXML_URL_Addr::operator= (const ACEXML_URL_Addr &addr) { if (this->set (addr) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACEXML_URL_Addr::ACEXML_URL_Addr"))); } ACE_INLINE u_long ACEXML_URL_Addr::hash () const { u_long result = this->ACE_INET_Addr::hash () + ACE::hash_pjw (this->get_path_name ()); return result; } ACE_INLINE bool ACEXML_URL_Addr::operator== (const ACEXML_URL_Addr &addr) const { return ACE_OS::strcmp (addr.get_path_name (), this->get_path_name ()) == 0 && addr.get_port_number () == this->get_port_number () && addr.get_ip_address () == this->get_ip_address (); } ACE_INLINE bool ACEXML_URL_Addr::operator!= (const ACEXML_URL_Addr &addr) const { return !(*this == addr); } ACE_INLINE const ACEXML_Char * ACEXML_URL_Addr::get_path_name () const { return this->path_name_; } ACE_INLINE int ACEXML_URL_Addr::destroy () { // Commit suicide. delete this; return 0; } ace-8.0.4+dfsg.orig/ACEXML/common/AttributesImpl.h0000644000175000017500000002066515027201772020561 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file AttributesImpl.h * * @author Nanbor Wang */ //============================================================================= #ifndef ACEXML_ATTRIBUTESIMPL_H #define ACEXML_ATTRIBUTESIMPL_H #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/Attributes.h" #include "ace/Containers_T.h" #if !defined ACEXML_AttributesImpl_Default_Size #define ACEXML_AttributesImpl_Default_Size 20 #endif /* ACEXML_AttributesImpl_Default_Size */ class ACEXML_AttributesImpl; /** * @class ACEXML_Attribute * * @brief ACEXML_Attribute defines the data structure of an attribute * * @sa ACEXML_AttributesImpl */ class ACEXML_Export ACEXML_Attribute { public: friend class ACEXML_AttributesImpl; /// Default constructor. ACEXML_Attribute (); /// Copy constructor. ACEXML_Attribute (const ACEXML_Attribute &attr); /// Initialize all constructor. ACEXML_Attribute (const ACEXML_Char *uri, const ACEXML_Char *localName, const ACEXML_Char *qName, const ACEXML_Char *type, const ACEXML_Char *value); /// Destructor. ~ACEXML_Attribute (); /// Set all members. void setAttribute (const ACEXML_Char *uri, const ACEXML_Char *localName, const ACEXML_Char *qName, const ACEXML_Char *type, const ACEXML_Char *value); /// Get \a uri_. const ACEXML_Char *uri () const; /// Set \a uri_. void uri (const ACEXML_Char *uri); /// Get \a localName_. const ACEXML_Char *localName () const; /// Set \a localName_. void localName (const ACEXML_Char *localName); /// Get \a qName_. const ACEXML_Char *qName () const; /// Set \a qName_. void qName (const ACEXML_Char *qName); /// Get \a type_. const ACEXML_Char *type () const; /// Set \a type_. void type (const ACEXML_Char *type); /// Get \a value_. const ACEXML_Char *value () const; /// Set \a value_. void value (const ACEXML_Char *value); /// Assignment operator. ACEXML_Attribute &operator= (const ACEXML_Attribute &rhs); /// Comparison operator. bool operator!= (const ACEXML_Attribute&rhs) const; private: /// Namespace URI of an attribute ACEXML_Char *uri_; ACEXML_Char *localName_; ACEXML_Char *qName_; ACEXML_Char *type_; ACEXML_Char *value_; }; /** * @typedef ACE_Array ACEXML_Attribute_Array */ typedef ACE_Array ACEXML_Attribute_Array; /** * @class ACEXML_AttributesImpl AttributesImpl.h "ACEXML/common/AttributesImpl.h" * * @brief ACEXML_AttributesImpl provides the default implementation * of interface ACEXML_Attributes. * * This class provides a default implementation of the SAX2 Attributes * interface, with the addition of manipulators so that the list can * be modified or reused. * * There are two typical uses of this class: * * - to take a persistent snapshot of an Attributes object in a * startElement event; or * - to construct or modify an Attributes object in a SAX2 driver or filter. * * This class replaces the now-deprecated SAX1 AttributeListImpl * class; in addition to supporting the updated Attributes interface * rather than the deprecated AttributeList interface, it also * includes a much more efficient implementation using a single array * rather than a set of Vectors. * * @sa ACEXML_Attributes */ class ACEXML_Export ACEXML_AttributesImpl : public ACEXML_Attributes { public: /** * Initialize an AttributesImpl that holds @a size attributes. */ ACEXML_AttributesImpl (int size = ACEXML_AttributesImpl_Default_Size); ACEXML_AttributesImpl (const ACEXML_AttributesImpl &attrs); virtual ~ACEXML_AttributesImpl (); /** * Add a new attribute using the argument(s) supplied. * Return -1 if an attribute with the same name already exists. */ virtual int addAttribute (const ACEXML_Char *uri, const ACEXML_Char *localName, const ACEXML_Char *qName, const ACEXML_Char *type, const ACEXML_Char *value); virtual int addAttribute (const ACEXML_Attribute &att); /** * Check for duplicate attributes. */ virtual int isDuplicate (const ACEXML_Char *uri, const ACEXML_Char *localName, const ACEXML_Char *qName); /** * Remove an attribute from the array. Notice that this * operation can invalidate previously acquired @a index * value. (It will repack the array.) */ virtual int removeAttribute (size_t index); /** * Look up the index of an attribute by XML 1.0 qualified name. * Return -1 if we fail to find a match. */ virtual int getIndex (const ACEXML_Char *qName); /** * Look up the index of an attribute by Namespace name. * Return -1 if we fail to find a match. */ virtual int getIndex (const ACEXML_Char *uri, const ACEXML_Char *localPart); /** * Return the number of attributes in the list. */ virtual size_t getLength (); /** * Look up an attribute's local name by index. * Return 0 if index is out of range. */ virtual const ACEXML_Char *getLocalName (size_t index); /** * Look up an attribute's XML 1.0 qualified name by index. * Return 0 if index is out of range. */ virtual const ACEXML_Char *getQName (size_t index); /** * Look up an attribute's type by index. * Return 0 if index is out of range. */ virtual const ACEXML_Char *getType (size_t index); /** * Look up an attribute's type by XML 1.0 qualified name. * Return 0 if we fail to find a match. */ virtual const ACEXML_Char *getType (const ACEXML_Char *qName); /** * Look up an attribute's type by Namespace name. * Return 0 if we fail to find a match. */ virtual const ACEXML_Char *getType (const ACEXML_Char *uri, const ACEXML_Char *localPart); /** * Look up an attribute's Namespace URI by index. * Return 0 if index is out of range. */ virtual const ACEXML_Char *getURI (size_t index); /** * Look up an attribute's value by index. * Return 0 if index is out of range. */ virtual const ACEXML_Char *getValue (size_t index); /** * Look up an attribute's value by XML 1.0 qualified name. * Return 0 if we fail to find a match. */ virtual const ACEXML_Char *getValue (const ACEXML_Char *qName); /** * Look up an attribute's value by Namespace name. * Return 0 if we fail to find a match. */ virtual const ACEXML_Char *getValue (const ACEXML_Char *uri, const ACEXML_Char *localPart); /** * Set an attribute at index. Return -1 if index is out of * range. */ virtual int setAttribute (size_t index, const ACEXML_Char *uri, const ACEXML_Char *localName, const ACEXML_Char *qName, const ACEXML_Char *type, const ACEXML_Char *value); /** * Set the localName of the attribute at @a index. * return -1 if @a index is out of range. */ virtual int setLocalName (size_t index, const ACEXML_Char *localName); /** * Set the qName of the attribute at @a index. * return -1 if @a index is out of range. */ virtual int setQName (size_t index, const ACEXML_Char *qName); /** * Set the URI of the attribute at @a index. * return -1 if @a index is out of range. */ virtual int setURI (size_t index, const ACEXML_Char *uri); /** * Set the type of the attribute at @a index. * return -1 if @a index is out of range. */ virtual int setType (size_t index, const ACEXML_Char *type); /** * Set the value of the attribute at @a index. * return -1 if @a index is out of range. */ virtual int setValue (size_t index, const ACEXML_Char *value); private: /// Container for all attributes. ACEXML_Attribute_Array attrs_; }; #if defined (__ACEXML_INLINE__) # include "ACEXML/common/AttributesImpl.inl" #endif /* __ACEXML_INLINE__ */ #include /**/ "ace/post.h" #endif /* ACEXML_ATTRIBUTESIMPL_H */ ace-8.0.4+dfsg.orig/ACEXML/common/ACEXML.pc.in0000644000175000017500000000032115027201772017325 0ustar sudipsudipprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: ACEXML Description: ACE XML Library Requires: ACE Version: @VERSION@ Libs: -L${libdir} -lACEXML Cflags: -I${includedir} ace-8.0.4+dfsg.orig/ACEXML/common/URL_Addr.h0000644000175000017500000000772515027201772017207 0ustar sudipsudip/* -*- C++ -*- */ /** @file URL_Addr.h * * @author Douglas C. Schmidt * @author Krishnakumar B */ #ifndef _ACEXML_URL_ADDR_H #define _ACEXML_URL_ADDR_H #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Default_Constants.h" #include "ace/INET_Addr.h" #include "ACEXML/common/XML_Types.h" #include "ACEXML/common/ACEXML_Export.h" /** * @class ACEXML_URL_Addr * * Defines a URL address family address format. */ class ACEXML_Export ACEXML_URL_Addr : public ACE_INET_Addr { public: /// Initialization and termination methods. ACEXML_URL_Addr (); /// Constructor. ACEXML_URL_Addr (const ACEXML_Char *host_name, const ACEXML_Char *path_name, unsigned short port = ACE_DEFAULT_HTTP_PORT); /// Copy constructor. ACEXML_URL_Addr (const ACEXML_URL_Addr &addr); /// Essentially the copy constructor. int set (const ACEXML_URL_Addr &addr); /** * Initializes an from the
, which can be * "ip-number:port-number/path-name" (e.g., * "www.cs.wustl.edu:1234/~schmidt/" "ip-number:port-number/path-name" * (e.g., "128.252.166.57:1234/~schmidt"). If there is no ':' in the *
it is assumed to be an ip-number or ip-address number, with * the port number . */ virtual int string_to_addr (const ACEXML_Char* address, int address_family = AF_UNSPEC); // Function to shut up Borland C++ #if defined (ACE_USES_WCHAR) virtual int string_to_addr (const char* addresss, int address_family = AF_UNSPEC); #endif /** * Transform the current address into string format. If * is non-0 this produces * "ip-number:port-number/path-name" (e.g., * "128.252.166.57:80/~schmidt/"), whereas if is 0 this * produces "ip-name:port-number" (e.g., * "www.cs.wustl.edu:80/~schmidt/"). Returns -1 if the of the * is too small, else 0. */ virtual int addr_to_string (ACEXML_Char *s, size_t size, int ipaddr_format = 1) const; /** * Transform the current ACE_INET_Addr address into string format. If * @a ipaddr_format is non-0 this produces * "ip-number:port-number/path-name" (e.g., * "128.252.166.57:80/~schmidt/"), whereas if @a ipaddr_format is 0 this * produces "ip-name:port-number" (e.g., * "www.cs.wustl.edu:80/~schmidt/"). Uses dynamic memory, which is * allocated on demand and deallocated when the object is destroyed. * Returns -1 if dynamic memory fails, else 0. */ virtual const ACEXML_Char *addr_to_string (int ipaddr_format = 1); /// Assignment operator. void operator= (const ACEXML_URL_Addr &addr); /// Destructor. ~ACEXML_URL_Addr (); /** * Compare two addresses for equality. The addresses are considered * equal if they contain the same IP address, port number, and path name. */ bool operator == (const ACEXML_URL_Addr &SAP) const; /// Compare two addresses for inequality. bool operator != (const ACEXML_URL_Addr &SAP) const; /// Computes and returns hash value. virtual u_long hash () const; /// Return the path name. const ACEXML_Char *get_path_name () const; /// Commit suicide. int destroy (); private: /// Calculate the maximum length of the address string size_t calculate_length (int ipaddr_format) const; /// Our path name. ACEXML_Char *path_name_; /// The dynamically created address string that's used for the /// method. ACEXML_Char *addr_string_; /// Current length of the size_t addr_string_len_; }; #if defined (__ACEXML_INLINE__) # include "ACEXML/common/URL_Addr.inl" #endif /* __ACEXML_INLINE__ */ #include /**/ "ace/post.h" #endif /* _ACEXML_URL_ADDR_H */ ace-8.0.4+dfsg.orig/ACEXML/common/Attributes.cpp0000644000175000017500000000010615027201772020256 0ustar sudipsudip#include "Attributes.h" ACEXML_Attributes::~ACEXML_Attributes () { } ace-8.0.4+dfsg.orig/ACEXML/common/Attributes_Def_Builder.cpp0000644000175000017500000000027515027201772022511 0ustar sudipsudip#include "ACEXML/common/Attributes_Def_Builder.h" ACEXML_Attribute_Def_Builder::~ACEXML_Attribute_Def_Builder () { } ACEXML_Attributes_Def_Builder::~ACEXML_Attributes_Def_Builder () { } ace-8.0.4+dfsg.orig/ACEXML/common/StrCharStream.cpp0000644000175000017500000000525015027201772020657 0ustar sudipsudip#include "ACEXML/common/StrCharStream.h" #include "ACEXML/common/Encoding.h" #include "ace/ACE.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_string.h" ACEXML_StrCharStream::ACEXML_StrCharStream () : start_ (0), ptr_ (0), end_ (0), encoding_ (0), name_ (0) { } ACEXML_StrCharStream::~ACEXML_StrCharStream () { this->close(); } int ACEXML_StrCharStream::open (const ACEXML_Char *str, const ACEXML_Char* name) { if (str != 0 && name != 0) { delete [] this->start_; if ((this->start_ = ACE::strnew (str)) == 0) return -1; delete [] this->name_; if ((this->name_ = ACE::strnew (name)) == 0) return -1; this->ptr_ = this->start_; this->end_ = this->start_ + ACE_OS::strlen (this->start_); return this->determine_encoding(); } return -1; // Invalid string passed. } int ACEXML_StrCharStream::available () { if (this->start_ != 0) return static_cast (this->end_ - this->start_); // @@ Will this work on all platforms? return -1; } int ACEXML_StrCharStream::close () { delete[] this->start_; delete[] this->encoding_; this->encoding_ = 0; delete[] this->name_; this->name_ = 0; this->start_ = this->ptr_ = this->end_ = 0; return 0; } int ACEXML_StrCharStream::determine_encoding () { if (this->start_ == 0) return -1; char input[4] = {0,0,0,0}; char* sptr = (char*)this->start_; int i = 0; for ( ; i < 4 && sptr != (char*)this->end_; ++sptr, ++i) input[i] = *sptr; const ACEXML_Char* temp = ACEXML_Encoding::get_encoding (input); if (!temp) return -1; else { delete [] this->encoding_; this->encoding_ = ACE::strnew (temp); // ACE_DEBUG ((LM_DEBUG, "String's encoding is %s\n", this->encoding_)); } return 0; } void ACEXML_StrCharStream::rewind () { this->ptr_ = this->start_; this->determine_encoding(); } int ACEXML_StrCharStream::get (ACEXML_Char& ch) { if (this->start_ != 0 && this->ptr_ != this->end_) { ch = *this->ptr_++; return 0; } return -1; } int ACEXML_StrCharStream::read (ACEXML_Char *str, size_t len) { if (this->start_ != 0 && this->ptr_ != this->end_) { if (len * sizeof (ACEXML_Char) > (size_t) (this->end_ - this->ptr_)) len = this->end_ - this->ptr_; ACE_OS::strncpy (str, this->ptr_, len); this->ptr_ += len; return static_cast (len); } return 0; } int ACEXML_StrCharStream::peek () { if (this->start_ != 0 && this->ptr_ != this->end_) return *this->ptr_; return -1; } const ACEXML_Char* ACEXML_StrCharStream::getEncoding () { return this->encoding_; } const ACEXML_Char* ACEXML_StrCharStream::getSystemId() { return this->name_; } ace-8.0.4+dfsg.orig/ACEXML/common/InputSource.cpp0000644000175000017500000000410515027201772020413 0ustar sudipsudip// -*- C++ -*- #include "ACEXML/common/InputSource.h" #include "ACEXML/common/StreamFactory.h" #include "ace/ACE.h" ACEXML_InputSource::ACEXML_InputSource () : charStream_ (0), encoding_ (0), publicId_ (0), systemId_ (0) { } ACEXML_InputSource::ACEXML_InputSource (ACEXML_CharStream *stm) : charStream_ (stm), encoding_ (ACE::strnew (stm->getEncoding())), publicId_ (0), systemId_ (stm->getSystemId() ? ACE::strnew (stm->getSystemId()): 0) { } /* * Create a new input source with a character stream. * */ ACEXML_InputSource::ACEXML_InputSource (const ACEXML_Char *systemId) : charStream_ (0), encoding_ (0), publicId_ (0), systemId_ (ACE::strnew (systemId)) { ACEXML_StreamFactory factory; ACEXML_CharStream* stm = factory.create_stream (this->systemId_); if (stm) { this->setCharStream (stm); this->setEncoding (this->charStream_->getEncoding()); } } ACEXML_InputSource::~ACEXML_InputSource () { delete[] this->publicId_; this->publicId_ = 0; delete[] this->systemId_; this->systemId_ = 0; delete this->charStream_; this->charStream_ = 0; delete[] this->encoding_; this->encoding_ = 0; } ACEXML_CharStream * ACEXML_InputSource::getCharStream () const { return this->charStream_; } const ACEXML_Char * ACEXML_InputSource::getEncoding () const { return this->encoding_; } const ACEXML_Char * ACEXML_InputSource::getPublicId () const { return this->publicId_; } const ACEXML_Char * ACEXML_InputSource::getSystemId () const { return this->systemId_; } void ACEXML_InputSource::setCharStream (ACEXML_CharStream *stm) { delete this->charStream_; this->charStream_ = stm; } void ACEXML_InputSource::setEncoding (const ACEXML_Char *encoding) { delete[] this->encoding_; this->encoding_ = ACE::strnew (encoding); } void ACEXML_InputSource::setPublicId (const ACEXML_Char *publicId) { delete[] this->publicId_; this->publicId_ = ACE::strnew (publicId); } void ACEXML_InputSource::setSystemId (const ACEXML_Char *systemId) { delete[] this->systemId_; this->systemId_ = ACE::strnew (systemId); } ace-8.0.4+dfsg.orig/ACEXML/common/AttributesImpl.inl0000644000175000017500000000674315027201772021115 0ustar sudipsudip// -*- C++ -*- // #include "ace/ACE.h" #include "ace/OS_NS_string.h" ACEXML_INLINE ACEXML_Attribute::ACEXML_Attribute () : uri_ (0), localName_ (0), qName_ (0), type_ (0), value_ (0) { } ACEXML_INLINE ACEXML_Attribute::ACEXML_Attribute (const ACEXML_Attribute &attr) : uri_ (ACE::strnew (attr.uri_)), localName_ (ACE::strnew (attr.localName_)), qName_ (ACE::strnew (attr.qName_)), type_ (ACE::strnew (attr.type_)), value_ (ACE::strnew (attr.value_)) { } ACEXML_INLINE ACEXML_Attribute::ACEXML_Attribute (const ACEXML_Char *uri, const ACEXML_Char *localName, const ACEXML_Char *qName, const ACEXML_Char *type, const ACEXML_Char *value) : uri_ (ACE::strnew (uri)), localName_ (ACE::strnew (localName)), qName_ (ACE::strnew (qName)), type_ (ACE::strnew (type)), value_ (ACE::strnew (value)) { } ACEXML_INLINE ACEXML_Attribute::~ACEXML_Attribute () { delete[] this->uri_; delete[] this->localName_; delete[] this->qName_; delete[] this->type_; delete[] this->value_; } ACEXML_INLINE const ACEXML_Char * ACEXML_Attribute::uri () const { return this->uri_; } ACEXML_INLINE void ACEXML_Attribute::uri (const ACEXML_Char *uri) { delete[] this->uri_; this->uri_ = ACE::strnew (uri); } ACEXML_INLINE const ACEXML_Char * ACEXML_Attribute::localName () const { return this->localName_; } ACEXML_INLINE void ACEXML_Attribute::localName (const ACEXML_Char *localName) { delete[] this->localName_; this->localName_ = ACE::strnew (localName); } ACEXML_INLINE const ACEXML_Char * ACEXML_Attribute::qName () const { return this->qName_; } ACEXML_INLINE void ACEXML_Attribute::qName (const ACEXML_Char *qName) { delete[] this->qName_; this->qName_ = ACE::strnew (qName); } ACEXML_INLINE const ACEXML_Char * ACEXML_Attribute::type () const { return this->type_; } ACEXML_INLINE void ACEXML_Attribute::type (const ACEXML_Char *type) { delete[] this->type_; this->type_ = ACE::strnew (type); } ACEXML_INLINE const ACEXML_Char * ACEXML_Attribute::value () const { return this->value_; } ACEXML_INLINE void ACEXML_Attribute::value (const ACEXML_Char *value) { delete[] this->value_; this->value_ = ACE::strnew (value); } ACEXML_INLINE void ACEXML_Attribute::setAttribute (const ACEXML_Char *uri, const ACEXML_Char *localName, const ACEXML_Char *qName, const ACEXML_Char *type, const ACEXML_Char *value) { this->uri (uri); this->qName (qName); this->localName (localName); this->type (type); this->value (value); } ACEXML_INLINE ACEXML_Attribute & ACEXML_Attribute::operator= (const ACEXML_Attribute &rhs) { if (this != &rhs) // Check for self assignment { this->uri (rhs.uri ()); this->qName (rhs.qName ()); this->localName (rhs.localName ()); this->type (rhs.type ()); this->value (rhs.value ()); } return *this; } ACEXML_INLINE bool ACEXML_Attribute::operator!= (const ACEXML_Attribute &rhs) const { return (ACE_OS::strcmp (this->uri_, rhs.uri ()) == 0 && ACE_OS::strcmp (this->localName_, rhs.localName ()) == 0 && ACE_OS::strcmp (this->qName_, rhs .qName ()) == 0 && ACE_OS::strcmp (this->type_, rhs.type ()) == 0 && ACE_OS::strcmp (this->value_, rhs.value ()) == 0 ? false : true); } ace-8.0.4+dfsg.orig/ACEXML/common/HttpCharStream.h0000644000175000017500000000552415027201772020477 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file HttpCharStream.h * * @author Krishnakumar B */ //============================================================================= #ifndef _ACEXML_HTTPCHARSTREAM_H_ #define _ACEXML_HTTPCHARSTREAM_H_ #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/CharStream.h" #include "ACEXML/common/URL_Addr.h" #include "ACEXML/common/Mem_Map_Stream.h" /** * @class ACEXML_HttpCharStream * * An implementation of ACEXML_CharStream for reading input from a URL. */ class ACEXML_Export ACEXML_HttpCharStream : public ACEXML_CharStream { public: /// Default constructor. ACEXML_HttpCharStream (); /// Destructor virtual ~ACEXML_HttpCharStream (); /// Open an URL. int open (const ACEXML_Char *url); /** * Returns the available ACEXML_Char in the buffer. -1 * if the object is not initialized properly. */ virtual int available (); /** * Close this stream and release all resources used by it. */ virtual int close (); /** * Read the next ACEXML_Char. Return -1 if we are not able to * return an ACEXML_Char, 0 if EOS is reached, or 1 if succeed. */ virtual int get (ACEXML_Char& ch); /** * Read the next batch of ACEXML_Char strings */ virtual int read (ACEXML_Char *str, size_t len); /** * Peek the next ACEXML_Char in the CharStream. Return the * character if succeess, -1 if EOS is reached. */ virtual int peek (); /** * Resets the file pointer to the beginning of the stream. */ virtual void rewind (); /** * Determine the encoding of the file. */ virtual int determine_encoding (); /** * Get the encoding of the file */ virtual const ACEXML_Char* getEncoding (); /* * Get the systemId for the underlying CharStream */ virtual const ACEXML_Char* getSystemId (); private: #if defined (ACE_USES_WCHAR) /** * Read the next character from the stream taking into account the * encoding of the file. */ int get_i (ACEXML_Char& ch); /** * Read the next character from the stream taking into account the * encoding of the file. Subsequent call to get() returns this * character. */ int peek_i (); #endif /* ACE_USES_WCHAR */ /** * Send a HTTP/1.1 request to fetch the contents of the URL. */ int send_request (); /** * Fetch the URL and save it in backing store. */ int get_url (size_t& len); ACEXML_Char *url_; ACEXML_URL_Addr* url_addr_; ACEXML_Mem_Map_Stream* stream_; Connector* connector_; ACE_OFF_T size_; ACE_OFF_T data_offset_; ACEXML_Char* encoding_; }; #include /**/ "ace/post.h" #endif /* _ACEXML_HTTPCHARSTREAM_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/Element_Def_Builder.h0000644000175000017500000000576715027201772021434 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Element_Def_Builder.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_ELEMENT_DEF_BUILDER_H_ #define _ACEXML_ELEMENT_DEF_BUILDER_H_ #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/XML_Types.h" #include "ACEXML/common/SAXExceptions.h" #include /** * @class ACEXML_Element_Def_Builder * * @brief An abstract virtual class that defines the interface to define an * element definition. * * This class defines how to define an element definition after parsing a * DTD. */ class ACEXML_Export ACEXML_Element_Def_Builder { public: typedef std::unique_ptr VAR; typedef enum { EMPTY, ANY, MIXED, CHILDREN, UNDEFINED } CONTENT_TYPE; typedef enum { ONE, ZERO_OR_MORE, ONE_OR_MORE, ONE_OR_ZERO } CARDINALITY; virtual ~ACEXML_Element_Def_Builder () = 0; /** * Define the name of the element. * * @retval 0 if valid, -1 otherwise. */ virtual int setElementName (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName) = 0; /** * Define the content type of the element. * * @retval 0 if valid, -1 otherwise. */ virtual int setContentType (CONTENT_TYPE type) = 0; /** * Insert one more element into Mixed definition. */ virtual int insertMixedElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName) = 0; /** * Start a new group of children. */ virtual int startChildGroup () = 0; /** * End a new group of children. * * @retval 0 on success. */ virtual int endChildGroup (CARDINALITY card) = 0; /** * Set the type of current child group to Choice. * * @retval 0 on success, -1 if the type of the child group has * already been set and this action conflicts with the previous * setting. */ virtual int setChoice () = 0; /** * Set the type of current child group to Sequence. * * @retval 0 on success, -1 if the type of the child group has * already been set and this action conflicts with the previous * setting. */ virtual int setSequence () = 0; /** * Insert an new element into the current child group. * * @retval 0 on success, -1 otherwise. */ virtual int insertElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName) = 0; /** * Dump the content of the attribute definition. */ virtual void dump () = 0; }; #include /**/ "ace/post.h" #endif /* _ACEXML_ELEMENT_DEF_BUILDER_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/ACEXML.rc0000644000175000017500000000150315027201772016725 0ustar sudipsudip#include "../../ace/Version.h" 1 VERSIONINFO FILEVERSION ACE_MAJOR_VERSION,ACE_MINOR_VERSION,ACE_MICRO_VERSION,0 PRODUCTVERSION ACE_MAJOR_VERSION,ACE_MINOR_VERSION,ACE_MICRO_VERSION,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x4L FILETYPE 0x1L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904B0" BEGIN VALUE "FileDescription", "ACEXML\0" VALUE "FileVersion", ACE_VERSION "\0" VALUE "InternalName", "ACEXMLDLL\0" VALUE "LegalCopyright", "\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "ACEXML.DLL\0" VALUE "ProductName", "ACE\0" VALUE "ProductVersion", ACE_VERSION "\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END ace-8.0.4+dfsg.orig/ACEXML/common/XMLReader.cpp0000644000175000017500000000010315027201772017710 0ustar sudipsudip#include "XMLReader.h" ACEXML_XMLReader::~ACEXML_XMLReader () { } ace-8.0.4+dfsg.orig/ACEXML/common/Exception.inl0000644000175000017500000000034315027201772020071 0ustar sudipsudip// -*- C++ -*- ACEXML_INLINE const ACEXML_Char * ACEXML_Exception::id () const { return ACEXML_Exception::exception_name_; } ACEXML_INLINE ACEXML_Exception* ACEXML_Exception::_downcast (ACEXML_Exception* x) { return x; } ace-8.0.4+dfsg.orig/ACEXML/common/EntityResolver.cpp0000644000175000017500000000012215027201772021124 0ustar sudipsudip#include "EntityResolver.h" ACEXML_EntityResolver::~ACEXML_EntityResolver () { } ace-8.0.4+dfsg.orig/ACEXML/common/HttpCharStream.cpp0000644000175000017500000003172015027201772021027 0ustar sudipsudip#include "ace/ACE.h" #include "ace/ace_wchar.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/Truncate.h" #include "ACEXML/common/HttpCharStream.h" #include "ACEXML/common/Encoding.h" /* Header FSM states. */ static const int HDST_LINE1_PROTOCOL = 0; static const int HDST_LINE1_WHITESPACE = 1; static const int HDST_LINE1_STATUS = 2; static const int HDST_BOL = 10; static const int HDST_TEXT = 11; static const int HDST_LF = 12; static const int HDST_CR = 13; static const int HDST_CRLF = 14; static const int HDST_CRLFCR = 15; ACEXML_HttpCharStream::ACEXML_HttpCharStream () : url_(0), url_addr_(0), stream_(0), connector_(0), size_(0), data_offset_ (0), encoding_ (0) { } ACEXML_HttpCharStream::~ACEXML_HttpCharStream () { this->close (); } int ACEXML_HttpCharStream::open (const ACEXML_Char *url) { this->url_ = ACE::strnew (url); ACE_NEW_RETURN (this->url_addr_, ACEXML_URL_Addr, -1); ACE_NEW_RETURN (this->stream_, ACEXML_Mem_Map_Stream, -1); if (this->url_addr_->string_to_addr (this->url_) == -1) { this->close(); ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "cannot convert URL"), -1); } ACE_NEW_RETURN (this->connector_, Connector (0, ACE_NONBLOCK), -1); if (this->stream_->open (this->connector_, *this->url_addr_) == -1) { this->close(); ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "cannot open backing store"), -1); } int result = this->send_request(); if (result == -1) { this->close(); ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "send_request"), -1); } size_t len = 0; result = this->get_url(len); if (result == -1) { this->close(); ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "get_url"), -1); } if (result != 200) { this->close(); ACE_ERROR_RETURN ((LM_ERROR, "Server returned status %d : %s\n", result, "Refer HTTP/1.0 error code for details"), -1); } this->size_ = static_cast (len); return this->determine_encoding(); } // The FSM was taken from the implementation of http_get and that falls // under the following license: // // Copyrigh (c) 2000 by Jef Poskanzer . 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. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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. int ACEXML_HttpCharStream::get_url (size_t& len) { if (this->stream_ == 0) { return -1; } int header_state = HDST_LINE1_PROTOCOL; int status = 0; size_t b = 0; char const * buf = 0; size_t buflen = BUFSIZ; for (;;) { buf = this->stream_->recv (buflen); if (buf == 0) { if (buflen == 0) { break; } else { continue; } } for (b = 0; b < buflen; ++b) { switch ( header_state ) { case HDST_LINE1_PROTOCOL: switch ( buf[b] ) { case ' ': case '\t': header_state = HDST_LINE1_WHITESPACE; break; case '\n': header_state = HDST_LF ; break; case '\r': header_state = HDST_CR; break; } break; case HDST_LINE1_WHITESPACE: switch ( buf[b] ) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': status = buf[b] - '0'; header_state = HDST_LINE1_STATUS; break; case '\n': header_state = HDST_LF ; break; case '\r': header_state = HDST_CR; break; default: header_state = HDST_TEXT; break; } break; case HDST_LINE1_STATUS: switch ( buf[b] ) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': status = status * 10 + buf[b] - '0'; break; case '\n': header_state = HDST_LF ; break; case '\r': header_state = HDST_CR; break; default: header_state = HDST_TEXT; break; } break; case HDST_BOL: switch ( buf[b] ) { case '\n': header_state = HDST_LF; break; case '\r': header_state = HDST_CR; break; default: header_state = HDST_TEXT; break; } break; case HDST_TEXT: switch ( buf[b] ) { case '\n': header_state = HDST_LF; break; case '\r': header_state = HDST_CR; break; } break; case HDST_LF: switch ( buf[b] ) { case '\n': goto end_of_headers; case '\r': header_state = HDST_CR; break; default: header_state = HDST_TEXT; break; } break; case HDST_CR: switch ( buf[b] ) { case '\n': header_state = HDST_CRLF; break; case '\r': goto end_of_headers; default: header_state = HDST_TEXT; break; } break; case HDST_CRLF: switch ( buf[b] ) { case '\n': goto end_of_headers; case '\r': header_state = HDST_CRLFCR; break; default: header_state = HDST_TEXT; break; } break; case HDST_CRLFCR: switch ( buf[b] ) { case '\n': case '\r': goto end_of_headers; default: header_state = HDST_TEXT; break; } break; } } } end_of_headers: if (b == 0) { return -1; } ++b; // Store the address of the beginning of data. We will use it to seek to // beginning of the data in the URL. char const * const data_beg = buf + b; buflen = BUFSIZ; // Get all of the data. Since this is backed by file store, we won't lose // any of the data. while ((buf = this->stream_->recv (buflen)) != 0) ; // Length of data in the URL. len = this->stream_->recv() - data_beg; // Move the pointer to the beginning of the file store. this->stream_->rewind(); this->data_offset_ = ACE_Utils::truncate_cast (data_beg - this->stream_->recv()); // Forward to the beginning of data. if (this->stream_->seek (this->data_offset_, SEEK_SET) == -1) { ACE_ERROR_RETURN ((LM_ERROR, "%s: %m", "Error in seeking to beginning of data"), -1); } return status; } int ACEXML_HttpCharStream::send_request () { char* path = ACE::strnew (ACE_TEXT_ALWAYS_CHAR (this->url_addr_->get_path_name())); std::unique_ptr path_ptr (path); size_t commandsize = ACE_OS::strlen (path) + ACE_OS::strlen (this->url_addr_->get_host_name ()) + 20 // Extra + 1 // NUL byte + 16 ; // Protocol filler... char* command; ACE_NEW_RETURN (command, char[commandsize], -1); // Ensure that the memory is deallocated. std::unique_ptr cmd_ptr (command); int bytes = ACE_OS::sprintf (command, "GET %s HTTP/1.0\r\n", path); bytes += ACE_OS::sprintf (&command[bytes], "Host: %s\r\n", this->url_addr_->get_host_name ()); bytes += ACE_OS::sprintf (&command[bytes], "\r\n"); ACE_Time_Value tv (ACE_DEFAULT_TIMEOUT); // Send the command to the connected server. int retval = static_cast (this->stream_->send_n (command, bytes, &tv)); if (retval <= 0) return -1; return retval; } int ACEXML_HttpCharStream::available () { if (this->stream_ == 0) return -1; return static_cast (this->stream_->available()); } int ACEXML_HttpCharStream::close () { delete[] this->url_; this->url_ = 0; delete this->url_addr_; this->url_addr_ = 0; delete this->stream_; this->stream_ = 0; delete this->connector_; this->connector_ = 0; this->size_ = 0; this->data_offset_ = 0; delete[] this->encoding_; this->encoding_ = 0; return 0; } int ACEXML_HttpCharStream::determine_encoding () { if (this->stream_ == 0) return -1; char input[] = {0, 0, 0, 0}; size_t const len = sizeof (input) / sizeof (input[0]); size_t i = 0; for (; i < len && input[i] != static_cast (EOF); ++i) input[i] = static_cast (this->stream_->peek_char (i)); if (i < len) return -1; ACEXML_Char const * const temp = ACEXML_Encoding::get_encoding (input); if (!temp) return -1; else { if (this->encoding_) delete [] this->encoding_; this->encoding_ = ACE::strnew (temp); // ACE_DEBUG ((LM_DEBUG, "URI's encoding is %s\n", this->encoding_)); } // Move over the byte-order-mark if present. for (size_t j = 0; j < len; ++j) { if (input[j] == '\xFF' || input[j] == '\xFE' || input[j] == '\xEF' || input[j] == '\xBB' || input[j] == '\xBF') { this->stream_->get_char(); continue; } break; } return 0; } void ACEXML_HttpCharStream::rewind () { if (this->stream_ == 0) return; this->stream_->rewind(); // Forward to the beginning of data. if (this->stream_->seek (this->data_offset_, SEEK_SET) == -1) ACE_ERROR ((LM_ERROR, "%s: %m", "Error in seeking to beginning of data")); this->determine_encoding(); } const ACEXML_Char* ACEXML_HttpCharStream::getEncoding () { return this->encoding_; } const ACEXML_Char* ACEXML_HttpCharStream::getSystemId () { return this->url_; } int ACEXML_HttpCharStream::read (ACEXML_Char *str, size_t len) { if (this->stream_ == 0) return -1; len = len * sizeof (ACEXML_Char); const char* temp = this->stream_->recv (len); if (temp == 0) return -1; ACE_OS::strncpy (str, ACE_TEXT_CHAR_TO_TCHAR (temp), len); return static_cast (len); } int ACEXML_HttpCharStream::get (ACEXML_Char& ch) { if (this->stream_ == 0) return -1; #if defined (ACE_USES_WCHAR) return this->get_i (ch); #else ch = (ACEXML_Char) this->stream_->get_char(); return (ch == (ACEXML_Char)EOF ? -1 :0); #endif /* ACE_USES_WCHAR */ } int ACEXML_HttpCharStream::peek () { if (this->stream_ == 0) return -1; #if defined (ACE_USES_WCHAR) return this->peek_i(); #else return this->stream_->peek_char (0); #endif /* ACE_USES_WCHAR */ } #if defined (ACE_USES_WCHAR) int ACEXML_HttpCharStream::get_i (ACEXML_Char& ch) { if (ACE_OS::strcmp (this->encoding_, ACE_TEXT ("UTF-8")) == 0) { ch = (ACEXML_Char) this->stream_->get_char(); return (ch == (ACEXML_Char)EOF ? -1 : 0); } int BE = (ACE_OS::strcmp (this->encoding_, ACE_TEXT ("UTF-16BE")) == 0) ? 1 : 0; ACEXML_Char input[2] = {0}; int i = 0; for (; i < 2 && (input[i] = this->stream_->get_char()) > 0; ++i) ; if (i < 2) { ch = 0; return input[i]; } ch = BE ? input[0] << 8 | input[1] : input[1] << 8 | input[0]; return 0; } int ACEXML_HttpCharStream::peek_i () { // If we are reading a UTF-8 encoded file, just use the plain unget. if (ACE_OS::strcmp (this->encoding_, ACE_TEXT ("UTF-8")) == 0) { ACEXML_Char ch = (ACEXML_Char) this->stream_->peek_char (0); return ch; } int BE = (ACE_OS::strcmp (this->encoding_, ACE_TEXT ("UTF-16BE")) == 0) ? 1 : 0; // Peek into the stream. ACEXML_Char input[2]; int i = 0; for (; i < 2 && (input[i] = this->stream_->peek_char (i)) > 0; ++i) ; if (i < 2) return -1; return (BE ? input[0] << 8 | input[1] : input[1] << 8 | input[0]); } #endif /* ACE_USES_WCHAR */ ace-8.0.4+dfsg.orig/ACEXML/common/DTDHandler.cpp0000644000175000017500000000010615027201772020041 0ustar sudipsudip#include "DTDHandler.h" ACEXML_DTDHandler::~ACEXML_DTDHandler () { } ace-8.0.4+dfsg.orig/ACEXML/common/FileCharStream.cpp0000644000175000017500000001352615027201772020773 0ustar sudipsudip#include "ACEXML/common/FileCharStream.h" #include "ace/ACE.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_sys_stat.h" #include "ace/Truncate.h" #if defined (ACE_USES_WCHAR) # include "ace/OS_NS_wchar.h" #endif /* ACE_USES_WCHAR */ ACEXML_FileCharStream::ACEXML_FileCharStream () : filename_ (0), encoding_ (0), size_ (0), infile_ (0), close_infile_ (true), peek_ (0) { } ACEXML_FileCharStream::~ACEXML_FileCharStream () { this->close(); } int ACEXML_FileCharStream::use_stream_i (FILE* open_file, const ACEXML_Char *name) { delete[] this->filename_; this->filename_ = 0; delete[] this->encoding_; this->encoding_ = 0; this->infile_ = open_file; if (this->infile_ == 0) return -1; ACE_stat statbuf; if (ACE_OS::stat (name, &statbuf) < 0) return -1; this->size_ = ACE_Utils::truncate_cast (statbuf.st_size); this->filename_ = ACE::strnew (name); return this->determine_encoding(); } int ACEXML_FileCharStream::use_stream (FILE* open_file, const ACEXML_Char *name) { if (open_file != 0) ACE_OS::rewind(open_file); this->close_infile_ = false; return use_stream_i(open_file, name); } int ACEXML_FileCharStream::open (const ACEXML_Char *name) { this->close_infile_ = true; return use_stream_i(ACE_OS::fopen (name, ACE_TEXT ("r")), name); } int ACEXML_FileCharStream::determine_encoding () { if (this->infile_ == 0) return -1; char input[4]; int retval = 0; int i = 0; for (; i < 4 && retval != -1; ++i) retval = this->getchar_i(input[i]); if (i < 4) return -1; // Rewind the stream ACE_OS::rewind (this->infile_); const ACEXML_Char* temp = ACEXML_Encoding::get_encoding (input); if (!temp) return -1; else { delete [] this->encoding_; this->encoding_ = ACE::strnew (temp); // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("File's encoding is %s\n"), // this->encoding_)); } // Move over the byte-order-mark if present. char ch; for (int j = 0; j < 3; ++j) { if (this->getchar_i (ch) < 0) return -1; if (ch == '\xFF' || ch == '\xFE' || ch == '\xEF' || ch == '\xBB' || ch == '\xBF') continue; else { ACE_OS::ungetc (ch, this->infile_); break; } } return 0; } void ACEXML_FileCharStream::rewind() { if (this->infile_ == 0) return; ACE_OS::rewind (this->infile_); this->determine_encoding(); } int ACEXML_FileCharStream::available () { if (this->infile_ == 0) return -1; long curr; if ((curr = ACE_OS::ftell (this->infile_)) < 0) return -1; return static_cast (this->size_ - curr); } int ACEXML_FileCharStream::close () { if (this->infile_ != 0) { if (this->close_infile_) { ACE_OS::fclose (this->infile_); } this->infile_ = 0; } delete[] this->filename_; this->filename_ = 0; delete[] this->encoding_; this->encoding_ = 0; this->size_ = 0; this->peek_ = 0; return 0; } int ACEXML_FileCharStream::getchar_i (char& ch) { ch = static_cast (ACE_OS::fgetc (this->infile_)); return (feof(this->infile_) ? -1 : 0); } int ACEXML_FileCharStream::read (ACEXML_Char *str, size_t len) { if (this->infile_ == 0) return -1; return static_cast (ACE_OS::fread (str, sizeof (ACEXML_Char), len, this->infile_)); } int ACEXML_FileCharStream::get (ACEXML_Char& ch) { if (this->infile_ == 0) return -1; #if defined (ACE_USES_WCHAR) return this->get_i (ch); #else ch = (ACEXML_Char) ACE_OS::fgetc (this->infile_); return (feof(this->infile_) ? -1 : 0); #endif /* ACE_USES_WCHAR */ } int ACEXML_FileCharStream::peek () { if (this->infile_ == 0) return -1; #if defined (ACE_USES_WCHAR) return this->peek_i(); #else ACEXML_Char ch = static_cast (ACE_OS::fgetc (this->infile_)); ACE_OS::ungetc (ch, this->infile_); return ch; #endif /* ACE_USES_WCHAR */ } #if defined (ACE_USES_WCHAR) int ACEXML_FileCharStream::get_i (ACEXML_Char& ch) { if (ACE_OS::strcmp (this->encoding_, ACE_TEXT ("UTF-8")) == 0) { ch = (ACEXML_Char) ACE_OS::fgetc (this->infile_); return (feof(this->infile_) ? -1 : 0); } // If we have a value in peek_, return it. if (this->peek_ != 0) { ch = this->peek_; this->peek_ = 0; return 0; } int BE = (ACE_OS::strcmp (this->encoding_, ACE_TEXT ("UTF-16BE")) == 0) ? 1 : 0; ACEXML_Char input[2]; int i = 0; for (; i < 2 && !feof (this->infile_); ++i) { input[i] = ACE_OS::fgetwc (this->infile_); } if (i < 2) { ch = 0; return -1; } ch = BE ? input[0] << 8 | input[1] : input[1] << 8 | input[0]; return 0; } int ACEXML_FileCharStream::peek_i () { // If we are reading a UTF-8 encoded file, just use the plain unget. if (ACE_OS::strcmp (this->encoding_, ACE_TEXT ("UTF-8")) == 0) { ACEXML_Char ch = (ACEXML_Char) ACE_OS::fgetc (this->infile_); ACE_OS::ungetc (ch, this->infile_); return ch; } // If somebody had already called peek() and not consumed it, return the // value held in this->peek_. if (this->peek_ != 0) return this->peek_; // Peek into the stream. This reads two characters off the stream, keeps // it in peek_. int BE = (ACE_OS::strcmp (this->encoding_, ACE_TEXT ("UTF-16BE")) == 0) ? 1 : 0; ACEXML_Char input[2]; int i = 0; for (; i < 2 && !feof (this->infile_); ++i) { input[i] = ACE_OS::fgetwc (this->infile_); } if (i < 2) { this->peek_ = 0; return -1; } this->peek_ = BE ? input[0] << 8 | input[1] : input[1] << 8 | input[0]; return this->peek_; } #endif /* ACE_USES_WCHAR */ const ACEXML_Char* ACEXML_FileCharStream::getEncoding () { return this->encoding_; } const ACEXML_Char* ACEXML_FileCharStream::getSystemId () { return this->filename_; } ace-8.0.4+dfsg.orig/ACEXML/common/XMLFilterImpl.h0000644000175000017500000001553615027201772020242 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file XMLFilterImpl.h * * @author Nanbor Wang */ //============================================================================= #ifndef ACEXML_XMLFILTERIMPL_H #define ACEXML_XMLFILTERIMPL_H #include /**/ "ace/pre.h" #include "ACEXML/common/XMLFilter.h" #include "ACEXML/common/XMLReader.h" #include "ACEXML/common/Locator.h" #include "ACEXML/common/ContentHandler.h" #include "ACEXML/common/DTDHandler.h" #include "ACEXML/common/EntityResolver.h" #include "ACEXML/common/ErrorHandler.h" /** * @class ACEXML_XMLFilterImpl * * @brief ACEXML_XMLFilterImpl * * This class is designed to sit between an XMLReader and the client * application's event handlers. By default, it does nothing but pass * requests up to the reader and events on to the handlers unmodified, but * subclasses can override specific methods to modify the event stream or * the configuration requests as they pass through. */ class ACEXML_Export ACEXML_XMLFilterImpl : public ACEXML_XMLFilter, public ACEXML_ContentHandler, public ACEXML_DTDHandler, public ACEXML_EntityResolver, public ACEXML_ErrorHandler { public: /** * Default constructor. Create with no parent. */ ACEXML_XMLFilterImpl (); /** * Construct an XML filter with the specified parent. */ ACEXML_XMLFilterImpl (ACEXML_XMLReader *parent); /** * Destructor. */ virtual ~ACEXML_XMLFilterImpl (); /* * Look up the value of a feature. */ virtual int getFeature (const ACEXML_Char *name); /* * Look up the value of a property. */ virtual void * getProperty (const ACEXML_Char *name); /* * Parse an XML document. */ virtual void parse (ACEXML_InputSource *input); /* * Parse an XML document from a system identifier (URI). */ virtual void parse (const ACEXML_Char *systemId); /* * Set the state of a feature. */ virtual void setFeature (const ACEXML_Char *name, int boolean_value); /* * Set the value of a property. */ virtual void setProperty (const ACEXML_Char *name, void *value); /* * Get the parent reader. */ virtual ACEXML_XMLReader *getParent () const; /* * Set the parent reader. */ virtual void setParent (ACEXML_XMLReader *parent); /* * Get the current DTD event handler. */ virtual ACEXML_DTDHandler *getDTDHandler () const; /* * Get the current content event handler. */ virtual ACEXML_ContentHandler *getContentHandler () const; /* * Get the current entity resolver. */ virtual ACEXML_EntityResolver *getEntityResolver () const; /* * Get the current error event handler. */ virtual ACEXML_ErrorHandler *getErrorHandler () const; /* * Set the DTD event handler. */ virtual void setDTDHandler (ACEXML_DTDHandler *handler); /* * Set the content event handler. */ virtual void setContentHandler (ACEXML_ContentHandler *handler); /* * Set the entity resolver. */ virtual void setEntityResolver (ACEXML_EntityResolver *handler); /* * Set the error event handler. */ virtual void setErrorHandler (ACEXML_ErrorHandler *handler); /* * Receive notification of character data. */ virtual void characters (const ACEXML_Char *ch, size_t start, size_t length); /* * Receive notification of the end of a document. */ virtual void endDocument (); /* * Receive notification of the end of an element. */ virtual void endElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName); /* * End the scope of a prefix-URI mapping. */ virtual void endPrefixMapping (const ACEXML_Char *prefix); /* * Receive notification of ignorable whitespace in element content. */ virtual void ignorableWhitespace (const ACEXML_Char *ch, int start, int length); /* * Receive notification of a processing instruction. */ virtual void processingInstruction (const ACEXML_Char *target, const ACEXML_Char *data); /* * Receive an object for locating the origin of SAX document events. */ virtual void setDocumentLocator (ACEXML_Locator *locator) ; /* * Receive notification of a skipped entity. */ virtual void skippedEntity (const ACEXML_Char *name); /* * Receive notification of the beginning of a document. */ virtual void startDocument (); /* * Receive notification of the beginning of an element. */ virtual void startElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName, ACEXML_Attributes *atts); /* * Begin the scope of a prefix-URI Namespace mapping. */ virtual void startPrefixMapping (const ACEXML_Char *prefix, const ACEXML_Char *uri); // *** Methods inherit from ACEXML_DTDHandler. /* * Receive notification of a notation declaration event. */ virtual void notationDecl (const ACEXML_Char *name, const ACEXML_Char *publicId, const ACEXML_Char *systemId); /* * Receive notification of an unparsed entity declaration event. */ virtual void unparsedEntityDecl (const ACEXML_Char *name, const ACEXML_Char *publicId, const ACEXML_Char *systemId, const ACEXML_Char *notationName); // Methods inherit from ACEXML_EnitityResolver. /* * Allow the application to resolve external entities. */ virtual ACEXML_InputSource *resolveEntity (const ACEXML_Char *publicId, const ACEXML_Char *systemId); // Methods inherit from ACEXML_ErrorHandler. /* * Receive notification of a recoverable error. */ virtual void error (ACEXML_SAXParseException &exception); /* * Receive notification of a non-recoverable error. */ virtual void fatalError (ACEXML_SAXParseException &exception); /* * Receive notification of a warning. */ virtual void warning (ACEXML_SAXParseException &exception); protected: int setupParser (); // Set up the event handlers of parent parser to this. // Returns -1 if no valid parent is set. private: ACEXML_XMLReader *parent_; // ACEXML_Locator *locator_; ACEXML_EntityResolver *entityResolver_; ACEXML_DTDHandler *dtdHandler_; ACEXML_ContentHandler *contentHandler_; ACEXML_ErrorHandler *errorHandler_; }; #if defined (__ACEXML_INLINE__) # include "ACEXML/common/XMLFilterImpl.inl" #endif /* __ACEXML_INLINE__ */ #include /**/ "ace/post.h" #endif /* ACEXML_XMLFILTERIMPL_H */ ace-8.0.4+dfsg.orig/ACEXML/common/DefaultHandler.cpp0000644000175000017500000000522015027201772021014 0ustar sudipsudip// -*- C++ -*- #include "ACEXML/common/DefaultHandler.h" ACEXML_DefaultHandler::ACEXML_DefaultHandler () { } ACEXML_DefaultHandler::~ACEXML_DefaultHandler () { } void ACEXML_DefaultHandler::characters (const ACEXML_Char *, size_t, size_t) { } void ACEXML_DefaultHandler::endDocument () { } void ACEXML_DefaultHandler::endElement (const ACEXML_Char *, const ACEXML_Char *, const ACEXML_Char *) { } void ACEXML_DefaultHandler::endPrefixMapping (const ACEXML_Char *) { // No-op. } void ACEXML_DefaultHandler::ignorableWhitespace (const ACEXML_Char *, int, int) { // No-op. } void ACEXML_DefaultHandler::processingInstruction (const ACEXML_Char *, const ACEXML_Char *) { // No-op. } void ACEXML_DefaultHandler::setDocumentLocator (ACEXML_Locator * ) { // No-op. } void ACEXML_DefaultHandler::skippedEntity (const ACEXML_Char *) { // No-op. } void ACEXML_DefaultHandler::startDocument () { // No-op. } void ACEXML_DefaultHandler::startElement (const ACEXML_Char *, const ACEXML_Char *, const ACEXML_Char *, ACEXML_Attributes *) { // No-op. } void ACEXML_DefaultHandler::startPrefixMapping (const ACEXML_Char *, const ACEXML_Char *) { // No-op. } // *** Methods inherited from ACEXML_DTDHandler. void ACEXML_DefaultHandler::notationDecl (const ACEXML_Char *, const ACEXML_Char *, const ACEXML_Char *) { // No-op. } void ACEXML_DefaultHandler::unparsedEntityDecl (const ACEXML_Char *, const ACEXML_Char *, const ACEXML_Char *, const ACEXML_Char *) { // No-op. } // Methods inherited from ACEXML_EntityResolver. ACEXML_InputSource * ACEXML_DefaultHandler::resolveEntity (const ACEXML_Char *, const ACEXML_Char * ) { // No-op. return 0; } // Methods inherited from ACEXML_ErrorHandler. /* * Receive notification of a recoverable error. */ void ACEXML_DefaultHandler::error (ACEXML_SAXParseException &) { // No-op. } void ACEXML_DefaultHandler::fatalError (ACEXML_SAXParseException &) { // No-op. } void ACEXML_DefaultHandler::warning (ACEXML_SAXParseException &) { // No-op. } ace-8.0.4+dfsg.orig/ACEXML/common/LocatorImpl.h0000644000175000017500000001000615027201772020022 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file LocatorImpl.h * * @author Nanbor Wang * @author Krishnakumar Balasubramanian */ //============================================================================= #ifndef ACEXML_LOCALTORIMPL_H #define ACEXML_LOCALTORIMPL_H #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/Locator.h" /** * @class ACEXML_LocatorImpl * * @brief ACEXML_LocatorImpl is an implementation of ACEXML_Locator. * * This class is available mainly for application writers, who can * use it to make a persistent snapshot of a locator at any point * during a document parse: * * @code * ACEXML_Locator locator; * ACEXML_Locator startloc; * * public void setLocator (ACEXML_Locator locator) * { * // note the locator * this.locator = locator; * } * * public void startDocument () * { * // save the location of the start of the document * // for future use. * ACEXML_Locator startloc = new ACEXML_LocatorImpl(locator); * } * @endcode * * Normally, parser writers will not use this class, since it is more * efficient to provide location information only when requested, * rather than constantly updating a Locator object. * * @todo ACEXML parser doesn't support the use of Locator yet. * * @sa ACEXML_Locator */ class ACEXML_Export ACEXML_LocatorImpl : public ACEXML_Locator { public: /* * Default constructor. */ ACEXML_LocatorImpl (); /** * Construct a locator with systemId and publicId * */ ACEXML_LocatorImpl (const ACEXML_Char* systemId, const ACEXML_Char* publicId); /** * Copy constructor. Create a persistent copy of the current state * of a locator. When the original locator changes, this copy will * still keep the original values (and it can be used outside the * scope of DocumentHandler methods). */ ACEXML_LocatorImpl (const ACEXML_Locator& locator); ACEXML_LocatorImpl (const ACEXML_LocatorImpl &) = delete; ACEXML_LocatorImpl (ACEXML_LocatorImpl &&) = delete; ACEXML_LocatorImpl &operator= (const ACEXML_LocatorImpl &) = delete; ACEXML_LocatorImpl &operator= (ACEXML_LocatorImpl &&) = delete; /* * Destructor. */ virtual ~ACEXML_LocatorImpl (); /* * Return the column number where the current document event ends. */ virtual int getColumnNumber () const; /* * Return the line number where the current document event ends. */ virtual int getLineNumber () const; /* * Return the public identifier for the current document event. */ virtual const ACEXML_Char *getPublicId () const; /* * Return the system identifier for the current document event. */ virtual const ACEXML_Char *getSystemId () const; /* * Set the column number of this locator. */ void setColumnNumber (int cn); /* * Set the line number of this locator. */ void setLineNumber (int ln); /* * Set the public identifier of this locator. */ void setPublicId (const ACEXML_Char *id); /* * Set the system identifier of this locator. */ void setSystemId (const ACEXML_Char *id); /* * Increment the line number. */ void incrLineNumber (); /* * Increment the column number. */ void incrColumnNumber (); /* * Reset the Locator information. This is necessary because one might * want to use the same parser to parse multiple files. In that case, * tying the life of the Locator with the parser is not appropriate. The * parser calls this method as soon as issuing an endDocument() call. */ void reset (); private: ACEXML_Char *publicId_; ACEXML_Char *systemId_; int lineNumber_; int columnNumber_; }; #if defined (__ACEXML_INLINE__) # include "ACEXML/common/LocatorImpl.inl" #endif /* __ACEXML_INLINE__ */ #include /**/ "ace/post.h" #endif /* ACEXML_LOCALTORIMPL_H */ ace-8.0.4+dfsg.orig/ACEXML/common/EntityResolver.h0000644000175000017500000000322715027201772020602 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file EntityResolver.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_ENTITYHANDLER_H_ #define _ACEXML_ENTITYHANDLER_H_ #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/InputSource.h" #include "ACEXML/common/SAXExceptions.h" /** * @class ACEXML_EntityResolver * * @brief ACEXML_EntityResolver * * If a SAX application needs to implement customized handling for * external entities, it must implement this interface and register an * instance with the SAX driver using the setEntityResolver method. * * The XML reader will then allow the application to intercept any * external entities (including the external DTD subset and external * parameter entities, if any) before including them. * * Many SAX applications will not need to implement this interface, * but it will be especially useful for applications that build XML * documents from databases or other specialised input sources, or for * applications that use URI types other than URLs. */ class ACEXML_Export ACEXML_EntityResolver { public: virtual ~ACEXML_EntityResolver (); /** * Allow the application to resolve external entities. */ virtual ACEXML_InputSource *resolveEntity (const ACEXML_Char *publicId, const ACEXML_Char *systemId) = 0; }; #include /**/ "ace/post.h" #endif /* _ACEXML_ENTITYHANDLER_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/ZipCharStream.cpp0000644000175000017500000001215615027201772020654 0ustar sudipsudip#ifdef USE_ZZIP #include "ACEXML/common/ZipCharStream.h" #include "ace/ACE.h" ACEXML_ZipCharStream::ACEXML_ZipCharStream () : filename_ (0), encoding_ (0), size_ (0), infile_ (0), pos_ (0), limit_ (0) { } ACEXML_ZipCharStream::~ACEXML_ZipCharStream () { this->close(); } int ACEXML_ZipCharStream::open (const ACEXML_Char *name) { delete[] this->filename_; this->filename_ = 0; delete[] this->encoding_; this->encoding_ = 0; this->infile_ = zzip_fopen (name, ACE_TEXT ("r")); if (this->infile_ == 0) return -1; this->filename_ = ACE::strnew (ACE::basename (name)); return this->determine_encoding(); } int ACEXML_ZipCharStream::determine_encoding () { if (this->infile_ == 0) return -1; char input[4]; int i = 0; for (; i < 4 && (input[i] = this->peekchar_i(i)) > 0; ++i) ; if (i < 4) return -1; const ACEXML_Char* temp = ACEXML_Encoding::get_encoding (input); if (!temp) return -1; else { if (this->encoding_) delete [] this->encoding_; this->encoding_ = ACE::strnew (temp); // ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("File's encoding is %s\n"), // this->encoding_)); } // Move over the byte-order-mark if present. for (int j = 0; j < 3; ++j) { ACEXML_Char ch; if ((ch = this->peekchar_i()) < 0) return -1; if (ch == '\xFF' || ch == '\xFE' || ch == '\xEF' || ch == '\xBB' || ch == '\xBF') this->get(ch); else break; } return 0; } void ACEXML_ZipCharStream::rewind() { if (this->infile_ == 0) return; zzip_rewind (this->infile_); this->determine_encoding(); } int ACEXML_ZipCharStream::available () { if (this->infile_ == 0) return -1; long curr; if ((curr = zzip_tell (this->infile_)) < 0) return -1; return (this->size_ - curr); } int ACEXML_ZipCharStream::close () { if (this->infile_ != 0) { zzip_close (this->infile_); this->infile_ = 0; } delete[] this->filename_; this->filename_ = 0; delete[] this->encoding_; this->encoding_ = 0; this->size_ = 0; this->pos_ = 0; this->limit_ = 0; return 0; } int ACEXML_ZipCharStream::getchar_i (char& ch) { if (this->infile_ == 0) return -1; if (this->pos_ < this->limit_) { ch = this->buf_[this->pos_++]; return 0; } this->limit_ = zzip_read (this->infile_, this->buf_, sizeof (this->buf_)); if (this->limit_ == 0) return -1; this->pos_ = 0; ch = this->buf_[this->pos_++]; return 0; } int ACEXML_ZipCharStream::peekchar_i (ACE_OFF_T offset) { if (this->infile_ == 0) return -1; if (offset > (ACE_OFF_T) sizeof (this->buf_)) return -1; if (this->pos_ + offset < this->limit_) return this->buf_[this->pos_ + offset]; int i = 0; for (; this->pos_ < this->limit_; ++this->pos_, ++i) this->buf_[i] = this->buf_[this->pos_]; this->limit_ = zzip_read (this->infile_, this->buf_ + i, sizeof (this->buf_) - i); this->limit_ += i; if (this->limit_ == 0) return -1; this->pos_ = 0; return this->buf_[this->pos_ + offset]; } int ACEXML_ZipCharStream::read (ACEXML_Char *str, size_t len) { if (this->infile_ == 0) return -1; size_t i = 0; for (; i < len && this->pos_ < this->limit_; ++i) str[i] = this->buf_[this->pos_++]; if (i == len) return len; len = len - i; this->pos_ = 0; this->limit_ = 0; int bytes = zzip_fread (str + i, sizeof (ACEXML_Char), len, this->infile_); return (bytes + i); } int ACEXML_ZipCharStream::get (ACEXML_Char& ch) { #if defined (ACE_USES_WCHAR) return this->get_i (ch); #else return this->getchar_i (ch); #endif /* ACE_USES_WCHAR */ } int ACEXML_ZipCharStream::peek () { #if defined (ACE_USES_WCHAR) return this->peek_i(); #else return this->peekchar_i(); #endif /* ACE_USES_WCHAR */ } const ACEXML_Char* ACEXML_ZipCharStream::getEncoding () { return this->encoding_; } const ACEXML_Char* ACEXML_ZipCharStream::getSystemId () { return this->filename_; } #if defined (ACE_USES_WCHAR) int ACEXML_ZipCharStream::get_i (ACEXML_Char& ch) { if (ACE_OS::strcmp (this->encoding_, ACE_TEXT ("UTF-8")) == 0) return this->getchar_i (ch); int BE = (ACE_OS::strcmp (this->encoding_, ACE_TEXT ("UTF-16BE")) == 0) ? 1 : 0; ACEXML_Char input[2]; int i = 0; for (; i < 2 && (this->getchar_i (input[i]) == 0); ++i) ; if (i < 2) { ch = 0; return -1; } ch = BE ? input[0] << 8 | input[1] : input[1] << 8 | input[0]; return 0; } int ACEXML_ZipCharStream::peek_i () { // If we are reading a UTF-8 encoded file, just use the plain unget. if (ACE_OS::strcmp (this->encoding_, ACE_TEXT ("UTF-8")) == 0) return this->peekchar_i(); // Peek into the stream. This reads two characters off the stream, keeps // it in peek_. int BE = (ACE_OS::strcmp (this->encoding_, ACE_TEXT ("UTF-16BE")) == 0) ? 1 : 0; ACEXML_Char input[2]; int i = 0; for (; i < 2 && (input[i] = this->peekchar_i (i)) > 0; ++i) ; if (i < 2) return -1; return (BE ? input[0] << 8 | input[1] : input[1] << 8 | input[0]); } #endif /* ACE_USES_WCHAR */ #endif /* USE_ZZIP */ ace-8.0.4+dfsg.orig/ACEXML/common/FileCharStream.h0000644000175000017500000000632515027201772020437 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file FileCharStream.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_FILECHARSTREAM_H_ #define _ACEXML_FILECHARSTREAM_H_ #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/CharStream.h" #include "ACEXML/common/Encoding.h" /** * @class ACEXML_FileCharStream * * An implementation of ACEXML_CharStream for reading input from a file. */ class ACEXML_Export ACEXML_FileCharStream : public ACEXML_CharStream { public: /// Default constructor. ACEXML_FileCharStream (); /// Destructor virtual ~ACEXML_FileCharStream (); /// Open a file. int open (const ACEXML_Char *name); /** * Accept an already opened file. The stream does not * assume ownership of open_file. */ int use_stream (FILE* open_file, const ACEXML_Char *name); /** * Returns the available ACEXML_Char in the buffer. -1 * if the object is not initialized properly. */ virtual int available (); /** * Close this stream and release all resources used by it. */ virtual int close (); /** * Read the next ACEXML_Char. Return -1 if we are not able to * return an ACEXML_Char, 0 if succees. */ virtual int get (ACEXML_Char& ch); /** * Read the next batch of ACEXML_Char strings */ virtual int read (ACEXML_Char *str, size_t len); /** * Determine the encoding of the file. */ virtual int determine_encoding (); /** * Peek the next ACEXML_Char in the CharStream. Return the * character if success, -1 if EOF is reached. */ virtual int peek (); /** * Resets the file pointer to the beginning of the stream. */ virtual void rewind (); /* * Get the character encoding for the file. */ virtual const ACEXML_Char *getEncoding (); /* * Get the systemId for the underlying CharStream */ virtual const ACEXML_Char* getSystemId (); private: /** Read the next character as a normal character. Return -1 if EOF is * reached, else return 0. */ int getchar_i (char& ch); #if defined (ACE_USES_WCHAR) /** * Read the next character from the stream taking into account the * encoding of the file. */ int get_i (ACEXML_Char& ch); /** * Read the next character from the stream taking into account the * encoding of the file. Subsequent call to get() returns this * character. */ int peek_i (); #endif /* ACE_USES_WCHAR */ /// internal accept an already opened file. int use_stream_i (FILE* open_file, const ACEXML_Char *name); ACEXML_Char* filename_; ACEXML_Char* encoding_; ACE_OFF_T size_; FILE* infile_; bool close_infile_; // This is needed to ensure that we can implement a peek operation on a // UTF-16 encoded file. It is a bit hackish, but there is no other way of // implementing a peek() as the standard I/O FILE* guarantees only one // pushback. ACEXML_Char peek_; }; #include /**/ "ace/post.h" #endif /* _ACEXML_FILECHARSTREAM_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/Attributes_Def_Builder.h0000644000175000017500000000645315027201772022162 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Attributes_Def_Builder.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_ATTRIBUTES_DEF_BUILDER_H_ #define _ACEXML_ATTRIBUTES_DEF_BUILDER_H_ #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/XML_Types.h" #include "ACEXML/common/SAXExceptions.h" #include /** * @class ACEXML_Attribute_Def_Builder * * @brief An abstract virtual class defining an interface for building an * attribute definition from DTD. * * This class should be invisible to application programmers and is only * used for validator implementors. */ class ACEXML_Export ACEXML_Attribute_Def_Builder { public: typedef std::unique_ptr VAR; enum ATT_TYPE { CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION, ENUMERATION, ERROR_TYPE }; enum DEFAULT_DECL { REQUIRED, IMPLIED, FIXED, INVALID }; virtual ~ACEXML_Attribute_Def_Builder () = 0; /** * Specify the name of the attribute. */ virtual int setName (const ACEXML_Char *n) = 0; /** * Get the name of the attribute. */ virtual const ACEXML_Char *getName () = 0; /** * Set the attribute type. */ virtual int setAttType (const ATT_TYPE type) = 0; /** * Insert an element for NOTATION or ENUMERATION type attribute. */ virtual int insertList (const ACEXML_Char *Name) = 0; /** * Set default attribute declaration. */ virtual int setDefault (const DEFAULT_DECL def, const ACEXML_Char *value) = 0; /** * Check validity of the current attribute definition being built. * * @retval 0 if the attribute is not a valid combo. */ virtual int validAttr () = 0; /** * Dump the content of the attribute definition. */ virtual void dump () = 0; }; /** * @ class ACEXML_Attributes_Def_Builder Attributes_Def_Builder.h "common/Attributes_Def_Builder.h" * * @ brief An abstract virtual class defining an interface for building * attribute definitions from DTD. * * This class should be invisible to application programmers and * is only used for validator implementors. */ class ACEXML_Export ACEXML_Attributes_Def_Builder { public: typedef std::unique_ptr VAR; virtual ~ACEXML_Attributes_Def_Builder () = 0; /** * Set the element name that the attribute builder applies. * * @retval 0 if valid, -1 otherwise. */ virtual int setElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName) = 0; /** * Acquire an Attribute_Builder. */ virtual ACEXML_Attribute_Def_Builder *getAttribute_Def_Builder () = 0; /** * Add a definition for one attribute. */ virtual int insertAttribute (ACEXML_Attribute_Def_Builder *def) = 0; /** * Dump the content of the attribute definition. */ virtual void dump () = 0; }; #include /**/ "ace/post.h" #endif /* _ACEXML_ATTRIBUTES_DEF_BUILDER_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/NamespaceSupport.cpp0000644000175000017500000001366715027201772021441 0ustar sudipsudip// -*- C++ -*- #include "ACEXML/common/NamespaceSupport.h" #include "ace/OS_NS_string.h" static const ACEXML_Char ACEXML_XMLNS_PREFIX_name[] = ACE_TEXT ("xmlns"); const ACEXML_Char *ACEXML_NamespaceSupport::XMLNS_PREFIX = ACEXML_XMLNS_PREFIX_name; static const ACEXML_Char ACEXML_DEFAULT_NS_PREFIX[] = {0}; static const ACEXML_Char ACEXML_TABOO_NS_PREFIX[] = ACE_TEXT ("xml"); static const ACEXML_Char ACEXML_XMLNS_URI_name[] = ACE_TEXT ("http://www.w3.org/XML/1998/namespace"); const ACEXML_Char *ACEXML_NamespaceSupport::XMLNS = ACEXML_XMLNS_URI_name; ACEXML_Namespace_Context_Stack::ACEXML_Namespace_Context_Stack () { } ACEXML_Namespace_Context_Stack::~ACEXML_Namespace_Context_Stack () { // Clean up stuff. } int ACEXML_Namespace_Context_Stack::push (ACEXML_NS_CONTEXT *nsc) { return (this->stack_.push (nsc) < 0); } ACEXML_NS_CONTEXT * ACEXML_Namespace_Context_Stack::pop () { if (this->stack_.size() <= 0) return 0; ACEXML_NS_CONTEXT* temp = 0; int retval = this->stack_.pop (temp); if (retval != 0) { ACE_ERROR ((LM_ERROR, "Unable to pop Namespace context from stack\n")); return 0; } return temp; } int ACEXML_NamespaceSupport::popContext () { delete this->effective_context_; if ((this->effective_context_ = this->ns_stack_.pop ()) == 0) return -1; return 0; } int ACEXML_NamespaceSupport::pushContext () { ACEXML_NS_CONTEXT *temp = this->effective_context_; ACE_NEW_RETURN (this->effective_context_, ACEXML_NS_CONTEXT (), -1); // @@ Copy everything from the old context to the new one. ACEXML_NS_CONTEXT_ENTRY *entry = 0; for (ACEXML_NS_CONTEXT_ITER iter (*temp); iter.next (entry) != 0; iter.advance ()) this->effective_context_->bind (entry->ext_id_, entry->int_id_); this->ns_stack_.push (temp); return 0; } ACEXML_NamespaceSupport::ACEXML_NamespaceSupport () : ns_stack_ (), effective_context_ (0) {} int ACEXML_NamespaceSupport::init () { // @@ No way to tell if the new fails. ACE_NEW_RETURN (effective_context_, ACEXML_NS_CONTEXT(), -1); ACEXML_String prefix (ACEXML_TABOO_NS_PREFIX, 0, false); ACEXML_String uri (ACEXML_XMLNS_URI_name, 0, false); return this->effective_context_->bind (prefix, uri); } ACEXML_NamespaceSupport::~ACEXML_NamespaceSupport () { while (this->popContext () == 0) ; } int ACEXML_NamespaceSupport::declarePrefix (const ACEXML_Char *prefix, const ACEXML_Char *uri) { if (!prefix || !uri) return -1; // Unless predefined by w3.org(?) NS prefix can never start with // "xml". if (ACE_OS::strcmp (ACEXML_TABOO_NS_PREFIX, prefix) == 0) return -1; ACEXML_String ns_prefix (prefix, 0, false); ACEXML_String ns_uri (uri, 0, false); return this->effective_context_->rebind (ns_prefix, ns_uri); } int ACEXML_NamespaceSupport::getDeclaredPrefixes (ACEXML_STR_LIST &prefixes) const { ACEXML_NS_CONTEXT_ENTRY *entry = 0; // The prefix for default namespace (empty string) is included in // the return list. for (ACEXML_NS_CONTEXT_ITER iter (*this->effective_context_); iter.next (entry) != 0; iter.advance ()) prefixes.enqueue_tail (entry->ext_id_.c_str ()); return 0; } const ACEXML_Char * ACEXML_NamespaceSupport::getPrefix (const ACEXML_Char *uri) const { if (!uri || *uri == 0) return 0; ACEXML_NS_CONTEXT_ENTRY *entry = 0; for (ACEXML_NS_CONTEXT_ITER iter (*this->effective_context_); iter.next (entry) != 0; iter.advance ()) if (entry->int_id_ == ACEXML_String (uri, 0, false)) return entry->ext_id_.c_str (); return 0; // Nothing found. } int ACEXML_NamespaceSupport::getPrefixes (ACEXML_STR_LIST &prefixes) const { ACEXML_NS_CONTEXT_ENTRY *entry = 0; // The prefix for default namespace (empty string) is not included // in the return list. for (ACEXML_NS_CONTEXT_ITER iter (*this->effective_context_); iter.next (entry) != 0; iter.advance ()) prefixes.enqueue_tail (entry->ext_id_.c_str ()); return 0; } int ACEXML_NamespaceSupport::getPrefixes (const ACEXML_Char *uri, ACEXML_STR_LIST &prefixes) const { if (!uri) return -1; ACEXML_NS_CONTEXT_ENTRY *entry = 0; for (ACEXML_NS_CONTEXT_ITER iter (*this->effective_context_); iter.next (entry) != 0; iter.advance ()) if (entry->int_id_ == ACEXML_String (uri, 0, false) && entry->ext_id_ != ACEXML_String (ACEXML_DEFAULT_NS_PREFIX, 0, false)) prefixes.enqueue_tail (entry->ext_id_.c_str ()); else continue; return 0; // Nothing found. } const ACEXML_Char * ACEXML_NamespaceSupport::getURI (const ACEXML_Char *prefix) const { if (!prefix) return 0; ACEXML_NS_CONTEXT_ENTRY *entry = 0; if (this->effective_context_->find (ACEXML_String (prefix, 0, false), entry) == 0) return entry->int_id_.c_str (); return 0; } int ACEXML_NamespaceSupport::processName (const ACEXML_Char *qName, const ACEXML_Char *&uri, const ACEXML_Char *&name, int is_attribute) const { int qlen = static_cast (ACE_OS::strlen (qName)); int len = -1; for (int i = 0; i < qlen; ++i) if (qName [i] == ':') { len = i; break; } ACEXML_String prefix (ACE_TEXT (""), 0, false); if (len == -1) name = qName; else { prefix.set (qName, len, 1); name = qName + len + 1; } if (is_attribute && len == -1) { uri = ACEXML_DEFAULT_NS_PREFIX; return 0; } ACEXML_NS_CONTEXT_ENTRY *entry = 0; if (this->effective_context_->find (prefix, entry) == 0) uri = entry->int_id_.c_str (); else { uri = ACEXML_DEFAULT_NS_PREFIX; return -1; } return 0; } int ACEXML_NamespaceSupport::reset () { while (this->popContext() != -1) ; return 0; } ace-8.0.4+dfsg.orig/ACEXML/common/CharStream.h0000644000175000017500000000371715027201772017641 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file CharStream.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_CHARSTREAM_H_ #define _ACEXML_CHARSTREAM_H_ #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/XML_Types.h" /** * @class ACEXML_CharStream * * ACEXML_CharStream is an abstract class (interface) which defines the * basic opertions a parser could use to retrieve XML charater sequence. * The sequence can be read from a file or a character buffer. */ class ACEXML_Export ACEXML_CharStream { public: /** * Virtual destructor, must have. */ virtual ~ACEXML_CharStream () = 0; /** * Returns the available ACEXML_Char in the buffer. -1 * if the object is not initialized properly. */ virtual int available () = 0; /** * Close this stream and release all resources used by it. */ virtual int close () = 0; /** * Read the next ACEXML_Char. Return -1 if we are not able to * return an ACEXML_Char, 0 if EOS is reached, or 1 if succeed. */ virtual int get (ACEXML_Char& ch) = 0; /** * Read the next batch of ACEXML_Char strings */ virtual int read (ACEXML_Char *str, size_t len) = 0; /** * Peek the next ACEXML_Char in the CharStream. Return the * character if succeess, -1 if EOS is reached. */ virtual int peek () = 0; /** * Resets the pointer to the beginning of the stream. */ virtual void rewind () = 0; /* * Get the character encoding for a byte stream or URI. */ virtual const ACEXML_Char *getEncoding () = 0; /* * Get the systemId for the underlying CharStream */ virtual const ACEXML_Char* getSystemId () = 0; }; #include /**/ "ace/post.h" #endif /* _ACEXML_CHARSTREAM_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/XMLFilterImpl.cpp0000644000175000017500000001667515027201772020602 0ustar sudipsudip// -*- C++ -*- #include "ACEXML/common/XMLFilterImpl.h" #if !defined (__ACEXML_INLINE__) # include "ACEXML/common/XMLFilterImpl.inl" #endif /* __ACEXML_INLINE__ */ ACEXML_XMLFilterImpl::ACEXML_XMLFilterImpl () : parent_ (0), // locator_ (0), entityResolver_ (0), dtdHandler_ (0), contentHandler_ (0), errorHandler_ (0) { } ACEXML_XMLFilterImpl::ACEXML_XMLFilterImpl (ACEXML_XMLReader *parent) : parent_ (parent), // locator_ (0), entityResolver_ (0), dtdHandler_ (0), contentHandler_ (0), errorHandler_ (0) { } ACEXML_XMLFilterImpl::~ACEXML_XMLFilterImpl () { // @@ How are all the object lifecycles managed? } void ACEXML_XMLFilterImpl::parse (ACEXML_InputSource *input) { if (this->setupParser () < 0) { throw ACEXML_SAXException (ACE_TEXT ("No Parent available")); } this->parent_->parse (input); } void ACEXML_XMLFilterImpl::parse (const ACEXML_Char *systemId) { if (this->setupParser () < 0) { throw ACEXML_SAXException (ACE_TEXT ("No Parent available")); } this->parent_->parse (new ACEXML_InputSource (systemId)); } int ACEXML_XMLFilterImpl::getFeature (const ACEXML_Char *name) { if (this->parent_ != 0) return this->parent_->getFeature (name); throw ACEXML_SAXNotRecognizedException (name); } void * ACEXML_XMLFilterImpl::getProperty (const ACEXML_Char *name) { if (this->parent_ != 0) return this->parent_->getProperty (name); throw ACEXML_SAXNotRecognizedException (name); } void ACEXML_XMLFilterImpl::setFeature (const ACEXML_Char *name, int boolean_value) { if (this->parent_ != 0) { this->parent_->setFeature (name, boolean_value); } else { throw ACEXML_SAXNotRecognizedException (name); } } void ACEXML_XMLFilterImpl::setProperty (const ACEXML_Char *name, void *value) { if (this->parent_ != 0) { this->parent_->setProperty (name, value); } else { throw ACEXML_SAXNotRecognizedException (name); } } ACEXML_XMLReader * ACEXML_XMLFilterImpl::getParent () const { return this->parent_; } void ACEXML_XMLFilterImpl::setParent (ACEXML_XMLReader *parent) { this->parent_ = parent; } void ACEXML_XMLFilterImpl::characters (const ACEXML_Char *ch, size_t start, size_t length) { if (this->contentHandler_ != 0) this->contentHandler_->characters (ch, start, length); } void ACEXML_XMLFilterImpl::endDocument () { if (this->contentHandler_ != 0) this->contentHandler_->endDocument (); } void ACEXML_XMLFilterImpl::endElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName) { if (this->contentHandler_ != 0) this->contentHandler_->endElement (namespaceURI, localName, qName); } void ACEXML_XMLFilterImpl::endPrefixMapping (const ACEXML_Char *prefix) { if (this->contentHandler_ != 0) this->contentHandler_->endPrefixMapping (prefix); } void ACEXML_XMLFilterImpl::ignorableWhitespace (const ACEXML_Char *ch, int start, int length) { if (this->contentHandler_ != 0) this->contentHandler_->ignorableWhitespace (ch, start, length); } void ACEXML_XMLFilterImpl::processingInstruction (const ACEXML_Char *target, const ACEXML_Char *data) { if (this->contentHandler_ != 0) this->contentHandler_->processingInstruction (target, data); } void ACEXML_XMLFilterImpl::setDocumentLocator (ACEXML_Locator *locator) { if (this->contentHandler_ != 0) this->contentHandler_->setDocumentLocator (locator); } void ACEXML_XMLFilterImpl::skippedEntity (const ACEXML_Char *name) { if (this->contentHandler_ != 0) this->contentHandler_->skippedEntity (name); } void ACEXML_XMLFilterImpl::startDocument () { if (this->contentHandler_ != 0) this->contentHandler_->startDocument (); } void ACEXML_XMLFilterImpl::startElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName, ACEXML_Attributes *atts) { if (this->contentHandler_ != 0) this->contentHandler_->startElement (namespaceURI, localName, qName, atts); } void ACEXML_XMLFilterImpl::startPrefixMapping (const ACEXML_Char *prefix, const ACEXML_Char *uri) { if (this->contentHandler_ != 0) this->contentHandler_->startPrefixMapping (prefix, uri); } void ACEXML_XMLFilterImpl::notationDecl (const ACEXML_Char *name, const ACEXML_Char *publicId, const ACEXML_Char *systemId) { if (this->dtdHandler_ != 0) this->dtdHandler_->notationDecl (name, publicId, systemId); } void ACEXML_XMLFilterImpl::unparsedEntityDecl (const ACEXML_Char *name, const ACEXML_Char *publicId, const ACEXML_Char *systemId, const ACEXML_Char *notationName) { if (this->dtdHandler_ != 0) this->dtdHandler_->unparsedEntityDecl (name, publicId, systemId, notationName); } ACEXML_InputSource * ACEXML_XMLFilterImpl::resolveEntity (const ACEXML_Char *publicId, const ACEXML_Char *systemId) { if (this->entityResolver_ != 0) return this->entityResolver_->resolveEntity (publicId, systemId); return 0; } void ACEXML_XMLFilterImpl::error (ACEXML_SAXParseException &exception) { if (this->errorHandler_ != 0) this->errorHandler_->error (exception); } void ACEXML_XMLFilterImpl::fatalError (ACEXML_SAXParseException &exception) { if (this->errorHandler_ != 0) this->errorHandler_->fatalError (exception); } void ACEXML_XMLFilterImpl::warning (ACEXML_SAXParseException &exception) { if (this->errorHandler_ != 0) this->errorHandler_->warning (exception); } ACEXML_DTDHandler * ACEXML_XMLFilterImpl::getDTDHandler () const { return this->dtdHandler_; } ACEXML_ContentHandler * ACEXML_XMLFilterImpl::getContentHandler () const { return this->contentHandler_; } ACEXML_EntityResolver * ACEXML_XMLFilterImpl::getEntityResolver () const { return this->entityResolver_; } ACEXML_ErrorHandler * ACEXML_XMLFilterImpl::getErrorHandler () const { return this->errorHandler_; } void ACEXML_XMLFilterImpl::setDTDHandler (ACEXML_DTDHandler *handler) { this->dtdHandler_ = handler; } void ACEXML_XMLFilterImpl::setContentHandler (ACEXML_ContentHandler *handler) { this->contentHandler_ = handler; } void ACEXML_XMLFilterImpl::setEntityResolver (ACEXML_EntityResolver *handler) { this->entityResolver_ = handler; } void ACEXML_XMLFilterImpl::setErrorHandler (ACEXML_ErrorHandler *handler) { this->errorHandler_ = handler; } ace-8.0.4+dfsg.orig/ACEXML/common/XMLReader.h0000644000175000017500000000613315027201772017366 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file XMLReader.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_XMLREADER_H_ #define _ACEXML_XMLREADER_H_ #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/ContentHandler.h" #include "ACEXML/common/DTDHandler.h" #include "ACEXML/common/EntityResolver.h" #include "ACEXML/common/ErrorHandler.h" /** * @class ACEXML_XMLReader * * @brief ACEXML_XMLReader * * XMLReader is the interface that an XML parser's SAX2 driver must * implement. This interface allows an application to set and query * features and properties in the parser, to register event handlers * for document processing, and to initiate a document parse. * * All SAX interfaces are assumed to be synchronous: the parse methods * must not return until parsing is complete, and readers must wait * for an event-handler callback to return before reporting the next * event. */ class ACEXML_Export ACEXML_XMLReader { public: virtual ~ACEXML_XMLReader (); /** * Return the current content handler. */ virtual ACEXML_ContentHandler *getContentHandler () const = 0; /** * Return the current DTD handler. */ virtual ACEXML_DTDHandler *getDTDHandler () const = 0; /** * Return the current entity resolver. */ virtual ACEXML_EntityResolver *getEntityResolver () const = 0; /** * Return the current error handler. */ virtual ACEXML_ErrorHandler *getErrorHandler () const = 0; /** * Look up the value of a feature. This method allows * programmers to check whether a specific feature has been * activated in the parser. */ virtual int getFeature (const ACEXML_Char *name) = 0; /** * Look up the value of a property. */ virtual void * getProperty (const ACEXML_Char *name) = 0; /** * Parse an XML document. */ virtual void parse (ACEXML_InputSource *input) = 0; /** * Parse an XML document from a system identifier (URI). */ virtual void parse (const ACEXML_Char *systemId) = 0; /** * Allow an application to register a content event handler. */ virtual void setContentHandler (ACEXML_ContentHandler *handler) = 0; /** * Allow an application to register a DTD event handler. */ virtual void setDTDHandler (ACEXML_DTDHandler *handler) = 0; /** * Allow an application to register an entity resolver. */ virtual void setEntityResolver (ACEXML_EntityResolver *resolver) = 0; /** * Allow an application to register an error event handler. */ virtual void setErrorHandler (ACEXML_ErrorHandler *handler) = 0; /** * Activating or deactivating a feature. */ virtual void setFeature (const ACEXML_Char *name, int boolean_value) = 0; /** * Set the value of a property. */ virtual void setProperty (const ACEXML_Char *name, void *value) = 0; }; #include /**/ "ace/post.h" #endif /* _ACEXML_XMLREADER_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/DefaultHandler.h0000644000175000017500000001142015027201772020460 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file DefaultHandler.h * * @author Nanbor Wang */ //============================================================================= #ifndef ACEXML_DEFAULTHANDLER_H #define ACEXML_DEFAULTHANDLER_H #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/ContentHandler.h" #include "ACEXML/common/DTDHandler.h" #include "ACEXML/common/EntityResolver.h" #include "ACEXML/common/ErrorHandler.h" /** * @class ACEXML_DefaultHandler * * @brief ACEXML_DefaultHandler * * This class is available as a convenience base class for SAX2 * applications: it provides default implementations for all of the * callbacks in the four core SAX2 handler classes: * * - EntityResolver * - DTDHandler * - ContentHandler * - ErrorHandler * * Application writers can extend this class when they need to implement * only part of an interface; parser writers can instantiate this class to * provide default handlers when the application has not supplied its own. */ class ACEXML_Export ACEXML_DefaultHandler : public ACEXML_ContentHandler, public ACEXML_DTDHandler, public ACEXML_EntityResolver, public ACEXML_ErrorHandler { public: /** * Default constructor. */ ACEXML_DefaultHandler (); /** * destructor. */ virtual ~ACEXML_DefaultHandler (); // Methods inherit from ACEXML_ContentHandler. /* * Receive notification of character data. */ virtual void characters (const ACEXML_Char *ch, size_t start, size_t length); /* * Receive notification of the end of a document. */ virtual void endDocument (); /* * Receive notification of the end of an element. */ virtual void endElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName); /* * End the scope of a prefix-URI mapping. */ virtual void endPrefixMapping (const ACEXML_Char *prefix); /* * Receive notification of ignorable whitespace in element content. */ virtual void ignorableWhitespace (const ACEXML_Char *ch, int start, int length); /* * Receive notification of a processing instruction. */ virtual void processingInstruction (const ACEXML_Char *target, const ACEXML_Char *data); /* * Receive an object for locating the origin of SAX document events. */ virtual void setDocumentLocator (ACEXML_Locator *locator) ; /* * Receive notification of a skipped entity. */ virtual void skippedEntity (const ACEXML_Char *name); /* * Receive notification of the beginning of a document. */ virtual void startDocument (); /* * Receive notification of the beginning of an element. */ virtual void startElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName, ACEXML_Attributes *atts); /* * Begin the scope of a prefix-URI Namespace mapping. */ virtual void startPrefixMapping (const ACEXML_Char *prefix, const ACEXML_Char *uri); // *** Methods inherit from ACEXML_DTDHandler. /* * Receive notification of a notation declaration event. */ virtual void notationDecl (const ACEXML_Char *name, const ACEXML_Char *publicId, const ACEXML_Char *systemId); /* * Receive notification of an unparsed entity declaration event. */ virtual void unparsedEntityDecl (const ACEXML_Char *name, const ACEXML_Char *publicId, const ACEXML_Char *systemId, const ACEXML_Char *notationName); // Methods inherit from ACEXML_EnitityResolver. /* * Allow the application to resolve external entities. */ virtual ACEXML_InputSource *resolveEntity (const ACEXML_Char *publicId, const ACEXML_Char *systemId); // Methods inherit from ACEXML_ErrorHandler. /* * Receive notification of a recoverable error. */ virtual void error (ACEXML_SAXParseException &exception); /* * Receive notification of a non-recoverable error. */ virtual void fatalError (ACEXML_SAXParseException &exception); /* * Receive notification of a warning. */ virtual void warning (ACEXML_SAXParseException &exception); }; #include /**/ "ace/post.h" #endif /* ACEXML_DEFAULTHANDLER_H */ ace-8.0.4+dfsg.orig/ACEXML/common/AttributesImpl.cpp0000644000175000017500000001575115027201772021114 0ustar sudipsudip// -*- C++ -*- #include "ACEXML/common/AttributesImpl.h" #if !defined (__ACEXML_INLINE__) # include "ACEXML/common/AttributesImpl.inl" #endif /* __ACEXML_INLINE__ */ ACEXML_AttributesImpl::ACEXML_AttributesImpl (int size) : attrs_ (size) { this->attrs_.size (0); // attrs array contains nothing } ACEXML_AttributesImpl::ACEXML_AttributesImpl (const ACEXML_AttributesImpl &attrs) : ACEXML_Attributes (attrs), attrs_ (attrs.attrs_.size ()) { for (size_t i = 0; i < attrs.attrs_.size (); i++) this->attrs_[i] = attrs.attrs_[i]; } ACEXML_AttributesImpl::~ACEXML_AttributesImpl () { } int ACEXML_AttributesImpl::addAttribute (const ACEXML_Char *uri, const ACEXML_Char *localName, const ACEXML_Char *qName, const ACEXML_Char *type, const ACEXML_Char *value) { if (this->isDuplicate (uri, localName, qName)) return -1; size_t length = this->attrs_.size (); this->attrs_.size (length+1); this->setAttribute (length, uri, localName, qName, type, value); return static_cast (length); } int ACEXML_AttributesImpl::addAttribute (const ACEXML_Attribute &att) { if (this->isDuplicate (att.uri(), att.localName(), att.qName())) return -1; size_t length = this->attrs_.size (); this->attrs_.size (length+1); this->attrs_[length] = att; return static_cast (length); } int ACEXML_AttributesImpl::isDuplicate (const ACEXML_Char *uri, const ACEXML_Char *localName, const ACEXML_Char *qName) { for (size_t i = 0; i < this->attrs_.size(); ++i) { if (ACE_OS::strcmp (this->attrs_[i].localName(), localName) == 0) { if (qName != 0 && this->attrs_[i].qName() != 0 && ACE_OS::strcmp (this->attrs_[i].qName(), qName) == 0) { if (uri != 0 && this->attrs_[i].uri() != 0 && ACE_OS::strcmp (this->attrs_[i].uri(), uri) == 0) return 1; } } } return 0; } int ACEXML_AttributesImpl::removeAttribute (size_t index) { size_t length = this->attrs_.size (); if (index >= length) return -1; this->attrs_[index] = this->attrs_[length - 1]; this->attrs_.size (length - 1); return 0; } int ACEXML_AttributesImpl::getIndex (const ACEXML_Char *qName) { for (size_t i = 0; i < this->attrs_.size (); i++) if (ACE_OS::strcmp (qName, this->attrs_[i].qName ()) == 0) return static_cast (i); return -1; } int ACEXML_AttributesImpl::getIndex (const ACEXML_Char *uri, const ACEXML_Char *localPart) { for (size_t i = 0; i < this->attrs_.size (); i++) if (ACE_OS::strcmp (uri, this->attrs_[i].uri ()) == 0 && ACE_OS::strcmp (localPart, this->attrs_[i].localName ()) == 0) return static_cast (i); return -1; } size_t ACEXML_AttributesImpl::getLength () { return this->attrs_.size (); } const ACEXML_Char * ACEXML_AttributesImpl::getLocalName (size_t index) { if (index < this->attrs_.size ()) return this->attrs_[index].localName (); return 0; } const ACEXML_Char * ACEXML_AttributesImpl::getQName (size_t index) { if (index < this->attrs_.size ()) return this->attrs_[index].qName (); return 0; } const ACEXML_Char * ACEXML_AttributesImpl::getType (size_t index) { if (index < this->attrs_.size ()) return this->attrs_[index].type (); return 0; } const ACEXML_Char * ACEXML_AttributesImpl::getType (const ACEXML_Char *qName) { for (size_t i = 0; i < this->attrs_.size (); i++) if (ACE_OS::strcmp (qName, this->attrs_[i].qName ()) == 0) return this->attrs_[i].type (); return 0; } const ACEXML_Char * ACEXML_AttributesImpl::getType (const ACEXML_Char *uri, const ACEXML_Char *localPart) { for (size_t i = 0; i < this->attrs_.size (); i++) if (ACE_OS::strcmp (uri, this->attrs_[i].uri ()) == 0 && ACE_OS::strcmp (localPart, this->attrs_[i].localName ()) == 0) return this->attrs_[i].type (); return 0; } const ACEXML_Char * ACEXML_AttributesImpl::getURI (size_t index) { if (index < this->attrs_.size ()) return this->attrs_[index].uri (); return 0; } const ACEXML_Char * ACEXML_AttributesImpl::getValue (size_t index) { if (index < this->attrs_.size ()) return this->attrs_[index].value (); return 0; } const ACEXML_Char * ACEXML_AttributesImpl::getValue (const ACEXML_Char *qName) { for (size_t i = 0; i < this->attrs_.size (); i++) if (ACE_OS::strcmp (qName, this->attrs_[i].qName ()) == 0) return this->attrs_[i].value (); return 0; } const ACEXML_Char * ACEXML_AttributesImpl::getValue (const ACEXML_Char *uri, const ACEXML_Char *localPart) { for (size_t i = 0; i < this->attrs_.size (); i++) if (ACE_OS::strcmp (uri, this->attrs_[i].uri ()) == 0 && ACE_OS::strcmp (localPart, this->attrs_[i].localName ()) == 0) return this->attrs_[i].value (); return 0; } int ACEXML_AttributesImpl::setAttribute (size_t index, const ACEXML_Char *uri, const ACEXML_Char *localName, const ACEXML_Char *qName, const ACEXML_Char *type, const ACEXML_Char *value) { if (index < this->attrs_.size ()) { this->attrs_[index].setAttribute (uri, localName, qName, type, value); return 0; } return -1; } int ACEXML_AttributesImpl::setLocalName (size_t index, const ACEXML_Char *localName) { if (index < this->attrs_.size ()) { this->attrs_[index].localName (localName); return 0; } return -1; } int ACEXML_AttributesImpl::setQName (size_t index, const ACEXML_Char *qName) { if (index < this->attrs_.size ()) { this->attrs_[index].qName (qName); return 0; } return -1; } int ACEXML_AttributesImpl::setURI (size_t index, const ACEXML_Char *uri) { if (index < this->attrs_.size ()) { this->attrs_[index].uri (uri); return 0; } return -1; } int ACEXML_AttributesImpl::setType (size_t index, const ACEXML_Char *type) { if (index < this->attrs_.size ()) { this->attrs_[index].type (type); return 0; } return -1; } int ACEXML_AttributesImpl::setValue (size_t index, const ACEXML_Char *value) { if (index < this->attrs_.size ()) { this->attrs_[index].value (value); return 0; } return -1; } ace-8.0.4+dfsg.orig/ACEXML/common/ErrorHandler.cpp0000644000175000017500000000011415027201772020516 0ustar sudipsudip#include "ErrorHandler.h" ACEXML_ErrorHandler::~ACEXML_ErrorHandler () { } ace-8.0.4+dfsg.orig/ACEXML/common/StreamFactory.h0000644000175000017500000000250515027201772020365 0ustar sudipsudip/** * @file StreamFactory.h * * @author Krishnakumar B */ #ifndef _ACEXML_STREAM_FACTORY_H #define _ACEXML_STREAM_FACTORY_H #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/XML_Types.h" // Forward declarations class ACEXML_CharStream; /** * @class ACEXML_StreamFactory * * @brief A generic factory used to create an appropriate @sa * ACEXML_CharStream from a SYSTEM id. This class creates a @sa * ACEXML_FileCharStream or a @sa ACEXML_HttpCharStream depending on the * URI supplied. * * @todo Write a stream abstraction for handling ftp:// type URIs and add * a function to create and return such streams. That is the only chunk * missing in the armour. */ class ACEXML_Export ACEXML_StreamFactory { public: // Destructor virtual ~ACEXML_StreamFactory (); /** * Create the appropriate stream from the @a uri passed and return the * stream. The caller is responsible for deallocating the returned * stream. * * @param uri SYSTEM id or a stream of characters (in the case of a * StrCharStream). */ virtual ACEXML_CharStream* create_stream (const ACEXML_Char* uri); }; #include /**/ "ace/post.h" #endif /* _ACEXML_STREAM_FACTORY_H */ ace-8.0.4+dfsg.orig/ACEXML/common/ACEXML_Export.h0000644000175000017500000000316315027201772020115 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file ACEXML_Export.h * * @author Nanbor Wang */ //============================================================================= // Definition for Win32 Export directives. // This file is generated automatically by generate_export_file.pl // ------------------------------ #ifndef ACEXML_EXPORT_H #define ACEXML_EXPORT_H #include "ace/config-all.h" #if defined (ACE_AS_STATIC_LIBS) # if !defined (ACEXML_HAS_DLL) # define ACEXML_HAS_DLL 0 # endif /* ! ACEXML_HAS_DLL */ #else # if !defined (ACEXML_HAS_DLL) # define ACEXML_HAS_DLL 1 # endif /* ! ACEXML_HAS_DLL */ #endif /* ACE_AS_STATIC_LIB */ #if defined (ACEXML_HAS_DLL) && (ACEXML_HAS_DLL == 1) # if defined (ACEXML_BUILD_DLL) # define ACEXML_Export ACE_Proper_Export_Flag # define ACEXML_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) # define ACEXML_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) # else /* ACEXML_BUILD_DLL */ # define ACEXML_Export ACE_Proper_Import_Flag # define ACEXML_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) # define ACEXML_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) # endif /* ACEXML_BUILD_DLL */ #else /* ACEXML_HAS_DLL == 1 */ # define ACEXML_Export # define ACEXML_SINGLETON_DECLARATION(T) # define ACEXML_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) #endif /* ACEXML_HAS_DLL == 1 */ #endif /* ACEXML_EXPORT_H */ // End of auto generated file. ace-8.0.4+dfsg.orig/ACEXML/common/DTDHandler.h0000644000175000017500000000463515027201772017521 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file DTDHandler.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_DTDHANDLER_H_ #define _ACEXML_DTDHANDLER_H_ #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/SAXExceptions.h" /** * @class ACEXML_DTDHandler * * @brief ACEXML_DTDHandler * * If a SAX application needs information about notations and unparsed * entities, then the application implements this interface and registers * an instance with the SAX parser using the parser's setDTDHandler method. * The parser uses the instance to report notation and unparsed entity * declarations to the application. * * Note that this interface includes only those DTD events that the XML * recommendation requires processors to report: notation and unparsed * entity declarations. * * The SAX parser may report these events in any order, regardless of the * order in which the notations and unparsed entities were declared; * however, all DTD events must be reported after the document handler's * startDocument event, and before the first startElement event. * * It is up to the application to store the information for future use * (perhaps in a hash table or object tree). If the application encounters * attributes of type "NOTATION", "ENTITY", or "ENTITIES", it can use the * information that it obtained through this interface to find the entity * and/or notation corresponding with the attribute value. */ class ACEXML_Export ACEXML_DTDHandler { public: virtual ~ACEXML_DTDHandler (); /** * Receive notification of a notation declaration event. */ virtual void notationDecl (const ACEXML_Char *name, const ACEXML_Char *publicId, const ACEXML_Char *systemId) = 0; /** * Receive notification of an unparsed entity declaration event. */ virtual void unparsedEntityDecl (const ACEXML_Char *name, const ACEXML_Char *publicId, const ACEXML_Char *systemId, const ACEXML_Char *notationName) = 0; }; #include /**/ "ace/post.h" #endif /* _ACEXML_DTDHANDLER_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/Exception.h0000644000175000017500000000356215027201772017544 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Exception.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_EXCEPTION_H_ #define _ACEXML_EXCEPTION_H_ #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/XML_Types.h" /** * @class ACEXML_Exception * * @brief ACEXML_Exception * * ACEXML_Exception is the base class for all ACEXML related exceptions. * Since ACEXML currently does not support native exceptions, all * exceptions should be thrown thru ACEXML_Env. * * @sa ACEXML_Env */ class ACEXML_Export ACEXML_Exception { public: /// Destructor. virtual ~ACEXML_Exception (); /// Throw the exception. virtual void _raise () = 0; /// Static narrow operation. static ACEXML_Exception* _downcast (ACEXML_Exception* ex); /// Return the exception type. (for safe downcast.) virtual const ACEXML_Char *id () const ; /// Dynamically create a copy of this exception. virtual ACEXML_Exception *duplicate () const = 0; /// Check whether this is an exception of type specified by . virtual int is_a (const ACEXML_Char *name); /// Print out exception using ACE_DEBUG. virtual void print () const = 0; protected: /// Default constructor. ACEXML_Exception (); /// All exceptions have names. This name is used to identify the /// type of an exception. static const ACEXML_Char *exception_name_; /// A null string that we return when there is no exception. static const ACEXML_Char *null_; }; #if defined (__ACEXML_INLINE__) # include "ACEXML/common/Exception.inl" #endif /* __ACEXML_INLINE__ */ #include /**/ "ace/post.h" #endif /* _ACEXML_EXCEPTION_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/XMLFilterImpl.inl0000644000175000017500000000044715027201772020570 0ustar sudipsudip// -*- C++ -*- ACEXML_INLINE int ACEXML_XMLFilterImpl::setupParser () { if (this->parent_ == 0) return -1; this->parent_->setEntityResolver (this); this->parent_->setDTDHandler (this); this->parent_->setContentHandler (this); this->parent_->setErrorHandler (this); return 0; } ace-8.0.4+dfsg.orig/ACEXML/common/XML_Codecs.h0000644000175000017500000000343715027201772017527 0ustar sudipsudip// -*- C++ -*- /** * @file XML_Codecs.h * * @author Krishnakumar B * * XML_Codecs is a generic wrapper for various encoding and decoding * mechanisms used in ACEXML. Currently it includes support for handling * Base64 content transfer-encoding of ACEXML_Chars. */ #ifndef _ACEXML_XML_CODECS_H #define _ACEXML_XML_CODECS_H #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/XML_Types.h" #include "ace/Codecs.h" /** * @class ACEXML_Base64 * * @brief Encode/Decode a stream of ACEXML_Chars according to Base64 encoding. * * This class provides methods to encode or decode a stream of ACEXML_Chars * to/from Base64 encoding. It doesn't convert the input stream to a * canonical form before encoding. */ class ACEXML_Export ACEXML_Base64 : public ACE_Base64 { public: //@{ /** * Encodes a stream of octets to Base64 data * * @param input Binary data in ACEXML_Char stream. * @param output_len Length of the encoded Base64 ACEXML_Char stream. * @return Encoded Base64 data in ACEXML_Char stream or NULL if input data * cannot be encoded. */ static ACEXML_Char* encode (const ACEXML_Char* input, size_t* output_len); /** * Decodes a stream of Base64 to octets data * * @param input Encoded Base64 data in ACEXML_Char stream. * @param output_len Length of the binary ACEXML_Char stream. * @return Binary data in ACEXML_Char stream or NULL if input data cannot * be encoded. */ static ACEXML_Char* decode (const ACEXML_Char* input, size_t* output_len); //@} }; #include /**/ "ace/post.h" #endif /* _ACEXML_XML_CODECS_H */ ace-8.0.4+dfsg.orig/ACEXML/common/ContentHandler.h0000644000175000017500000000671715027201772020523 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file ContentHandler.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_CONTENTHANDLER_H_ #define _ACEXML_CONTENTHANDLER_H_ #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/SAXExceptions.h" #include "ACEXML/common/Locator.h" #include "ACEXML/common/Attributes.h" /** * @class ACEXML_ContentHandler * * @brief ACEXML_ContentHandler * * This is the main interface that most SAX applications implement: if the * application needs to be informed of basic parsing events, it implements * this interface and registers an instance with the SAX parser using the * setContentHandler method. The parser uses the instance to report basic * document-related events like the start and end of elements and character * data. * * The order of events in this interface is very important, and mirrors the * order of information in the document itself. For example, all of an * element's content (character data, processing instructions, and/or * subelements) will appear, in order, between the startElement event and * the corresponding endElement event. */ class ACEXML_Export ACEXML_ContentHandler { public: virtual ~ACEXML_ContentHandler (); /** * Receive notification of character data. */ virtual void characters (const ACEXML_Char *ch, size_t start, size_t length) = 0; /** * Receive notification of the end of a document. */ virtual void endDocument () = 0; /** * Receive notification of the end of an element. */ virtual void endElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName) = 0; /** * End the scope of a prefix-URI mapping. */ virtual void endPrefixMapping (const ACEXML_Char *prefix) = 0; /** * Receive notification of ignorable whitespace in element content. */ virtual void ignorableWhitespace (const ACEXML_Char *ch, int start, int length) = 0; /** * Receive notification of a processing instruction. */ virtual void processingInstruction (const ACEXML_Char *target, const ACEXML_Char *data) = 0; /** * Receive an object for locating the origin of SAX document events. */ virtual void setDocumentLocator (ACEXML_Locator *locator) = 0; /** * Receive notification of a skipped entity. */ virtual void skippedEntity (const ACEXML_Char *name) = 0; /** * Receive notification of the beginning of a document. */ virtual void startDocument () = 0; /** * Receive notification of the beginning of an element. */ virtual void startElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName, ACEXML_Attributes *atts) = 0; /** * Begin the scope of a prefix-URI Namespace mapping. */ virtual void startPrefixMapping (const ACEXML_Char *prefix, const ACEXML_Char *uri) = 0; }; #include /**/ "ace/post.h" #endif /* _ACEXML_CONTENTHANDLER_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/Encoding.h0000644000175000017500000000230015027201772017321 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Encoding.h * * This file provides utility functions to determine the encoding of a file * or a byte stream automatically. * * @author Krishnakumar B */ //============================================================================= #ifndef _ACEXML_ENCODING_H #define _ACEXML_ENCODING_H #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/XML_Types.h" /** * @class ACEXML_Encoding Encoding.h * * @brief ACEXML_Encoding * * Wrapper class for determining the encoding of a file or a byte stream. */ class ACEXML_Export ACEXML_Encoding { public: enum { UCS4BE, UCS4LE, UCS4_2143, UCS4_3412, UTF16BE, UTF16LE, UTF8, OTHER } ENCODING; static const ACEXML_Char* encoding_names_[8]; static const ACEXML_UTF8 byte_order_mark_[][4]; static const ACEXML_UTF8 magic_values_[][4]; static const ACEXML_Char* get_encoding (const char* input); }; #include /**/ "ace/post.h" #endif /* _ACEXML_ENCODING_H */ ace-8.0.4+dfsg.orig/ACEXML/common/ErrorHandler.h0000644000175000017500000000372115027201772020172 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file ErrorHandler.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_ERRORHANDLER_H_ #define _ACEXML_ERRORHANDLER_H_ #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/SAXExceptions.h" /** * @class ACEXML_ErrorHandler * * @brief ACEXML_ErrorHandler * * If a SAX application needs to implement customized error handling, * it must implement this interface and then register an instance with * the XML reader using the setErrorHandler method. The parser will * then report all errors and warnings through this interface. * * @b WARNING: If an application does not register an ErrorHandler, * XML parsing errors will go unreported and bizarre behaviour may * result. * * For XML processing errors, a SAX driver must use this interface * instead of throwing an exception: it is up to the application to * decide whether to throw an exception for different types of errors * and warnings. Note, however, that there is no requirement that the * parser continue to provide useful information after a call to * fatalError (in other words, a SAX driver class could catch an * exception and report a fatalError). */ class ACEXML_Export ACEXML_ErrorHandler { public: virtual ~ACEXML_ErrorHandler (); /** * Receive notification of a recoverable error. */ virtual void error (ACEXML_SAXParseException &exception) = 0; /** * Receive notification of a non-recoverable error. */ virtual void fatalError (ACEXML_SAXParseException &exception) = 0; /** * Receive notification of a warning. */ virtual void warning (ACEXML_SAXParseException &exception) = 0; }; #include /**/ "ace/post.h" #endif /* _ACEXML_ERRORHANDLER_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/ContentHandler.cpp0000644000175000017500000000012215027201772021036 0ustar sudipsudip#include "ContentHandler.h" ACEXML_ContentHandler::~ACEXML_ContentHandler () { } ace-8.0.4+dfsg.orig/ACEXML/common/LocatorImpl.inl0000644000175000017500000000211115027201772020353 0ustar sudipsudip// -*- C++ -*- #include "ace/ACE.h" ACEXML_INLINE void ACEXML_LocatorImpl::setColumnNumber (int cn) { this->columnNumber_ = cn; } ACEXML_INLINE void ACEXML_LocatorImpl::setLineNumber (int ln) { this->lineNumber_ = ln; } ACEXML_INLINE int ACEXML_LocatorImpl::getColumnNumber () const { return this->columnNumber_; } ACEXML_INLINE int ACEXML_LocatorImpl::getLineNumber () const { return this->lineNumber_; } ACEXML_INLINE void ACEXML_LocatorImpl::setPublicId (const ACEXML_Char *id) { delete[] this->publicId_; this->publicId_ = ACE::strnew (id); } ACEXML_INLINE void ACEXML_LocatorImpl::setSystemId (const ACEXML_Char *id) { delete[] this->systemId_; this->systemId_ = ACE::strnew (id); } ACEXML_INLINE const ACEXML_Char * ACEXML_LocatorImpl::getPublicId () const { return this->publicId_; } ACEXML_INLINE const ACEXML_Char * ACEXML_LocatorImpl::getSystemId () const { return this->systemId_; } ACEXML_INLINE void ACEXML_LocatorImpl::incrLineNumber () { ++this->lineNumber_; } ACEXML_INLINE void ACEXML_LocatorImpl::incrColumnNumber () { ++this->columnNumber_; } ace-8.0.4+dfsg.orig/ACEXML/common/Transcode.cpp0000644000175000017500000002034115027201772020055 0ustar sudipsudip// -*- C++ -*- #include "ACEXML/common/Transcode.h" #include "ace/OS_NS_string.h" #include "ace/Truncate.h" int ACEXML_Transcoder::utf162utf8 (ACEXML_UTF16 src, ACEXML_UTF8 *dst, size_t len) { // Check for valid argument first... if (dst == 0) return ACEXML_INVALID_ARGS; if (src < 0x80) { if (len < 1) return ACEXML_DESTINATION_TOO_SHORT; *dst = static_cast (src); return 1; } else if (src < 0x800) { if (len < 2) return ACEXML_DESTINATION_TOO_SHORT; *dst = 0xc0 | (static_cast (src) / 0x40); *(dst+1) = 0x80 | (static_cast (src) % 0x40); return 2; } else { if (len < 3) return ACEXML_DESTINATION_TOO_SHORT; // Surrogates (0xD800 - 0xDFFF) are not valid unicode values if (src >= 0xD800 && src < 0xE000) return ACEXML_IS_SURROGATE; *dst = static_cast (0xe0 | (src / 0x1000)); *(dst+1) = static_cast (0x80 | (src % 0x1000 / 0x40)); *(dst+2) = static_cast (0x80 | (src % 0x40)); return 3; } } int ACEXML_Transcoder::ucs42utf8 (ACEXML_UCS4 src, ACEXML_UTF8 *dst, size_t len) { if (src < 0x10000) { int retv = ACEXML_Transcoder::utf162utf8 (static_cast (src), dst, len); return (retv == ACEXML_IS_SURROGATE ? ACEXML_NON_UNICODE : retv); } else if (src >= 0x100000 && src < 0x110000) { if (len < 4) return ACEXML_DESTINATION_TOO_SHORT; if (dst == 0) return ACEXML_INVALID_ARGS; *dst = static_cast (0xf0 | (src / 0x40000)); *(dst+1) = static_cast (0x80 | (src % 0x40000 / 0x1000)); *(dst+2) = static_cast (0x80 | (src % 0x1000 / 0x40)); *(dst+3) = static_cast (0x80 | (src % 0x40)); return 4; } return ACEXML_NON_UNICODE; } int ACEXML_Transcoder::ucs42utf16 (ACEXML_UCS4 src, ACEXML_UTF16 *dst, size_t len) { if (dst == 0) return ACEXML_INVALID_ARGS; if (src < 0x10000) { if (len < 1) return ACEXML_DESTINATION_TOO_SHORT; if (src >= 0xD800 && src < 0xE000) return ACEXML_NON_UNICODE; // Surrogates are not valid unicode value *dst = static_cast (src); return 1; } else if (src >= 0x100000 && src < 0x110000) // Scalar values are encoded into surrogates { if (len < 2) return ACEXML_DESTINATION_TOO_SHORT; *dst = 0xD800 | (static_cast (src) / 0x400); *(dst+1) = 0xDC00 | (static_cast (src) % 0x400); return 2; } return ACEXML_NON_UNICODE; } int ACEXML_Transcoder::surrogate2utf8 (ACEXML_UTF16 high, ACEXML_UTF16 low, ACEXML_UTF8 *dst, size_t len) { if (len < 3) return ACEXML_DESTINATION_TOO_SHORT; if (dst == 0 || (high >= 0xD800 && high < 0xDC00) || (low >= 0xDC00 && low < 0xE000)) return ACEXML_INVALID_ARGS; ACEXML_UCS4 src = (high - 0xD800) * 0x400 + (low - 0xDC00) + 0x10000; *dst = static_cast (0xD800 | (src / 0x400)); *(dst+1) = static_cast (0xDC00 | (src % 0x400)); return 2; } int ACEXML_Transcoder::surrogate2ucs4 (ACEXML_UTF16 high, ACEXML_UTF16 low, ACEXML_UCS4 &dst) { if ((high >= 0xD800 && high < 0xDC00) || (low >= 0xDC00 && low < 0xE000)) return ACEXML_INVALID_ARGS; dst = (high - 0xD800) * 0x400 + (low - 0xDC00) + 0x10000; return ACEXML_SUCCESS; } int ACEXML_Transcoder::utf82ucs4 (const ACEXML_UTF8 *the_src, size_t len, ACEXML_UCS4 &dst) { if (the_src == 0) { return ACEXML_INVALID_ARGS; } const unsigned char *src = reinterpret_cast (the_src); size_t forward = 1; if (forward > len) { return ACEXML_END_OF_SOURCE; } if (static_cast (*src) < 0x80) { dst = *src; } else if ((*src & 0xE0) == 0xC0) { dst = (*(src++) & 0x1f) * 0x40; if (++forward > len) return ACEXML_END_OF_SOURCE; if ((*src & 0xC0) != 0x80) return ACEXML_NON_UNICODE; // Error transcoding unicode scalar dst += *src & 0x3f; } else if ((*src & 0xF0) == 0xE0) { dst = (*src++ & 0x0f) * 0x40; if (++forward > len) return ACEXML_END_OF_SOURCE; if ((*src & 0xC0) != 0x80) return ACEXML_NON_UNICODE; dst = (dst + (*src++ & 0x3f)) * 0x40; if (++forward > len) return ACEXML_END_OF_SOURCE; if ((*src & 0xC0) != 0x80) return ACEXML_NON_UNICODE; dst += *src & 0x3f; } else if ((*src & 0xF8) == 0xF0) { dst = (*src++ & 0x0f) * 0x40; if (++forward > len) return ACEXML_END_OF_SOURCE; if ((*src & 0xC0) != 0x80) return ACEXML_NON_UNICODE; dst = (dst + (*src++ & 0x3f)) * 0x40; if (++forward > len) return ACEXML_END_OF_SOURCE; if ((*src & 0xC0) != 0x80) return ACEXML_NON_UNICODE; dst = (dst + (*src++ & 0x3f)) * 0x40; if (++forward > len) return ACEXML_END_OF_SOURCE; if ((*src & 0xC0) != 0x80) return ACEXML_NON_UNICODE; dst += *src & 0x3f; } else { return ACEXML_NON_UNICODE; } return ACE_Utils::truncate_cast (forward); } int ACEXML_Transcoder::utf162ucs4 (const ACEXML_UTF16 *src, size_t len, ACEXML_UCS4 &dst) { if (src == 0) { return ACEXML_INVALID_ARGS; } size_t forward = 1; if (*src >= 0xDC00 && *src < 0xE000) { if (len < 2) { return ACEXML_END_OF_SOURCE; } return ACEXML_Transcoder::surrogate2ucs4 (*src, *(src+1), dst); } else { if (len < 1) { return ACEXML_END_OF_SOURCE; } dst = *src; } return ACE_Utils::truncate_cast (forward); } int ACEXML_Transcoder::utf8s2utf16s (const ACEXML_UTF8 *src, ACEXML_UTF16 *dst, size_t len) { if (src == 0 || dst == 0) { return ACEXML_INVALID_ARGS; } size_t src_len = ACE_OS::strlen (src) + 1; size_t total_len = 0; int forward; ACEXML_UCS4 temp; while (src_len > 0) { if ((forward = ACEXML_Transcoder::utf82ucs4 (src, src_len, temp)) <= 0) return forward; src += forward; src_len -= forward; if ((forward = ACEXML_Transcoder::ucs42utf16 (temp, dst, len)) <= 0) return forward; total_len += forward; dst += forward; len -= forward; } return ACE_Utils::truncate_cast (total_len); } int ACEXML_Transcoder::utf16s2utf8s (const ACEXML_UTF16 *src, ACEXML_UTF8 *dst, size_t len) { if (src == 0 || dst == 0) return ACEXML_INVALID_ARGS; size_t src_len = 1; for (const ACEXML_UTF16 *p = src; *p++ != 0; ++src_len) ; size_t total_len = 0; int forward; ACEXML_UCS4 temp; while (src_len > 0) { if ((forward = ACEXML_Transcoder::utf162ucs4 (src, src_len, temp)) <= 0) return forward; src += forward; src_len -= forward; if ((forward = ACEXML_Transcoder::ucs42utf8 (temp, dst, len)) <= 0) return forward; total_len += forward; dst += forward; len -= forward; } return ACE_Utils::truncate_cast (total_len); } ace-8.0.4+dfsg.orig/ACEXML/common/Locator.h0000644000175000017500000000413115027201772017202 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Locator.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_LOCATOR_H_ #define _ACEXML_LOCATOR_H_ #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #include "ACEXML/common/XML_Types.h" /** * @class ACEXML_Locator * * @brief ACEXML_Locator defines operations that an XML locator should support. * * If a SAX parser provides location information to the SAX * application, it does so by implementing this interface and then * passing an instance to the application using the content handler's * setDocumentLocator method. The application can use the object to * obtain the location of any other content handler event in the XML * source document. * * Note that the results returned by the object will be valid only * during the scope of each content handler method: the application * will receive unpredictable results if it attempts to use the * locator at any other time. * * SAX parsers are not required to supply a locator, but they are very * strongly encouraged to do so. If the parser supplies a locator, it * must do so before reporting any other document events. If no * locator has been set by the time the application receives the * startDocument event, the application should assume that a locator * is not available. */ class ACEXML_Export ACEXML_Locator { public: virtual ~ACEXML_Locator (); /* * Return the column number where the current document event ends. */ virtual int getColumnNumber () const = 0; /* * Return the line number where the current document event ends. */ virtual int getLineNumber () const = 0; /* * Return the public identifier for the current document event. */ virtual const ACEXML_Char *getPublicId () const = 0; /* * Return the system identifier for the current document event. */ virtual const ACEXML_Char *getSystemId () const = 0; }; #include /**/ "ace/post.h" #endif /* _ACEXML_LOCATOR_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/Locator.cpp0000644000175000017500000000007515027201772017540 0ustar sudipsudip#include "Locator.h" ACEXML_Locator::~ACEXML_Locator () { } ace-8.0.4+dfsg.orig/ACEXML/common/XML_Util.h0000644000175000017500000000145215027201772017237 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file XML_Util.h * * Initially contains a function to escape strings for use in XML files. * * @author Justin Michel */ //============================================================================= #ifndef _ACEXML_XML_UTIL_H_ #define _ACEXML_XML_UTIL_H_ #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/XML_Types.h" ACEXML_Export ACEXML_String ACEXML_escape_string(const ACEXML_String& str); ACEXML_Export void ACEXML_escape_string(const ACEXML_String& in, ACEXML_String& out); #include /**/ "ace/post.h" #endif /* _ACEXML_XML_UTIL_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/ZipCharStream.h0000644000175000017500000000615115027201772020317 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file ZipCharStream.h * * @author Krishnakumar B */ //============================================================================= #ifndef _ACEXML_ZIPCHARSTREAM_H_ #define _ACEXML_ZIPCHARSTREAM_H_ #ifdef USE_ZZIP #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/CharStream.h" #include "ACEXML/common/Encoding.h" #include "zzip/zzip.h" // Ugly wart to get aroung a macro version of read defined in zzip.h. Evil... #ifdef read #undef read #endif /** * @class ACEXML_ZipCharStream * * An implementation of ACEXML_CharStream for reading input from a ZIP archive. */ class ACEXML_Export ACEXML_ZipCharStream : public ACEXML_CharStream { public: /// Default constructor. ACEXML_ZipCharStream (); /// Destructor virtual ~ACEXML_ZipCharStream (); /// Open a file. int open (const ACEXML_Char *name); /** * Returns the available ACEXML_Char in the buffer. -1 * if the object is not initialized properly. */ virtual int available (); /** * Close this stream and release all resources used by it. */ virtual int close (); /** * Read the next ACEXML_Char. Return -1 if we are not able to * return an ACEXML_Char, 0 if EOF is reached, or 1 if succeed. */ virtual int get (ACEXML_Char& ch); /** * Read the next batch of ACEXML_Char strings */ virtual int read (ACEXML_Char *str, size_t len); /** * Determine the encoding of the file. */ virtual int determine_encoding (); /** * Peek the next ACEXML_Char in the CharStream. Return the * character if success, -1 if EOF is reached. */ virtual int peek (); /** * Resets the file pointer to the beginning of the stream. */ virtual void rewind (); /* * Get the character encoding for a byte stream or URI. */ virtual const ACEXML_Char *getEncoding (); /* * Get the systemId for the underlying CharStream */ virtual const ACEXML_Char* getSystemId (); protected: /** Read the next character as a normal character. Return -1 if EOF is * reached, else return 0. */ virtual int getchar_i (char& ch); /** * Peek @c offset bytes into the stream and return the character at @c * offset. If EOF is reached, return -1. */ virtual int peekchar_i (ACE_OFF_T offset = 0); private: #if defined (ACE_USES_WCHAR) /** * Read the next character from the stream taking into account the * encoding of the file. */ int get_i (ACEXML_Char& ch); /** * Return the next character from the stream taking into account the * encoding of the file. Subsequent call to get() returns this * character. */ int peek_i (); #endif /* ACE_USES_WCHAR */ ACEXML_Char* filename_; ACEXML_Char* encoding_; ACE_OFF_T size_; ZZIP_FILE* infile_; char buf_[80]; int pos_; int limit_; }; #include /**/ "ace/post.h" #endif /* USE_ZZIP */ #endif /* _ACEXML_ZIPCHARSTREAM_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/CharStream.cpp0000644000175000017500000000014415027201772020163 0ustar sudipsudip// -*- C++ -*- #include "ACEXML/common/CharStream.h" ACEXML_CharStream::~ACEXML_CharStream () { } ace-8.0.4+dfsg.orig/ACEXML/common/LocatorImpl.cpp0000644000175000017500000000222415027201772020360 0ustar sudipsudip// -*- C++ -*- #include "ACEXML/common/LocatorImpl.h" #if !defined (__ACEXML_INLINE__) # include "ACEXML/common/LocatorImpl.inl" #endif /* __ACEXML_INLINE__ */ ACEXML_LocatorImpl::ACEXML_LocatorImpl () : publicId_ (0), systemId_ (0), lineNumber_ (1), columnNumber_ (0) { } ACEXML_LocatorImpl::ACEXML_LocatorImpl (const ACEXML_Char* systemId, const ACEXML_Char* publicId) : publicId_ (publicId ? ACE::strnew (publicId) : 0), systemId_ (systemId ? ACE::strnew (systemId) : 0), lineNumber_ (1), columnNumber_ (0) { } ACEXML_LocatorImpl::ACEXML_LocatorImpl (const ACEXML_Locator& locator) : publicId_ (locator.getPublicId() ? ACE::strnew(locator.getPublicId ()): 0), systemId_ (locator.getSystemId() ? ACE::strnew(locator.getSystemId ()): 0), lineNumber_ (locator.getLineNumber ()), columnNumber_ (locator.getColumnNumber ()) { } ACEXML_LocatorImpl::~ACEXML_LocatorImpl () { this->reset(); } void ACEXML_LocatorImpl::reset () { delete[] this->publicId_; this->publicId_ = 0; delete[] this->systemId_; this->systemId_ = 0; this->columnNumber_ = 0; this->lineNumber_ = 1; } ace-8.0.4+dfsg.orig/ACEXML/common/Mem_Map_Stream.cpp0000644000175000017500000001510715027201772020765 0ustar sudipsudip#include "ace/FILE_Addr.h" #include "ace/OS_NS_unistd.h" #include "ace/Truncate.h" #include "ACEXML/common/Mem_Map_Stream.h" ACEXML_Mem_Map_Stream::ACEXML_Mem_Map_Stream () : svc_handler_ (0), recv_pos_ (0), get_pos_ (0), end_of_mapping_plus1_ (0) { } ACE_SOCK_Stream & ACEXML_Mem_Map_Stream::stream () { return svc_handler_->peer (); } ssize_t ACEXML_Mem_Map_Stream::send_n (const void *buf, size_t size, ACE_Time_Value *tv) { return svc_handler_->peer ().send_n (buf, size, 0, tv); } int ACEXML_Mem_Map_Stream::eof () const { return this->get_pos_ >= this->end_of_mapping_plus1_; } int ACEXML_Mem_Map_Stream::get_char () { if (this->eof () && this->grow_file_and_remap () == -1) return EOF; return *this->get_pos_++; } void ACEXML_Mem_Map_Stream::rewind () { this->recv_pos_ = reinterpret_cast (this->mem_map_.addr ()); this->get_pos_ = this->recv_pos_; this->end_of_mapping_plus1_ = this->recv_pos_ + this->mem_map_.size (); } int ACEXML_Mem_Map_Stream::peek_char (size_t offset) { // We may need to iterate if the size of is large. while (this->get_pos_ + offset >= this->end_of_mapping_plus1_) if (this->grow_file_and_remap () == -1) return EOF; return this->get_pos_[offset]; } const char * ACEXML_Mem_Map_Stream::recv () const { return this->recv_pos_; } const char * ACEXML_Mem_Map_Stream::recv (size_t &len) { if (this->eof () && this->grow_file_and_remap () == -1) { len = 0; return 0; } const char *s = this->recv_pos_; this->seek (static_cast (len), SEEK_CUR); len = this->get_pos_ - s; return s; } size_t ACEXML_Mem_Map_Stream::recv_len () const { return this->get_pos_ - this->recv_pos_; } const char * ACEXML_Mem_Map_Stream::peek_str (size_t offset, size_t size) { // We will iterate if the size of is large. while (this->get_pos_ + (offset + size) > this->end_of_mapping_plus1_) if (this->grow_file_and_remap () == -1) return 0; return &this->get_pos_[offset]; } ACE_OFF_T ACEXML_Mem_Map_Stream::seek (ACE_OFF_T offset, int whence) { switch (whence) { case SEEK_SET: this->get_pos_ = reinterpret_cast (this->mem_map_.addr ()) + offset; break; case SEEK_CUR: this->get_pos_ += offset; break; case SEEK_END: this->get_pos_ = this->end_of_mapping_plus1_ + offset; // @@ Not sure how to implement this (yet). ACE_NOTSUP_RETURN (-1); } // Make sure that the backing store will cover this. while (this->get_pos_ > this->end_of_mapping_plus1_) if (this->grow_file_and_remap () == -1) this->get_pos_ = this->end_of_mapping_plus1_; this->recv_pos_ = this->get_pos_; return ACE_Utils::truncate_cast ( this->recv_pos_ - reinterpret_cast (this->mem_map_.addr ())); } Svc_Handler * ACEXML_Mem_Map_Stream::svc_handler () { return this->svc_handler_; } size_t ACEXML_Mem_Map_Stream::available () const { return this->end_of_mapping_plus1_ - this->get_pos_; } int ACEXML_Mem_Map_Stream::open (Connector *connector, const ACE_INET_Addr &addr) { svc_handler_ = 0; // Connect to the server at . If the handler has to be // connected to the server again, the Caching strategy takes care // and uses the same connection. if (connector->connect (svc_handler_, addr) == -1) { ACE_ERROR_RETURN ((LM_ERROR, "%p %s %d\n", "Connect failed", addr.get_host_name (), addr.get_port_number ()), -1); } // Create a temporary filename. ACE_FILE_Addr file (ACE_sap_any_cast (ACE_FILE_Addr &)); // Create the temporary file via the class API. if (this->mem_map_.open (file.get_path_name (), O_RDWR | O_CREAT | O_APPEND, ACE_DEFAULT_FILE_PERMS) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1); // Make sure to unlink this right away so that if this process // crashes these files will be removed automatically. else if (ACE_OS::unlink (file.get_path_name ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "unlink"), -1); else // Initialize all the position pointers to 0. this->rewind (); return 0; } int ACEXML_Mem_Map_Stream::grow_file_and_remap () { char buf[8192]; // Copy the next chunk of bytes from the socket into the temporary // file. ACE_Time_Value tv (ACE_DEFAULT_TIMEOUT); ssize_t bytes = 0; while (1) { ssize_t const n = this->svc_handler_->peer ().recv (buf, sizeof buf, 0, &tv); if (n < 0) { if (errno != EWOULDBLOCK) { ACE_ERROR ((LM_ERROR, "%p\n", "recv")); } return -1; } bytes += n; if (n == 0 && !bytes) return -1; else if (n == 0) break; else if (ACE::write_n (this->mem_map_.handle (), buf, n) != n) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "write_n"), -1); } // ssize_t n = this->svc_handler_->peer ().recv (buf, sizeof buf, 0, &tv); // if (n == -1) // { // ACE_ERROR ((LM_ERROR, "%p\n", "recv")); // return -1; // } // else if (n == 0) // return -1; // else if (ACE::write_n (this->mem_map_.handle (), buf, n) != n) // ACE_ERROR_RETURN ((LM_ERROR, // "%p\n", // "write_n"), // -1); // Grow the memory-mapping to encompass the entire temporary file. if (this->mem_map_.map (static_cast (-1), PROT_RDWR, ACE_MAP_PRIVATE, (void*)0) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "map"), -1); // MAP_FAILED is used as a "first time in" flag. if (this->recv_pos_ == MAP_FAILED) { this->recv_pos_ = reinterpret_cast (this->mem_map_.addr ()); this->get_pos_ = this->recv_pos_; } this->end_of_mapping_plus1_ = reinterpret_cast (this->mem_map_.addr ()) + this->mem_map_.size (); return 0; } ACEXML_Mem_Map_Stream::~ACEXML_Mem_Map_Stream () { // Remove the mapping and the file. this->mem_map_.remove (); delete this->svc_handler_; } ace-8.0.4+dfsg.orig/ACEXML/common/SAXExceptions.cpp0000644000175000017500000001362215027201772020634 0ustar sudipsudip// -*- C++ -*- #include "ACEXML/common/SAXExceptions.h" #include "ace/Log_Msg.h" #include "ace/ACE.h" #include "ace/OS_Memory.h" #include "ace/OS_NS_string.h" const ACEXML_Char * ACEXML_SAXException::exception_name_ = ACE_TEXT ("ACEXML_SAXException"); const ACEXML_Char ACEXML_SAXNotSupportedException::exception_name_[] = ACE_TEXT ("ACEXML_SAXNotSupportedException"); const ACEXML_Char ACEXML_SAXNotRecognizedException::exception_name_[] = ACE_TEXT ("ACEXML_SAXNotRecognizedException"); const ACEXML_Char ACEXML_SAXParseException::exception_name_[] = ACE_TEXT ("ACEXML_SAXParseException"); #if !defined (__ACEXML_INLINE__) # include "ACEXML/common/SAXExceptions.inl" #endif /* __ACEXML_INLINE__ */ ACEXML_SAXException::ACEXML_SAXException () : message_ (0) { } ACEXML_SAXException::ACEXML_SAXException (const ACEXML_Char *msg) : message_ (ACE::strnew (msg)) { } ACEXML_SAXException::ACEXML_SAXException (const ACEXML_SAXException &ex) : ACEXML_Exception (ex), message_ (ACE::strnew (ex.message_)) { } ACEXML_SAXException& ACEXML_SAXException::operator= (const ACEXML_SAXException& src) { if (this != &src) { ACE::strdelete (this->message_); this->message_ = ACE::strnew (src.message_); } return *this; } ACEXML_SAXException* ACEXML_SAXException::_downcast (ACEXML_Exception* ex) { return dynamic_cast (ex); } ACEXML_SAXException::~ACEXML_SAXException () { ACE::strdelete (this->message_); } ACEXML_Exception * ACEXML_SAXException::duplicate () const { ACEXML_Exception *tmp; ACE_NEW_RETURN (tmp, ACEXML_SAXException (*this), 0); return tmp; } int ACEXML_SAXException::is_a (const ACEXML_Char *name) { return ACE_OS::strcmp (ACEXML_SAXException::exception_name_, name) == 0 || this->ACEXML_Exception::is_a (name); } void ACEXML_SAXException::print () const { ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACEXML: (%P|%t) %s: %s\n"), this->exception_name_, this->message())); } ACEXML_SAXNotSupportedException::ACEXML_SAXNotSupportedException () { } ACEXML_SAXNotSupportedException::ACEXML_SAXNotSupportedException (const ACEXML_SAXNotSupportedException &ex) : ACEXML_SAXException (ex) { } ACEXML_SAXNotSupportedException& ACEXML_SAXNotSupportedException::operator= (const ACEXML_SAXNotSupportedException &ex) { this->ACEXML_SAXException::operator= (ex); return *this; } ACEXML_SAXNotSupportedException* ACEXML_SAXNotSupportedException::_downcast (ACEXML_Exception* ex) { return dynamic_cast (ex); } ACEXML_SAXNotSupportedException::ACEXML_SAXNotSupportedException (const ACEXML_Char* msg) : ACEXML_SAXException (msg) { } ACEXML_SAXNotSupportedException::~ACEXML_SAXNotSupportedException () { } ACEXML_Exception * ACEXML_SAXNotSupportedException::duplicate () const { ACEXML_Exception *tmp; ACE_NEW_RETURN (tmp, ACEXML_SAXNotSupportedException (*this), 0); return tmp; } int ACEXML_SAXNotSupportedException::is_a (const ACEXML_Char *name) { return ACE_OS::strcmp (ACEXML_SAXNotSupportedException::exception_name_, name) == 0 || this->ACEXML_SAXException::is_a (name); } void ACEXML_SAXNotSupportedException::print () const { ACE_DEBUG ((LM_ERROR, ACE_TEXT ("ACEXML: (%P|%t) %s: %s\n"), this->exception_name_, this->message())); } ACEXML_SAXNotRecognizedException::ACEXML_SAXNotRecognizedException () { } ACEXML_SAXNotRecognizedException::ACEXML_SAXNotRecognizedException (const ACEXML_Char *msg) : ACEXML_SAXException (msg) { } ACEXML_SAXNotRecognizedException::ACEXML_SAXNotRecognizedException (const ACEXML_SAXNotRecognizedException &ex) : ACEXML_SAXException (ex) { } ACEXML_SAXNotRecognizedException& ACEXML_SAXNotRecognizedException::operator= (const ACEXML_SAXNotRecognizedException &ex) { this->ACEXML_SAXException::operator= (ex); return *this; } ACEXML_SAXNotRecognizedException* ACEXML_SAXNotRecognizedException::_downcast (ACEXML_Exception* ex) { return dynamic_cast (ex); } ACEXML_SAXNotRecognizedException::~ACEXML_SAXNotRecognizedException () { } ACEXML_Exception * ACEXML_SAXNotRecognizedException::duplicate () const { ACEXML_Exception *tmp; ACE_NEW_RETURN (tmp, ACEXML_SAXNotRecognizedException (*this), 0); return tmp; } int ACEXML_SAXNotRecognizedException::is_a (const ACEXML_Char *name) { return ACE_OS::strcmp (ACEXML_SAXNotRecognizedException::exception_name_, name) == 0 || this->ACEXML_SAXException::is_a (name); } void ACEXML_SAXNotRecognizedException::print () const { ACE_DEBUG ((LM_ERROR, ACE_TEXT ("ACEXML: (%P|%t) %s: %s\n"), this->exception_name_, this->message())); } ACEXML_SAXParseException::ACEXML_SAXParseException () { } ACEXML_SAXParseException::ACEXML_SAXParseException (const ACEXML_Char *msg) : ACEXML_SAXException (msg) { } ACEXML_SAXParseException::ACEXML_SAXParseException (const ACEXML_SAXParseException &ex) : ACEXML_SAXException (ex) { } ACEXML_SAXParseException& ACEXML_SAXParseException::operator= (const ACEXML_SAXParseException &ex) { this->ACEXML_SAXException::operator= (ex); return *this; } ACEXML_SAXParseException* ACEXML_SAXParseException::_downcast (ACEXML_Exception* ex) { return dynamic_cast (ex); } ACEXML_SAXParseException::~ACEXML_SAXParseException () { } ACEXML_Exception * ACEXML_SAXParseException::duplicate () const { ACEXML_Exception *tmp; ACE_NEW_RETURN (tmp, ACEXML_SAXParseException (*this), 0); return tmp; } int ACEXML_SAXParseException::is_a (const ACEXML_Char *name) { return ACE_OS::strcmp (ACEXML_SAXParseException::exception_name_, name) == 0 || this->ACEXML_SAXException::is_a (name); } void ACEXML_SAXParseException::print () const { ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACEXML: (%P|%t) %s: %s\n"), this->exception_name_, this->message())); } ace-8.0.4+dfsg.orig/ACEXML/common/DTD_Manager.cpp0000644000175000017500000000012715027201772020200 0ustar sudipsudip#include "ACEXML/common/DTD_Manager.h" ACEXML_DTD_Manager::~ACEXML_DTD_Manager () { } ace-8.0.4+dfsg.orig/ACEXML/common/XMLFilter.h0000644000175000017500000000262115027201772017407 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file XMLFilter.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_XMLFILTER_H_ #define _ACEXML_XMLFILTER_H_ #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/XMLReader.h" /** * @class ACEXML_XMLFilter XMLFilter.h "ACEXML/common/XMLFilter.h" * * @brief ACEXML_XMLFilter * * An XML filter is like an XML reader, except that it obtains its events * from another XML reader rather than a primary source like an XML * document or database. Filters can modify a stream of events as they pass * on to the final application. * * The XMLFilterImpl helper class provides a convenient base for creating * SAX2 filters, by passing on all ACEXML_EntityResolver, * ACEXML_DTDHandler, ACEXML_ContentHandler and ACEXML_ErrorHandler events * automatically. */ class ACEXML_Export ACEXML_XMLFilter : public ACEXML_XMLReader { public: /** * Get the parent reader. */ virtual ACEXML_XMLReader *getParent () const = 0; /** * Set the parent reader. */ virtual void setParent (ACEXML_XMLReader *parent) = 0; }; #include /**/ "ace/post.h" #endif /* _ACEXML_XMLFILTER_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/XML_Util.cpp0000644000175000017500000000230515027201772017570 0ustar sudipsudip#include "ACEXML/common/XML_Util.h" static const ACEXML_Char ESCAPED_AMP[] = ACE_TEXT("&"); static const ACEXML_Char ESCAPED_LESS[] = ACE_TEXT("<"); static const ACEXML_Char ESCAPED_GREATER[] = ACE_TEXT(">"); static const ACEXML_Char ESCAPED_APOS[] = ACE_TEXT("'"); static const ACEXML_Char ESCAPED_QUOTE[] = ACE_TEXT("""); #define CSTRLEN(x) ((sizeof(x) / sizeof(ACEXML_Char)) - 1) ACEXML_String ACEXML_escape_string(const ACEXML_String& str) { ACEXML_String ret(str.length ()); ACEXML_escape_string(str, ret); return ret; } void ACEXML_escape_string(const ACEXML_String& in, ACEXML_String& out) { size_t len = in.length (); out.clear(); for (size_t stridx = 0; stridx < len; ++stridx) { switch (in[stridx]) { case '&': out.append(ESCAPED_AMP, CSTRLEN(ESCAPED_AMP)); break; case '<': out.append(ESCAPED_LESS, CSTRLEN(ESCAPED_LESS)); break; case '>': out.append(ESCAPED_GREATER, CSTRLEN(ESCAPED_GREATER)); break; case '\'': out.append(ESCAPED_APOS, CSTRLEN(ESCAPED_APOS)); break; case '\"': out.append(ESCAPED_QUOTE, CSTRLEN(ESCAPED_QUOTE)); break; default: out += in[stridx]; } } } ace-8.0.4+dfsg.orig/ACEXML/common/DTD_Manager.h0000644000175000017500000000435315027201772017652 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file DTD_Manager.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_DTD_Manager_H_ #define _ACEXML_DTD_Manager_H_ #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/Attributes_Def_Builder.h" #include "ACEXML/common/Element_Def_Builder.h" #include "ACEXML/common/Validator.h" /** * @class ACEXML_DTD_Manager * * @todo Fill in the blank. */ class ACEXML_Export ACEXML_DTD_Manager { public: virtual ~ACEXML_DTD_Manager () = 0; /** * Acquire a pointer to an element definition builder. * The XML parser use this interface to acquire the * definition builder and use the builder to create * the DTD element definition. The resulting builder * is then registered with the DTD Manager or destroyed * if error occurred when the builder encountered errors. * * @retval 0 if error occurs creating the builder. */ virtual ACEXML_Element_Def_Builder *getElement_Def_Builder () = 0; /** * Insert a new element definition into the DTD Manager. * * @retval 0 if success, -1 if error. */ virtual int insertElement_Definition (ACEXML_Element_Def_Builder *def) = 0; /** * Acquire a pointer to an attributes definition builder. * */ virtual ACEXML_Attributes_Def_Builder *getAttribute_Def_Builder () = 0; /** * Insert a new attributes definition into the DTD Manager. * * @retval 0 if success, -1 otherwise. */ virtual int insertAttributes_Definition (ACEXML_Attributes_Def_Builder *def) = 0; /** * Acquire an element validator to validate an XML element. * * @todo I haven't figured out what memory management scheme * we should use for the acquired validator. */ virtual ACEXML_Validator *getValidator (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName) = 0; }; #include /**/ "ace/post.h" #endif /* _ACEXML_DTD_Manager_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/XML_Types.h0000644000175000017500000000452215027201772017427 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file XML_Types.h * * This file collects the type definitions for data types * used in ACE XML parser. * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_XML_TYPES_H_ #define _ACEXML_XML_TYPES_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/Basic_Types.h" #include "ace/SString.h" #include "ace/Functor_String.h" # if defined (ACE_HAS_WCHAR) && (ACE_SIZEOF_WCHAR == 2) typedef wchar_t ACEXML_UTF16; # else typedef ACE_UINT16 ACEXML_UTF16; # endif /* ACE_HAS_WCHAR && ACE_SIZEOF_WCHAR == 2 */ # if defined (ACE_HAS_WCHAR) && (ACE_SIZEOF_WCHAR == 4) typedef wchar_t ACEXML_UCS4; # else typedef ACE_UINT32 ACEXML_UCS4; # endif /* ACE_HAS_WCHAR && ACE_SIZEOF_WCHAR == 4 */ typedef char ACEXML_UTF8; /** * @typedef ACEXML_Char * ACEXML_Char only maps to ACEXML_UTF16 when ACE_USES_WCHAR is defined. * Here we assume sizeof (wchar_t) is always 2 bytes. * * Default XML strings will use UTF-8 encoding. We would like to use * the string classes in standard C++ Library here. But they are not * very portable yet (as far as I know,) and I'll just use ACE_CString * for now, unless UNICODE support is turned on. Notice that you * should never convert strings between ACE_CString and ACE_WString * using the built-in conversion functions as they only perform simple * copy without any encoding conversion. */ typedef ACE_TCHAR ACEXML_Char; # if defined (ACE_USES_WCHAR) //typedef ACEXML_UTF16 ACEXML_Char; typedef ACE_WString ACEXML_String; # else //typedef ACEXML_UTF8 ACEXML_Char; typedef ACE_CString ACEXML_String; # endif /* ACE_USES_WCHAR */ # if (!defined (ACEXML_HAS_INLINE) && defined (__ACE_INLINE__)) || (ACEXML_HAS_INLINE == 1) # define __ACEXML_INLINE__ inline # else # if defined (__ACEXML_INLINE__) # undef __ACEXML_INLINE__ # endif /* __ACEXML_INLINE__ */ # endif /* (!ACEXML_HAS_INLINE) && (__ACE_INLINE__) || (ACEXML_HAS_INLINE == 1) */ # if defined (__ACEXML_INLINE__) # define ACEXML_INLINE inline # else # define ACEXML_INLINE # endif /* __ACEXML_INLINE */ #include /**/ "ace/post.h" #endif /* _ACEXML_XML_TYPE_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/SAXExceptions.h0000644000175000017500000001205415027201772020277 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file SAXExceptions.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_SAXEXCEPTIONS_H_ #define _ACEXML_SAXEXCEPTIONS_H_ #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/Exception.h" /** * @class ACEXML_SAXException * * @brief ACEXML_SAXException * * ACEXML_SAXException is the mother of all SAX related exceptions. */ class ACEXML_Export ACEXML_SAXException : public ACEXML_Exception { public: /// Default constructor. ACEXML_SAXException (); /// Constructor initializing the exception message. ACEXML_SAXException (const ACEXML_Char *msg); /// Assignment operator ACEXML_SAXException& operator= (const ACEXML_SAXException& src); /// Copy constructor. ACEXML_SAXException (const ACEXML_SAXException &ex); /// Destructor. virtual ~ACEXML_SAXException (); /// Throw the exception. virtual void _raise (); /// Static narrow operation. static ACEXML_SAXException* _downcast (ACEXML_Exception* ex); /// Return the name of the exception. virtual const ACEXML_Char *id () const; /// Return the extra message accompanying the exception. const ACEXML_Char *message () const; virtual ACEXML_Exception *duplicate () const; virtual int is_a (const ACEXML_Char *name); virtual void print () const; protected: static const ACEXML_Char * exception_name_; /// A message providing more information about the exception being thrown. ACEXML_Char *message_; }; /** * @class ACEXML_SAXNotSupportedException SAXExceptions.h "ACEXML/common/SAXExceptions.h" * * @brief ACEXML_SAXNotSupportedException */ class ACEXML_Export ACEXML_SAXNotSupportedException : public ACEXML_SAXException { public: /// Default constructor. ACEXML_SAXNotSupportedException (); /// Copy constructor. ACEXML_SAXNotSupportedException (const ACEXML_SAXNotSupportedException &ex); /// Assignment operator ACEXML_SAXNotSupportedException& operator= (const ACEXML_SAXNotSupportedException &ex); /// Constructor which accepts an informational message ACEXML_SAXNotSupportedException (const ACEXML_Char* msg); /// Destructor. virtual ~ACEXML_SAXNotSupportedException (); /// Throw the exception. virtual void _raise (); /// Static narrow operation. static ACEXML_SAXNotSupportedException* _downcast (ACEXML_Exception* ex); virtual const ACEXML_Char *id () const; virtual ACEXML_Exception *duplicate () const; virtual int is_a (const ACEXML_Char *name); virtual void print () const; protected: static const ACEXML_Char exception_name_[]; }; /** * @class ACEXML_SAXNotRecognizedException SAXExceptions.h "ACEXML/common/SAXExceptions.h" * * @brief ACEXML_SAXNotRecognizedException */ class ACEXML_Export ACEXML_SAXNotRecognizedException : public ACEXML_SAXException { public: /// Default constructor. ACEXML_SAXNotRecognizedException (); /// Constructor with an initializing exception message. ACEXML_SAXNotRecognizedException (const ACEXML_Char *msg); /// Copy constructor. ACEXML_SAXNotRecognizedException (const ACEXML_SAXNotRecognizedException &ex); /// Assignment operator. ACEXML_SAXNotRecognizedException& operator= (const ACEXML_SAXNotRecognizedException &ex); /// Destructor. virtual ~ACEXML_SAXNotRecognizedException (); /// Throw the exception. virtual void _raise (); /// Static narrow operation. static ACEXML_SAXNotRecognizedException* _downcast (ACEXML_Exception* ex); virtual const ACEXML_Char *id () const; virtual ACEXML_Exception *duplicate () const; virtual int is_a (const ACEXML_Char *name); virtual void print () const; protected: static const ACEXML_Char exception_name_[]; }; /** * @class ACEXML_SAXParseException SAXExceptions.h "ACEXML/common/SAXExceptions.h" * * @brief ACEXML_SAXParseException */ class ACEXML_Export ACEXML_SAXParseException : public ACEXML_SAXException { public: /// Default constructor. ACEXML_SAXParseException (); /// Constructor with an initializing exception message. ACEXML_SAXParseException (const ACEXML_Char *msg); /// Copy constructor. ACEXML_SAXParseException (const ACEXML_SAXParseException &ex); /// Assignment operator. ACEXML_SAXParseException& operator= (const ACEXML_SAXParseException &ex); /// Destructor. virtual ~ACEXML_SAXParseException (); /// Throw the exception. virtual void _raise (); /// Static narrow operation. static ACEXML_SAXParseException* _downcast (ACEXML_Exception* ex); virtual const ACEXML_Char *id () const; virtual ACEXML_Exception *duplicate () const; virtual int is_a (const ACEXML_Char *name); virtual void print () const; protected: static const ACEXML_Char exception_name_[]; }; #if defined (__ACEXML_INLINE__) # include "ACEXML/common/SAXExceptions.inl" #endif /* __ACEXML_INLINE__ */ #include /**/ "ace/post.h" #endif /* _ACEXML_SAXEXCEPTIONS_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/SAXExceptions.inl0000644000175000017500000000201115027201772020622 0ustar sudipsudip// -*- C++ -*- ACEXML_INLINE const ACEXML_Char * ACEXML_SAXException::message () const { return (this->message_ == 0 ? ACEXML_Exception::null_ : this->message_); } ACEXML_INLINE void ACEXML_SAXException::_raise () { throw *this; } ACEXML_INLINE void ACEXML_SAXNotSupportedException::_raise () { throw *this; } ACEXML_INLINE void ACEXML_SAXNotRecognizedException::_raise () { throw *this; } ACEXML_INLINE void ACEXML_SAXParseException::_raise () { throw *this; } ACEXML_INLINE const ACEXML_Char * ACEXML_SAXException::id () const { return ACEXML_SAXException::exception_name_; } ACEXML_INLINE const ACEXML_Char * ACEXML_SAXNotSupportedException::id () const { return ACEXML_SAXNotSupportedException::exception_name_; } ACEXML_INLINE const ACEXML_Char * ACEXML_SAXNotRecognizedException::id () const { return ACEXML_SAXNotRecognizedException::exception_name_; } ACEXML_INLINE const ACEXML_Char * ACEXML_SAXParseException::id () const { return ACEXML_SAXParseException::exception_name_; } ace-8.0.4+dfsg.orig/ACEXML/common/URL_Addr.cpp0000644000175000017500000001151015027201772017525 0ustar sudipsudip#include "ACEXML/common/URL_Addr.h" #if !defined (__ACEXML_INLINE__) #include "ACEXML/common/URL_Addr.inl" #endif /* __ACEXML_INLINE__ */ #include "ace/Log_Msg.h" #include "ace/OS_Memory.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_stdlib.h" #include "ace/OS_NS_string.h" #include ACEXML_URL_Addr::ACEXML_URL_Addr () : path_name_ (0), addr_string_ (0), addr_string_len_ (0) { } int ACEXML_URL_Addr::addr_to_string (ACEXML_Char *s, size_t size, int ipaddr_format) const { size_t total_len = this->calculate_length (ipaddr_format); if (size < total_len) return -1; else { ACE_OS::sprintf (s, ACE_TEXT ("%s:%d/%s"), ACE_TEXT_CHAR_TO_TCHAR (ipaddr_format == 0 ? this->get_host_name () : this->get_host_addr ()), this->get_port_number (), this->get_path_name ()); return 0; } } const ACEXML_Char * ACEXML_URL_Addr::addr_to_string (int ipaddr_format) { size_t size = this->calculate_length (ipaddr_format); if (size > this->addr_string_len_) { ACE_ALLOCATOR_RETURN (this->addr_string_, (ACEXML_Char *) ACE_OS::realloc(this->addr_string_, size), 0); this->addr_string_len_ = size; } ACE_OS::sprintf (this->addr_string_, ACE_TEXT ("%s:%d/%s"), ACE_TEXT_CHAR_TO_TCHAR (ipaddr_format == 0 ? this->get_host_name () : this->get_host_addr ()), this->get_port_number (), this->get_path_name ()); return this->addr_string_; } #if defined (ACE_USES_WCHAR) int ACEXML_URL_Addr::string_to_addr (const char* s, int address_family) { return this->string_to_addr (ACE_TEXT_CHAR_TO_TCHAR (s), address_family); } #endif /* ACE_USES_WCHAR */ int ACEXML_URL_Addr::string_to_addr (const ACEXML_Char* s, int /*address_family */) { if (s == 0) return -1; const ACEXML_Char* http = ACE_TEXT ("http://"); size_t http_len = ACE_OS::strlen (http); // Check validity of URL if (ACE_OS::strncmp (http, s, http_len) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Invalid URL %s\n"), s), -1); const ACEXML_Char* url = 0; // Get the host name for (url = s + http_len; *url != '\0' && *url != ':' && *url != '/'; ++url) ; size_t host_len = url - s; host_len -= http_len; ACEXML_Char* host_name = 0; ACE_NEW_RETURN (host_name, ACEXML_Char[host_len + 1], -1); ACE_OS::strncpy (host_name, s + http_len, host_len); host_name[host_len] = '\0'; std::unique_ptr cleanup_host_name (host_name); // Get the port number (if any) unsigned short port = ACE_DEFAULT_HTTP_PORT; if (*url == ':') { port = (unsigned short) ACE_OS::strtol (++url, 0, 10); // Skip over ':' while ( *url != '\0' && *url != '/' ) ++url; } // Set the addr int result = this->ACE_INET_Addr::set (port, host_name); if (result == -1) return -1; // Get the path name const ACEXML_Char* path_name = 0; if (*url == '\0') path_name = ACE_TEXT ("/"); else path_name = url; ACE_ALLOCATOR_RETURN (this->path_name_, ACE_OS::strdup (path_name), -1); return result; } ACEXML_URL_Addr::ACEXML_URL_Addr (const ACEXML_URL_Addr &addr) : ACE_INET_Addr (), path_name_ (0), addr_string_ (0), addr_string_len_ (0) { if (this->set (addr) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACEXML_URL_Addr::ACEXML_URL_Addr"))); } int ACEXML_URL_Addr::set (const ACEXML_URL_Addr &addr) { ACE_OS::free (this->path_name_); ACE_OS::free (this->addr_string_); if (this->ACE_INET_Addr::set (addr) == -1) return -1; else { if (addr.path_name_) ACE_ALLOCATOR_RETURN (this->path_name_, ACE_OS::strdup (addr.path_name_), -1); if (addr.addr_string_) ACE_ALLOCATOR_RETURN (this->addr_string_, ACE_OS::strdup (addr.addr_string_), -1); this->addr_string_len_ = addr.addr_string_len_; return 0; } } ACEXML_URL_Addr::ACEXML_URL_Addr (const ACEXML_Char *host_name, const ACEXML_Char *path_name, unsigned short port) : ACE_INET_Addr (port, host_name), path_name_ (ACE_OS::strdup (path_name)), addr_string_ (0), addr_string_len_ (0) { } ACEXML_URL_Addr::~ACEXML_URL_Addr () { ACE_OS::free (this->path_name_); ACE_OS::free (this->addr_string_); this->path_name_ = 0; } ace-8.0.4+dfsg.orig/ACEXML/common/Attributes.h0000644000175000017500000000711715027201772017734 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Attributes.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_ATTRIBUTES_H_ #define _ACEXML_ATTRIBUTES_H_ #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/XML_Types.h" /** * @class ACEXML_Attributes * * @brief ACEXML_Attributes defines a collection of attributes of an XML element. * * This is an abstract class (interface in Java) that defines * the API for accessing attributes of an XML entity. * * This interface allows access to a list of attributes in three different ways: * * - by attribute index; * - by Namespace-qualified name; or * - by qualified (prefixed) name. * * The list will not contain attributes that were declared #IMPLIED * but not specified in the start tag. It will also not contain * attributes used as Namespace declarations (xmlns*) unless the * http://xml.org/sax/features/namespace-prefixes feature is set to * true (it is false by default). * * If the namespace-prefixes feature (see above) is false, access by * qualified name may not be available; if the * http://xml.org/sax/features/namespaces feature is false, access by * Namespace-qualified names may not be available. * * This interface replaces the now-deprecated SAX1 AttributeList * interface, which does not contain Namespace support. In addition to * Namespace support, it adds the getIndex methods (below). * * The order of attributes in the list is unspecified, and will vary * from implementation to implementation. */ class ACEXML_Export ACEXML_Attributes { public: /// Destructor. virtual ~ACEXML_Attributes (); /** * Look up the index of an attribute by XML 1.0 qualified name. */ virtual int getIndex (const ACEXML_Char *qName) = 0; /** * Look up the index of an attribute by Namespace name. */ virtual int getIndex (const ACEXML_Char *uri, const ACEXML_Char *localPart) = 0; /** * Return the number of attributes in the list. */ virtual size_t getLength () = 0; /** * Look up an attribute's local name by index. */ virtual const ACEXML_Char *getLocalName (size_t index) = 0; /** * Look up an attribute's XML 1.0 qualified name by index. */ virtual const ACEXML_Char *getQName (size_t index) = 0; /** * Look up an attribute's type by index. */ virtual const ACEXML_Char *getType (size_t index) = 0; /** * Look up an attribute's type by XML 1.0 qualified name. */ virtual const ACEXML_Char *getType (const ACEXML_Char *qName) = 0; /** * Look up an attribute's type by Namespace name. */ virtual const ACEXML_Char *getType (const ACEXML_Char *uri, const ACEXML_Char *localPart) = 0; /** * Look up an attribute's Namespace URI by index. */ virtual const ACEXML_Char *getURI (size_t index) = 0; /** * Look up an attribute's value by index. */ virtual const ACEXML_Char *getValue (size_t index) = 0; /** * Look up an attribute's value by XML 1.0 qualified name. */ virtual const ACEXML_Char *getValue (const ACEXML_Char *qName) = 0; /** * Look up an attribute's value by Namespace name. */ virtual const ACEXML_Char *getValue (const ACEXML_Char *uri, const ACEXML_Char *localPart) = 0; }; #include /**/ "ace/post.h" #endif /* _ACEXML_ ATTRIBUTES_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/Transcode.h0000644000175000017500000001176115027201772017530 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Transcode.h * * This file declares functions to convert char string among different * unicode encoding (utf8, utf16, utf32) * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_TRANSCODE_H_ #define _ACEXML_TRANSCODE_H_ #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/XML_Types.h" /** * @class ACEXML_Transcoder * * @brief ACEXML_Transcoder * * Wrapper class for performing transcoding among different UNICODE * encoding. */ class ACEXML_Export ACEXML_Transcoder { public: /* * Status of the conversion function. */ enum { ACEXML_SUCCESS = 0, ACEXML_DESTINATION_TOO_SHORT = -1, ACEXML_END_OF_SOURCE = -2, ACEXML_INVALID_ARGS = -3, ACEXML_IS_SURROGATE = -4, ACEXML_NON_UNICODE = -5 } ACEXML_STATUS; // The following functions translate a unicode characters // into different encoding. Return number of characters put into // destination or consumed from src if success without // error, otherwise, return corresponding error code. /* * Convert a UTF-16 character into a string in UTF-8 encoding. * * @return number of characters the function uses to store the * converted string if it succeeds or one of the error STATUS * otherwise. */ static int utf162utf8 (ACEXML_UTF16 src, ACEXML_UTF8 *dst, size_t len); /* * Convert a UCS-4 character into a string in UTF-8 encoding. * * @return number of characters the function uses to store the * converted string if it succeeds or one of the error STATUS * otherwise. */ static int ucs42utf8 (ACEXML_UCS4 src, ACEXML_UTF8 *dst, size_t len); /* * Convert a UCS-4 character into a string in UTF-16 encoding. * * @return number of characters the function uses to store the * converted string if it succeeds or one of the error STATUS * otherwise. */ static int ucs42utf16 (ACEXML_UCS4 src, ACEXML_UTF16 *dst, size_t len); /* * Convert a UTF-16 surrogate character pair into a string in UTF-8 encoding. * * @return number of characters the function uses to store the * converted string if it succeeds or one of the error STATUS * otherwise. */ static int surrogate2utf8 (ACEXML_UTF16 high, ACEXML_UTF16 low, ACEXML_UTF8 *dst, size_t len); /* * Convert a UTF-16 surrogate character pair into a UCS-4 character. * * @return SUCCESS if it succeeds or one of the error STATUS * otherwise. */ static int surrogate2ucs4 (ACEXML_UTF16 high, ACEXML_UTF16 low, ACEXML_UCS4 &dst); /* * Convert the first UNICODE character in a UTF-8 character string * into a UCS-4 character. * * @return number of characters the function consumed from the * UTF-8 string if it succeeds or one of the error STATUS * otherwise. */ static int utf82ucs4 (const ACEXML_UTF8 *src, size_t len, ACEXML_UCS4 &dst); /* * Convert the first UNICODE character in a UTF-16 character string * into a UCS-4 character. * * @return number of characters the function consumed from the * UTF-16 string if it succeeds or one of the error STATUS * otherwise. */ static int utf162ucs4 (const ACEXML_UTF16 *src, size_t len, ACEXML_UCS4 &dst); // static int utf82utf16 (const ACEXML_UTF8 *src, // size_t len, // ACEXML_UTF16 &dst); // This function does not handle surrogates. // = The following functions are non-inlined: /* * Convert a UTF-8 string into a UTF-16 string. * * @param len The length of @a dst string. * * @return number of characters the function consumed from the * UTF-8 string if it succeeds or one of the error STATUS * otherwise. */ static int utf8s2utf16s (const ACEXML_UTF8 *src, ACEXML_UTF16 *dst, size_t len); /* * Convert a UTF-16 string into a UTF-8 string. * * @param len The length of @a dst string. * * @return number of characters the function uses in * UTF-8 string if it succeeds or one of the error STATUS * otherwise. */ static int utf16s2utf8s (const ACEXML_UTF16 *src, ACEXML_UTF8 *dst, size_t len); }; #include /**/ "ace/post.h" #endif /* _ACEXML_TRANSCODE_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/StreamFactory.cpp0000644000175000017500000000235015027201772020716 0ustar sudipsudip#include "ace/OS_NS_string.h" #include "ACEXML/common/StreamFactory.h" #include "ACEXML/common/FileCharStream.h" #include "ACEXML/common/HttpCharStream.h" #ifdef USE_ZZIP #include "ACEXML/common/ZipCharStream.h" #endif /* USE_ZZIP */ ACEXML_CharStream* ACEXML_StreamFactory::create_stream (const ACEXML_Char* uri) { if (uri == 0) return 0; ACEXML_FileCharStream* fstream = 0; ACEXML_HttpCharStream* hstream = 0; if (ACE_OS::strstr (uri, ACE_TEXT("ftp://")) != 0) { return 0; } else if (ACE_OS::strstr (uri, ACE_TEXT ("http://")) != 0) { ACE_NEW_RETURN (hstream, ACEXML_HttpCharStream, 0); if (hstream->open (uri) != -1) return hstream; } else { if (ACE_OS::strstr (uri, ACE_TEXT ("file://")) != 0) uri += 7; // Skip over file:// ACE_NEW_RETURN (fstream, ACEXML_FileCharStream, 0); if (fstream->open (uri) != -1) return fstream; #ifdef USE_ZZIP else { ACEXML_ZipCharStream* zstream = 0; ACE_NEW_RETURN (zstream, ACEXML_ZipCharStream, 0); if (zstream->open (uri) != -1) return zstream; } #endif /* USE_ZZIP */ } return 0; } ACEXML_StreamFactory::~ACEXML_StreamFactory () { // No op } ace-8.0.4+dfsg.orig/ACEXML/common/Validator.h0000644000175000017500000000275615027201772017537 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Validator.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_VALIDATOR_H_ #define _ACEXML_VALIDATOR_H_ #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/Attributes.h" #include "ACEXML/common/SAXExceptions.h" /** * @class ACEXML_Validator * * @brief An abstract virtual class defining validator interface. * * An validator provides validation service for one XML element. * ACEXML_Validators are stateful object. Implementations should * remember the current element encountered and determine if * it's a valid sequence of child elements. A parser fishes * out a validator of certain */ class ACEXML_Export ACEXML_Validator { public: virtual ~ACEXML_Validator () = 0; /** * Validate attributes of an element. * * @retval 0 if valid, -1 otherwise. */ virtual int startElement (ACEXML_Attributes *atts) = 0; /** * Validate the next child element. * * @retval 0 if valid, -1 otherwise. */ virtual int nextElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName) = 0; }; #include /**/ "ace/post.h" #endif /* _ACEXML_VALIDATOR_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/InputSource.h0000644000175000017500000000720115027201772020060 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file InputSource.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_INPUTSOURCE_H_ #define _ACEXML_INPUTSOURCE_H_ #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/CharStream.h" /** * @class ACEXML_InputSource * * @brief ACEXML_InputSource encapsulates the actual input stream with some * added information. * * This class allows a SAX application to encapsulate information * about an input source in a single object, which may include a * public identifier, a system identifier, a byte stream (possibly * with a specified encoding), and/or a character stream. * * There are two places that the application will deliver this input * source to the parser: as the argument to the Parser.parse method, * or as the return value of the EntityResolver.resolveEntity method. * * The SAX parser will use the InputSource object to determine how to * read XML input. If there is a character stream available, the * parser will read that stream directly; if not, the parser will use * a byte stream, if available; if neither a character stream nor a * byte stream is available, the parser will attempt to open a URI * connection to the resource identified by the system identifier. * * An InputSource object belongs to the application: the SAX parser * shall never modify it in any way (it may modify a copy if * necessary). * * @sa ACEXML_CharStream */ class ACEXML_Export ACEXML_InputSource { public: /** * Default constructor. */ ACEXML_InputSource (); ACEXML_InputSource (const ACEXML_InputSource &) = delete; ACEXML_InputSource (ACEXML_InputSource &&) = delete; ACEXML_InputSource &operator= (const ACEXML_InputSource &) = delete; ACEXML_InputSource &operator= (ACEXML_InputSource &&) = delete; /** * Create a new input source with a ACEXML_Char stream. * Notice that ACEXML_InputSource assumes the ownership * of */ explicit ACEXML_InputSource (ACEXML_CharStream *stream); /** * Create a new input source with a system identifier. */ ACEXML_InputSource (const ACEXML_Char *systemId); /** * Default destructor. */ virtual ~ACEXML_InputSource (); /** * Get the ACEXML_Char stream for this input source. */ virtual ACEXML_CharStream *getCharStream () const; /** * Get the character encoding for a byte stream or URI. */ virtual const ACEXML_Char *getEncoding () const; /** * Get the public identifier for this input source. */ virtual const ACEXML_Char *getPublicId () const; /** * Get the system identifier for this input source. */ virtual const ACEXML_Char *getSystemId () const; /** * Set the ACEXML_Char stream for this input source. * Notice that ACEXML_InputSource assumes the ownership * of */ virtual void setCharStream (ACEXML_CharStream *charStream); /** * Set the character encoding, if known. */ virtual void setEncoding (const ACEXML_Char *encoding); /** * Set the public identifier for this input source. */ virtual void setPublicId (const ACEXML_Char *publicId); /** * Set the public identifier for this input source. */ virtual void setSystemId (const ACEXML_Char *systemId); private: ACEXML_CharStream *charStream_; ACEXML_Char *encoding_; ACEXML_Char *publicId_; ACEXML_Char *systemId_; }; #include /**/ "ace/post.h" #endif /* _ACEXML_INPUTSOURCE_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/Exception.cpp0000644000175000017500000000140615027201772020072 0ustar sudipsudip// -*- C++ -*- #include "ACEXML/common/Exception.h" #include "ace/Log_Msg.h" #include "ace/ACE.h" #include "ace/OS_NS_string.h" const ACEXML_Char *ACEXML_Exception::exception_name_ = ACE_TEXT ("ACEXML_Exception"); const ACEXML_Char *ACEXML_Exception::null_ = ACE_TEXT (""); #if !defined (__ACEXML_INLINE__) # include "ACEXML/common/Exception.inl" #endif /* __ACEXML_INLINE__ */ ACEXML_Exception::ACEXML_Exception() { } ACEXML_Exception::~ACEXML_Exception() { } int ACEXML_Exception::is_a (const ACEXML_Char *name) { return ACE_OS::strcmp (ACEXML_Exception::exception_name_, name) == 0; } void ACEXML_Exception::print () const { ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACEXML: (%P|%t) EXCEPTION : %s\n"), this->exception_name_)); } ace-8.0.4+dfsg.orig/ACEXML/common/codecs.mpb0000644000175000017500000000013515027201772017366 0ustar sudipsudip// -*- MPC -*- feature(ace_codecs, !ace_for_tao) { Source_Files { XML_Codecs.cpp } } ace-8.0.4+dfsg.orig/ACEXML/common/Mem_Map_Stream.h0000644000175000017500000001321115027201772020424 0ustar sudipsudip/* -*- C++ -*- */ /** @file Mem_Map_Stream.h * * @author Douglas C. Schmidt * @author Krishnakumar B */ #ifndef _ACEXML_MEM_MAP_STREAM_H #define _ACEXML_MEM_MAP_STREAM_H #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/SOCK_Stream.h" #include "ace/Mem_Map.h" #include "ace/SOCK_Connector.h" #include "ace/Connector.h" #include "ace/Svc_Handler.h" #include "ACEXML/common/XML_Types.h" typedef ACE_Svc_Handler Svc_Handler; typedef ACE_Connector Connector; /** * @class ACEXML_Mem_Map_Stream * * @brief Provides a memory-mapped stream abstraction to simplify parsing * of tokens. * * This class makes it possible to treat an connection as a stream of * bytes, similar to the C library stdio streams. The contents of the * connection are buffered incrementally in a memory-mapped file. This * class maintains pointers to two positions in the stream: * * 1. The position, which keeps track of the beginning of a * token that is in the stream. * * 2. The position, which moves along character-by-character * until the end of the token is reached. * * Once a token has been located, it can be extracted from the stream by * calling the . The length of the token, i.e., the , is * the length in bytes between the position and the position. * Once the token has been extracted, the and positions can be * updated by the method. */ class ACEXML_Export ACEXML_Mem_Map_Stream { public: /// Default constructor ACEXML_Mem_Map_Stream (); /// Initialize this object. virtual int open (Connector *connector, const ACE_INET_Addr &); /// Destructor. virtual ~ACEXML_Mem_Map_Stream (); /// Returns the underlying . ACE_SOCK_Stream &stream (); /** * Send bytes in to the connected peer. This is a * completely unbuffered call. */ virtual ssize_t send_n (const void *buf, size_t size, ACE_Time_Value *tv = 0); /** * Return the next character in the stream and advance the * position. Returns EOF when the position reaches the end of the * HTTP stream. */ virtual int get_char (); /** * Returns a pointer to array of at most characters starting at * the position. If the position + extends past the * EOF then is set to the number of characters between the * position and the EOF and both the and positions are * advanced by . Returns 0 if the position is at the EOF. */ virtual const char *recv (size_t &len); /** * Returns a pointer to array of characters starting at the * position. */ virtual const char *recv () const; /** * Returns the length in bytes between the position and the * position. */ virtual size_t recv_len () const; /** * Returns the no. of bytes available in the stream. */ virtual size_t available () const; /** * Resets the and positions to the beginning of the stream. * This works since all the data has been cached in the memory-mapped * backing store. */ virtual void rewind (); /** * Returns the nth character from the position in the * stream without advancing the position. Automatically extends * the backing store if necessary. Returns EOF if is past the * end of the stream. */ virtual int peek_char (size_t offset); /** * Return a pointer to an array of characters starting at * characters from the position in the stream without * advancing the position. Automatically extends the backing store * if necessary. Returns 0 if or is past the * end of the stream. */ virtual const char *peek_str (size_t offset, size_t size); /** * Sets the and positions as follows: * o If is , the positions are set to * bytes from the start of the stream. * o If is , the positions are set to the * current position plus . * o If is , the positions are set to the size * of the stream plus . * * If offset is greater than EOF, both and are set to EOF. * Note special return value is returned to indicate this condition. */ virtual ACE_OFF_T seek (ACE_OFF_T offset, int whence = SEEK_CUR); /// Returns 1 if we're at the end of the HTTP stream, else 0. virtual int eof () const; /// Returns the underlying service handler. Svc_Handler *svc_handler (); private: /** * Grow the file by reading another chunk from the HTTP socket and * extend the mapping to cover this chunk. Returns -1 on failure or * EOF, else 0. */ int grow_file_and_remap (); /** * Connection to peer. The granularity is at the Svc_Handler level. * The Svc_Handler has an SOCK_Stream. */ Svc_Handler *svc_handler_; /// Memory-mapped file that we're iterating over. ACE_Mem_Map mem_map_; /// Pointer to the address where the next method will start. char *recv_pos_; /** * Pointer to the address where the next method will * start. */ char *get_pos_; /// Address at the end of the file mapping. char *end_of_mapping_plus1_; }; #include /**/ "ace/post.h" #endif /* _ACEXML_MEM_MAP_STREAM_H */ ace-8.0.4+dfsg.orig/ACEXML/common/StrCharStream.h0000644000175000017500000000433415027201772020326 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file StrCharStream.h * * @author Nanbor Wang */ //============================================================================= #ifndef _ACEXML_STRCHARSTREAM_H_ #define _ACEXML_STRCHARSTREAM_H_ #include /**/ "ace/pre.h" #include "ACEXML/common/ACEXML_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ACEXML/common/CharStream.h" /** * @class ACEXML_StrCharStream * * An implementation of ACEXML_CharStream for reading * input from a null-terminated ACEXML_Char string. */ class ACEXML_Export ACEXML_StrCharStream : public ACEXML_CharStream { public: /// Default constructor. ACEXML_StrCharStream (); /// Destructor virtual ~ACEXML_StrCharStream (); /// Initializing StrCharStream with @a str and @a name int open (const ACEXML_Char *str, const ACEXML_Char* name); /** * Returns the available ACEXML_Char in the buffer. -1 * if the object is not initialized properly. */ virtual int available (); /** * Close this stream and release all resources used by it. */ virtual int close (); /** * Determine the encoding of the file. */ virtual int determine_encoding (); /** * Read the next ACEXML_Char. Return -1 if we are not able to * return an ACEXML_Char, 0 if EOS is reached, or 1 if succeed. */ virtual int get (ACEXML_Char& ch); /** * Read the next batch of ACEXML_Char strings */ virtual int read (ACEXML_Char *str, size_t len); /** * Peek the next ACEXML_Char in the CharStream. Return the * character if succeess, -1 if EOS is reached. */ virtual int peek (); /* * Get the character encoding for a byte stream or URI. */ virtual const ACEXML_Char *getEncoding (); /* * Get the systemId for the underlying CharStream */ virtual const ACEXML_Char* getSystemId (); /** * Resets the pointer to the beginning of the stream. */ virtual void rewind (); private: ACEXML_Char *start_; ACEXML_Char *ptr_; ACEXML_Char *end_; ACEXML_Char* encoding_; ACEXML_Char* name_; }; #include /**/ "ace/post.h" #endif /* _ACEXML_STRCHARSTREAM_H_ */ ace-8.0.4+dfsg.orig/ACEXML/common/Encoding.cpp0000644000175000017500000000526215027201772017666 0ustar sudipsudip// -*- C++ -*- #include "ACEXML/common/Encoding.h" #include "ace/OS_NS_string.h" const ACEXML_Char* ACEXML_Encoding::encoding_names_[8] = { ACE_TEXT ("UCS-4BE"), ACE_TEXT ("UCS-4LE"), ACE_TEXT ("UCS-4_2143"), ACE_TEXT ("UCS-4_3412"), ACE_TEXT ("UTF-16"), ACE_TEXT ("UTF-16"), ACE_TEXT ("UTF-8"), ACE_TEXT ("Unsupported Encoding") }; const ACEXML_UTF8 ACEXML_Encoding::byte_order_mark_[][4] = { { '\x00', '\x00', '\xFE', '\xFF' }, // UCS-4, big-endian (1234 order) { '\xFF', '\xFE', '\x00', '\x00' }, // UCS-4, little-endian (4321 order) { '\x00', '\x00', '\xFF', '\xFE' }, // UCS-4, unusual octet order (2143) { '\xFE', '\xFF', '\x00', '\x00' }, // UCS-4, unusual octet order (3412) { '\xFE', '\xFF', '\xFF', '\xFF' }, // UTF-16, big-endian (3 & 4 != 0) { '\xFF', '\xFE', '\xFF', '\xFF' }, // UTF-16, little-endian ( 3 & 4 != 0) { '\xEF', '\xBB', '\xBF', '\xFF' } // UTF-8 }; const ACEXML_UTF8 ACEXML_Encoding::magic_values_[][4] = { { '\x00', '\x00', '\x00', '\x3c' }, // { '\x3c', '\x00', '\x00', '\x00' }, // UCS-4 and variants { '\x00', '\x00', '\x3c', '\x00' }, // { '\x00', '\x3c', '\x00', '\x00' }, // { '\x00', '\x3c', '\x00', '\x3f' }, // UTF-16BE { '\x3c', '\x00', '\x3f', '\x00' }, // UTF-16LE { '\x3c', '\x3f', '\x78', '\x6d' }, // UTF-8 }; const ACEXML_Char* ACEXML_Encoding::get_encoding (const char* input) { if ((ACE_OS::memcmp (&ACEXML_Encoding::byte_order_mark_[ACEXML_Encoding::UTF16BE][0], input, 2) == 0) && (input[2] != 0 || input[3] != 0)) // 3 & 4 should not be both zero return ACEXML_Encoding::encoding_names_[ACEXML_Encoding::UTF16BE]; else if ((ACE_OS::memcmp (&ACEXML_Encoding::byte_order_mark_[ACEXML_Encoding::UTF16LE][0], input, 2) == 0) && (input[2] != 0 || input[3] != 0)) // 3 & 4 should not be both zero return ACEXML_Encoding::encoding_names_[ACEXML_Encoding::UTF16LE]; else if (ACE_OS::memcmp (&ACEXML_Encoding::byte_order_mark_[ACEXML_Encoding::UTF8][0], input, 3) == 0) return ACEXML_Encoding::encoding_names_[ACEXML_Encoding::UTF8]; else if (ACE_OS::memcmp (&ACEXML_Encoding::magic_values_[ACEXML_Encoding::UTF16BE][0], input, 4) == 0) return ACEXML_Encoding::encoding_names_[ACEXML_Encoding::UTF16BE]; else if (ACE_OS::memcmp (&ACEXML_Encoding::magic_values_[ACEXML_Encoding::UTF16LE][0], input, 4) == 0) return ACEXML_Encoding::encoding_names_[ACEXML_Encoding::UTF16LE]; else if (ACE_OS::memcmp (&ACEXML_Encoding::magic_values_[ACEXML_Encoding::UTF8][0], input, 4) == 0) return ACEXML_Encoding::encoding_names_[ACEXML_Encoding::UTF8]; else { // ACE_ERROR ((LM_ERROR, "Unknown encoding. Assuming UTF-8\n")); return ACEXML_Encoding::encoding_names_[ACEXML_Encoding::UTF8]; } } ace-8.0.4+dfsg.orig/ACEXML/common/Validator.cpp0000644000175000017500000000012115027201772020052 0ustar sudipsudip#include "ACEXML/common/Validator.h" ACEXML_Validator::~ACEXML_Validator () { } ace-8.0.4+dfsg.orig/ACEXML/common/Element_Def_Builder.cpp0000644000175000017500000000016015027201772021745 0ustar sudipsudip#include "ACEXML/common/Element_Def_Builder.h" ACEXML_Element_Def_Builder::~ACEXML_Element_Def_Builder () { } ace-8.0.4+dfsg.orig/ACEXML/ACEXML.mwc0000644000175000017500000000003515027201772015616 0ustar sudipsudip// -*- MPC -*- workspace { } ace-8.0.4+dfsg.orig/ACEXML/README0000644000175000017500000000107615027201772015023 0ustar sudipsudipACE XML PARSER Framework README file * Character set ACE XML only deal with pure unicode encoding. I.e., ACE XML does not care about language specific encoding information. * SAX - The Simple API for XML ACE XML Parser interfaces follows the the design of SAX 2.0, which is a public domain specification for Java. The major difference between ACE XML Parser interfaces and SAX is that we added an reference of ACEXML_Env to every SAX method to accommodate platforms/compilers that don't support C++ exceptions. SAX is defined by David Megginson ace-8.0.4+dfsg.orig/PROBLEM-REPORT-FORM0000644000175000017500000000546415027201773015775 0ustar sudipsudipPlease use the PRF form below to submit bug reports, problem reports, etc., to the ACE developers and interested users. Post it as issue or discussion at https://github.com/DOCGroup/ACE_TAO. If you are using OCI, MicroFocus, or Riverace's versions of ACE do not use github, but instead contact those companies for support. Please paste your PRF as text, _not_ as an attachment. We prefer that all bug reports be submitted through github issues. See https://github.com/DOCGroup/ACE_TAO/issues for more information about how to do this. Not using this problem report form will make it harder or impossible to identify the problem, and in many cases we will be unable to help at all. Also please try to browse the existing github issues and the ChangeLog files to find out if your problem has been solved in a more recent version of ACE. PLEASE make your Title: line as descriptive as possible. Titles like "ACE bug" or "bug report" are not helpful! Also, do _not_ include the word "help" in the Title! When including your config.h and platform_macros.GNU files as requested below, only include the contents if you use the recommended method of including the platform-specific file in your file. If you use a link to the platform-specific file, simply state which one - DO NOT include an entire platform-specific configuration file in the form. 8<----------8<----------8<----------8<----------8<----------8<----------8<---- ACE VERSION: 8.0.4 HOST MACHINE and OPERATING SYSTEM: If on Windows based OS's, which version of WINSOCK do you use?: TARGET MACHINE and OPERATING SYSTEM, if different from HOST: COMPILER NAME AND VERSION (AND PATCHLEVEL): THE $ACE_ROOT/ace/config.h FILE [if you use a link to a platform- specific file, simply state which one]: THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE [if you use a link to a platform-specific file, simply state which one (unless this isn't used in this case, e.g., with Microsoft Visual C++)]: CONTENTS OF $ACE_ROOT/bin/MakeProjectCreator/config/default.features (used by MPC when you generate your own makefiles): AREA/CLASS/EXAMPLE AFFECTED: [What example failed? What module failed to compile?] DOES THE PROBLEM AFFECT: COMPILATION? LINKING? On Unix systems, did you run make realclean first? EXECUTION? OTHER (please specify)? [Please indicate whether ACE, your application, or both are affected.] SYNOPSIS: [Brief description of the problem] DESCRIPTION: [Detailed description of problem. Don't just say " doesn't work, here's a fix," explain what your program does to get to the state. ] REPEAT BY: [What you did to get the error; include test program or session transcript if at all possible. ] SAMPLE FIX/WORKAROUND: [If available ] ace-8.0.4+dfsg.orig/apps/0000755000175000017500000000000015046037655014141 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/mkcsregdb/0000755000175000017500000000000015046037655016102 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/mkcsregdb/cs_test.txt0000644000175000017500000000052415027201773020301 0ustar sudipsudip start description ISO 8859-1:1987; Latin Alphabet No. 1 loc_name ASCII rgy_value 0x00010001 char_values 0x0011 max_bytes 1 end start description IBM-1047 (CCSID 01047); Latin-1 Open System loc_name ECBDIC rgy_value 0x10020417 char_values 0x0011 max_bytes 1 end ace-8.0.4+dfsg.orig/apps/mkcsregdb/code_set_registry1.2g.txt0000644000175000017500000010153715027201773022750 0ustar sudipsudip start description ISO 8859-1:1987; Latin Alphabet No. 1 loc_name NONE rgy_value 0x00010001 char_values 0x0011 max_bytes 1 end start description ISO 8859-2:1987; Latin Alphabet No. 2 loc_name NONE rgy_value 0x00010002 char_values 0x0012 max_bytes 1 end start description ISO 8859-3:1988; Latin Alphabet No. 3 loc_name NONE rgy_value 0x00010003 char_values 0x0013 max_bytes 1 end start description ISO 8859-4:1988; Latin Alphabet No. 4 loc_name NONE rgy_value 0x00010004 char_values 0x0014 max_bytes 1 end start description ISO/IEC 8859-5:1988; Latin-Cyrillic Alphabet loc_name NONE rgy_value 0x00010005 char_values 0x0015 max_bytes 1 end start description ISO 8859-6:1987; Latin-Arabic Alphabet loc_name NONE rgy_value 0x00010006 char_values 0x0016 max_bytes 1 end start description ISO 8859-7:1987; Latin-Greek Alphabet loc_name NONE rgy_value 0x00010007 char_values 0x0017 max_bytes 1 end start description ISO 8859-8:1988; Latin-Hebrew Alphabet loc_name NONE rgy_value 0x00010008 char_values 0x0018 max_bytes 1 end start description ISO/IEC 8859-9:1989; Latin Alphabet No. 5 loc_name NONE rgy_value 0x00010009 char_values 0x0019 max_bytes 1 end start description ISO/IEC 8859-10:1992; Latin Alphabet No. 6 loc_name NONE rgy_value 0x0001000a char_values 0x001a max_bytes 1 end start description ISO 646:1991 IRV (International Reference Version) loc_name NONE rgy_value 0x00010020 char_values 0x0001 max_bytes 1 end start description ISO/IEC 10646-1:1993; UCS-2, Level 1 loc_name NONE rgy_value 0x00010100 char_values 0x1000 max_bytes 2 end start description ISO/IEC 10646-1:1993; UCS-2, Level 2 loc_name NONE rgy_value 0x00010101 char_values 0x1000 max_bytes 2 end start description ISO/IEC 10646-1:1993; UCS-2, Level 3 loc_name NONE rgy_value 0x00010102 char_values 0x1000 max_bytes 2 end start description ISO/IEC 10646-1:1993; UCS-4, Level 1 loc_name NONE rgy_value 0x00010104 char_values 0x1000 max_bytes 4 end start description ISO/IEC 10646-1:1993; UCS-4, Level 2 loc_name NONE rgy_value 0x00010105 char_values 0x1000 max_bytes 4 end start description ISO/IEC 10646-1:1993; UCS-4, Level 3 loc_name NONE rgy_value 0x00010106 char_values 0x1000 max_bytes 4 end start description ISO/IEC 10646-1:1993; UTF-1, UCS Transformation Format 1 loc_name NONE rgy_value 0x00010108 char_values 0x1000 max_bytes 5 end start description ISO/IEC 10646-1:1993; UTF-16, UCS Transformation Format 16-bit form loc_name NONE rgy_value 0x00010109 char_values 0x1000 max_bytes 2 end start description JIS X0201:1976; Japanese phonetic characters loc_name NONE rgy_value 0x00030001 char_values 0x0080 max_bytes 1 end start description JIS X0208:1978 Japanese Kanji Graphic Characters loc_name NONE rgy_value 0x00030004 char_values 0x0081 max_bytes 2 end start description JIS X0208:1983 Japanese Kanji Graphic Characters loc_name NONE rgy_value 0x00030005 char_values 0x0081 max_bytes 2 end start description JIS X0208:1990 Japanese Kanji Graphic Characters loc_name NONE rgy_value 0x00030006 char_values 0x0081 max_bytes 2 end start description JIS X0212:1990; Supplementary Japanese Kanji Graphic Chars loc_name NONE rgy_value 0x0003000a char_values 0x0082 max_bytes 2 end start description JIS eucJP:1993; Japanese EUC loc_name NONE rgy_value 0x00030010 char_values 0x0011:0x0080:0x0081:0x0082 max_bytes 3 end start description KS C5601:1987; Korean Hangul and Hanja Graphic Characters loc_name NONE rgy_value 0x00040001 char_values 0x0100 max_bytes 2 end start description KS C5657:1991; Supplementary Korean Graphic Characters loc_name NONE rgy_value 0x00040002 char_values 0x0101 max_bytes 2 end start description KS eucKR:1991; Korean EUC loc_name NONE rgy_value 0x0004000a char_values 0x0011:0x0100:0x0101 max_bytes 2 end start description CNS 11643:1986; Taiwanese Hanzi Graphic Characters loc_name NONE rgy_value 0x00050001 char_values 0x0180 max_bytes 2 end start description CNS 11643:1992; Taiwanese Extended Hanzi Graphic Chars loc_name NONE rgy_value 0x00050002 char_values 0x0181 max_bytes 4 end start description CNS eucTW:1991; Taiwanese EUC loc_name NONE rgy_value 0x0005000a char_values 0x0001:0x0180 max_bytes 4 end start description CNS eucTW:1993; Taiwanese EUC loc_name NONE rgy_value 0x00050010 char_values 0x0001:0x0181 max_bytes 4 end start description TIS 620-2529, Thai characters loc_name NONE rgy_value 0x000b0001 char_values 0x0200 max_bytes 1 end start description TTB CCDC:1984; Chinese Code for Data Communications loc_name NONE rgy_value 0x000d0001 char_values 0x0180 max_bytes 2 end start description OSF Japanese UJIS loc_name NONE rgy_value 0x05000010 char_values 0x0001:0x0080:0x0081 max_bytes 2 end start description OSF Japanese SJIS-1 loc_name NONE rgy_value 0x05000011 char_values 0x0001:0x0080:0x0081 max_bytes 2 end start description OSF Japanese SJIS-2 loc_name NONE rgy_value 0x05000012 char_values 0x0001:0x0080:0x0081 max_bytes 2 end start description X/Open UTF-8; UCS Transformation Format 8 (UTF-8) loc_name NONE rgy_value 0x05010001 char_values 0x1000 max_bytes 6 end start description JVC_eucJP loc_name NONE rgy_value 0x05020001 char_values 0x0001:0x0080:0x0081:0x0082 max_bytes 3 end start description JVC_SJIS loc_name NONE rgy_value 0x05020002 char_values 0x0001:0x0080:0x0081 max_bytes 2 end start description DEC Kanji loc_name NONE rgy_value 0x10000001 char_values 0x0011:0x0080:0x0081 max_bytes 2 end start description Super DEC Kanji loc_name NONE rgy_value 0x10000002 char_values 0x0011:0x0080:0x0081:0x0082 max_bytes 3 end start description DEC Shift JIS loc_name NONE rgy_value 0x10000003 char_values 0x0011:0x0080:0x0081 max_bytes 2 end start description HP roman8; English and Western European languages loc_name NONE rgy_value 0x10010001 char_values 0x0011 max_bytes 1 end start description HP kana8; Japanese katakana (incl JIS X0201:1976) loc_name NONE rgy_value 0x10010002 char_values 0x0080 max_bytes 1 end start description HP arabic8; Arabic loc_name NONE rgy_value 0x10010003 char_values 0x0016 max_bytes 1 end start description HP greek8; Greek loc_name NONE rgy_value 0x10010004 char_values 0x0017 max_bytes 1 end start description HP hebrew8; Hebrew loc_name NONE rgy_value 0x10010005 char_values 0x0018 max_bytes 1 end start description HP turkish8; Turkish loc_name NONE rgy_value 0x10010006 char_values 0x0013:0x0019 max_bytes 1 end start description HP15CN; encoding method for Simplified Chinese loc_name NONE rgy_value 0x10010007 char_values 0x0001:0x0300 max_bytes 2 end start description HP big5; encoding method for Traditional Chinese loc_name NONE rgy_value 0x10010008 char_values 0x0001:0x0180 max_bytes 2 end start description HP japanese15 (sjis); Shift-JIS for mainframe (incl JIS X0208:1990) loc_name NONE rgy_value 0x10010009 char_values 0x0001:0x0080:0x0081 max_bytes 2 end start description HP sjishi; Shift-JIS for HP user (incl JIS X0208:1990) loc_name NONE rgy_value 0x1001000a char_values 0x0001:0x0080:0x0081 max_bytes 2 end start description HP sjispc; Shift-JIS for PC (incl JIS X0208:1990) loc_name NONE rgy_value 0x1001000b char_values 0x0001:0x0080:0x0081 max_bytes 2 end start description HP ujis; EUC (incl JIS X0208:1990) loc_name NONE rgy_value 0x1001000c char_values 0x0001:0x0080:0x0081 max_bytes 2 end start description IBM-037 (CCSID 00037); CECP for USA, Canada, NL, Ptgl, Brazil, Australia, NZ loc_name NONE rgy_value 0x10020025 char_values 0x0011 max_bytes 1 end start description IBM-273 (CCSID 00273); CECP for Austria, Germany loc_name NONE rgy_value 0x10020111 char_values 0x0011 max_bytes 1 end start description IBM-277 (CCSID 00277); CECP for Denmark, Norway loc_name NONE rgy_value 0x10020115 char_values 0x0011 max_bytes 1 end start description IBM-278 (CCSID 00278); CECP for Finland, Sweden loc_name NONE rgy_value 0x10020116 char_values 0x0011 max_bytes 1 end start description IBM-280 (CCSID 00280); CECP for Italy loc_name NONE rgy_value 0x10020118 char_values 0x0011 max_bytes 1 end start description IBM-282 (CCSID 00282); CECP for Portugal loc_name NONE rgy_value 0x1002011a char_values 0x0011 max_bytes 1 end start description IBM-284 (CCSID 00284); CECP for Spain, Latin America (Spanish) loc_name NONE rgy_value 0x1002011c char_values 0x0011 max_bytes 1 end start description IBM-285 (CCSID 00285); CECP for United Kingdom loc_name NONE rgy_value 0x1002011d char_values 0x0011 max_bytes 1 end start description IBM-290 (CCSID 00290); Japanese Katakana Host Ext SBCS loc_name NONE rgy_value 0x10020122 char_values 0x0080 max_bytes 1 end start description IBM-297 (CCSID 00297); CECP for France loc_name NONE rgy_value 0x10020129 char_values 0x0011 max_bytes 1 end start description IBM-300 (CCSID 00300); Japanese Host DBCS incl 4370 UDC loc_name NONE rgy_value 0x1002012c char_values 0x0081 max_bytes 2 end start description IBM-301 (CCSID 00301); Japanese PC Data DBCS incl 1880 UDC loc_name NONE rgy_value 0x1002012d char_values 0x0081 max_bytes 2 end start description IBM-420 (CCSID 00420); Arabic (presentation shapes) loc_name NONE rgy_value 0x100201a4 char_values 0x0016 max_bytes 1 end start description IBM-424 (CCSID 00424); Hebrew loc_name NONE rgy_value 0x100201a8 char_values 0x0018 max_bytes 1 end start description IBM-437 (CCSID 00437); PC USA loc_name NONE rgy_value 0x100201b5 char_values 0x0011 max_bytes 1 end start description IBM-500 (CCSID 00500); CECP for Belgium, Switzerland loc_name NONE rgy_value 0x100201f4 char_values 0x0011 max_bytes 1 end start description IBM-833 (CCSID 00833); Korean Host Extended SBCS loc_name NONE rgy_value 0x10020341 char_values 0x0001 max_bytes 1 end start description IBM-834 (CCSID 00834); Korean Host DBCS incl 1227 UDC loc_name NONE rgy_value 0x10020342 char_values 0x0100 max_bytes 2 end start description IBM-835 (CCSID 00835); T-Ch Host DBCS incl 6204 UDC loc_name NONE rgy_value 0x10020343 char_values 0x0180 max_bytes 2 end start description IBM-836 (CCSID 00836); S-Ch Host Extended SBCS loc_name NONE rgy_value 0x10020344 char_values 0x0001 max_bytes 1 end start description IBM-837 (CCSID 00837); S-Ch Host DBCS incl 1880 UDC loc_name NONE rgy_value 0x10020345 char_values 0x0300 max_bytes 2 end start description IBM-838 (CCSID 00838); Thai Host Extended SBCS loc_name NONE rgy_value 0x10020346 char_values 0x0200 max_bytes 1 end start description IBM-839 (CCSID 00839); Thai Host DBCS incl 374 UDC loc_name NONE rgy_value 0x10020347 char_values 0x0200 max_bytes 2 end start description IBM-850 (CCSID 00850); Multilingual IBM PC Data-MLP 222 loc_name NONE rgy_value 0x10020352 char_values 0x0011 max_bytes 1 end start description IBM-852 (CCSID 00852); Multilingual Latin-2 loc_name NONE rgy_value 0x10020354 char_values 0x0012 max_bytes 1 end start description IBM-855 (CCSID 00855); Cyrillic PC Data loc_name NONE rgy_value 0x10020357 char_values 0x0015 max_bytes 1 end start description IBM-856 (CCSID 00856); Hebrew PC Data (extensions) loc_name NONE rgy_value 0x10020358 char_values 0x0018 max_bytes 1 end start description IBM-857 (CCSID 00857); Turkish Latin-5 PC Data loc_name NONE rgy_value 0x10020359 char_values 0x0019 max_bytes 1 end start description IBM-861 (CCSID 00861); PC Data Iceland loc_name NONE rgy_value 0x1002035d char_values 0x0011 max_bytes 1 end start description IBM-862 (CCSID 00862); PC Data Hebrew loc_name NONE rgy_value 0x1002035e char_values 0x0018 max_bytes 1 end start description IBM-863 (CCSID 00863); PC Data Canadian French loc_name NONE rgy_value 0x1002035f char_values 0x0011 max_bytes 1 end start description IBM-864 (CCSID 00864); Arabic PC Data loc_name NONE rgy_value 0x10020360 char_values 0x0016 max_bytes 1 end start description IBM-866 (CCSID 00866); PC Data Cyrillic 2 loc_name NONE rgy_value 0x10020362 char_values 0x0015 max_bytes 1 end start description IBM-868 (CCSID 00868); Urdu PC Data loc_name NONE rgy_value 0x10020364 char_values 0x0016 max_bytes 1 end start description IBM-869 (CCSID 00869); Greek PC Data loc_name NONE rgy_value 0x10020365 char_values 0x0017 max_bytes 1 end start description IBM-870 (CCSID 00870); Multilingual Latin-2 EBCDIC loc_name NONE rgy_value 0x10020366 char_values 0x0012 max_bytes 1 end start description IBM-871 (CCSID 00871); CECP for Iceland loc_name NONE rgy_value 0x10020367 char_values 0x0011 max_bytes 1 end start description IBM-874 (CCSID 00874); Thai PC Display Extended SBCS loc_name NONE rgy_value 0x1002036a char_values 0x0200 max_bytes 1 end start description IBM-875 (CCSID 00875); Greek loc_name NONE rgy_value 0x1002036b char_values 0x0017 max_bytes 1 end start description IBM-880 (CCSID 00880); Multilingual Cyrillic loc_name NONE rgy_value 0x10020370 char_values 0x0015 max_bytes 1 end start description IBM-891 (CCSID 00891); Korean PC Data SBCS loc_name NONE rgy_value 0x1002037b char_values 0x0001 max_bytes 1 end start description IBM-896 (CCSID 00896); Japanese Katakana characters; superset of JIS X0201:1976 loc_name NONE rgy_value 0x10020380 char_values 0x0080 max_bytes 1 end start description IBM-897 (CCSID 00897); PC Data Japanese SBCS (use with CP 00301) loc_name NONE rgy_value 0x10020381 char_values 0x0080 max_bytes 1 end start description IBM-903 (CCSID 00903); PC Data Simplified Chinese SBCS (use with DBCS) loc_name NONE rgy_value 0x10020387 char_values 0x0001 max_bytes 1 end start description IBM-904 (CCSID 00904); PC Data Traditional Chinese SBCS (use with DBCS) loc_name NONE rgy_value 0x10020388 char_values 0x0001 max_bytes 1 end start description IBM-918 (CCSID 00918); Urdu loc_name NONE rgy_value 0x10020396 char_values 0x0016 max_bytes 1 end start description IBM-921 (CCSID 00921); Baltic 8-Bit loc_name NONE rgy_value 0x10020399 char_values 0x001a max_bytes 1 end start description IBM-922 (CCSID 00922); Estonia 8-Bit loc_name NONE rgy_value 0x1002039a char_values 0x001a max_bytes 1 end start description IBM-926 (CCSID 00926); Korean PC Data DBCS incl 1880 UDC loc_name NONE rgy_value 0x1002039e char_values 0x0100 max_bytes 2 end start description IBM-927 (CCSID 00927); T-Ch PC Data DBCS incl 6204 UDC loc_name NONE rgy_value 0x1002039f char_values 0x0180 max_bytes 2 end start description IBM-928 (CCSID 00928); S-Ch PC Data DBCS incl 1880 UDC loc_name NONE rgy_value 0x100203a0 char_values 0x0300 max_bytes 2 end start description IBM-929 (CCSID 00929); Thai PC Data DBCS incl 374 UDC loc_name NONE rgy_value 0x100203a1 char_values 0x0200 max_bytes 2 end start description IBM-930 (CCSID 00930); Kat-Kanji Host MBCS Ext-SBCS loc_name NONE rgy_value 0x100203a2 char_values 0x0080:0x0081 max_bytes 2 end start description IBM-932 (CCSID 00932); Japanese PC Data Mixed loc_name NONE rgy_value 0x100203a4 char_values 0x0080:0x0081 max_bytes 2 end start description IBM-933 (CCSID 00933); Korean Host Extended SBCS loc_name NONE rgy_value 0x100203a5 char_values 0x0001:0x0100 max_bytes 2 end start description IBM-934 (CCSID 00934); Korean PC Data Mixed loc_name NONE rgy_value 0x100203a6 char_values 0x0001:0x0100 max_bytes 2 end start description IBM-935 (CCSID 00935); S-Ch Host Mixed loc_name NONE rgy_value 0x100203a7 char_values 0x0001:0x0300 max_bytes 2 end start description IBM-936 (CCSID 00936); PC Data S-Ch MBCS loc_name NONE rgy_value 0x100203a8 char_values 0x0001:0x0300 max_bytes 2 end start description IBM-937 (CCSID 00937); T-Ch Host Mixed loc_name NONE rgy_value 0x100203a9 char_values 0x0001:0x0180 max_bytes 2 end start description IBM-938 (CCSID 00938); PC Data T-Ch MBCS loc_name NONE rgy_value 0x100203aa char_values 0x0001:0x0180 max_bytes 2 end start description IBM-939 (CCSID 00939); Latin-Kanji Host MBCS loc_name NONE rgy_value 0x100203ab char_values 0x0080:0x0081 max_bytes 2 end start description IBM-941 (CCSID 00941); Japanese PC DBCS for Open loc_name NONE rgy_value 0x100203ad char_values 0x0081 max_bytes 2 end start description IBM-942 (CCSID 00942); Japanese PC Data Mixed loc_name NONE rgy_value 0x100203ae char_values 0x0080:0x0081 max_bytes 2 end start description IBM-943 (CCSID 00943); Japanese PC MBCS for Open loc_name NONE rgy_value 0x100203af char_values 0x0080:0x0081 max_bytes 2 end start description IBM-946 (CCSID 00946); S-Ch PC Data Mixed loc_name NONE rgy_value 0x100203b2 char_values 0x0001:0x0300 max_bytes 2 end start description IBM-947 (CCSID 00947); T-Ch PC Data DBCS incl 6204 UDC loc_name NONE rgy_value 0x100203b3 char_values 0x0180 max_bytes 2 end start description IBM-948 (CCSID 00948); T-Ch PC Data Mixed loc_name NONE rgy_value 0x100203b4 char_values 0x0001:0x0180 max_bytes 2 end start description IBM-949 (CCSID 00949); IBM KS PC Data Mixed loc_name NONE rgy_value 0x100203b5 char_values 0x0001:0x0100 max_bytes 2 end start description IBM-950 (CCSID 00950); T-Ch PC Data Mixed loc_name NONE rgy_value 0x100203b6 char_values 0x0001:0x0180 max_bytes 2 end start description IBM-951 (CCSID 00951); IBM KS PC Data DBCS incl 1880 UDC loc_name NONE rgy_value 0x100203b7 char_values 0x0100 max_bytes 2 end start description IBM-955 (CCSID 00955); Japan Kanji characters; superset of JIS X0208:1978 loc_name NONE rgy_value 0x100203bb char_values 0x0081 max_bytes 2 end start description IBM-964 (CCSID 00964); T-Chinese EUC CNS1163 plane 1,2 loc_name NONE rgy_value 0x100203c4 char_values 0x0001:0x0180 max_bytes 4 end start description IBM-970 (CCSID 00970); Korean EUC loc_name NONE rgy_value 0x100203ca char_values 0x0011:0x0100:0x0101 max_bytes 2 end start description IBM-1006 (CCSID 01006); Urdu 8-bit loc_name NONE rgy_value 0x100203ee char_values 0x0016 max_bytes 1 end start description IBM-1025 (CCSID 01025); Cyrillic Multilingual loc_name NONE rgy_value 0x10020401 char_values 0x0015 max_bytes 1 end start description IBM-1026 (CCSID 01026); Turkish Latin-5 loc_name NONE rgy_value 0x10020402 char_values 0x0019 max_bytes 1 end start description IBM-1027 (CCSID 01027); Japanese Latin Host Ext SBCS loc_name NONE rgy_value 0x10020403 char_values 0x0080 max_bytes 1 end start description IBM-1040 (CCSID 01040); Korean PC Data Extended SBCS loc_name NONE rgy_value 0x10020410 char_values 0x0001 max_bytes 1 end start description IBM-1041 (CCSID 01041); Japanese PC Data Extended SBCS loc_name NONE rgy_value 0x10020411 char_values 0x0080 max_bytes 1 end start description IBM-1043 (CCSID 01043); T-Ch PC Data Extended SBCS loc_name NONE rgy_value 0x10020413 char_values 0x0001 max_bytes 1 end start description IBM-1046 (CCSID 01046); Arabic PC Data loc_name NONE rgy_value 0x10020416 char_values 0x0016 max_bytes 1 end start description IBM-1047 (CCSID 01047); Latin-1 Open System loc_name NONE rgy_value 0x10020417 char_values 0x0011 max_bytes 1 end start description IBM-1088 (CCSID 01088); IBM KS Code PC Data SBCS loc_name NONE rgy_value 0x10020440 char_values 0x0001 max_bytes 1 end start description IBM-1097 (CCSID 01097); Farsi loc_name NONE rgy_value 0x10020449 char_values 0x0016 max_bytes 1 end start description IBM-1098 (CCSID 01098); Farsi PC Data loc_name NONE rgy_value 0x1002044a char_values 0x0016 max_bytes 1 end start description IBM-1112 (CCSID 01112); Baltic Multilingual loc_name NONE rgy_value 0x10020458 char_values 0x001a max_bytes 1 end start description IBM-1114 (CCSID 01114); T-Ch PC Data SBCS (IBM BIG-5) loc_name NONE rgy_value 0x1002045a char_values 0x0001 max_bytes 1 end start description IBM-1115 (CCSID 01115); S-Ch PC Data SBCS (IBM GB) loc_name NONE rgy_value 0x1002045b char_values 0x0001 max_bytes 1 end start description IBM-1122 (CCSID 01122); Estonia loc_name NONE rgy_value 0x10020462 char_values 0x001a max_bytes 1 end start description IBM-1250 (CCSID 01250); MS Windows Latin-2 loc_name NONE rgy_value 0x100204e2 char_values 0x0012 max_bytes 1 end start description IBM-1251 (CCSID 01251); MS Windows Cyrillic loc_name NONE rgy_value 0x100204e3 char_values 0x0015 max_bytes 1 end start description IBM-1252 (CCSID 01252); MS Windows Latin-1 loc_name NONE rgy_value 0x100204e4 char_values 0x0011 max_bytes 1 end start description IBM-1253 (CCSID 01253); MS Windows Greek loc_name NONE rgy_value 0x100204e5 char_values 0x0017 max_bytes 1 end start description IBM-1254 (CCSID 01254); MS Windows Turkey loc_name NONE rgy_value 0x100204e6 char_values 0x0019 max_bytes 1 end start description IBM-1255 (CCSID 01255); MS Windows Hebrew loc_name NONE rgy_value 0x100204e7 char_values 0x0018 max_bytes 1 end start description IBM-1256 (CCSID 01256); MS Windows Arabic loc_name NONE rgy_value 0x100204e8 char_values 0x0016 max_bytes 1 end start description IBM-1257 (CCSID 01257); MS Windows Baltic loc_name NONE rgy_value 0x100204e9 char_values 0x001a max_bytes 1 end start description IBM-1380 (CCSID 01380); S-Ch PC Data DBCS incl 1880 UDC loc_name NONE rgy_value 0x10020564 char_values 0x0300 max_bytes 2 end start description IBM-1381 (CCSID 01381); S-Ch PC Data Mixed incl 1880 UDC loc_name NONE rgy_value 0x10020565 char_values 0x0001:0x0300 max_bytes 2 end start description IBM-1383 (CCSID 01383); S-Ch EUC GB 2312-80 set (1382) loc_name NONE rgy_value 0x10020567 char_values 0x0001:0x0300 max_bytes 3 end start description IBM-300 (CCSID 04396); Japanese Host DBCS incl 1880 UDC loc_name NONE rgy_value 0x1002112c char_values 0x0081 max_bytes 2 end start description IBM-850 (CCSID 04946); Multilingual IBM PC Data-190 loc_name NONE rgy_value 0x10021352 char_values 0x0011 max_bytes 1 end start description IBM-852 (CCSID 04948); Latin-2 Personal Computer loc_name NONE rgy_value 0x10021354 char_values 0x0012 max_bytes 1 end start description IBM-855 (CCSID 04951); Cyrillic Personal Computer loc_name NONE rgy_value 0x10021357 char_values 0x0015 max_bytes 1 end start description IBM-856 (CCSID 04952); Hebrew PC Data loc_name NONE rgy_value 0x10021358 char_values 0x0018 max_bytes 1 end start description IBM-857 (CCSID 04953); Turkish Latin-5 PC Data loc_name NONE rgy_value 0x10021359 char_values 0x0019 max_bytes 1 end start description IBM-864 (CCSID 04960); Arabic PC Data (all shapes) loc_name NONE rgy_value 0x10021360 char_values 0x0016 max_bytes 1 end start description IBM-868 (CCSID 04964); PC Data for Urdu loc_name NONE rgy_value 0x10021364 char_values 0x0016 max_bytes 1 end start description IBM-869 (CCSID 04965); Greek PC Data loc_name NONE rgy_value 0x10021365 char_values 0x0017 max_bytes 1 end start description IBM-5026 (CCSID 05026); Japanese Katakana-Kanji Host Mixed loc_name NONE rgy_value 0x100213a2 char_values 0x0080:0x0081 max_bytes 2 end start description IBM-5031 (CCSID 05031); S-Ch Host MBCS loc_name NONE rgy_value 0x100213a7 char_values 0x0001:0x0300 max_bytes 2 end start description IBM-1027 and -300 (CCSID 05035); Japanese Latin-Kanji Host Mixed loc_name NONE rgy_value 0x100213ab char_values 0x0080:0x0081 max_bytes 2 end start description IBM-5048 (CCSID 05048); Japanese Kanji characters; superset of JIS X0208:1990 (and 1983) loc_name NONE rgy_value 0x100213b8 char_values 0x0081 max_bytes 2 end start description IBM-5049 (CCSID 05049); Japanese Kanji characters; superset of JIS X0212:1990 loc_name NONE rgy_value 0x100213b9 char_values 0x0082 max_bytes 2 end start description IBM-5067 (CCSID 05067); Korean Hangul and Hanja; superset of KS C5601:1987 loc_name NONE rgy_value 0x100213cb char_values 0x0100 max_bytes 2 end start description IBM-420 (CCSID 08612); Arabic (base shapes only) loc_name NONE rgy_value 0x100221a4 char_values 0x0016 max_bytes 1 end start description IBM-833 (CCSID 09025); Korean Host SBCS loc_name NONE rgy_value 0x10022341 char_values 0x0001 max_bytes 1 end start description IBM-834 (CCSID 09026); Korean Host DBCS incl 1880 UDC loc_name NONE rgy_value 0x10022342 char_values 0x0100 max_bytes 2 end start description IBM-838 (CCSID 09030); Thai Host Extended SBCS loc_name NONE rgy_value 0x10022346 char_values 0x0200 max_bytes 1 end start description IBM-864 (CCSID 09056); Arabic PC Data (unshaped) loc_name NONE rgy_value 0x10022360 char_values 0x0016 max_bytes 1 end start description IBM-874 (CCSID 09066); Thai PC Display Extended SBCS loc_name NONE rgy_value 0x1002236a char_values 0x0200 max_bytes 1 end start description IBM-9125 (CCSID 09125); Korean Host Mixed incl 1880 UDC loc_name NONE rgy_value 0x100223a5 char_values 0x0001:0x0100 max_bytes 2 end start description IBM-850 (CCSID 25426); Multilingual IBM PC Display-MLP loc_name NONE rgy_value 0x10026352 char_values 0x0011 max_bytes 1 end start description IBM-856 (CCSID 25432); Hebrew PC Display (extensions) loc_name NONE rgy_value 0x10026358 char_values 0x0018 max_bytes 1 end start description IBM-1042 (CCSID 25618); S-Ch PC Display Ext SBCS loc_name NONE rgy_value 0x10026412 char_values 0x0001 max_bytes 1 end start description IBM-037 (CCSID 28709); T-Ch Host Extended SBCS loc_name NONE rgy_value 0x10027025 char_values 0x0001 max_bytes 1 end start description IBM-856 (CCSID 33624); Hebrew PC Display loc_name NONE rgy_value 0x10028358 char_values 0x0018 max_bytes 1 end start description IBM33722 (CCSID 33722); Japanese EUC JISx201,208,212 loc_name NONE rgy_value 0x100283ba char_values 0x0080:0x0081:0x0082 max_bytes 3 end start description HTCsjis; Hitachi SJIS 90-1 loc_name NONE rgy_value 0x10030001 char_values 0x0001:0x0080:0x0081 max_bytes 2 end start description HTCujis; Hitachi eucJP 90-1 loc_name NONE rgy_value 0x10030002 char_values 0x0001:0x0080:0x0081 max_bytes 2 end start description Fujitsu U90; Japanese EUC loc_name NONE rgy_value 0x10040001 char_values 0x0001:0x0080:0x0081 max_bytes 3 end start description Fujitsu S90; Japanese EUC loc_name NONE rgy_value 0x10040002 char_values 0x0001:0x0080:0x0081 max_bytes 3 end start description Fujitsu R90; Fujitsu Shift JIS loc_name NONE rgy_value 0x10040003 char_values 0x0001:0x0080:0x0081 max_bytes 2 end start description EBCDIC(ASCII) and JEF; Japanese encoding method for mainframe loc_name NONE rgy_value 0x10040004 char_values 0x0001:0x0081 max_bytes 3 end start description EBCDIC(Katakana) and JEF; Japanese encoding method for mainframe loc_name NONE rgy_value 0x10040005 max_bytes 3 char_values 0x0001:0x0080:0x0081 end start description EBCDIC(Japanese English) and JEF; Japanese encoding method for mainframe loc_name NONE rgy_value 0x10040006 max_bytes 3 char_values 0x0001:0x0081 end ace-8.0.4+dfsg.orig/apps/mkcsregdb/mkcsregdb.mpc0000644000175000017500000000012015027201773020526 0ustar sudipsudip// -*- MPC -*- project: aceexe { exename = mkcsregdb avoids += uses_wchar } ace-8.0.4+dfsg.orig/apps/mkcsregdb/iso_only.txt0000644000175000017500000000024615027201773020471 0ustar sudipsudip start description ISO 8859-1:1987; Latin Alphabet No. 1 loc_name ASCII rgy_value 0x00010001 char_values 0x0011 max_bytes 1 end ace-8.0.4+dfsg.orig/apps/mkcsregdb/mkcsregdb.cpp0000644000175000017500000002461015027201773020543 0ustar sudipsudip/* * * To populate the registry_db, construct a codeset registry text file based * on the OSF's Character and Code Set Registry. See DCE RFC 40.1 for details * on obtaining the full text for the current registry. Once you have composed * a text file containing all the desired codeset information, build and run * mkcsregdb. The source is in $ACE_ROOT/apps/mkcsregdb. It will generate a new * copy of this file, with the registry_db_ array properly initialized. */ // FUZZ: disable check_for_streams_include #include "ace/streams.h" #include "ace/Codeset_Registry.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_sys_stat.h" #include "ace/OS_NS_time.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_stdlib.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" class csdb_generator : public ACE_Codeset_Registry { public: csdb_generator (); int read_from (const char *source); int init_output (const char *srcfile); int write_entry (); int fini_output (const char *target); int read_line (); void write_dummy_entry(); void fail(const char *msg); private: static const char * tags_[]; static int max_line_; int count_; int in_entry_; registry_entry entry_; int linecounter_; char *source_line_; char *line_data_; ifstream *inf_; FILE *outf_; char tempfilename_[MAXPATHLEN]; char *ace_src_; }; int csdb_generator::max_line_ = 1024; const char * csdb_generator::tags_[] = { "start", "end", "description ", "loc_name ", "rgy_value ", "char_values ", "max_bytes ", 0 }; csdb_generator::csdb_generator () :count_(0), in_entry_(0), linecounter_(0), source_line_ (new char[max_line_]), line_data_ (0), inf_ (0), outf_ (0) { ace_src_ = ACE_OS::getenv("ACE_ROOT"); tempfilename_[0] = '\0'; } void csdb_generator::fail (const char *msg) { ACE_ERROR ((LM_ERROR,"Error, line %d: %s\n",linecounter_,msg)); ACE_OS::fclose (outf_); ACE_OS::unlink (tempfilename_); ACE_OS::exit (-1); } int csdb_generator::read_line() { inf_->getline (source_line_,max_line_); line_data_ = 0; char *cpos = ACE_OS::strchr (source_line_,'#'); if (cpos == 0) cpos = source_line_ + ACE_OS::strlen(source_line_); while (cpos > source_line_ && ACE_OS::strchr(" \t",*(cpos - 1))) cpos--; *cpos = 0; if (cpos == source_line_) return 0; for (int i = 0; tags_[i]; i++) { cpos = ACE_OS::strstr (source_line_,tags_[i]); if (cpos == 0) // not found continue; if (cpos > source_line_) // make sure it's first token { char *tpos = cpos-1; while (tpos > source_line_ && ACE_OS::strchr(" \t",*tpos)) tpos--; if (tpos > source_line_) continue; } if (i == 0 && in_entry_) fail ("\"start\" encountered twice before \"end\""); if (i > 0 && !in_entry_) { char *emsg = new char[100]; ACE_OS::sprintf (emsg,"\"%s\" encountered before \"start\"",tags_[i]); fail (emsg); } if (i > 1) { line_data_ = cpos + ACE_OS::strlen(tags_[i]); while (*line_data_ && ACE_OS::strchr(" \t",(*line_data_))) line_data_++; } return i+1; } return -1; } int csdb_generator::read_from (const char *srcfile) { inf_ = new ifstream(srcfile); char *ptr; while (inf_->good() && !inf_->eof()) { linecounter_++; switch (read_line ()) { case -1: // bogus line fail ("unknown field tag"); break; case 0: // comment or blank line break; case 1: // start entry_.desc_ = 0; entry_.loc_name_ = 0; entry_.codeset_id_ = 0; entry_.num_sets_ = 0; entry_.max_bytes_ = 0; in_entry_ = 1; break; case 2: // end if (entry_.codeset_id_ == 0) fail ("entry missing rgy_value"); if (entry_.num_sets_ == 0) fail ("entry does not include at least one char_value"); if (entry_.max_bytes_ == 0) fail ("entry does not define max_bytes"); write_entry (); delete [] const_cast (entry_.desc_); delete [] const_cast (entry_.loc_name_); count_++; in_entry_ = 0; break; case 3: // description if (entry_.desc_ != 0) fail ("duplicate description"); entry_.desc_ = ACE_OS::strdup(line_data_); break; case 4: // loc_name if (entry_.loc_name_ != 0) fail ("duplicate loc_name"); entry_.loc_name_ = ACE_OS::strdup(line_data_); break; case 5: // rgy_value if (entry_.codeset_id_ != 0) fail ("duplicate rgy_value"); entry_.codeset_id_ = ACE_OS::strtoul(line_data_,&ptr,16); if (*ptr != 0 || entry_.codeset_id_ == 0) { char emsg [100]; ACE_OS::sprintf (emsg,"invalid rgy_value, '%s'",line_data_); fail (emsg); } break; case 6: // char_values if (entry_.num_sets_ != 0) fail ("duplicate char_values"); ptr = line_data_; do { if (*ptr == ':') ptr++; ACE_CDR::UShort tmp = static_cast (ACE_OS::strtoul(ptr,&ptr,16)); if (*ptr != 0 && *ptr != ':') { char *emsg = new char [100]; ACE_OS::sprintf (emsg,"invalid symbol \'%c\' in char_values",*ptr); fail (emsg); } if (entry_.num_sets_ < max_charsets_) entry_.char_sets_[entry_.num_sets_++] = tmp; else entry_.num_sets_++; } while (*ptr == ':'); if (entry_.num_sets_ > max_charsets_) { char *emsg = new char [200]; ACE_OS::sprintf (emsg,"max of %d char_values exceeded.\nIncrease ACE_Codeset_Registry::max_charsets_ to at least %d and rebuild mkcsregdb",max_charsets_,entry_.num_sets_); fail (emsg); } break; case 7: // max_bytes if (entry_.max_bytes_ != 0) fail ("duplicate max_bytes"); entry_.max_bytes_ = static_cast (ACE_OS::strtol(line_data_,&ptr,10)); if (*ptr != 0) fail ("invalid max_bytes"); break; } } return 0; } int csdb_generator::init_output (const char *srcfile) { ACE_stat buf; if (ACE_OS::stat (srcfile,&buf) != 0) ACE_ERROR_RETURN ((LM_ERROR,"Unable to open %s\n",srcfile),-1); if (ace_src_ == 0) ACE_ERROR_RETURN ((LM_ERROR,"You must first set $ACE_ROOT\n"),-1); time_t now = ACE_OS::time(); if (ACE_OS::strlen(ace_src_) > 0) { ACE_OS::sprintf (tempfilename_, "%s%s%s", ace_src_, ACE_DIRECTORY_SEPARATOR_STR, "csdbXXXXXX"); } else { ACE_OS::strcpy (tempfilename_, "csdbXXXXXX"); } ACE_HANDLE fd = ACE_OS::mkstemp (tempfilename_); if (fd == ACE_INVALID_HANDLE) ACE_ERROR_RETURN ((LM_ERROR, "Unable to open output file, %p\n", tempfilename_), -1); outf_ = ACE_OS::fdopen (fd, "w"); ACE_OS::fprintf (outf_,"/*\n * Codeset registry DB, generated %s * source: %s\n", ACE_OS::asctime (ACE_OS::localtime(&now)), srcfile); ACE_OS::fprintf (outf_," *\n * To populate the registry_db, construct a codeset registry text file based\n"); ACE_OS::fprintf (outf_," * on the OSF's Character and Code Set Registry. See DCE RFC 40.1 for details\n"); ACE_OS::fprintf (outf_," * on obtaining the full text for the current registry. Once you have composed\n"); ACE_OS::fprintf (outf_," * a text file containing all the desired codeset information, build and run\n"); ACE_OS::fprintf (outf_," * mkcsregdb. The source is in $ACE_ROOT/apps/mkcsregdb. It will generate a new\n"); ACE_OS::fprintf (outf_," * copy of this file, with the registry_db_ array properly initialized.\n */\n"); ACE_OS::fprintf (outf_,"\n#include \"ace/Codeset_Registry.h\"\n\nACE_BEGIN_VERSIONED_NAMESPACE_DECL\n\n%s\n%s\n{\n", "ACE_Codeset_Registry::registry_entry const", "ACE_Codeset_Registry::registry_db_[] ="); return 0; } int csdb_generator::write_entry () { if (count_) ACE_OS::fprintf (outf_,",\n"); ACE_OS::fprintf (outf_," {\"%s\",\"%s\",0x%08x,%d,{", entry_.desc_, entry_.loc_name_, entry_.codeset_id_, entry_.num_sets_); for (ACE_CDR::UShort j = 0; j < entry_.num_sets_; j++) if (j+1 < entry_.num_sets_) ACE_OS::fprintf (outf_,"0x%04x,",entry_.char_sets_[j]); else ACE_OS::fprintf (outf_,"0x%04x",entry_.char_sets_[j]); ACE_OS::fprintf (outf_,"},%d}",entry_.max_bytes_); return 0; } void csdb_generator::write_dummy_entry() { entry_.desc_ = "No codesets defined"; entry_.loc_name_ = "NONE"; entry_.codeset_id_ = 0; entry_.num_sets_ = 1; entry_.char_sets_[0] = 0; entry_.max_bytes_ = 0; write_entry(); } int csdb_generator::fini_output (const char *tgt) { char *target = new char [ACE_OS::strlen(ace_src_) + ACE_OS::strlen(tgt) + 6]; ACE_OS::sprintf (target,"%s/ace/%s",ace_src_,tgt); if (count_ == 0) write_dummy_entry(); ACE_OS::fprintf (outf_,"\n};\n\nsize_t const ACE_Codeset_Registry::num_registry_entries_ = %d;\n\nACE_END_VERSIONED_NAMESPACE_DECL\n",count_); ACE_OS::fclose (outf_); ACE_stat buf; if (ACE_OS::stat (target,&buf) == 0) { char fname[200]; int result = 0; for (int i = 0; result == 0; i++) { ACE_OS::sprintf (fname,"%s.%03d",target,i); result = ACE_OS::stat(fname,&buf); } ACE_DEBUG ((LM_DEBUG,"Moving $ACE_ROOT/ace/%s to $ACE_ROOT/ace%s\n", tgt,ACE_OS::strrchr(fname,'/'))); if (ACE_OS::rename (target,fname) == -1) ACE_ERROR_RETURN ((LM_ERROR,"Could not create %s\n, output stored in %s", fname,tempfilename_),-1); } ACE_DEBUG ((LM_DEBUG,"writing $ACE_ROOT/ace/%s\n",tgt)); if (ACE_OS::rename (tempfilename_,target) == -1) ACE_ERROR_RETURN ((LM_ERROR,"Could not create %s\n, output stored in %s", target,tempfilename_),-1); return 0; } int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { ACE_CString srcname; if (argc > 1) srcname.set(argv[1]); else ACE_ERROR_RETURN ((LM_ERROR,"Usage: %s \nwhere source file is the full path to a code set registry text file.\n",argv[0]),-1); csdb_generator csdb; if (csdb.init_output(srcname.c_str()) == -1) return 0; if (csdb.read_from (srcname.c_str()) == 0) csdb.fini_output ("Codeset_Registry_db.cpp"); return 0; } ace-8.0.4+dfsg.orig/apps/soreduce/0000755000175000017500000000000015046037655015752 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/soreduce/Signature.cpp0000644000175000017500000000064615027201773020416 0ustar sudipsudip#include "Signature.h" Signature::Signature (const ACE_CString &name) :name_(name), ref_count_ (1), used_ (0) { } void Signature::used () { used_++; } int Signature::used_count() const { return used_; } const ACE_CString & Signature::name() const { return name_; } Signature * Signature::dup() { ref_count_++; return this; } void Signature::release() { if (--ref_count_ == 0) delete this; } ace-8.0.4+dfsg.orig/apps/soreduce/soreduce.cpp0000644000175000017500000000305315027201773020261 0ustar sudipsudip// File: soreduce.cpp // Author: Phil Mesnier // theory of operation: // 1. Build a complete set of applications // 2. apply "nm" to each of the .o files that make up the libraries to subset // filter the results into two files for each, one with exported names, the // other with imported names. // 3. apply "nm" to all of the elements which use ace & tao. build a list of // imported names // 4. Repeat the following steps until no entries remain in the list of // imports // 4.1 Take a name from the list of imports, locate the module containing the // export of that name // 4.2 Add the exporting module to the list of required modules, add its list // of exports to the list of resolved exports, add its imported names to // the list of imports. // 4.4 Traverse the list of imported names to eliminate any found in the list // of exported names. // 4.5 go to step 4.1 // 5. construct a new makefile for all required modules. // // Currently works only with GNU nm #include #include "SO_Group.h" int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { SO_Group group; ACE_DEBUG ((LM_DEBUG, "discovering libraries\n")); for (int i = 1; i < argc; group.add_executable (argv[i++])) { // No action. } ACE_DEBUG ((LM_DEBUG, "loading object modules\n")); group.load_modules (); group.list_libs (); ACE_DEBUG ((LM_DEBUG, "Starting analysis\n")); group.analize (); ACE_DEBUG ((LM_DEBUG, "Writing results\n")); group.write_results (); ACE_DEBUG ((LM_DEBUG, "Done.\n")); return 0; } ace-8.0.4+dfsg.orig/apps/soreduce/Library.cpp0000644000175000017500000002075615027201773020065 0ustar sudipsudip// -*- C++ -*- // File: Library.cpp // Author: Phil Mesnier // This file contains the implementation of the classes responsible for // generating specialized mpc files for individual libraries, as well as // outputting usage metrics for the various object modules contained in the // library. #include "ace/OS_NS_dirent.h" #include "ace/OS_NS_stdlib.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_sys_stat.h" #include "ace/OS_NS_ctype.h" #include "ace/Log_Msg.h" #include "Library.h" MPC_Generator::MPC_Generator (const ACE_CString& libname) : mpcfile_(), libname_(libname), mpcfilename_() { mpcfilename_ = libname_ + "_subset.mpc"; } MPC_Generator::~MPC_Generator () { } void MPC_Generator::write_file (const ACE_CString& file) { mpcfile_ << " " << file << ".cpp" << endl; } void MPC_Generator::write_prolog (const ACE_CString& path) { ACE_CString fname (path + "/" + mpcfilename_); ACE_DEBUG ((LM_DEBUG, "writing file %s\n",fname.c_str())); mpcfile_.open(fname.c_str()); if (!mpcfile_) ACE_DEBUG ((LM_DEBUG,"mpc file open failed\n")); mpcfile_ << "// Generated mpc file for producing a subset of the " << libname_ << " library " << endl << endl << "project(" << libname_ << "_subset)"; this->write_baseprojects (); mpcfile_ << " {" << endl << " sharedname = " << libname_ << "_subset" << endl << " pch_header = " << endl << " pch_source = " << endl; this->write_projectinfo (); mpcfile_ << endl << " Source_Files {" << endl; } void MPC_Generator::write_epilog () { mpcfile_ << " }" << endl << "}" << endl; mpcfile_.close(); } void MPC_Generator::write_baseprojects() { mpcfile_ << ": acedefaults, core"; } void MPC_Generator::write_projectinfo() { mpcfile_ << " libout = $(ACE_ROOT)/lib" << endl << " dynamicflags = ACE_BUILD_DLL ACE_OS_BUILD_DLL" << endl; } //----------------------------------------------------------------------------- MPC_ACE_Dep_Lib::MPC_ACE_Dep_Lib (const ACE_CString& libname) : MPC_Generator(libname) {} void MPC_ACE_Dep_Lib::write_baseprojects() { mpcfile_ << ": acedefaults, aceversion"; } void MPC_ACE_Dep_Lib::write_projectinfo() { mpcfile_ << " libout = $(ACE_ROOT)/lib" << endl << " libs += ACE_subset" << endl << " after += ACE_subset" << endl; } //----------------------------------------------------------------------------- MPC_TAO_Lib::MPC_TAO_Lib (const ACE_CString& libname) : MPC_ACE_Dep_Lib(libname) {} void MPC_TAO_Lib::write_baseprojects() { MPC_ACE_Dep_Lib::write_baseprojects (); mpcfile_ << ", core, tao_output, taodefaults"; } void MPC_TAO_Lib::write_projectinfo() { MPC_ACE_Dep_Lib::write_projectinfo(); mpcfile_ << " dynamicflags = TAO_BUILD_DLL" << endl; } //----------------------------------------------------------------------------- MPC_TAO_Dep_Lib::MPC_TAO_Dep_Lib (const ACE_CString& libname) : MPC_TAO_Lib(libname) {} void MPC_TAO_Dep_Lib::write_baseprojects() { MPC_TAO_Lib::write_baseprojects (); mpcfile_ << ", taoidldefaults"; } void MPC_TAO_Dep_Lib::write_projectinfo() { // Try our best to generate the dynamicflags ACE_CString dflags; for(size_t i = 0; i < this->libname_.length (); ++i) { dflags += static_cast(ACE_OS::ace_toupper (this->libname_[i])); } dflags += "_BUILD_DLL"; MPC_ACE_Dep_Lib::write_projectinfo(); mpcfile_ << " dynamicflags = " << dflags.c_str () << endl << " libs += TAO_subset" << endl << " after += TAO_subset" << endl << " includes += $(TAO_ROOT)/orbsvcs" << endl << " idlflags += -I$(TAO_ROOT)/orbsvcs" << endl; } //----------------------------------------------------------------------------- Library::Library (const char *name) : name_(name), path_(), num_modules_(0), num_exports_(0), num_extrefs_(0), modules_(0), exported_(0), mpcfile_(0) { if (name_ == "ACE") mpcfile_ = new MPC_Generator(name_); else if (name_.find ("ACE_") == 0) mpcfile_ = new MPC_ACE_Dep_Lib (name_); else if (name_ == "TAO") mpcfile_ = new MPC_TAO_Lib (name_); else mpcfile_ = new MPC_TAO_Dep_Lib (name_); } Library::~Library () { delete mpcfile_; int i; for (i = 0; i < num_modules_; delete modules_[i++]) { // No action. } delete [] modules_; } void Library::set_path (const char *p) { char abspath[1000]; ACE_OS::memset (abspath,0,1000); ssize_t abspathlen = ACE_OS::readlink(p,abspath,999); ACE_CString path (p); if (abspathlen > 0) { abspath[abspathlen] = 0; path = abspath; } ACE_CString::size_type pathsep = path.rfind('/'); if (pathsep == ACE_CString::npos) { path_ = "."; } else { path_ = path.substr(0,pathsep); } } const ACE_CString & Library::name () const { return name_; } int Library::has_modules () const { return num_modules_ > 0; } extern "C" { static int selector (const dirent *d) { return ACE_OS::strstr (d->d_name, ACE_TEXT (".o")) != 0; } static int comparator (const dirent **d1, const dirent **d2) { return ACE_OS::strcmp ((*d1)->d_name, (*d2)->d_name); } } /* extern "C" */ void Library::load_modules () { ACE_CString subdir = path_ + "/.shobj"; struct dirent **dent; num_modules_ = ACE_OS::scandir(ACE_TEXT_CHAR_TO_TCHAR (subdir.c_str()), &dent,selector,comparator); if (num_modules_ > 0) { modules_ = new Obj_Module * [num_modules_]; for (int i = 0; i < num_modules_; i++) { ACE_CString ent_name (ACE_TEXT_ALWAYS_CHAR (dent[i]->d_name)); modules_[i] = new Obj_Module(ent_name); modules_[i]->add_source (ACE_CString(subdir + "/" + ent_name).c_str()); ACE_OS::free(dent[i]); }; } if (num_modules_ > -1) ACE_OS::free(dent); } void Library::resolve (Sig_List &undefs) { if (num_modules_ < 1) return; for (const Signature *uname = undefs.first(); undefs.hasmore(); uname = undefs.next()) { if (exported_.index_of(uname) != -1) { undefs.remove_current(); } else for (int i = 0; i < num_modules_; i++) if (modules_[i]->extref() == 0 && modules_[i]->exports().index_of(uname) != -1) { undefs.remove_current(); exported_.add (modules_[i]->exports()); for (const Signature *needed = modules_[i]->imports().first(); modules_[i]->imports().hasmore(); needed = modules_[i]->imports().next()) if (exported_.index_of(needed) == -1) undefs.add (needed->name()); modules_[i]->add_extref(); num_extrefs_++; break; } } } void Library::write_export_list (int show_ref_counts) { if (num_modules_ < 1) return; ACE_CString excludedfilename = path_ + "/excluded_modules"; ACE_CString rcpath = path_ + "/usage_metrics"; ofstream exclusions (excludedfilename.c_str()); if (!exclusions) { ACE_ERROR ((LM_ERROR, "%p\n", "open exclusions list")); } if (show_ref_counts) { ACE_DEBUG ((LM_DEBUG, "Making directory %s\n",rcpath.c_str())); if (ACE_OS::mkdir(ACE_TEXT_CHAR_TO_TCHAR (rcpath.c_str())) == -1 && errno != EEXIST) ACE_ERROR ((LM_ERROR, "%p\n", "mkdir")); } ACE_DEBUG ((LM_DEBUG,"%s: %d out of %d modules required\n", name_.c_str(), num_extrefs_, num_modules_)); mpcfile_->write_prolog(path_); for (int i = 0; i < num_modules_ ; i++) if (modules_[i]->extref()) { if (show_ref_counts) { ACE_CString fname = rcpath + "/" + modules_[i]->name(); ofstream countfile (fname.c_str()); countfile << "Exported symbols:" << endl; for (const Signature *sig = modules_[i]->exports().first(); modules_[i]->exports().hasmore(); sig = modules_[i]->exports().next()) { countfile.width(5); countfile << sig->used_count() << " " << sig->name() << endl; } countfile << "\nImported symbols:" << endl; for (const Signature *n_sig = modules_[i]->imports().first(); modules_[i]->imports().hasmore(); n_sig = modules_[i]->imports().next()) countfile << n_sig->name() << endl; } mpcfile_->write_file(modules_[i]->name().substring(0,modules_[i]->name().length()-2)); } else { // const char * modname = modules_[i]->name().c_str(); exclusions << modules_[i]->name().substring(0,modules_[i]->name().length()-2) << endl; } mpcfile_->write_epilog(); } ace-8.0.4+dfsg.orig/apps/soreduce/SO_Group.cpp0000644000175000017500000001003715027201773020145 0ustar sudipsudip// -*- C++ -*- // File: SO_Group.cpp #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #include "ace/Log_Msg.h" #include "ace/Process.h" #include "ace/Pipe.h" #include "Library.h" #include "SO_Group.h" SO_Group::SO_Group () : undef_wrapper_ ("nothing"), undefs_(undef_wrapper_.imports()), libs_ (0), max_libs_ (128), num_libs_(0) { libs_ = new Library*[max_libs_]; } SO_Group::~SO_Group () { for (int i = 0; i < num_libs_; delete libs_[i++]) { // No action. } delete [] libs_; } void SO_Group::add_executable (const char * path) { ACE_Process proc; ACE_Process_Options opts; ACE_HANDLE pipe[2]; ACE_Pipe io(pipe); opts.set_handles (ACE_STDIN,pipe[1]); int result = opts.command_line ("ldd %s",path); // Prevent compiler warning about "unused variable" if ACE_ASSERT is // an empty macro. ACE_UNUSED_ARG (result); ACE_ASSERT (result == 0); proc.spawn (opts); if (ACE_OS::close(pipe[1]) == -1) ACE_DEBUG ((LM_DEBUG, "%p\n", "close")); opts.release_handles(); const int max_line_length = 1000; char line[max_line_length]; while (true) { ACE_OS::memset (line,0,max_line_length); int len = 0; int nread = 0; int bogus = 0; // Skip initial whitespace. while ((nread = ACE_OS::read (pipe[0], line,1)) == 1 && (*line == ' ' || *line == '\t')) { // No action. } if (nread != 1) { break; } // read the library name len = 1; while ((nread = ACE_OS::read (pipe[0], line + len, 1)) == 1 && (line[len] != ' ')) { if (! bogus && ++len == max_line_length) { bogus = 1; break; } } if (nread != 1 || bogus) { break; } line[len] = 0; char * dot = ACE_OS::strchr (line,'.'); if (dot != 0) { *dot = 0; } char * libname = line + 3; // skip over "lib" // check to see if this is a new library int found = 0; for (int i = 0; !found && i < num_libs_; ++i) { found = (libs_[i]->name() == libname); } if (!found) { Library *nlib = new Library(libname); ACE_OS::memset (line,0,max_line_length); // Skip over '=> '. if (ACE_OS::read (pipe[0], line, 3) != 3) { break; } // get library path len = 0; while ((nread = ACE_OS::read(pipe[0],line + len,1)) == 1 && (line[len] != ' ')) { if (! bogus && ++len == max_line_length) { bogus = 1; break; } } if (nread != 1 || bogus) { break; } line[len] = 0; nlib->set_path (line); libs_[num_libs_++] = nlib; ACE_ASSERT (num_libs_ < max_libs_); // grow max libs? } // Skip the rest of the line. while ((nread = ACE_OS::read (pipe[0], line, 1)) == 1 && *line != '\n') { // No action. } if (nread != 1) { break; } } proc.wait (); ACE_OS::close (pipe[0]); undef_wrapper_.add_source(path,1); // now do the ldd, iterate over the results to add new libs, etc. } void SO_Group::analize () { for (int passcount = 0; undefs_.modified (); ++passcount) { ACE_DEBUG ((LM_DEBUG, "pass %d, undef count = %d\n", passcount, undefs_.size ())); for (int i = 0; i < num_libs_; libs_[i++]->resolve (undefs_)) { // No action. } } } void SO_Group::write_results () { for (int i = 0; i < num_libs_; libs_[i++]->write_export_list (1)) { // No action. } } void SO_Group::load_modules () { for (int i = 0; i < num_libs_; libs_[i++]->load_modules ()) { // No action. } } void SO_Group::list_libs () { ACE_DEBUG ((LM_DEBUG, "Libs subject to analysis:\n")); for (int i = 0; i < num_libs_; ++i) { if (libs_[i]->has_modules ()) { ACE_DEBUG ((LM_DEBUG, " %s\n", libs_[i]->name ().c_str ())); } } } ace-8.0.4+dfsg.orig/apps/soreduce/Library.h0000644000175000017500000000642615027201773017530 0ustar sudipsudip// -*- C++ -*- #ifndef _LIBRARY_H_ #define _LIBRARY_H_ // -*- C++ -*- // File: Library.h // Author: Phil Mesnier // A Library is a collection of Obj_Modules that define a single shared // library. It is used to manipulate the list of unresolved references by // removing those that are resolved and adding those brought in by new modules // that are required to resolve references. The Library is responsible // for outputting a specialized mpc file to build the reduce footprint library. #include "Obj_Module.h" // FUZZ: disable check_for_streams_include #include "ace/streams.h" // The MPC generator class serves as the base class used to output the // custom mpc files used to build the subsetted libraries. // The base class will make libACE_subset.so class MPC_Generator { public: MPC_Generator (const ACE_CString& libname); virtual ~MPC_Generator(); void write_prolog (const ACE_CString& ); void write_file (const ACE_CString& ); void write_epilog (); protected: virtual void write_baseprojects(); virtual void write_projectinfo(); ofstream mpcfile_; ACE_CString libname_; ACE_CString mpcfilename_; }; // Generate mpc files for libraries dependant on ACE, that are not TAO. class MPC_ACE_Dep_Lib : public MPC_Generator { public: MPC_ACE_Dep_Lib (const ACE_CString& libname); protected: virtual void write_baseprojects(); virtual void write_projectinfo(); }; // Generates mpc files for libTAO_subset.so class MPC_TAO_Lib : public MPC_ACE_Dep_Lib { public: MPC_TAO_Lib (const ACE_CString& libname); protected: virtual void write_baseprojects(); virtual void write_projectinfo(); }; // Generates makefiles for libs dependant on TAO. This has a problem when // building libraries in the orbsvcs tree. class MPC_TAO_Dep_Lib : public MPC_TAO_Lib { public: MPC_TAO_Dep_Lib (const ACE_CString& ); protected: virtual void write_baseprojects(); virtual void write_projectinfo(); }; //---------------------------------------------------------------------------- class Library { public: Library (const ACE_TCHAR *name = 0 ); /// Constructor is responsible for loading all of the modules related to the /// library ~Library (); // Resolve interates over the supplied list of undefined signatures to locate // modules that contain definitions. Any symbol defined in a module marked as // exported is simply removed from the undef list. Any symbol defined in a // module not yet exported removed from the undef list, the module is marked // as exported, and its unresolved symbols are added to the undef list. void resolve (Sig_List &undefs); // Outputs a list of files suitable for inclusion in an mpc file to produce // a subsetted library. If the argument is non-zero, reference countes for // each module are also listed. void write_export_list ( int ); // set the path to find the .so files void set_path (const ACE_TCHAR *p ); // Load the actual .so files from the path. void load_modules(); // returns the library name const ACE_CString &name () const; // returns non-zero if the module count is > 0. int has_modules () const; private: ACE_CString name_; ACE_CString path_; int num_modules_; int num_exports_; int num_extrefs_; Obj_Module **modules_; Sig_List exported_; MPC_Generator *mpcfile_; }; #endif /* _LIBRARY_H_ */ ace-8.0.4+dfsg.orig/apps/soreduce/Sig_List.cpp0000644000175000017500000000653715027201773020177 0ustar sudipsudip// File: Sig_List.cpp // Author: Phil Mesnier #include "ace/OS_NS_string.h" #include "Sig_List.h" //----------------------------------------------------------------------------- Sig_List::Sig_List (int cap) : size_(0), capacity_(cap), index_(0), has_nulls_(0), modified_(0), array_(0) { array_ = new Signature*[capacity_]; } Sig_List::~Sig_List () { for (int i = 0; i < size_; i++) if (array_[i]) array_[i]->release(); delete [] array_; } void Sig_List::add (const ACE_CString &s) { if (this->index_of (s) != -1) return; modified_ = 1; if (has_nulls_) for (int i = 0; i < size_; i++) if (array_[i] == 0) { array_[i] = new Signature (s); has_nulls_ --; return; } if (size_ == capacity_) { int ncap = capacity_ * 2; Signature ** narray = new Signature *[ncap]; ACE_OS::memcpy (narray,array_,capacity_ * sizeof(Signature*)); delete [] array_; array_ = narray; capacity_ = ncap; } array_[size_++] = new Signature(s); } void Sig_List::add (const Sig_List &other) { if (capacity_ < size_ + other.capacity_) { int ncap = size_ + other.capacity_ + 50; Signature ** narray = new Signature *[ncap]; ACE_OS::memcpy (narray,array_,capacity_ * sizeof(Signature*)); delete [] array_; array_ = narray; capacity_ = ncap; } modified_ = 1; for (int i = 0; i < other.size_; i++) if (other.array_[i] != 0 && this->index_of (other.array_[i]->name()) == -1) { if (!has_nulls_) array_[size_++] = other.array_[i]->dup(); else for (int i = 0; i < size_; i++) if (array_[i] == 0) { array_[i] = other.array_[i]->dup(); has_nulls_ --; break; } } } void Sig_List::remove (const Signature &s) { for (int i = 0; i < size_; i++) if (array_[i] && array_[i]->name() == s.name()) { array_[i]->release(); array_[i] = 0; modified_ = 1; if (i == size_ - 1) size_ --; else has_nulls_ ++; break; } } void Sig_List::remove_current () { array_[index_]->release(); array_[index_] = 0; modified_ = 1; if (index_ == size_ - 1) size_--; else has_nulls_++; } int Sig_List::index_of (const Signature *s) { for (int i = 0; i < size_; i++) if (array_[i] && array_[i]->name() == s->name()) { array_[i]->used(); return i; } return -1; } int Sig_List::index_of (const ACE_CString &s) { for (int i = 0; i < size_; i++) if (array_[i] && array_[i]->name() == s) { return i; } return -1; } const Signature * Sig_List::first() { for (index_ = 0; index_ < size_; index_++) if (array_[index_] != 0) return array_[index_]; return 0; } const Signature * Sig_List::next() { for (++index_; index_ < size_; index_++) if (array_[index_] != 0) return array_[index_]; return 0; } int Sig_List::hasmore () { return index_ < size_; } int Sig_List::size() { return size_; } int Sig_List::modified() { int rtn = modified_; modified_ = 0; int insert = 0; if (has_nulls_) { for (int i = 0; i < size_; i++) if (array_[i] != 0) { if (i != insert) { array_[insert] = array_[i]; array_[i] = 0; } insert++; } size_ = insert+1; has_nulls_ = 0; } return rtn; } ace-8.0.4+dfsg.orig/apps/soreduce/SO_Group.h0000644000175000017500000000174615027201773017621 0ustar sudipsudip// -*- C++ -*- // File: SO_Group.h // Author: Phil Mesnier #ifndef _SO_GROUP_H_ #define _SO_GROUP_H_ #include "Library.h" // A shared object group is a wrapper around all of the information needed to // analize a collection of applications so that common shared libraries can // be reduced. class SO_Group { public: SO_Group (); ~SO_Group (); // For each executable named, run ldd to get the dependances list, For each // library listed, see if there is a path to .shobj and add to the list of // libraries if found. Finally, add the undefined symbols from the executable // to the undefs collection. void add_executable(const char * ); // Do the actual business of the program void analize (); // Output the results void write_results (); // load the object modules for the group void load_modules (); void list_libs(); private: Obj_Module undef_wrapper_; Sig_List &undefs_; Library **libs_; int max_libs_; int num_libs_; }; #endif //_SO_GROUP_H_ ace-8.0.4+dfsg.orig/apps/soreduce/Obj_Module.h0000644000175000017500000000442215027201773020135 0ustar sudipsudip// -*- C++ -*- // File: Obj_Module.h // Author: Phil Mesnier #ifndef _OBJ_MODULE_H_ #define _OBJ_MODULE_H_ // Obj_Module encapsulates the result of applying nm to a single object module // in a shared library. Currently an object module consists of two types of // signatures, those that are exported, able to resolve references from others, // and those that are imported, needing resolution. // // Obj_Modules keep track of external references. In the end, any module that // has one or more external references to it must be included in the resulting // library. While the means exists to remove external references, perhaps // through further analysis of undefined signatures and their usage, this is // not currently done. Once a technique is discovered to allow for easy // determination that reference is truly unneeded this code may be useful. #include "Sig_List.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Message_Block; ACE_END_VERSIONED_NAMESPACE_DECL class Obj_Module { public: Obj_Module ( const ACE_CString &, int = 500); // Returns the list of exported signatures, ie. those that are defined in // this module Sig_List & exports(); // Returns the list of signatures used by this module but not defined within Sig_List & imports(); // Returns the name of the object module. ACE_CString &name(); // Add_source invokes GNU nm on the supplied file and parses the output to // build the list of imported and exported signatures. When replacing GNU // nm to use a different tool, this method must be modified. In the future // this could be a virtual to allow for specialization based on toolset. void add_source (const char *, int = 0); // Get the number of external references to this object module. At the end // of processing, if the number of external references is 0, the module is // not included in the final library. int extref (); // add a new external reference to this module. void add_extref (); // remove an exterenal reference. Currently, this function is not used. void remove_extref(); private: void populate_sig_list (Sig_List &, int , ACE_Message_Block *); int read_line (ACE_HANDLE src, ACE_Message_Block **buf); ACE_CString name_; Sig_List imports_; Sig_List exports_; int extrefs_; }; #endif /* _OBJ_MODULE_H_ */ ace-8.0.4+dfsg.orig/apps/soreduce/Sig_List.h0000644000175000017500000000203615027201773017632 0ustar sudipsudip// -*- C++ -*- // File: Sig_List.h // Author: Phil Mesnier #ifndef _SIG_LIST_H_ #define _SIG_LIST_H_ // A Sig_List is a specialized container of signatures. The initial use of a // Sig_List was to manage a variable length of undefined Signatures, so the // program could know when all possible resolutions were determined. As the // program grows in complexity, Sig_Lists are used to store other groups as // well. The methods provide simple list traversal, as well as efficient use // of space. #include "Signature.h" class Sig_List { public: Sig_List (int cap = 500); ~Sig_List (); void add (const ACE_CString &s); void add (const Sig_List &other); void remove (const Signature &s); void remove_current (); int index_of (const Signature *s); int index_of (const ACE_CString &s); int hasmore(); const Signature *first(); const Signature *next(); int modified (); int size(); private: int size_; int capacity_; int index_; int has_nulls_; int modified_; Signature ** array_; }; #endif /* _SIG_LIST_H_ */ ace-8.0.4+dfsg.orig/apps/soreduce/README0000644000175000017500000001505715027201773016633 0ustar sudipsudip Shared Library Reduction Tool ----------------------------- The motivation for this tool was the understanding that the ACE & TAO libraries were to be linked with the VxWorks kernel to allow multiple applications to be run simultaneously with a minimum of footprint consumed. Ordinarily a choice is made between static linking applications, where each application gets only the object modules needed, and shared object linkage, where multiple applications share access to full libraries. Frequently a shared library will contain code and data which is not used by any of the applications in a particular configuration. The Shared Library Reduction Tool builds libraries that include only the modules needed to support a specified set of applications. The analysis is performed very late in the application implementation, allowing the system implementors the freedom to use whatever TAO & ACE components are needed. Once an application is built and running, its shared object need may be evaluated. The evaluation is straight forward. Run the soreduce program, passing the path to all of the applications that will share the libraries. The soreduce program uses the following steps to generate its results. 1. A list of undefined symbols and shared libraries is built by invoking the ldd and nm commands on each application. For now, soreduce assumes the GNU variant of these tools. 2. For each shared library, soreduce tries to invoke nm on each of the intermediate object files used to build the library. It is important that target library directory has a current .shobj subdirectory. 3. The list of undefined symbols is traversed. For each entry in the list, the modules loaded from step 2 are examined to look for a matching symbol. When one is found, the target symbol, and any others satisfied by the module are removed from the list, and any undefined symbols in the module are added to the list. This process is repeated until the entire list of undefined symbols is traversed without change. 4. MPC files are generated. Rather than invoking the linker directly, an mpc file is generated that may be used to build the libs. With these mpc files, the actual library will be named (orig)_subset. Analysis Artifacts ------------------ Development of the shared library reduction tool also provided a secondary benefit. It is able to output usage metrics for the various modules, which may be useful for directing further hand-crafted reduction efforts. Using the GNU nm with more verbose output, it is possible to determine the first function using a given undefined symbol. While it is not (yet) possible to automate the refactoring of code based on this analysis, this information can provide a road map for breaking a single module into two or a few that will result in fewer incidental dependancies overall. However this speculation has not been tested. Test results ------------ Running soreduce providing itself as the sole client. The soreduce application is built on top of ACE, using just a few of ACE's features. Here is the output: bash$ ./soreduce soreduce discovering libraries loading object modules Libs subject to analysis: ACE Starting analysis pass 0, undef count = 69 pass 1, undef count = 207 pass 2, undef count = 278 pass 3, undef count = 271 pass 4, undef count = 245 pass 5, undef count = 235 Writing results Making directory /opt/wustl/ACE_wrappers/build/native/ace/usage_metrics ACE: 61 out of 210 modules required writing file /opt/wustl/ACE_wrappers/build/native/ace/ACE_subset.mpc Done. The size of libACE.so before rebuilding: bash$ size libACE.so text data bss dec hex filename 2361958 498760 12516 2873234 2bd792 libACE.so and after: bash$ size libACE_subset.so text data bss dec hex filename 987167 207452 7580 1202199 125817 libACE_subset.so 2873234 - 1202199 = 1671035 bytes eliminated, a 58.2% reduction Here is another example, using the Naming Service, and its simple test client. Note that the orbsvcs results are bogus, the libraries are already fairly well factored so that the additional subsetting by soreduce is not effective. Also, due to the layout of the orbsvcs library source directory, the tool may not generate valid mpc files. bash$ $ACE_ROOT/apps/soreduce/soreduce Naming_Service/Naming_Service tests/Simple_Naming/client discovering libraries loading object modules Libs subject to analysis: TAO_CosNaming TAO_Svc_Utils TAO_IORTable TAO_PortableServer TAO ACE Starting analysis pass 0, undef count = 339 pass 1, undef count = 580 pass 2, undef count = 438 pass 3, undef count = 278 pass 4, undef count = 244 pass 5, undef count = 246 pass 6, undef count = 242 Writing results Making directory /opt/wustl/ACE_wrappers/build/native/TAO/orbsvcs/orbsvcs/usage_metrics TAO_CosNaming: 11 out of 256 modules required writing file /opt/wustl/ACE_wrappers/build/native/TAO/orbsvcs/orbsvcs/TAO_CosNaming_subset.mpc Making directory /opt/wustl/ACE_wrappers/build/native/TAO/orbsvcs/orbsvcs/usage_metrics TAO_Svc_Utils: 8 out of 256 modules required writing file /opt/wustl/ACE_wrappers/build/native/TAO/orbsvcs/orbsvcs/TAO_Svc_Utils_subset.mpc Making directory /opt/wustl/ACE_wrappers/build/native/TAO/tao/IORTable/usage_metrics TAO_IORTable: 4 out of 4 modules required writing file /opt/wustl/ACE_wrappers/build/native/TAO/tao/IORTable/TAO_IORTable_subset.mpc Making directory /opt/wustl/ACE_wrappers/build/native/TAO/tao/PortableServer/usage_metrics TAO_PortableServer: 26 out of 29 modules required writing file /opt/wustl/ACE_wrappers/build/native/TAO/tao/PortableServer/TAO_PortableServer_subset.mpc Making directory /opt/wustl/ACE_wrappers/build/native/TAO/tao/usage_metrics TAO: 160 out of 191 modules required writing file /opt/wustl/ACE_wrappers/build/native/TAO/tao/TAO_subset.mpc Making directory /opt/wustl/ACE_wrappers/build/native/ace/usage_metrics ACE: 75 out of 210 modules required writing file /opt/wustl/ACE_wrappers/build/native/ace/ACE_subset.mpc Done. Size before & after: text data bss dec hex filename 2361958 498760 12516 2873234 2bd792 libACE.so 3432206 704188 30992 4167386 3f96da libTAO.so 1931145 326632 7528 2265305 2290d9 libTAO_PortableServer.so 76561 12504 364 89429 15d55 libTAO_IORTable.so Sum: 9395354 text data bss dec hex filename 1340017 275440 8140 1623597 18c62d libACE_subset.so 3131226 643816 27984 3803026 3a0792 libTAO_subset.so 1845515 308812 6896 2161223 20fa47 libTAO_PortableServer_subset.so 76603 12508 364 89475 15d83 libTAO_IORTable_subset.so Sum: 7677321 Savings: 1718033 or 18.3% ace-8.0.4+dfsg.orig/apps/soreduce/Obj_Module.cpp0000644000175000017500000001063315027201773020471 0ustar sudipsudip// -*- C++ -*- // File: Obj_Module.cpp // Author: Phil Mesnier // This file contains the implementation of the classes responsible for // managing the contents of a single object module (.o file). #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #include "ace/Process.h" #include "ace/Pipe.h" #include "ace/Message_Block.h" #include "ace/Log_Msg.h" #include "Obj_Module.h" //---------------------------------------------------------------------------- Obj_Module::Obj_Module (const ACE_CString &name, int cap) : name_ (name), imports_(cap), exports_(cap), extrefs_(0) { } ACE_CString & Obj_Module::name() { return name_; } Sig_List & Obj_Module::exports() { return exports_; } Sig_List & Obj_Module::imports() { return imports_; } int Obj_Module::extref() { return extrefs_; } void Obj_Module::add_extref() { extrefs_ ++; } void Obj_Module::remove_extref() { extrefs_ --; } int Obj_Module::read_line (ACE_HANDLE src, ACE_Message_Block **buf) { int eoln = 0; // ACE_Time_Value timeout (1,0); if (buf == 0 || *buf == 0) { char dummy; while (!eoln && ACE_OS::read(src,&dummy,1) == 1) { eoln = (dummy == '\n'); } return eoln; } // while (!eoln && ACE::recv(src,buf->wr_ptr(),1,&timeout) == 1) { while (!eoln && ACE_OS::read(src,(*buf)->wr_ptr(),1) == 1) { eoln = (*(*buf)->wr_ptr() == '\n'); (*buf)->wr_ptr(1); if ((*buf)->space() == 0) { (*buf)->cont(new ACE_Message_Block(102400)); *buf = (*buf)->cont(); } } return eoln; } void Obj_Module::add_source(const char *p, int imports_only) { ACE_Process nmproc; ACE_Process_Options nm_opts; ACE_CString path (p); ACE_CString::size_type pathsep = path.rfind('/'); ACE_CString src_name; ACE_CString workpath; if (pathsep == ACE_CString::npos) { src_name = path; workpath = "."; } else { src_name = path.substr(pathsep+1); workpath= path.substr(0,pathsep); } ACE_HANDLE pipe[2]; ACE_Pipe io(pipe); nm_opts.working_directory (workpath.c_str()); nm_opts.set_handles (ACE_STDIN,pipe[1]); // Options for the command line shown here are for the GNU nm 2.9.5 int result = nm_opts.command_line ("nm -C %s",src_name.c_str()); // Prevent compiler warning about "unused variable" if ACE_ASSERT is // an empty macro. ACE_UNUSED_ARG (result); ACE_ASSERT (result == 0); nmproc.spawn (nm_opts); if (ACE_OS::close(pipe[1]) == -1) ACE_DEBUG ((LM_DEBUG, "%p\n", "close")); nm_opts.release_handles(); int import_lines = 0; int export_lines = 0; ACE_Message_Block im_buffer (102400); ACE_Message_Block ex_buffer (102400); ACE_Message_Block *im_buf_cur = &im_buffer; ACE_Message_Block *ex_buf_cur = &ex_buffer; char dummy; int eoln = 1; // ACE_Time_Value timeout (1,0); int is_import = 1; int is_export = 1; while (eoln == 1) { for (int i = 0; i < 10; i++) { if (ACE_OS::read(pipe[0],&dummy,1) != 1) { eoln = 2; break; } } if (eoln == 2) break; is_import = dummy == 'U'; is_export = !imports_only && (ACE_OS::strchr("BCDRTVW",dummy) != 0); // if (ACE::recv(pipe[0],&dummy,1,&timeout) != 1) if (ACE_OS::read(pipe[0],&dummy,1) != 1) break; eoln = this->read_line (pipe[0], is_import ? &im_buf_cur : (is_export ? &ex_buf_cur : 0)); import_lines += is_import; export_lines += is_export; } // ACE_DEBUG ((LM_DEBUG, "read %d import lines and %d export lines\n", // import_lines, export_lines)); nmproc.wait (); ACE_OS::close (pipe[0]); this->populate_sig_list (imports_,import_lines,&im_buffer); if (!imports_only) this->populate_sig_list (exports_,export_lines,&ex_buffer); } void Obj_Module::populate_sig_list (Sig_List &siglist, int lines, ACE_Message_Block *buf) { char *c; ACE_CString temp; for (int i = 0; i < lines; i++) { for (c = buf->rd_ptr (); c != buf->wr_ptr () && *c != '\n'; ++c) { // No action. } temp += ACE_CString (buf->rd_ptr (), (c - buf->rd_ptr ())); buf->rd_ptr (c + 1); if (*c == '\n') { // ACE_DEBUG ((LM_DEBUG, "%s\n",temp.c_str())); siglist.add (temp); temp.clear (); } else { buf = buf->cont (); if (buf == 0) { siglist.add (temp); } } } } ace-8.0.4+dfsg.orig/apps/soreduce/soreduce.mpc0000644000175000017500000000032515027201773020255 0ustar sudipsudipproject(soreduce) : aceexe { avoids += uses_wchar ace_for_tao exename = soreduce Source_Files { Signature.cpp Sig_List.cpp Obj_Module.cpp Library.cpp SO_Group.cpp soreduce.cpp } } ace-8.0.4+dfsg.orig/apps/soreduce/Signature.h0000644000175000017500000000206115027201773020054 0ustar sudipsudip// -*- C++ -*- // File: Signature.h // Author: Phil Mesnier #ifndef _SIGNATURE_H_ #define _SIGNATURE_H_ // Signature class encapsulates a single line of nm output. This line may be // either an "undefined" name to be resolved, or text or data which resolves // the unknowns. Some of the features of the Signature class are currently // unused, such as owner_, which is anticipation of analysis that may lead to // further code reduction. The premise being that unresolved symbols that are // defined within otherwise unused code should not be resolved. However this // information is not available in the output of nm. Further research is // required. // // Signatures are reference counted to avoid duplication. #include class Signature { public: enum Kind { text_, undef_ }; Signature (const ACE_CString &); void used (); int used_count() const; const ACE_CString &name() const; Signature *dup(); void release(); private: ACE_CString name_; int ref_count_; int used_; Signature * owner_; Kind kind_; }; #endif ace-8.0.4+dfsg.orig/apps/JAWS/0000755000175000017500000000000015046037655014705 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/JAWS/server/0000755000175000017500000000000015046037655016213 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/JAWS/server/jaws.auth0000644000175000017500000000003615027201773020032 0ustar sudipsudipjxh:nonsense bill:no nonsense ace-8.0.4+dfsg.orig/apps/JAWS/server/HTTP_Response.cpp0000644000175000017500000002722115027201773021351 0ustar sudipsudip#include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_ctype.h" #include "ace/Process.h" #include "ace/Mem_Map.h" #include "ace/Log_Msg.h" #include "HTTP_Response.h" #include "HTTP_Request.h" #include "HTTP_Helpers.h" #include "HTTP_Config.h" #include "JAWS_IO.h" #if defined (ACE_JAWS_BASELINE) static char * const EMPTY_HEADER = ""; #else static const char * const EMPTY_HEADER = ""; #endif /* ACE_JAWS_BASELINE */ HTTP_Response::HTTP_Response (JAWS_IO &io, HTTP_Request &request) : io_(io), request_(request) { } HTTP_Response::HTTP_Response (HTTP_Request &request, JAWS_IO &io) : io_(io), request_(request) { } HTTP_Response::~HTTP_Response () { #if defined (ACE_JAWS_BASELINE) if (this->HTTP_HEADER != EMPTY_HEADER) delete [] this->HTTP_HEADER; // The [] is important. Without it, there was a huge memory leak! #endif /* ACE_JAWS_BASELINE */ } void HTTP_Response::process_request(HTTP_Response &response) { response.process_request(); } void HTTP_Response::process_request () { ACE_DEBUG ((LM_DEBUG, " (%t) processing request: %s\n", this->request_.status_string ())); switch (this->request_.status ()) { case HTTP_Status_Code::STATUS_OK : if (this->request_.cgi ()) { this->cgi_response (); } else { this->normal_response (); } break; default: this->error_response (this->request_.status (), this->request_.status_string ()); } } void HTTP_Response::error_response (int status_code, const char *log_message) { ACE_DEBUG ((LM_DEBUG, "(%t) [%s %s %s] %s\n", this->request_.method () ? this->request_.method () : "-", this->request_.uri () ? this->request_.uri () : "-", this->request_.version() ? this->request_.version () : "-", log_message ? log_message : "-")); static char const error_header1[] = "%s %d %s\r\n" "Server: JAWS/1.0prebeta\r\n" "Content-type: text/html\r\n" "Content-length: %d\r\n" "\r\n" "%s" ; static char const error_header2[] = "%s %d %s\r\n" "Server: JAWS/1.0prebeta\r\n" "WWW-Authenticate: Basic realm=\"JAWS_authorization\"\r\n" "Content-type: text/html\r\n" "Content-length: %d\r\n" "\r\n" "%s" ; static char const error_message[] = "\n" "Server error message\n" "\n" "

Error %d: %s

\n" "The request could not be completed because:\n %s\n" "\n" "\n" ; char *buf = 0; char buf1[4 * BUFSIZ]; char buf2[BUFSIZ]; int length; const char *error_header = error_header1; if (status_code == HTTP_Status_Code::STATUS_UNAUTHORIZED) error_header = error_header2; length = ACE_OS::sprintf (buf2, error_message, status_code, HTTP_Status_Code::instance ()[status_code], log_message); if (this->request_.version () == 0 || ACE_OS::strcmp ("HTTP/0.9", this->request_.version ()) == 0) buf = buf2; else { length = ACE_OS::sprintf (buf1, error_header, this->request_.version(), status_code, HTTP_Status_Code::instance ()[status_code], length, buf2); buf = buf1; } this->io_.send_error_message (buf, length); } void HTTP_Response::normal_response () { const char *hv = 0;; ACE_DEBUG ((LM_DEBUG, " (%t) %s request for %s [%s], version %s\n", request_.method (), request_.uri (), request_.path (), (request_.version () ? request_.version () : "HTTP/0.9"))); switch (this->request_.type ()) { case HTTP_Request::GET : this->build_headers (); this->io_.transmit_file (this->request_.path (), this->HTTP_HEADER, this->HTTP_HEADER_LENGTH, this->HTTP_TRAILER, this->HTTP_TRAILER_LENGTH); break; case HTTP_Request::HEAD : this->build_headers (); this->io_.send_confirmation_message (this->HTTP_HEADER, this->HTTP_HEADER_LENGTH); break; case HTTP_Request::POST : // What to do here? // Standard says this is implementation dependent. // Examples: annotations, page updates, etc. // This may be a good place to stick CORBA stuff, // and mobile code. this->error_response (HTTP_Status_Code::STATUS_NOT_IMPLEMENTED, "Requested method is not implemented."); break; case HTTP_Request::PUT : // Only commit to this if we can authenticate it // if there is no Authentication: header on the incoming request, // deny it hv = this->request_.headers ()["Authorization"].value (); if (hv == 0 || *hv == '\0') this->error_response (HTTP_Status_Code::STATUS_UNAUTHORIZED, "Unauthorized to use PUT method"); else if (ACE_OS::strncmp (hv, "Basic ", 6) != 0) // ``6'' is the length of the string "Basic " this->error_response (HTTP_Status_Code::STATUS_UNAUTHORIZED, "Unknown authorization method"); else { ACE_Mem_Map mmapfile; const char *hvv = hv + 6; // Skip past the string "Basic " char *buf = new char [ACE_OS::strlen (hv)]; char *auth = HTTP_Helper::HTTP_decode_base64 (ACE_OS::strcpy (buf, hvv)); if (mmapfile.map (ACE_TEXT ("jaws.auth")) != -1 && auth != 0 && ACE_OS::strstr((const char *) mmapfile.addr (), auth) != 0) this->io_.receive_file (this->request_.path (), this->request_.data (), this->request_.data_length (), this->request_.content_length ()); else this->error_response (HTTP_Status_Code::STATUS_UNAUTHORIZED, "Invalid authorization attempt"); delete [] buf; } break; default : this->error_response (HTTP_Status_Code::STATUS_NOT_IMPLEMENTED, "Requested method is not implemented."); } } void HTTP_Response::cgi_response () { ACE_Process_Options cgi_options; if (this->request_.cgi_args ()) cgi_options.command_line ("%s %s", this->request_.path (), this->request_.cgi_args ()); else cgi_options.command_line ("%s", this->request_.path ()); // Build environment variables cgi_options.setenv (ACE_TEXT ("SERVER_SOFTWARE"), ACE_TEXT ("%s"), ACE_TEXT ("JAWS/1.0")); cgi_options.setenv (ACE_TEXT ("SERVER_NAME"), ACE_TEXT ("%s"), ACE_TEXT ("localhost")); cgi_options.setenv (ACE_TEXT ("GATEWAY_INTERFACE"), ACE_TEXT ("%s"), ACE_TEXT ("CGI/1.1")); cgi_options.setenv (ACE_TEXT ("SERVER_PROTOCOL"), ACE_TEXT ("%s"), this->request_.version () ? this->request_.version () : "HTTP/0.9"); cgi_options.setenv (ACE_TEXT ("SERVER_PORT"), ACE_TEXT ("%d"), 5432); cgi_options.setenv (ACE_TEXT ("REQUEST_METHOD"), ACE_TEXT ("%s"), this->request_.method ()); if (this->request_.path_info ()) { cgi_options.setenv (ACE_TEXT ("PATH_INFO"), ACE_TEXT ("%s"), this->request_.path_info ()); cgi_options.setenv (ACE_TEXT ("PATH_TRANSLATED"), ACE_TEXT ("%s/%s"), HTTP_Config::instance ()->document_root (), this->request_.path_info ()); } cgi_options.setenv (ACE_TEXT ("SCRIPT_NAME"), ACE_TEXT ("%s"), this->request_.uri ()); if (this->request_.query_string ()) cgi_options.setenv (ACE_TEXT ("QUERY_STRING"), ACE_TEXT ("%s"), this->request_.query_string ()); if (this->request_.cgi_env ()) for (size_t i = 0; this->request_.cgi_env ()[i]; i += 2) cgi_options.setenv (ACE_TEXT_CHAR_TO_TCHAR (this->request_.cgi_env ()[i]), ACE_TEXT ("%s"), ACE_TEXT_CHAR_TO_TCHAR (this->request_.cgi_env ()[i+1])); ACE_TCHAR buf[BUFSIZ]; ACE_TCHAR *p = 0, *q = 0; ACE_OS::strcpy (buf, ACE_TEXT ("HTTP_")); p = q = buf + ACE_OS::strlen (buf); for (size_t i = 0; i < HTTP_Request::NUM_HEADER_STRINGS; i++) { int j = 0; for (char c; (c = this->request_.header_strings (i)[j++]) != '\0'; ) if (ACE_OS::ace_isalpha (c)) *q++ = ACE_OS::ace_toupper (c); else if (c == '-') *q++ = '_'; else *q++ = c; *q = '\0'; const char *hv = this->request_.header_values (i); if (hv && *hv) cgi_options.setenv (buf, "%s", hv); q = p; } cgi_options.set_handles (this->io_.handle (), this->io_.handle (), this->io_.handle ()); this->build_headers (); this->io_.send_confirmation_message (this->HTTP_HEADER, this->HTTP_HEADER_LENGTH); // ACE::send (this->io_.handle (), // this->HTTP_HEADER, this->HTTP_HEADER_LENGTH); // Exec the CGI program. ACE_Process cgi_process; cgi_process.spawn (cgi_options); // cgi_process.wait (); } void HTTP_Response::build_headers () { // At this point, we should really determine the type of request // this is, and build the appropriate header. // Let's assume this is HTML for now. Unless the request is CGI, // then do not include content-* headers. if (this->request_.version () == 0 || ACE_OS::strcmp ("HTTP/0.9", this->request_.version ()) == 0) { HTTP_HEADER = EMPTY_HEADER; HTTP_HEADER_LENGTH = 0; } else { #if defined (ACE_JAWS_BASELINE) HTTP_HEADER = new char[BUFSIZ * 4]; // We assume that at this point everything is OK HTTP_HEADER_LENGTH = ACE_OS::sprintf (HTTP_HEADER, "%s", "HTTP/1.0 200 OK\r\n"); char date_ptr [40]; // 40 bytes is the maximum length needed to store the date if (HTTP_Helper::HTTP_date (date_ptr) != 0) HTTP_HEADER_LENGTH += ACE_OS::sprintf (HTTP_HEADER+HTTP_HEADER_LENGTH, "Date: %s\r\n", date_ptr); if (! this->request_.cgi ()) { HTTP_HEADER_LENGTH += ACE_OS::sprintf (HTTP_HEADER+HTTP_HEADER_LENGTH, "Content-type: %s\r\n", "text/html"); struct stat file_stat; // If possible, add the Content-length field to the header. // @@ Note that using 'ACE_OS::stat' is a hack. Normally, a // web browser will have a 'virtual' file system. In a VFS, // 'stat' might not reference the correct location. if ((this->request_.type () == HTTP_Request::GET) && (ACE_OS::stat (this->request_.path (), &file_stat) == 0)) { HTTP_HEADER_LENGTH += ACE_OS::sprintf (HTTP_HEADER+HTTP_HEADER_LENGTH, "Content-length: %u\r\n", file_stat.st_size); } // Complete header with empty line and adjust header length. HTTP_HEADER[HTTP_HEADER_LENGTH++] = '\r'; HTTP_HEADER[HTTP_HEADER_LENGTH++] = '\n'; } #else if (! this->request_.cgi ()) HTTP_HEADER = "HTTP/1.0 200 OK\r\n" "Content-type: text/html\r\n\r\n"; else HTTP_HEADER = "HTTP/1.0 200 OK\r\n"; HTTP_HEADER_LENGTH = ACE_OS::strlen (HTTP_HEADER); #endif /* ACE_JAWS_BASELINE */ } HTTP_TRAILER = ""; HTTP_TRAILER_LENGTH = 0; } ace-8.0.4+dfsg.orig/apps/JAWS/server/svc.conf0000644000175000017500000000265315027201773017654 0ustar sudipsudip # # -p port number # -n threads in the server # -f thread activation flags # = THR_BOUND # = THR_DAEMON # = THR_DETACHED # = THR_NEW_LWP # -t threading strategy # = POOL -> thread pool # = PER_REQUEST -> thread per request # = THROTTLE -> thread per request with throttling # -i I/O strategy # = SYNCH # = ASYNCH # -b backlog value for listen () # -c caching: NO_CACHE or CACHE # # # Thread Pool, 20 unbound threads # This is the baseline static HTTP_Server "HTTP_Server -p 5432 -n 20 -i SYNCH -t POOL -b 50 -f THR_NEW_LWP" # # # Start a baseline server without caching #static HTTP_Server "HTTP_Server -p 5432 -n 20 -i SYNCH -t POOL -b 50 -f THR_NEW_LWP -c NO_CACHE" # # # Thread Pool, 40 threads #static HTTP_Server "HTTP_Server -p 5432 -n 40 -i SYNCH -t POOL -b 50 -f THR_NEW_LWP -f THR_BOUND" # # # Thread-per-request, unlimited number of threads #static HTTP_Server "HTTP_Server -p 5432 -i SYNCH -t PER_REQUEST -b 50 -f THR_NEW_LWP" # # # Throttling, 40 threads #static HTTP_Server "HTTP_Server -p 5432 -n 40 -i SYNCH -t THROTTLE -b 50 -f THR_NEW_LWP" # # # Example for using HTTP_Server as a dynamic service # # For NT. #dynamic HTTP_Server Service_Object * ./jaws.exe:_make_HTTP_Server() "HTTP_Server -p 5432 -n 20 -i SYNCH -t POOL -b 50 -f THR_NEW_LWP" # # For UNIX platforms. #dynamic HTTP_Server Service_Object * ./main:_make_HTTP_Server() "HTTP_Server -p 5432 -n 20 -i SYNCH -t POOL -b 50 -f THR_NEW_LWP" ace-8.0.4+dfsg.orig/apps/JAWS/server/HTTP_Request.cpp0000644000175000017500000003412415027201773021203 0ustar sudipsudip#include "ace/Message_Block.h" #include "HTTP_Request.h" #include "HTTP_Helpers.h" #include "HTTP_Config.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_pwd.h" #include "ace/Log_Msg.h" const char *const HTTP_Request::static_header_strings_[HTTP_Request::NUM_HEADER_STRINGS] = { "Date", "Pragma", "Authorization", "From", "If-Modified-Since", "Referrer", "User-Agent", "Allow", "Content-Encoding", "Content-Length", "Content-Type", "Expires", "Last-Modified" }; const char *const HTTP_Request::static_method_strings_[HTTP_Request::NUM_METHOD_STRINGS] = { "GET", "HEAD", "POST", "PUT" }; // For reasons of efficiency, this class expects buffer to be // null-terminated, and buflen does NOT include the \0. HTTP_Request::HTTP_Request () : got_request_line_ (0), method_ (0), uri_ (0), version_ (0), path_ (0), cgi_ (0), cgi_env_ (0), cgi_args_ (0), query_string_ (0), path_info_ (0), header_strings_ (HTTP_Request::static_header_strings_), method_strings_ (HTTP_Request::static_method_strings_) { for (size_t i = 0; i < HTTP_Request::NUM_HEADER_STRINGS; i++) this->headers_.recognize (this->header_strings_[i]); } HTTP_Request::~HTTP_Request () { ACE_OS::free (this->method_); ACE_OS::free (this->uri_); ACE_OS::free (this->version_); ACE_OS::free (this->path_); ACE_OS::free (this->query_string_); ACE_OS::free (this->path_info_); delete [] this->cgi_env_; } int HTTP_Request::parse_request (ACE_Message_Block &mb) { mb.wr_ptr ()[0] = '\0'; // Note that RFC 822 does not mention the maximum length of a header // line. So in theory, there is no maximum length. // In Apache, they assume that each header line should not exceed // 8K. int result = this->headers_.complete_header_line (mb.rd_ptr ()); if (result != 0) { if (!this->got_request_line ()) { this->parse_request_line (mb.rd_ptr ()); while (this->headers_.complete_header_line (mb.rd_ptr ()) > 0) this->headers_.parse_header_line (mb.rd_ptr ()); } else if (result > 0) do this->headers_.parse_header_line (mb.rd_ptr ()); while (this->headers_.complete_header_line (mb.rd_ptr ()) > 0); } mb.wr_ptr (ACE_OS::strlen(mb.rd_ptr ()) - mb.length ()); if (this->headers_.end_of_headers () || (this->got_request_line () && this->version () == 0)) return this->init (mb.rd_ptr (), mb.length ()); else return 0; } void HTTP_Request::parse_request_line (char *const request_line) { char *ptr = request_line; char *buf = request_line; int offset = 1; this->status_ = HTTP_Status_Code::STATUS_OK; ptr = ACE_OS::strchr (request_line, '\n'); if (ptr > request_line && ptr[-1] == '\r') ptr--, offset++; if (ptr == request_line) { this->status_ = HTTP_Status_Code::STATUS_BAD_REQUEST; return; } *ptr = '\0'; ptr += offset; char *lasts = 0; // for strtok_r // Get the request type. this->got_request_line_ = 1; if (this->method (ACE_OS::strtok_r (buf, " \t", &lasts)) && this->uri (ACE_OS::strtok_r (0, " \t", &lasts))) { this->type (this->method ()); if (this->version (ACE_OS::strtok_r (0, " \t", &lasts)) == 0 && this->type () != HTTP_Request::GET) this->status_ = HTTP_Status_Code::STATUS_NOT_IMPLEMENTED; if (this->path (this->uri ()) == 0) this->status_ = HTTP_Status_Code::STATUS_NOT_FOUND; } ACE_DEBUG ((LM_DEBUG, " (%t) request %s %s %s parsed\n", (this->method () ? this->method () : "-"), (this->uri () ? this->uri () : "="), (this->version () ? this->version () : "HTTP/0.9"))); ACE_OS::memmove (buf, ptr, ACE_OS::strlen (ptr)+1); } int HTTP_Request::init (char *const buffer, int buflen) { // Initialize these every time. content_length_ = -1; // Extract the data pointer. data_ = buffer; datalen_ = 0; // Set the datalen if (data_ != 0) datalen_ = buflen; else datalen_ = 0; ACE_DEBUG ((LM_DEBUG, " (%t) init has initialized\n")); return 1; } const char * HTTP_Request::method () const { return this->method_; } const char * HTTP_Request::uri () const { return this->uri_; } const char * HTTP_Request::version () const { return this->version_; } const char * HTTP_Request::path () const { return this->path_; } int HTTP_Request::cgi () const { return this->cgi_; } const char ** HTTP_Request::cgi_env () const { return (const char **)this->cgi_env_; } const char * HTTP_Request::cgi_args () const { return this->cgi_args_; } const char * HTTP_Request::query_string () const { return this->query_string_; } const char * HTTP_Request::path_info () const { return this->path_info_; } int HTTP_Request::got_request_line () const { return this->got_request_line_; } int HTTP_Request::type () const { return type_; } const Headers & HTTP_Request::headers () const { return this->headers_; } const char * HTTP_Request::header_strings (int index) const { const char *hs = 0; if (0 <= index && index < NUM_HEADER_STRINGS) hs = this->header_strings_[index]; return hs; } const char * HTTP_Request::header_values (int index) const { const char *hs = 0; const char *hv = 0; if (0 <= index && index < NUM_HEADER_STRINGS) { hs = this->header_strings_[index]; hv = this->headers_[hs].value (); } return hv; } char * HTTP_Request::data () { return data_; } int HTTP_Request::data_length () { return datalen_; } int HTTP_Request::content_length () { if (this->content_length_ == -1) { const char * clv = this->headers_["Content-length"].value (); this->content_length_ = (clv ? ACE_OS::atoi (clv) : 0); } return this->content_length_; } int HTTP_Request::status () { return this->status_; } const char * HTTP_Request::status_string () { return HTTP_Status_Code::instance ()[this->status_]; } void HTTP_Request::dump () { ACE_DEBUG ((LM_DEBUG, "%s command.\n" "filename is %s," " length of the file is %d," " data string is %s," " datalen is %d," " status is %d, which is %s\n\n", this->method () ? this->method () : "EMPTY", this->uri () ? this->uri () : "EMPTY", this->content_length (), this->data () ? this->data () : "EMPTY", this->data_length (), this->status (), this->status_string ())); } const char * HTTP_Request::method (const char *method_string) { if (this->method_) ACE_OS::free (this->method_); if (method_string == 0) { this->status_ = HTTP_Status_Code::STATUS_BAD_REQUEST; this->method_ = 0; } else this->method_ = ACE_OS::strdup (method_string); return this->method_; } const char * HTTP_Request::uri (char *uri_string) { if (this->uri_) ACE_OS::free (this->uri_); if (uri_string == 0) { this->status_ = HTTP_Status_Code::STATUS_BAD_REQUEST; this->uri_ = 0; } else { this->uri_ = ACE_OS::strdup (uri_string); this->cgi (this->uri_); HTTP_Helper::HTTP_decode_string (this->uri_); } return this->uri_; } const char * HTTP_Request::version (const char *version_string) { if (this->version_) ACE_OS::free (this->version_); if (version_string) this->version_ = ACE_OS::strdup (version_string); else this->version_ = 0; return this->version_; } int HTTP_Request::type (const char *type_string) { this->type_ = HTTP_Request::NO_TYPE; if (type_string == 0) return this->type_; for (size_t i = 0; i < HTTP_Request::NUM_METHOD_STRINGS; i++) if (ACE_OS::strcmp (type_string, this->method_strings_[i]) == 0) { this->type_ = i; break; } if (this->type_ == HTTP_Request::NO_TYPE) this->status_ = HTTP_Status_Code::STATUS_NOT_IMPLEMENTED; return this->type_; } int HTTP_Request::cgi (char *uri_string) { this->cgi_ = 0; this->cgi_env_ = 0; this->cgi_args_ = 0; ACE_DEBUG ((LM_DEBUG, " (%t) HTTP_Request::cgi (%s)\n", uri_string)); if (uri_string == 0 || ACE_OS::strlen (uri_string) == 0) return 0; // There are 2 cases where a file could be a CGI script // // (1) the file has a CGI extension. // (2) the file resides in a CGI bin directory. char *extra_path_info = 0; if (this->cgi_in_path (uri_string, extra_path_info) || this->cgi_in_extension (uri_string, extra_path_info)) { cgi_args_and_env (extra_path_info); if (extra_path_info) { this->path_info_ = ACE_OS::strdup (extra_path_info); HTTP_Helper::HTTP_decode_string (this->path_info_); *extra_path_info = '\0'; } } return this->cgi_; } int HTTP_Request::cgi_in_path (char *uri_string, char *&extra_path_info) { char *cgi_path; ACE_DEBUG ((LM_DEBUG, " (%t) HTTP_Request::cgi_in_path (%s)\n", uri_string)); if (HTTP_Config::instance ()->cgi_path ()) cgi_path = ACE_OS::strdup (HTTP_Config::instance ()->cgi_path ()); else cgi_path = ACE_OS::strdup (""); // error checking considered helpful! if (cgi_path == 0) return 0; char *lasts = 0; char *cgi_path_next = ACE_OS::strtok_r (cgi_path, ":", &lasts); if (cgi_path_next) do { int len = ACE_OS::strlen (cgi_path_next); // match path to cgi path int in_cgi_path = 0; if (*cgi_path_next == '/') { // cgi path next points to an ``absolute'' path extra_path_info = uri_string; in_cgi_path = (ACE_OS::strncmp (extra_path_info, cgi_path_next, len) == 0); } else { // cgi path next points to a ``relative'' path extra_path_info = ACE_OS::strstr (uri_string, cgi_path_next); in_cgi_path = (extra_path_info != 0); } if (in_cgi_path) { if (extra_path_info[len] == '/') { this->cgi_ = 1; extra_path_info += len; // move past the executable name do extra_path_info++; while (*extra_path_info != '/' && *extra_path_info != '?' && *extra_path_info != '\0'); if (*extra_path_info == '\0') extra_path_info = 0; break; } } extra_path_info = 0; cgi_path_next = ACE_OS::strtok_r (0, ":", &lasts); } while (cgi_path_next); ACE_OS::free (cgi_path); return this->cgi_; } int HTTP_Request::cgi_in_extension (char *uri_string, char *&extra_path_info) { extra_path_info = ACE_OS::strstr (uri_string, ".cgi"); ACE_DEBUG ((LM_DEBUG, " (%t) HTTP_Request::cgi_in_extension (%s)\n", uri_string)); while (extra_path_info != 0) { extra_path_info += 4; // skip past ``.cgi'' switch (*extra_path_info) { case '\0': extra_path_info = 0; break; case '/': case '?': break; default: extra_path_info = ACE_OS::strstr (extra_path_info, ".cgi"); continue; } this->cgi_ = 1; break; } return this->cgi_; } void HTTP_Request::cgi_args_and_env (char *&extra_path_info) { char *cgi_question = 0; if (extra_path_info) cgi_question = ACE_OS::strchr (extra_path_info, '?'); if (extra_path_info == cgi_question) extra_path_info = 0; if (cgi_question) { *cgi_question++ = '\0'; if (*cgi_question != '\0') { // We need the ``original'' QUERY_STRING for the // environment. We will substitute '+'s for spaces in the // other copy. this->query_string_ = ACE_OS::strdup (cgi_question); char *ptr = cgi_question; int count = 0; do if (*ptr == '+') *ptr = ' '; else if (*ptr == '&' || *ptr == '=') count++; while (*++ptr); count++; if (ACE_OS::strchr (cgi_question, '=')) { ACE_NEW (this->cgi_env_, char *[count+1]); int i = 0; ptr = cgi_question; do { this->cgi_env_ [i++] = ptr; while (*ptr++) if (*ptr == '&' || *ptr == '=') *ptr = '\0'; HTTP_Helper::HTTP_decode_string (this->cgi_env_[i-1]); } while (i < count); this->cgi_env_[count] = 0; } else { this->cgi_args_ = cgi_question; HTTP_Helper::HTTP_decode_string (cgi_question); } } } } const char * HTTP_Request::path (const char *uri_string) { char const *file_name = uri_string; char buf[MAXPATHLEN + 1]; buf[0] = '\0'; if (file_name == 0) return 0; if (*file_name == '/') { file_name++; if (*file_name == '~') { char *ptr = buf; while (*++file_name && *file_name != '/') *ptr++ = *file_name; *ptr = '\0'; if (ptr == buf) ACE_OS::strcpy (buf, ACE_OS::getenv ("HOME")); else { #if !defined (ACE_WIN32) && !defined (VXWORKS) char pw_buf[BUFSIZ]; struct passwd pw_struct; struct passwd *pw_struct_ptr; if (ACE_OS::getpwnam_r (buf, &pw_struct, pw_buf, sizeof (pw_buf), &pw_struct_ptr) == 0) return 0; ACE_OS::strcpy (buf, pw_struct.pw_dir); #endif /* NOT ACE_WIN32 AND NOT VXWORKS */ } ACE_OS::strcat (buf, "/"); ACE_OS::strcat (buf, HTTP_Config::instance ()->user_dir ()); ACE_OS::strcat (buf, file_name); } else { // With a starting '/' but no '~' ACE_OS::strcat (buf, HTTP_Config::instance ()->document_root ()); ACE_OS::strcat (buf, file_name - 1); } } if (*buf != '\0') this->path_ = ACE_OS::strdup (buf); return this->path_; } ace-8.0.4+dfsg.orig/apps/JAWS/server/JAWS_Concurrency.cpp0000644000175000017500000000323015027201773022024 0ustar sudipsudip#include "JAWS_Concurrency.h" JAWS_Concurrency_Base::JAWS_Concurrency_Base () { } int JAWS_Concurrency_Base::put (ACE_Message_Block *mb, ACE_Time_Value *tv) { return this->putq (mb, tv); } int JAWS_Concurrency_Base::svc () { int result = 0; for (;;) { ACE_Message_Block *mb = 0; // At this point we could set a timeout value so that the // threading strategy can delete a thread if there is nothing to // do. Carefully think how to implement it so you don't leave // yourself with 0 threads. result = this->getq (mb); if (result == -1 || mb == 0) break; this->put_next (mb); } return 0; } JAWS_Dispatch_Policy::JAWS_Dispatch_Policy () { } JAWS_Dispatch_Policy::~JAWS_Dispatch_Policy () { } JAWS_Dispatcher::JAWS_Dispatcher (JAWS_Dispatch_Policy *policy) : policy_(policy) { } JAWS_Thread_Pool_Task::JAWS_Thread_Pool_Task (long flags, int nthreads, int maxthreads) : nthreads_ (nthreads), maxthreads_ (maxthreads) { if (this->activate (flags, nthreads) == -1) ACE_ERROR ((LM_ERROR, "%p\n", "JAWS_Thread_Pool_Task::activate")); } JAWS_Thread_Per_Task::JAWS_Thread_Per_Task (long flags, int maxthreads) : flags_ (flags), maxthreads_ (maxthreads) { } int JAWS_Thread_Per_Task::put (ACE_Message_Block *mb, ACE_Time_Value *tv) { const int force_active = 1; const int nthreads = 1; if (this->activate (this->flags_, nthreads, force_active) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "JAWS_Thread_Pool_Task::activate"), -1); this->putq (mb, tv); return 0; } ace-8.0.4+dfsg.orig/apps/JAWS/server/HTTP_Helpers.h0000644000175000017500000000450215027201773020617 0ustar sudipsudip/* -*- c++ -*- */ //============================================================================= /** * @file HTTP_Helpers.h * * @author James Hu */ //============================================================================= #ifndef HTTP_HELPERS_H #define HTTP_HELPERS_H #include "ace/Synch_Traits.h" #include "ace/Thread_Mutex.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ /** * @class HTTP_Helper Static functions to enhance the lives of HTTP programmers everywhere. */ class HTTP_Helper { public: // Convert and HTTP-date into a time_t static time_t HTTP_mktime (const char *httpdate); // Create today's date static const char *HTTP_date (); static const char *HTTP_date (char *s); // Month conversions (ascii <--> numeric) static int HTTP_month (const char *month); static const char *HTTP_month (int month); static char *HTTP_decode_string (char *path); // Encode/Decode base64 stuff (weak security model) static char *HTTP_decode_base64 (char *data); static char *HTTP_encode_base64 (char *data); private: static int fixyear (int year); private: static const char *const months_[12]; static char const *alphabet_; /// Use this sometimes (e.g. HTTP_date) static char *date_string_; static ACE_SYNCH_MUTEX mutex_; }; // Design around the Singleton pattern /** * @class HTTP_Status_Code * * @brief Go from numeric status codes to descriptive strings. * * Design around the Singleton pattern */ class HTTP_Status_Code { public: /// Singleton access point. static const char **instance (); enum STATUS_CODE { STATUS_OK = 200, STATUS_CREATED = 201, STATUS_ACCEPTED = 202, STATUS_NO_CONTENT = 204, STATUS_MOVED_PERMANENTLY = 301, STATUS_MOVED_TEMPORARILY = 302, STATUS_NOT_MODIFIED = 304, STATUS_BAD_REQUEST = 400, STATUS_UNAUTHORIZED = 401, STATUS_FORBIDDEN = 403, STATUS_NOT_FOUND = 404, STATUS_INTERNAL_SERVER_ERROR = 500, STATUS_NOT_IMPLEMENTED = 501, STATUS_BAD_GATEWAY = 502, STATUS_SERVICE_UNAVAILABLE = 503, STATUS_INSUFFICIENT_DATA = 399 }; enum { MAX_STATUS_CODE = 599 }; private: // Singleton pattern is afoot here. static const char *Reason[MAX_STATUS_CODE + 1]; static int instance_; static ACE_SYNCH_MUTEX lock_; }; #endif /* HTTP_HELPERS_H */ ace-8.0.4+dfsg.orig/apps/JAWS/server/HTTP_Helpers.cpp0000644000175000017500000002654315027201773021163 0ustar sudipsudip// HTTP_Helpers.cpp -- Helper utilities for both server and client #include "HTTP_Helpers.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_string.h" #include "ace/Guard_T.h" #include "ace/OS_NS_time.h" #include "ace/OS_NS_stdio.h" // = Static initialization. const char *const HTTP_Helper::months_[12]= { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; char const *HTTP_Helper::alphabet_ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; char * HTTP_Helper::date_string_ = 0; ACE_SYNCH_MUTEX HTTP_Helper::mutex_; ACE_SYNCH_MUTEX HTTP_Status_Code::lock_; int HTTP_Status_Code::instance_ = 0; const char *HTTP_Status_Code::Reason[HTTP_Status_Code::MAX_STATUS_CODE + 1]; time_t HTTP_Helper::HTTP_mktime (const char *httpdate) { char *buf; ACE_NEW_RETURN (buf, char[ACE_OS::strlen (httpdate) + 1], (time_t) -1); // Make spaces in the date be semi-colons so we can parse robustly // with sscanf. const char *ptr1 = httpdate; char *ptr2 = buf; do { if (*ptr1 == ' ') *ptr2++ = ';'; else *ptr2++ = *ptr1; } while (*ptr1++ != '\0'); // In HTTP/1.0, there are three versions of an HTTP_date. // rfc1123-date = wkday "," SP dd month yyyy SP hh:mm:ss SP "GMT" // rfc850-date = weekday "," SP dd-month-yy SP hh:mm:ss SP "GMT" // asctime-date = wkday SP month dd SP hh:mm:ss SP yyyy // static const char rfc1123_date[] = "%3s,;%2d;%3s;%4d;%2d:%2d:%2d;GMT"; // static const char rfc850_date[] = "%s,;%2d-%3s-%2d;%2d:%2d:%2d;GMT"; // static const char asctime_date[] = "%3s;%3s;%2d;%2d:%2d:%2d;%4d"; // Should also support other versions (such as from NNTP and SMTP) // for robustness, but it should be clear how to extend this. struct tm tms; char month[4]; char weekday[10]; if (::sscanf(buf, "%3s,;%2d;%3s;%4d;%2d:%2d:%2d;GMT", // RFC-1123 date format weekday, &tms.tm_mday, month, &tms.tm_year, &tms.tm_hour, &tms.tm_min, &tms.tm_sec) == 7) ; else if (::sscanf(buf, "%s,;%2d-%3s-%2d;%2d:%2d:%2d;GMT", // RFC-850 date format weekday, &tms.tm_mday, month, &tms.tm_year, &tms.tm_hour, &tms.tm_min, &tms.tm_sec) == 7) { weekday[3] = '\0'; } else if (::sscanf(buf, "%3s;%3s;%2d;%2d:%2d:%2d;%4d", // ASCTIME date format. weekday, month, &tms.tm_mday, &tms.tm_hour, &tms.tm_min, &tms.tm_sec, &tms.tm_year) == 7) { } delete [] buf; tms.tm_year = HTTP_Helper::fixyear (tms.tm_year); tms.tm_mon = HTTP_Helper::HTTP_month (month); if (tms.tm_mon == -1) return (time_t) -1; // mktime is a Standard C function. { #if !defined (ACE_HAS_REENTRANT_LIBC) ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, g, HTTP_Helper::mutex_, -1)); #endif /* NOT ACE_HAS_REENTRANT_LIBC */ return ACE_OS::mktime (&tms); } } const char * HTTP_Helper::HTTP_date () { if (HTTP_Helper::date_string_ == 0) { ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, m, HTTP_Helper::mutex_, 0)); if (HTTP_Helper::date_string_ == 0) { // 40 bytes is all I need. ACE_NEW_RETURN (HTTP_Helper::date_string_, char[40], 0); if (!HTTP_Helper::HTTP_date (HTTP_Helper::date_string_)) { delete [] HTTP_Helper::date_string_; HTTP_Helper::date_string_ = 0; } } } return HTTP_Helper::date_string_; } const char * HTTP_Helper::HTTP_date (char *s) { // Return the date-string formatted per HTTP standards. Time must // be in UTC, so using the 'strftime' call (which obeys the locale) // isn't correct. static const char* months[] = {"Jan","Feb","Mar","Apr","May","Jun", "Jul","Aug","Sep","Oct","Nov","Dec"}; static const char* days[] = {"Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; time_t tloc; struct tm tms; char * date_string = s; if (ACE_OS::time (&tloc) != (time_t) -1 && ACE_OS::gmtime_r (&tloc, &tms) != 0) { ACE_OS::sprintf (date_string, "%s, %2.2d %s %4.4d %2.2d:%2.2d:%2.2d GMT", days[tms.tm_wday], tms.tm_mday, months[tms.tm_mon], tms.tm_year + 1900, tms.tm_hour, tms.tm_min, tms.tm_sec); } else date_string = 0; return date_string; } int HTTP_Helper::HTTP_month (const char *month) { for (size_t i = 0; i < 12; i++) if (ACE_OS::strcmp(month, HTTP_Helper::months_[i]) == 0) return i; return -1; } const char * HTTP_Helper::HTTP_month (int month) { if (month < 0 || month >= 12) return 0; return HTTP_Helper::months_[month]; } // Fix the path if it needs fixing/is fixable. char * HTTP_Helper::HTTP_decode_string (char *path) { // replace the percentcodes with the actual character int i, j; char percentcode[3]; for (i = j = 0; path[i] != '\0'; i++, j++) { if (path[i] == '%') { percentcode[0] = path[++i]; percentcode[1] = path[++i]; percentcode[2] = '\0'; path[j] = (char) ACE_OS::strtol (percentcode, (char **) 0, 16); } else path[j] = path[i]; } path[j] = path[i]; return path; } char * HTTP_Helper::HTTP_decode_base64 (char *data) { char inalphabet[256], decoder[256]; ACE_OS::memset (inalphabet, 0, sizeof (inalphabet)); ACE_OS::memset (decoder, 0, sizeof (decoder)); for (int i = ACE_OS::strlen (HTTP_Helper::alphabet_) - 1; i >= 0; i--) { inalphabet[(unsigned int) HTTP_Helper::alphabet_[i]] = 1; decoder[(unsigned int) HTTP_Helper::alphabet_[i]] = i; } char *indata = data; char *outdata = data; int bits = 0; int c; int char_count = 0; int errors = 0; while ((c = *indata++) != '\0') { if (c == '=') break; if (c > 255 || ! inalphabet[c]) continue; bits += decoder[c]; char_count++; if (char_count == 4) { *outdata++ = (bits >> 16); *outdata++ = ((bits >> 8) & 0xff); *outdata++ = (bits & 0xff); bits = 0; char_count = 0; } else bits <<= 6; } if (c == '\0') { if (char_count) { ACE_DEBUG ((LM_DEBUG, "base64 encoding incomplete: at least %d bits truncated\n", ((4 - char_count) * 6))); errors++; } } else { // c == '=' switch (char_count) { case 1: ACE_DEBUG ((LM_DEBUG, "base64 encoding incomplete: at least 2 bits missing\n")); errors++; break; case 2: *outdata++ = (bits >> 10); break; case 3: *outdata++ = (bits >> 16); *outdata++ = ((bits >> 8) & 0xff); break; } } *outdata = '\0'; return errors ? 0 : data; } char * HTTP_Helper::HTTP_encode_base64 (char *data) { char buf[BUFSIZ]; int c; int error; int char_count = 0; int bits = 0; error = 0; char *indata = data; char *outdata = buf; const unsigned char ASCII_MAX = ~0; while ((c = *indata++) != '\0') { if (c > (int)ASCII_MAX) { ACE_DEBUG ((LM_DEBUG, "encountered char > 255 (decimal %d)\n", c)); error++; break; } bits += c; char_count++; if (char_count == 3) { *outdata++ = HTTP_Helper::alphabet_[bits >> 18]; *outdata++ = HTTP_Helper::alphabet_[(bits >> 12) & 0x3f]; *outdata++ = HTTP_Helper::alphabet_[(bits >> 6) & 0x3f]; *outdata++ = HTTP_Helper::alphabet_[bits & 0x3f]; bits = 0; char_count = 0; } else bits <<= 8; } if (!error) { if (char_count != 0) { bits <<= 16 - (8 * char_count); *outdata++ = HTTP_Helper::alphabet_[bits >> 18]; *outdata++ = HTTP_Helper::alphabet_[(bits >> 12) & 0x3f]; if (char_count == 1) { *outdata++ = '='; *outdata++ = '='; } else { *outdata++ = HTTP_Helper::alphabet_[(bits >> 6) & 0x3f]; *outdata++ = '='; } } *outdata = '\0'; ACE_OS::strcpy (data, buf); } return (error ? 0 : data); } int HTTP_Helper::fixyear (int year) { // Fix the year 2000 problem if (year > 1000) year -= 1900; else if (year < 100) { struct tm tms; time_t tloc; if (ACE_OS::time (&tloc) != (time_t) -1) { ACE_OS::gmtime_r (&tloc, &tms); if (tms.tm_year % 100 == year) year = tms.tm_year; // The last two cases check boundary conditions, in case the // year just changed at the moment we checked to see if we // need to fix it. if ((year+1) % 100 == tms.tm_year % 100) year = tms.tm_year - 1; if (year == (tms.tm_year + 1) % 100) year = tms.tm_year + 1; // What to do if none of the above? } } return year; } const char ** HTTP_Status_Code::instance () { if (HTTP_Status_Code::instance_ == 0) { ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, g, lock_, 0)); if (HTTP_Status_Code::instance_ == 0) { for (size_t i = 0; i < HTTP_Status_Code::MAX_STATUS_CODE + 1; i++) { switch (i) { case STATUS_OK: HTTP_Status_Code::Reason[i] = "OK"; break; case STATUS_CREATED: HTTP_Status_Code::Reason[i] = "Created"; break; case STATUS_ACCEPTED: HTTP_Status_Code::Reason[i] = "Accepted"; break; case STATUS_NO_CONTENT: HTTP_Status_Code::Reason[i] = "No Content"; break; case STATUS_MOVED_PERMANENTLY: HTTP_Status_Code::Reason[i] = "Moved Permanently"; break; case STATUS_MOVED_TEMPORARILY: HTTP_Status_Code::Reason[i] = "Moved Temporarily"; break; case STATUS_NOT_MODIFIED: HTTP_Status_Code::Reason[i] = "Not Modified"; break; case STATUS_BAD_REQUEST: HTTP_Status_Code::Reason[i] = "Bad Request"; break; case STATUS_UNAUTHORIZED: HTTP_Status_Code::Reason[i] = "Unauthorized"; break; case STATUS_FORBIDDEN: HTTP_Status_Code::Reason[i] = "Forbidden"; break; case STATUS_NOT_FOUND: HTTP_Status_Code::Reason[i] = "Not Found"; break; case STATUS_INTERNAL_SERVER_ERROR: HTTP_Status_Code::Reason[i] = "Internal Server Error"; break; case STATUS_NOT_IMPLEMENTED: HTTP_Status_Code::Reason[i] = "Not Implemented"; break; case STATUS_BAD_GATEWAY: HTTP_Status_Code::Reason[i] = "Bad Gateway"; break; case STATUS_SERVICE_UNAVAILABLE: HTTP_Status_Code::Reason[i] = "Service Unavailable"; break; default: HTTP_Status_Code::Reason[i] = "Unknown"; } } HTTP_Status_Code::instance_ = 1; } // GUARD released } return HTTP_Status_Code::Reason; } ace-8.0.4+dfsg.orig/apps/JAWS/server/server.mpc0000644000175000017500000000125315027201773020214 0ustar sudipsudip// -*- MPC -*- project(JAWS) : install, ace_output, acelib { sharedname = JAWS dynamicflags += ACE_BUILD_SVC_DLL requires += ace_filecache avoids += uses_wchar avoids += ace_for_tao specific { install_dir = JAWS/server } Source_Files { HTTP_Server.cpp HTTP_Config.cpp HTTP_Handler.cpp HTTP_Helpers.cpp JAWS_Pipeline.cpp JAWS_Concurrency.cpp HTTP_Request.cpp HTTP_Response.cpp Parse_Headers.cpp JAWS_IO.cpp } } project(JAWS_server) : aceexe { exename = main after += JAWS libs += JAWS requires += ace_filecache avoids += uses_wchar avoids += ace_for_tao Source_Files { main.cpp } } ace-8.0.4+dfsg.orig/apps/JAWS/server/HTTP_Config.cpp0000644000175000017500000000463515027201773020764 0ustar sudipsudip// HTTP_Config.cpp #include "ace/OS_NS_stdlib.h" #include "HTTP_Config.h" // static HTTP_Config_Info config_info; HTTP_Config_Info *HTTP_Config::instance_ = 0; HTTP_Config_Info * HTTP_Config::instance () { if (HTTP_Config::instance_ == 0) { HTTP_Config::instance_ = new HTTP_Config_Info; HTTP_Config::instance_->document_root (0); HTTP_Config::instance_->cgi_path (0); HTTP_Config::instance_->user_dir (0); HTTP_Config::instance_->dir_index (0); HTTP_Config::instance_->proxy_flag (0); } return HTTP_Config::instance_; } HTTP_Config_Info::HTTP_Config_Info () : document_root_ (0), cgi_path_ (0), user_dir_ (0), dir_index_ (0), proxy_flag_ (0) { } HTTP_Config_Info::~HTTP_Config_Info () { } const char * HTTP_Config_Info::document_root () const { return this->document_root_; } const char * HTTP_Config_Info::cgi_path () const { return this->cgi_path_; } const char * HTTP_Config_Info::user_dir () const { return this->user_dir_; } const char * HTTP_Config_Info::dir_index () const { return this->dir_index_; } int HTTP_Config_Info::proxy_flag () const { return this->proxy_flag_; } const char * HTTP_Config_Info::document_root (const char *dr_string) { if (dr_string) this->document_root_ = dr_string; else { this->document_root_ = ACE_OS::getenv ("JAWS_DOCUMENT_ROOT"); if (!this->document_root_) this->document_root_ = "."; } return this->document_root_; } const char * HTTP_Config_Info::cgi_path (const char *cp_string) { if (cp_string) this->cgi_path_ = cp_string; else { this->cgi_path_ = ACE_OS::getenv ("JAWS_CGI_PATH"); if (!this->cgi_path_) this->cgi_path_ = "cgi-bin"; } return this->cgi_path_; } const char * HTTP_Config_Info::user_dir (const char *ud_string) { if (ud_string) this->user_dir_ = ud_string; else { this->user_dir_ = ACE_OS::getenv ("JAWS_USER_DIR"); if (!this->user_dir_) this->user_dir_ = ".www"; } return this->user_dir_; } const char * HTTP_Config_Info::dir_index (const char *di_string) { if (di_string) this->dir_index_ = di_string; else { this->dir_index_ = ACE_OS::getenv ("JAWS_DIR_INDEX"); if (!this->dir_index_) this->dir_index_ = "index.html"; } return this->dir_index_; } int HTTP_Config_Info::proxy_flag (int pf) { this->proxy_flag_ = pf; return this->proxy_flag_; } ace-8.0.4+dfsg.orig/apps/JAWS/server/JAWS_Concurrency.h0000644000175000017500000000503315027201773021474 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_CONCURRENCY_H #define JAWS_CONCURRENCY_H #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Task.h" #include "JAWS_IO.h" class JAWS_Concurrency_Base : public ACE_Task // = TITLE // Base class for different concurrency models // // = DESCRIPTION // Provides a default implementaion of the virtual put() method // which calls putq(), but can be overloaded to do something // synchronously, such as call put_next(). { public: JAWS_Concurrency_Base (); virtual int put (ACE_Message_Block *mb, ACE_Time_Value *tv = 0); virtual int svc (); }; class JAWS_Dispatch_Policy // = TITLE // Policy mechanism for choosing different concurrency models. // // = DESCRIPTION // Given some (unspecified) state, decides what the concurrency // model should be. (For now, we always return the same model.) { public: JAWS_Dispatch_Policy (); virtual ~JAWS_Dispatch_Policy (); virtual JAWS_Concurrency_Base * update (void *state = 0) = 0; }; class JAWS_Dispatcher // = TITLE // The class that is responsible to delivering events to the // appropriate concurrency mechanism. // // = DESCRIPTION // JAWS_IO_Handler calls into the dispatcher so that the completed // IO can find a thread to take care of it. { public: JAWS_Dispatcher (JAWS_Dispatch_Policy *policy); int dispatch (JAWS_IO_Handler *ioh); private: JAWS_Dispatch_Policy *policy_; }; class JAWS_Thread_Pool_Task : public JAWS_Concurrency_Base // = TITLE // Used to implement Thread Pool Concurrency Strategy // // = DESCRIPTION // This task is created to hold a pool of threads that receive // requests through the message queue. { public: JAWS_Thread_Pool_Task (long flags = THR_NEW_LWP, int nthreads = 5, int maxthreads = 20); private: int nthreads_; int maxthreads_; }; class JAWS_Thread_Per_Task : public JAWS_Concurrency_Base // = TITLE // Used to implement Thread Per Request Concurrency Strategy // // = DESCRIPTION // As each new message arrives from the queue, a new thread is // spawned to handle it. This is done by overloading put to call // activate. { public: JAWS_Thread_Per_Task (long flags = THR_NEW_LWP, int maxthreads = 20); virtual int put (ACE_Message_Block *mb, ACE_Time_Value *tv = 0); private: long flags_; int maxthreads_; }; #endif /* !defined (JAWS_CONCURRENCY_H) */ ace-8.0.4+dfsg.orig/apps/JAWS/server/HTTP_Config.h0000644000175000017500000000440515027201773020424 0ustar sudipsudip/* -*- c++ -*- */ //============================================================================= /** * @file HTTP_Config.h * * @author James Hu */ //============================================================================= // = Forward declaration. class HTTP_Config_Info; /** * @class HTTP_Config * * @brief Stores server configuration information. * Someday, this will be hip and cool and be able to parse * NCSA httpd style config files like Apache does. For now, * I'm just going to hack in environment variable stuff. * Designed around Singleton pattern. */ class HTTP_Config { public: /// Access the Singleton. static HTTP_Config_Info *instance (); private: /// Store the Singleton. static HTTP_Config_Info *instance_; }; /** * @class HTTP_Config_Info * * @brief This is where the information is really stored. */ class HTTP_Config_Info { friend class HTTP_Config; public: HTTP_Config_Info (); ~HTTP_Config_Info (); // Accessors to the information /// Where the root of the document tree begins. This prevents /// clients from being able to examine your entire filesystem. const char *document_root () const; /// A search path for CGI files. const char *cgi_path () const; /// The directory which is appended to a home user directory, e.g., /// ".www-docs" or "public_html". const char *user_dir () const; /// What is the default index file for a directory, e.g., /// "index.html". const char *dir_index () const; /// Will the server support proxy requests? int proxy_flag () const; private: // = Accesors that can set the data const char *document_root (const char *dr_string); const char *cgi_path (const char *cp_string); const char *user_dir (const char *ud_string); const char *dir_index (const char *di_string); int proxy_flag (int pf); private: // = Data members /// The directory root from which documents will be fetched const char *document_root_; /// The directories from which to expect CGI scripts const char *cgi_path_; /// Name of the sub-directory where user Web pages are const char *user_dir_; /// Name of the Web page to present in place of a directory listing const char *dir_index_; /// Should we support proxy requests? Ignored for now. int proxy_flag_; }; ace-8.0.4+dfsg.orig/apps/JAWS/server/JAWS_Pipeline_Handler.cpp0000644000175000017500000000077115027201773022743 0ustar sudipsudip#ifndef JAWS_PIPELINE_HANDLER_CPP #define JAWS_PIPELINE_HANDLER_CPP #include "JAWS_Pipeline_Handler.h" template JAWS_Pipeline_Handler::JAWS_Pipeline_Handler () { } template int JAWS_Pipeline_Handler::put (ACE_Message_Block *mb, ACE_Time_Value *tv) { TYPE *data = dynamic_cast (mb->data_block ()); int status = this->handle_input (data, tv); return (status != -1) ? this->put_next (mb, tv) : -1; } #endif /* !defined (JAWS_PIPELINE_HANDLER_CPP) */ ace-8.0.4+dfsg.orig/apps/JAWS/server/HTTP_Request.h0000644000175000017500000001027615027201773020652 0ustar sudipsudip/* -*- c++ -*- */ //============================================================================= /** * @file HTTP_Request.h * * @author James Hu */ //============================================================================= #ifndef HTTP_REQUEST_H #define HTTP_REQUEST_H #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "Parse_Headers.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Message_Block; ACE_END_VERSIONED_NAMESPACE_DECL /** * @class HTTP_Request * * @brief This parses the client request of an HTTP transaction. */ class HTTP_Request { public: /// Default construction. HTTP_Request (); /// Destructor. ~HTTP_Request (); /// parse an incoming request int parse_request (ACE_Message_Block &mb); /// the first line of a request is the request line, which is of the /// form: METHOD URI VERSION. void parse_request_line (char *const request_line); /// Initialize the request object. This will parse the buffer and /// prepare for the accessors. int init (char *const buffer, int buflen); public: // = The Accessors. /// HTTP request method const char *method () const; /// HTTP request uri const char *uri () const; /// HTTP request version const char *version () const; /// The HTTP request uri translated into a server filename path const char *path () const; /// TRUE of the request is a cgi request int cgi () const; /// The arguments to the cgi request const char *cgi_args () const; /// The environment variables passed to the CGI request const char **cgi_env () const; /// The cgi request query string const char *query_string () const; /// The cgi request path information const char *path_info () const; /// The type of the HTTP request int type () const; /// The headers that were parsed from the request const Headers &headers () const; /// Header strings stored const char *header_strings (int index) const; /// Values associated with the header strings const char *header_values (int index) const; /// The buffer into which request data is read char *data (); /// The length of the request data int data_length (); /// The length of incoming content if any int content_length (); /// Current status of the incoming request int status (); /// A string describing the state of the incoming request const char *status_string (); /// Dump the state of the request. void dump (); enum { NO_TYPE = -1, GET = 0, HEAD, POST, PUT, NUM_METHOD_STRINGS }; // Values for request type enum { DATE = 0, PRAGMA, AUTHORIZATION, FROM, IF_MODIFIED_SINCE, REFERRER, USER_AGENT, ALLOW, CONTENT_ENCODING, CONTENT_LENGTH, CONTENT_TYPE, EXPIRES, LAST_MODIFIED, NUM_HEADER_STRINGS }; // Header strings private: // = Private Accessors which can set values const char *method (const char *method_string); const char *uri (char *uri_string); const char *version (const char *version_string); const char *path (const char *uri_string); /// determine if the given URI is a CGI program. int cgi (char *uri_string); /// determine if the given URI resides in a cgi-bin directory int cgi_in_path (char *uri_string, char *&extra_path_info); /// determine if the given URI contains a cgi extension int cgi_in_extension (char *uri_string, char *&extra_path_info); /// set the arguments and environment for the cgi program void cgi_args_and_env (char *&extra_path_info); int type (const char *type_string); private: int got_request_line () const; private: int got_request_line_; Headers headers_; char *method_; char *uri_; char *version_; char *path_; int cgi_; char **cgi_env_; char *cgi_args_; char *query_string_; char *path_info_; const char * const *const header_strings_; static const char *const static_header_strings_[NUM_HEADER_STRINGS]; const char * const *const method_strings_; static const char *const static_method_strings_[NUM_METHOD_STRINGS]; char *data_; int datalen_; int content_length_; char *filename_; int status_; int type_; }; #endif /* HTTP_REQUEST_H */ ace-8.0.4+dfsg.orig/apps/JAWS/server/Parse_Headers.cpp0000644000175000017500000001606715027201773021427 0ustar sudipsudip#include "ace/Log_Msg.h" #include "Parse_Headers.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_strings.h" #include "ace/OS_NS_stdlib.h" #include "ace/OS_NS_ctype.h" // Implementation of class Headers Headers::Headers () : done_(0) { } Headers::~Headers () { } void Headers::recognize (const char * const header) { (void)this->map_[header]; } void Headers::parse_header_line (char * const header_line) { char *ptr = header_line; char *buf = header_line; int offset = 1; ptr = ACE_OS::strchr (header_line, '\n'); if (ptr > header_line && ptr[-1] == '\r') { ptr--; offset++; } if (ptr == header_line) { this->done_ = 1; return; } *ptr = '\0'; ptr += offset; char *value = 0; char *header = ACE_OS::strtok_r (buf, ":", &value); ACE_DEBUG((LM_DEBUG, " (%t) Headers::parse_header_line [%s]\n", header ? header : "")); if (header != 0 && this->map_.mapped (header)) { while (ACE_OS::ace_isspace (*value)) value++; this->map_[header] = value; ACE_DEBUG((LM_DEBUG, " (%t) Headers::parse_header_line <%s>\n", value ? value : "")); } // Write back the unused portion of the input. ACE_OS::memmove (header_line, ptr, ACE_OS::strlen(ptr) + 1); } int Headers::complete_header_line (char *const header_line) { // Algorithm -- // Scan for end of line marker. // If the next character is linear white space, then unfold the header. // Else, if the next character is printable, we have a complete header line. // Else, presumably the next character is '\0', so the header is incomplete. // return -1 if end of line but not complete header line // return 0 if no end of line marker // return 1 if complete header line char *ptr = header_line; int offset; if (!this->end_of_line (ptr, offset)) return 0; if (ptr == header_line) { ACE_OS::memmove (ptr, ptr+offset, ACE_OS::strlen (ptr + offset) + 1); this->done_ = 1; ACE_DEBUG ((LM_DEBUG, " (%t) no more headers\n")); return 0; } do { switch (ptr[offset]) { case ' ': case '\t': ACE_OS::memmove (ptr, ptr+offset, ACE_OS::strlen (ptr + offset) + 1); break; case '\n': case '\r': return 1; default: if (ACE_OS::ace_isalpha (ptr[offset])) return 1; else return -1; } } while (this->end_of_line (ptr, offset) != 0); return 0; } int Headers::end_of_headers () const { return this->done_; } Headers_Map_Item & Headers::operator[] (const char * const header) { return this->map_[header]; } const Headers_Map_Item & Headers::operator[] (const char * const header) const { return this->map_[header]; } int Headers::end_of_line (char *&line, int &offset) const { char *old_line = line; char *ptr = ACE_OS::strchr (old_line, '\n'); if (ptr == 0) return 0; line = ptr; offset = 1; if (line > old_line && line[-1] == '\r') { line--; offset = 2; } return 1; } // Implementation of class Headers_Map Headers_Map::Headers_Map () : num_headers_(0) { } Headers_Map::~Headers_Map () { } Headers_Map_Item::Headers_Map_Item () : header_(0), value_(0) { } Headers_Map_Item::~Headers_Map_Item () { ACE_OS::free ((void *) this->header_); ACE_OS::free ((void *) this->value_); this->header_ = this->value_ = 0; } // Headers_Map_Item::operator const char * () const // { // return this->value_ == 0 ? this->no_value_ : this->value_; // } Headers_Map_Item & Headers_Map_Item::operator= (char * value) { ACE_OS::free ((void *) this->value_); this->value_ = ACE_OS::strdup (value); return *this; } Headers_Map_Item & Headers_Map_Item::operator= (const char * value) { ACE_OS::free ((void *) this->value_); this->value_ = ACE_OS::strdup (value); return *this; } Headers_Map_Item & Headers_Map_Item::operator= (const Headers_Map_Item & mi) { ACE_OS::free ((void *) this->value_); ACE_OS::free ((void *) this->header_); this->header_ = ACE_OS::strdup (mi.header_); this->value_ = (mi.value_ ? ACE_OS::strdup (mi.value_) : 0); return *this; } const char * Headers_Map_Item::header () const { return this->header_; } const char * Headers_Map_Item::value () const { return this->value_; } Headers_Map_Item & Headers_Map::operator[] (const char * const header) { Headers_Map_Item *item_ptr; item_ptr = this->find (header); if (item_ptr == 0) item_ptr = this->place (header); return *item_ptr; } const Headers_Map_Item & Headers_Map::operator[] (const char * const header) const { Headers_Map_Item *item_ptr; Headers_Map *mutable_this = (Headers_Map *)this; item_ptr = this->find (header); if (item_ptr == 0) item_ptr = mutable_this->place (header); return *item_ptr; } int Headers_Map::mapped (const char * const header) const { int result = this->find (header) != 0; return result; } Headers_Map_Item * Headers_Map::find (const char * const header) const { Headers_Map *const mutable_this = (Headers_Map *) this; mutable_this->garbage_.header_ = header; #if 0 Headers_Map_Item *mi_ptr = (Headers_Map_Item *) ACE_OS::bsearch (&this->garbage_, this->map_, this->num_headers_, sizeof (Headers_Map_Item), Headers_Map::compare); #else int i = 0; int j = this->num_headers_; while (i < j-1) { int k = (i+j)/2; if (Headers_Map::compare (&this->garbage_, this->map_+k) < 0) j = k; else i = k; } Headers_Map_Item *mi_ptr = mutable_this->map_ + i; if (Headers_Map::compare (&this->garbage_, mi_ptr) != 0) mi_ptr = 0; #endif mutable_this->garbage_.header_ = 0; return mi_ptr; } Headers_Map_Item * Headers_Map::place (const char *const header) { this->garbage_.header_ = ACE_OS::strdup (header); int i = this->num_headers_++; ACE_OS::free ((void *) this->map_[i].header_); ACE_OS::free ((void *) this->map_[i].value_); this->map_[i].header_ = 0; this->map_[i].value_ = 0; Headers_Map_Item temp_item; while (i > 0) { if (Headers_Map::compare (&this->garbage_, &this->map_[i - 1]) > 0) break; this->map_[i].header_ = this->map_[i - 1].header_; this->map_[i].value_ = this->map_[i - 1].value_; this->map_[i - 1].header_ = 0; this->map_[i - 1].value_ = 0; i--; } this->map_[i].header_ = this->garbage_.header_; this->map_[i].value_ = this->garbage_.value_; this->garbage_.header_ = 0; return &this->map_[i]; } int Headers_Map::compare (const void *item1, const void *item2) { Headers_Map_Item *a, *b; int result; a = (Headers_Map_Item *) item1; b = (Headers_Map_Item *) item2; if (a->header_ == 0 || b->header_ == 0) { if (a->header_ == 0 && b->header_ == 0) result = 0; else if (a->header_ == 0) result = 1; else result = -1; } else result = ACE_OS::strcasecmp (a->header_, b->header_); return (result < 0) ? -1 : (result > 0); } ace-8.0.4+dfsg.orig/apps/JAWS/server/HTTP_Server.h0000644000175000017500000000750415027201773020470 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file HTTP_Server.h * * @author James Hu */ //============================================================================= #ifndef HTTP_SERVER_H #define HTTP_SERVER_H #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Service_Config.h" #include "ace/Service_Object.h" #include "ace/Thread_Manager.h" #include "ace/Acceptor.h" #include "ace/LOCK_SOCK_Acceptor.h" #include "ace/Task_T.h" #include "ace/Asynch_IO.h" #include "ace/svc_export.h" #include "HTTP_Handler.h" #include "ace/Synch_Traits.h" #include "ace/Thread_Mutex.h" #include "ace/Null_Mutex.h" #include "ace/Global_Macros.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Forward declaration. class ACE_Proactor; ACE_END_VERSIONED_NAMESPACE_DECL #if defined (ACE_HAS_THREAD_SAFE_ACCEPT) typedef ACE_LOCK_SOCK_Acceptor HTTP_SOCK_Acceptor; #else typedef ACE_LOCK_SOCK_Acceptor HTTP_SOCK_Acceptor; #endif /* ACE_HAS_THREAD_SAFE_ACCEPT */ typedef HTTP_SOCK_Acceptor HTTP_Acceptor; /** * @class HTTP_Server * * @brief This server is used to create HTTP Handlers for the Web * server */ class ACE_Svc_Export HTTP_Server : public ACE_Service_Object { public: /// Initialization virtual int init (int argc, ACE_TCHAR *argv[]); /// Exit hooks virtual int fini (); protected: /// Thread Per Request implementation virtual int thread_per_request (HTTP_Handler_Factory &factory); /// Asynch Thread Pool implementation virtual int asynch_thread_pool (); /// Synch Thread Pool implementation virtual int synch_thread_pool (HTTP_Handler_Factory &factory); private: // James, comment these data members. void parse_args (int argc, ACE_TCHAR **argv); int port_; int threads_; int strategy_; int backlog_; int throttle_; bool caching_; ACE_Thread_Manager tm_; HTTP_Acceptor acceptor_; }; /** * @class Synch_Thread_Pool_Task * * @brief Used to implement Synch Thread Pool * * Describe this and the others below. * NOTE: this class was modified to make caching disabling possible */ class Synch_Thread_Pool_Task : public ACE_Task { public: Synch_Thread_Pool_Task (HTTP_Acceptor &acceptor, ACE_Thread_Manager &tm, int threads, HTTP_Handler_Factory &factory); virtual int svc (); private: HTTP_Acceptor &acceptor_; HTTP_Handler_Factory &factory_; }; /** * @class Thread_Per_Request_Task * * @brief Used to implement Thread Per Request. * * Spawns a new thread for every new incoming connection. The * handle below is the socket stream of the incoming connection. * NOTE: this class was modified to make caching disabling possible */ class Thread_Per_Request_Task : public ACE_Task { public: Thread_Per_Request_Task (ACE_HANDLE handle, ACE_Thread_Manager &tm, int &grp_id, HTTP_Handler_Factory &factory); virtual int open (void *args = 0); virtual int close (u_long); virtual int svc (); private: ACE_HANDLE handle_; int &grp_id_; HTTP_Handler_Factory &factory_; }; // This only works on Win32 #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) /** * @class Asynch_Thread_Pool_Task * * @brief Used to implement Asynch Thread Pool * * The proactor below utilizes WaitForMultipleObjects. */ class Asynch_Thread_Pool_Task : public ACE_Task { public: Asynch_Thread_Pool_Task (ACE_Proactor &proactor, ACE_Thread_Manager &tm); virtual int svc (); private: ACE_Proactor &proactor_; }; #endif /* ACE_HAS_WIN32_OVERLAPPED_IO */ ACE_SVC_FACTORY_DECLARE (HTTP_Server) ACE_STATIC_SVC_DECLARE_EXPORT (ACE_Svc, HTTP_Server) #endif /* HTTP_SERVER_H */ ace-8.0.4+dfsg.orig/apps/JAWS/server/Parse_Headers.h0000644000175000017500000000472015027201773021065 0ustar sudipsudip/* -*- c++ -*- */ //============================================================================= /** * @file Parse_Headers.h * * @author James Hu */ //============================================================================= #ifndef PARSE_HEADERS_H #define PARSE_HEADERS_H #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ class Headers_Map_Item { friend class Headers_Map; friend class Headers; private: Headers_Map_Item (); ~Headers_Map_Item (); // operator const char * () const; Headers_Map_Item &operator= (char *); Headers_Map_Item &operator= (const char *); Headers_Map_Item &operator= (const Headers_Map_Item &); public: const char *header () const; const char *value () const; private: const char *header_; const char *value_; }; /** * @class Headers_Map * * @brief Map textual headings to header values (e.g. "Subject:" maps to * "Re: My left foot" */ class Headers_Map { public: Headers_Map (); ~Headers_Map (); Headers_Map_Item &operator[] (const char *const header); const Headers_Map_Item &operator[] (const char *const header) const; enum { MAX_HEADERS = 100 }; int mapped (const char *const header) const; private: Headers_Map_Item *find (const char *const header) const; Headers_Map_Item *place (const char *const header); static int compare (const void *item1, const void *item2); private: Headers_Map_Item map_[MAX_HEADERS]; Headers_Map_Item garbage_; int num_headers_; }; /** * @class Headers * * @brief A general mechanism to parse headers of Internet text headers. * * Allow interesting headers to be inserted and later associated * with values. This implementation assumes the parsing of headers * will be done from ACE_Message_Blocks. */ class Headers { public: Headers (); ~Headers (); void recognize (const char *const header); void parse_header_line (char *const header_line); /** * -1 -> end of line but not complete header line * 0 -> no end of line marker * 1 -> complete header line */ int complete_header_line (char *const header_line); int end_of_headers () const; enum { MAX_HEADER_LINE_LENGTH = 8192 }; Headers_Map_Item &operator[] (const char *const header); const Headers_Map_Item &operator[] (const char *const header) const; private: int end_of_line (char *&line, int &offset) const; private: Headers_Map map_; int done_; }; #endif /* PARSE_HEADERS_H */ ace-8.0.4+dfsg.orig/apps/JAWS/server/HTTP_Response.h0000644000175000017500000000345715027201773021023 0ustar sudipsudip/* -*- c++ -*- */ //============================================================================= /** * @file HTTP_Response.h * * @author James Hu */ //============================================================================= #ifndef HTTP_RESPONSE_H #define HTTP_RESPONSE_H class JAWS_IO; class HTTP_Request; /** * @class HTTP_Response * * @brief Abstraction for HTTP responses. * * Provides an encapsulation of responses to HTTP requests. * For instance, given an HTTP GET request, it will produce * header and body suitable for returning to the client who made * the request. */ class HTTP_Response { public: HTTP_Response (JAWS_IO &io, HTTP_Request &request); HTTP_Response (HTTP_Request &request, JAWS_IO &io); ~HTTP_Response (); /// This is called by the handler to initiate a response. void process_request (); /// This returns an error response for cases where there is a problem /// with the request, logging the log_message. void error_response (int status, const char *log_message); private: /// Called by process_request when the request is a normal request. void normal_response (); /// Called by process_request when the request is a cgi request. void cgi_response (); private: /// static version of process_request, just in case. static void process_request (HTTP_Response &response); /// creates the appropriate header information for responses. void build_headers (); private: /// The IO and Request objects associated with this re JAWS_IO &io_; HTTP_Request &request_; #if defined (ACE_JAWS_BASELINE) char *HTTP_HEADER; #else const char *HTTP_HEADER; #endif /// HTTP Headers and trailers. const char *HTTP_TRAILER; int HTTP_HEADER_LENGTH; int HTTP_TRAILER_LENGTH; }; #endif /* HTTP_RESPONSE_H */ ace-8.0.4+dfsg.orig/apps/JAWS/server/JAWS_Pipeline.cpp0000644000175000017500000000063615027201773021306 0ustar sudipsudip#include "JAWS_Pipeline.h" JAWS_Pipeline::JAWS_Pipeline () { } int JAWS_Pipeline::open (void *) { // Simply call into the virtual svc() method. if (this->svc () == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "JAWS_Pipeline::svc"), -1); return 0; } int JAWS_Pipeline::close (u_long) { return 0; } #include "JAWS_Pipeline_Handler.cpp" ace-8.0.4+dfsg.orig/apps/JAWS/server/HTTP_Server.cpp0000644000175000017500000003124315027201773021020 0ustar sudipsudip#ifndef ACE_BUILD_SVC_DLL #define ACE_BUILD_SVC_DLL #endif /* ACE_BUILD_SVC_DLL */ #include "ace/OS_NS_string.h" #include "ace/Get_Opt.h" #include "ace/Asynch_Acceptor.h" #include "ace/LOCK_SOCK_Acceptor.h" #include "ace/Proactor.h" #include "ace/Signal.h" #include "JAWS_IO.h" #include "HTTP_Server.h" #include // class is overkill class JAWS { public: enum { JAWS_POOL = 0, JAWS_PER_REQUEST = 1 }; enum { JAWS_SYNCH = 0, JAWS_ASYNCH = 2 }; }; void HTTP_Server::parse_args (int argc, ACE_TCHAR *argv[]) { int c; int thr_strategy = 0; int io_strategy = 0; const ACE_TCHAR *prog = argc > 0 ? argv[0] : ACE_TEXT ("HTTP_Server"); // Set some defaults this->port_ = 0; this->threads_ = 0; this->backlog_ = 0; this->throttle_ = 0; this->caching_ = true; ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("p:n:t:i:b:c:")); while ((c = get_opt ()) != -1) switch (c) { case 'p': this->port_ = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'n': this->threads_ = ACE_OS::atoi (get_opt.opt_arg ()); break; case 't': // POOL -> thread pool // PER_REQUEST -> thread per request // THROTTLE -> thread per request with throttling if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("POOL")) == 0) thr_strategy = JAWS::JAWS_POOL; else if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("PER_REQUEST")) == 0) { thr_strategy = JAWS::JAWS_PER_REQUEST; this->throttle_ = 0; } else if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("THROTTLE")) == 0) { thr_strategy = JAWS::JAWS_PER_REQUEST; this->throttle_ = 1; } break; case 'f': if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("THR_BOUND")) == 0) { // What happened here? } else if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("THR_DAEMON")) == 0) { } else if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("THR_DETACHED")) == 0) { } break; case 'i': // SYNCH -> synchronous I/O // ASYNCH -> asynchronous I/O if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("SYNCH")) == 0) io_strategy = JAWS::JAWS_SYNCH; else if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("ASYNCH")) == 0) io_strategy = JAWS::JAWS_ASYNCH; break; case 'b': this->backlog_ = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'c': if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("NO_CACHE")) == 0) this->caching_ = false; else this->caching_ = true; break; default: break; } // No magic numbers. if (this->port_ <= 0) this->port_ = 5432; if (this->threads_ <= 0) this->threads_ = 5; // Don't use number of threads as default if (this->backlog_ <= 0) this->backlog_ = this->threads_; this->strategy_ = thr_strategy | io_strategy; ACE_UNUSED_ARG (prog); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("in HTTP_Server::init, %s port = %d, ") ACE_TEXT ("number of threads = %d\n"), prog, this->port_, this->threads_)); } int HTTP_Server::init (int argc, ACE_TCHAR *argv[]) // Document this function { // Ignore signals generated when a connection is broken unexpectedly. ACE_Sig_Action sig ((ACE_SignalHandler) SIG_IGN, SIGPIPE); ACE_UNUSED_ARG (sig); // Parse arguments which sets the initial state. this->parse_args (argc, argv); //If the IO strategy is synchronous (SYNCH case), then choose a handler //factory based on the desired caching scheme HTTP_Handler_Factory *f = 0; if (this->strategy_ != (JAWS::JAWS_POOL | JAWS::JAWS_ASYNCH)) { if (this->caching_) { ACE_NEW_RETURN (f, Synch_HTTP_Handler_Factory (), -1); } else { ACE_NEW_RETURN (f, No_Cache_Synch_HTTP_Handler_Factory (), -1); } } //NOTE: At this point f better not be a NULL pointer, //so please do not change the ACE_NEW_RETURN macros unless //you know what you are doing std::unique_ptr factory (f); // Choose what concurrency strategy to run. switch (this->strategy_) { case (JAWS::JAWS_POOL | JAWS::JAWS_ASYNCH) : return this->asynch_thread_pool (); case (JAWS::JAWS_PER_REQUEST | JAWS::JAWS_SYNCH) : return this->thread_per_request (*factory.get ()); case (JAWS::JAWS_POOL | JAWS::JAWS_SYNCH) : default: return this->synch_thread_pool (*factory.get ()); } ACE_NOTREACHED (return 0); } int HTTP_Server::fini () { this->tm_.close (); return 0; } int HTTP_Server::synch_thread_pool (HTTP_Handler_Factory &factory) { // Main thread opens the acceptor if (this->acceptor_.open (ACE_INET_Addr (this->port_), 1, PF_INET, this->backlog_) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("HTTP_Acceptor::open")), -1); // Create a pool of threads to handle incoming connections. Synch_Thread_Pool_Task t (this->acceptor_, this->tm_, this->threads_, factory); this->tm_.wait (); return 0; } Synch_Thread_Pool_Task::Synch_Thread_Pool_Task (HTTP_Acceptor &acceptor, ACE_Thread_Manager &tm, int threads, HTTP_Handler_Factory &factory) : ACE_Task (&tm), acceptor_ (acceptor), factory_ (factory) { if (this->activate (THR_DETACHED | THR_NEW_LWP, threads) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Synch_Thread_Pool_Task::open"))); } int Synch_Thread_Pool_Task::svc () { // Creates a factory of HTTP_Handlers binding to synchronous I/O strategy //Synch_HTTP_Handler_Factory factory; for (;;) { ACE_SOCK_Stream stream; // Lock in this accept. When it returns, we have a connection. if (this->acceptor_.accept (stream) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT("%p\n"), ACE_TEXT ("HTTP_Acceptor::accept")), -1); ACE_Message_Block *mb = 0; ACE_NEW_RETURN (mb, ACE_Message_Block (HTTP_Handler::MAX_REQUEST_SIZE + 1), -1); // Create an HTTP Handler to handle this request HTTP_Handler *handler = this->factory_.create_http_handler (); handler->open (stream.get_handle (), *mb); // Handler is destroyed when the I/O puts the Handler into the // done state. mb->release (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%t) in Synch_Thread_Pool_Task::svc, recycling\n"))); } ACE_NOTREACHED(return 0); } int HTTP_Server::thread_per_request (HTTP_Handler_Factory &factory) { int grp_id = -1; // thread per request // Main thread opens the acceptor if (this->acceptor_.open (ACE_INET_Addr (this->port_), 1, PF_INET, this->backlog_) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("HTTP_Acceptor::open")), -1); ACE_SOCK_Stream stream; // When we are throttling, this is the amount of time to wait before // checking for runnability again. const ACE_Time_Value wait_time (0, 10); for (;;) { if (this->acceptor_.accept (stream) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("HTTP_Acceptor::accept")), -1); Thread_Per_Request_Task *t; // Pass grp_id as a constructor param instead of into open. ACE_NEW_RETURN (t, Thread_Per_Request_Task (stream.get_handle (), this->tm_, grp_id, factory), -1); if (t->open () != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Thread_Per_Request_Task::open")), -1); // Throttling is not allowing too many threads to run away. // Should really use some sort of condition variable here. if (!this->throttle_) continue; // This works because each task has only one thread. while (this->tm_.num_tasks_in_group (grp_id) > this->threads_) this->tm_.wait (&wait_time); } ACE_NOTREACHED(return 0); } Thread_Per_Request_Task::Thread_Per_Request_Task (ACE_HANDLE handle, ACE_Thread_Manager &tm, int &grp_id, HTTP_Handler_Factory &factory) : ACE_Task (&tm), handle_ (handle), grp_id_ (grp_id), factory_ (factory) { } // HEY! Add a method to the thread_manager to return total number of // threads managed in all the tasks. int Thread_Per_Request_Task::open (void *) { int status = -1; if (this->grp_id_ == -1) status = this->grp_id_ = this->activate (THR_DETACHED | THR_NEW_LWP); else status = this->activate (THR_DETACHED | THR_NEW_LWP, 1, 0, -1, this->grp_id_, 0); if (status == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Thread_Per_Request_Task::open")), -1); return 0; } int Thread_Per_Request_Task::svc () { ACE_Message_Block *mb = 0; ACE_NEW_RETURN (mb, ACE_Message_Block (HTTP_Handler::MAX_REQUEST_SIZE + 1), -1); //Synch_HTTP_Handler_Factory factory; HTTP_Handler *handler = this->factory_.create_http_handler (); handler->open (this->handle_, *mb); mb->release (); return 0; } int Thread_Per_Request_Task::close (u_long) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%t) Thread_Per_Request_Task::svc, dying\n"))); delete this; return 0; } // Understanding the code below requires understanding of the // WindowsNT asynchronous completion notification mechanism and the // Proactor Pattern. // (1) The application submits an asynchronous I/O request to the // operating system and a special handle with it (Asynchronous // Completion Token). // (2) The operating system commits to performing the I/O request, // while application does its own thing. // (3) Operating system finishes the I/O request and places ACT onto // the I/O Completion Port, which is a queue of finished // asynchronous requests. // (4) The application eventually checks to see if the I/O request // is done by checking the I/O Completion Port, and retrieves the // ACT. int HTTP_Server::asynch_thread_pool () { // This only works on Win32 #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) // Create the appropriate acceptor for this concurrency strategy and // an appropriate handler for this I/O strategy ACE_Asynch_Acceptor acceptor; // Tell the acceptor to listen on this->port_, which makes an // asynchronous I/O request to the OS. if (acceptor.open (ACE_INET_Addr (this->port_), HTTP_Handler::MAX_REQUEST_SIZE + 1) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_Asynch_Acceptor::open")), -1); // Create the thread pool. // Register threads with the proactor and thread manager. Asynch_Thread_Pool_Task t (*ACE_Proactor::instance (), this->tm_); // The proactor threads are waiting on the I/O Completion Port. // Wait for the threads to finish. return this->tm_.wait (); #endif /* ACE_HAS_WIN32_OVERLAPPED_IO */ return -1; } // This only works on Win32 #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) Asynch_Thread_Pool_Task::Asynch_Thread_Pool_Task (ACE_Proactor &proactor, ACE_Thread_Manager &tm) : ACE_Task (&tm), proactor_ (proactor) { if (this->activate () == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Asynch_Thread_Pool_Task::open"))); } int Asynch_Thread_Pool_Task::svc () { for (;;) if (this->proactor_.handle_events () == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_Proactor::handle_events")), -1); return 0; } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO */ // Define the factory function. ACE_SVC_FACTORY_DEFINE (HTTP_Server) // Define the object that describes the service. ACE_STATIC_SVC_DEFINE (HTTP_Server, ACE_TEXT ("HTTP_Server"), ACE_SVC_OBJ_T, &ACE_SVC_NAME (HTTP_Server), ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, 0) ace-8.0.4+dfsg.orig/apps/JAWS/server/JAWS_Pipeline.h0000644000175000017500000000137715027201773020756 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_PIPELINE_H #define JAWS_PIPELINE_H #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Service_Config.h" #include "ace/Stream.h" #include "ace/Module.h" #include "ace/Task.h" typedef ACE_Stream JAWS_Pipeline_Stream; typedef ACE_Module JAWS_Pipeline_Module; typedef ACE_Task JAWS_Pipeline_Task; class JAWS_Pipeline : public JAWS_Pipeline_Task // = TITLE // Methods that are common to pipeline components { public: JAWS_Pipeline (); // ACE_Task hooks virtual int open (void * = 0); virtual int close (u_long = 0); }; #include "JAWS_Pipeline_Handler.h" #endif /* !defined (JAWS_PIPELINE_H) */ ace-8.0.4+dfsg.orig/apps/JAWS/server/HTTP_Handler.cpp0000644000175000017500000001641115027201773021127 0ustar sudipsudip// HTTP_Service.cpp -- simple implementation of the HTTP protocol #include "ace/Message_Block.h" #include "ace/Filecache.h" #include "HTTP_Handler.h" #include "HTTP_Helpers.h" #include "JAWS_IO.h" #include "ace/OS_NS_sys_socket.h" #include "ace/OS_NS_stdio.h" HTTP_Handler::HTTP_Handler (JAWS_IO &io, HTTP_Handler_Factory &factory) : factory_ (factory), request_data_ (0), handle_ (ACE_INVALID_HANDLE), response_ (io, request_), io_ (io) { this->io_.handler (this); } HTTP_Handler::~HTTP_Handler () { this->request_data_->release (); this->request_data_ = 0; } void HTTP_Handler::open (ACE_HANDLE handle, ACE_Message_Block &initial_data) { ACE_DEBUG ((LM_DEBUG, "(%t) New connection\n")); int sockbufsize = HTTP_Handler::MAX_SOCKBUFSIZE; int result = ACE_OS::setsockopt (handle, SOL_SOCKET, SO_RCVBUF, (char *) &sockbufsize, sizeof sockbufsize); if (result == -1) ACE_ERROR ((LM_ERROR, "%p\n", "SO_RCVBUF")); sockbufsize = HTTP_Handler::MAX_SOCKBUFSIZE; result = ACE_OS::setsockopt (handle, SOL_SOCKET, SO_SNDBUF, (char *) &sockbufsize, sizeof sockbufsize); if (result == -1) ACE_ERROR ((LM_ERROR, "%p\n", "SO_SNDBUF")); this->handle_ = handle; this->io_.handle (this->handle_); this->request_data_ = initial_data.duplicate (); this->read_complete (initial_data); } void HTTP_Handler::read_complete (ACE_Message_Block &message_block) { // This is actually a callback entry point. The JAWS_IO framework // calls into this method after some data has been read in. switch (this->request_.parse_request (message_block)) { case 0: do { int next_read_size = HTTP_Handler::MAX_REQUEST_SIZE - message_block.length (); if (next_read_size == 0) { this->request_too_long (); return; } this->io_.read (message_block, next_read_size); } while (0); break; default: // this->request_.respond (); this->response_.process_request (); } } void HTTP_Handler::receive_file_complete () { ACE_DEBUG ((LM_DEBUG, " (%t) %s received successfully\n", request_.uri ())); char buffer[BUFSIZ]; int buflen = ACE_OS::sprintf (buffer, "%s %d %s\r\n", this->request_.version (), HTTP_Status_Code::STATUS_OK, "Successful"); this->io_.send_confirmation_message (buffer, buflen); } void HTTP_Handler::receive_file_error (int result) { ACE_DEBUG ((LM_DEBUG, " (%t) %s error in receiving file\n", request_.uri ())); char buffer[BUFSIZ]; int status_code; switch (result) { case ACE_Filecache_Handle::ACE_ACCESS_FAILED: case ACE_Filecache_Handle::ACE_WRITE_FAILED: case ACE_Filecache_Handle::ACE_OPEN_FAILED: status_code = HTTP_Status_Code::STATUS_NOT_FOUND; break; case ACE_Filecache_Handle::ACE_COPY_FAILED: case ACE_Filecache_Handle::ACE_STAT_FAILED: case ACE_Filecache_Handle::ACE_MEMMAP_FAILED: status_code = HTTP_Status_Code::STATUS_FORBIDDEN; break; default: status_code = HTTP_Status_Code::STATUS_INTERNAL_SERVER_ERROR; break; } int buflen = ACE_OS::sprintf (buffer, "%s %d %s", this->request_.version (), status_code, "Failed"); this->io_.send_confirmation_message (buffer, buflen); } void HTTP_Handler::confirmation_message_complete () { this->done (); } void HTTP_Handler::error_message_complete () { this->done (); } void HTTP_Handler::transmit_file_complete () { ACE_DEBUG ((LM_DEBUG, " (%t) %s transmitted successfully\n", request_.uri ())); this->done (); } void HTTP_Handler::transmit_file_error (int result) { ACE_DEBUG ((LM_DEBUG, " (%t) %s error in transmitting file\n", request_.uri ())); int status_code; switch (result) { case ACE_Filecache_Handle::ACE_ACCESS_FAILED: case ACE_Filecache_Handle::ACE_WRITE_FAILED: case ACE_Filecache_Handle::ACE_OPEN_FAILED: status_code = HTTP_Status_Code::STATUS_NOT_FOUND; break; case ACE_Filecache_Handle::ACE_COPY_FAILED: case ACE_Filecache_Handle::ACE_STAT_FAILED: case ACE_Filecache_Handle::ACE_MEMMAP_FAILED: status_code = HTTP_Status_Code::STATUS_FORBIDDEN; break; default: status_code = HTTP_Status_Code::STATUS_INTERNAL_SERVER_ERROR; break; } this->response_.error_response (status_code, "error in transmitting file"); } void HTTP_Handler::read_error () { ACE_DEBUG ((LM_DEBUG, " (%t) error in reading request\n")); this->done (); } void HTTP_Handler::write_error () { ACE_DEBUG ((LM_DEBUG, " (%t) %s error in writing response\n", request_.uri ())); this->done (); } void HTTP_Handler::timeout () { ACE_DEBUG ((LM_DEBUG, " (%t) %s error in reading request\n", request_.uri ())); this->response_. error_response (HTTP_Status_Code::STATUS_INTERNAL_SERVER_ERROR, "error in reading request"); } void HTTP_Handler::request_too_long () { ACE_DEBUG ((LM_DEBUG, " (%t) request too long\n")); this->response_. error_response (HTTP_Status_Code::STATUS_BAD_REQUEST, "request too long"); } void HTTP_Handler::done () { this->factory_.destroy_http_handler (*this, this->io_); } HTTP_Handler_Factory::~HTTP_Handler_Factory () { } HTTP_Handler * Synch_HTTP_Handler_Factory::create_http_handler () { JAWS_Synch_IO *io; ACE_NEW_RETURN (io, JAWS_Synch_IO, 0); HTTP_Handler *handler; ACE_NEW_RETURN (handler, HTTP_Handler (*io, *this), 0); return handler; } void Synch_HTTP_Handler_Factory::destroy_http_handler (HTTP_Handler &handler, JAWS_IO &io) { delete &io; delete &handler; } //-------------SYNCH IO no Cache HTTP_Handler * No_Cache_Synch_HTTP_Handler_Factory::create_http_handler () { JAWS_Synch_IO_No_Cache *io = 0; ACE_NEW_RETURN (io, JAWS_Synch_IO_No_Cache, 0); HTTP_Handler *handler = 0; ACE_NEW_RETURN (handler, HTTP_Handler (*io, *this), 0); return handler; } void No_Cache_Synch_HTTP_Handler_Factory::destroy_http_handler (HTTP_Handler &handler, JAWS_IO &io) { delete &io; delete &handler; } //---------------- // This only works on Win32 #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) void Asynch_HTTP_Handler_Factory::open (ACE_HANDLE handle, ACE_Message_Block &mb) { JAWS_Asynch_IO *io; ACE_NEW (io, JAWS_Asynch_IO); HTTP_Handler *handler; ACE_NEW (handler, HTTP_Handler (*io, *this)); handler->open (handle, mb); } void Asynch_HTTP_Handler_Factory::destroy_http_handler (HTTP_Handler &handler, JAWS_IO &io) { delete &handler; delete &io; delete this; } HTTP_Handler * Asynch_HTTP_Handler_Factory::create_http_handler () { return 0; } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO */ ace-8.0.4+dfsg.orig/apps/JAWS/server/main.cpp0000644000175000017500000000230415027201773017633 0ustar sudipsudip#include "ace/Service_Config.h" #include "ace/Reactor.h" #include "ace/Filecache.h" #include "HTTP_Server.h" #include "ace/OS_main.h" #include "ace/OS_NS_signal.h" ACE_STATIC_SVC_REQUIRE(HTTP_Server) #ifdef ACE_HAS_SIG_C_FUNC extern "C" { #endif /* ACE_HAS_SIG_C_FUNC */ // call exit() so that static destructors get called static void handler (int) { delete (ACE_Filecache *) ACE_Filecache::instance (); ACE_OS::exit (0); } #ifdef ACE_HAS_SIG_C_FUNC } #endif /* ACE_HAS_SIG_C_FUNC */ // This is the driver entry point into JAWS. It is possible to use // JAWS as an ACE Service, as well. int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { ACE_Service_Config daemon; ACE_OS::signal (SIGCHLD, SIG_IGN); // SigAction not needed since the handler will shutdown the server. ACE_OS::signal (SIGINT, (ACE_SignalHandler) handler); ACE_OS::signal (SIGUSR2, (ACE_SignalHandler) handler); if (daemon.open (argc, argv, ACE_DEFAULT_LOGGER_KEY, 0) != 0) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), 1); // The configured service creates threads, and the // server won't exit until the threads die. // Run forever, performing the configured services until we receive // a SIGINT. return 0; } ace-8.0.4+dfsg.orig/apps/JAWS/server/README0000644000175000017500000001566615027201773017102 0ustar sudipsudip# -*- text -*- # Hey, Emacs! This is a TEXT file. -------------------------- README for the JAWS server -------------------------- This is the README file for the JAWS server. CONTENTS 1. Compiling a. UNIX b. Windows NT 4.0 2. Executing a. svc.conf parameters b. General Info 3. Limitations 4. Acknowledgements 5. New additions ------------ 1. Compiling ------------ 1a. Compiling under UNIX. Assuming that the environment variable ACE_ROOT is set correctly, and that you are using GNU make, compiling should simply involve: $ cd $ACE_ROOT/apps/JAWS/server $ make clean $ make depend $ make This will produce an executable named ``main''. 1b. Compiling under Windows NT 4.0. Assuming you are using a recent version of Microsoft Visual C++, you can use the jaws.mdp file located in $ACE_ROOT/apps/JAWS/server to build JAWS. ------------ 2. Executing ------------ 2a. svc.conf parameters. To run JAWS, simply execute "main". It loads the HTTP server from the file named in the ``svc.conf'' file. The ``svc.conf'' file itself contains documentation about the load line. It supports the following command-line arguments: -p port Start JAWS on the specified port. -n num_threads Use num_threads as the maximum number of threads. -f thr_flag Can be used multiple times to set thread creation flags: THR_BOUND -> bound threads THR_DAEMON -> daemonized threads THR_DETACHED -> detached threads THR_NEW_LWP -> increase concurrency level -t thr_strategy Use one of the following strategies: POOL -> thread pool PER_REQUEST -> thread-per-request THROTTLE -> thread-per-request with throttling -i io_strategy Use one of the following strategies: SYNCH -> synchronous I/O ASYNCH -> asynchronous I/O -b backlog Backlog value for listen (). 2b. General Information By default, JAWS will used port 5432 with 5 threads and apply the synchronous thread pool strategy. Unless set, the default backlog value is equal the value of the maximum number of threads. JAWS also responds to several environment variables. This is a temporary feature which will be replaced by a more general configuration file similar to NCSA httpd's. The environment variables are: JAWS_DOCUMENT_ROOT This is the starting point the server will use to look for files. Default value: the current directory of the server. JAWS_CGI_PATH This is intended to be a ``:'' delimited list of paths (similar to your regular PATH environment variable) which describes the possible locations for CGI binaries. Default value: Any directory named ``cgi-bin''. JAWS_USER_DIR This is the name of the subdirectory in a users home directory which contains publicly available WWW documents. Default value: ``.www''. JAWS_DIR_INDEX The name of the file which is sent, if present, when the URL leads to a directory. Default value: ``index.html''. You may test the server by executing telnet, opening a connection to the server machine on the server port. For instance: $ telnet machinename 5432 Trying ###.###.###.###... Connected to machinename.your.domain Escape character is '^]'. GET /main.cpp // main.cpp //... Note that if you use an HTTP/1.0 get request, then you have to hit return twice before the file will be sent. E.g., $ telnet machinename 5432 Trying ###.###.###.###... Connected to machinename.your.domain Escape character is '^]'. GET /main.cpp HTTP/1.0 // main.cpp //... Where applicable, JAWS will perform ``~'' expansion for home directories of usernames. ----------- 3. Features ----------- (a) JAWS supports full HTTP/1.0 responses. (b) JAWS support CGI scripts on UNIX. (c) JAWS parses request headers. The mechanism can be used to parse headers from a variety of text based protocols (e.g., SNMP and NNTP). (d) Optimized filecaching. -------------- 4. Limitations -------------- The following are TODO items for JAWS: status|task ------+----------------------- | (a) JAWS will support HTTP/1.1 eventually, including | persistent connections. | | (b) JAWS can be more aggressive with its threading strategies, | such as: | (*) parallelize HTTP protocol processing, similar to | PHTTPD. | (*) prioritize threads to give more important requests | more execution time. | (*) apply throttling, similar to THTTPD. | | (c) JAWS will support a general protocol content filtering | mechanism which will be used to replace the existing CGI | support implementation. | Questions, comments, corrections, suggestions are welcome. Please feel free to send me any such correspondence. James Hu ------------------- 4. Acknowledgements ------------------- My partners in crime for this endeavor include: Eastman-Kodak, Rochester N.Y. and Object Technologies, Inc. For providing funding for this research. Dr. Douglas Schmidt For being my advisor, and convincing my sponsors to fund me. Irfan Pyarali For porting JAWS to NT, and for designing and implementing the JAWS IO mechanism. Sumedh Mungee For writing the benchmark client, and performing the UNIX benchmarks. Tim Harrison For his comments, advice, and help in designing the IO mechanism used by JAWS. ----------------------- 5. Additions ----------------------- The need arose to have JAWS not perform any file caching. We added this functionality and provided a new cmd line option -c with params NO_CACHE/CACHE. This capability is to be used with the RepositoryManager in CIAO. In its current design the RepositoryManager (RM) need a collocated HTTP server. When RM istalls packages, it unpacks them so that the separate files are accessible to ZIP unaware entities like JAWS. JAWS is used to serve the libraries in the package to the various deamons that might be interested in them, e.g. the NodeApplicationManager. The problem with using file caching reveals itself during the deletePackage operation of the RM. When the RM attempts to delete a file which was previously accessed via JAWS a is currently in the file cache the call fails and the file remains on the filesystem indefinitely. If the file is cached with a ACE_NOMAP option is is not stored in a file map and it is deleted upon server termination. The OS handles that. Althoguh this might or might not be OK (depending on how it scales) there is an additional problem because JAWS and the ACE_Filecache_Handle class used do not provide enough functionality to deal with the ACE_NOMAP case. I believe that ACE_NOMAP option was probably never used. To overcome the above problems we added the no caching functionality in JAWS. ace-8.0.4+dfsg.orig/apps/JAWS/server/HTTP_Handler.h0000644000175000017500000001426215027201773020576 0ustar sudipsudip/* -*- c++ -*- */ //============================================================================= /** * @file HTTP_Handler.h * * @author James Hu and Irfan Pyarali */ //============================================================================= #ifndef HTTP_HANDLER_H #define HTTP_HANDLER_H // = Forward declarations class Message_Block; class HTTP_Handler_Factory; #include "ace/Asynch_IO.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "HTTP_Request.h" #include "HTTP_Response.h" #include "JAWS_IO.h" /** * @class HTTP_Handler * * @brief This class is used to implement the HTTP protocol * * The HTTP_Handler class is a state based implementation of the * HTTP protocol. Therefore, it can be used synchronously and * asynchronously. It uses an abstract IO class to move between * different HTTP protocol states. It is up to the IO class to * decide on synchronous or asynchronous I/O. */ class HTTP_Handler : protected JAWS_IO_Handler { // Friend I/O classes. Can call protected methods. friend class JAWS_Synch_IO; friend class JAWS_Synch_IO_No_Cache; friend class JAWS_Asynch_IO; // Factories friend class Asynch_HTTP_Handler_Factory; friend class Synch_HTTP_Handler_Factory; friend class No_Cache_Synch_HTTP_Handler_Factory; public: /** * The handler is initialized with a connection of a new * client and any that came across. The * block will be of MAX_REQUEST_SIZE and the number * of bytes in can be found from * .length () */ virtual void open (ACE_HANDLE handle, ACE_Message_Block &initial_data); protected: /// The constructor is passed the factory that created and the /// IO mechanism that the handler should use. HTTP_Handler (JAWS_IO &io, HTTP_Handler_Factory &factory); /// Destructor virtual ~HTTP_Handler (); /// This method is called by the framework when there is a timeout. virtual void timeout (); /** * This is the termination state of the handler. After successful or * unsuccessful completions, the handler will end up in this state * (method). */ virtual void done (); /// Request too long. virtual void request_too_long (); /// Reference to the creating factory. HTTP_Handler_Factory &factory_; protected: // = Completion methods inherited from . virtual void read_complete (ACE_Message_Block &data); virtual void read_error (); virtual void transmit_file_complete (); virtual void transmit_file_error (int result); virtual void receive_file_complete (); virtual void receive_file_error (int result); virtual void write_error (); virtual void confirmation_message_complete (); virtual void error_message_complete (); public: enum { MAX_SOCKBUFSIZE = 64 * 1024, MAX_REQUEST_SIZE = 8192, METHODSIZ = 10, VERSIONSIZ = 10 }; private: /// This points to the request sent by the client ACE_Message_Block *request_data_; /// I/O handle to the client ACE_HANDLE handle_; HTTP_Request request_; HTTP_Response response_; /// IO class used by the handler JAWS_IO &io_; }; /** * @class HTTP_Handler_Factory * * @brief This class is used to create new HTTP handlers * * This is an abstract factory for creating new HTTP handlers. */ class HTTP_Handler_Factory { public: /// Destructor virtual ~HTTP_Handler_Factory (); /// This creates a new HTTP_Handler virtual HTTP_Handler *create_http_handler () = 0; /** * The HTTP handler will call this method from HTTP_Handler::done to * tell the factory to reap up the handler as it is now done with * the protocol */ virtual void destroy_http_handler (HTTP_Handler &handler, JAWS_IO &io) = 0; }; /** * @class Synch_HTTP_Handler_Factory * * @brief This class is used to create new HTTP handlers that will use * Synch IO */ class Synch_HTTP_Handler_Factory : public HTTP_Handler_Factory { public: /// This creates a new HTTP_Handler HTTP_Handler *create_http_handler (); /** * The HTTP handler will call this method from HTTP_Handler::done to * tell the factory to reap up the handler as it is now done with * the protocol */ void destroy_http_handler (HTTP_Handler &handler, JAWS_IO &io); }; //--------------Added a factory for SYNCH IO without caching /** * @class No_Cache_Synch_HTTP_Handler_Factory * * @brief This class is used to create new HTTP handlers that will use * Synch IO without caching */ class No_Cache_Synch_HTTP_Handler_Factory : public HTTP_Handler_Factory { public: /// This creates a new HTTP_Handler HTTP_Handler *create_http_handler (); /** * The HTTP handler will call this method from HTTP_Handler::done to * tell the factory to reap up the handler as it is now done with * the protocol */ void destroy_http_handler (HTTP_Handler &handler, JAWS_IO &io); }; //-------------- #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) /** * @class Asynch_HTTP_Handler_Factory * * @brief This class is used to create new HTTP handlers that will use * Asynchronous IO. This only works on Win32. */ class Asynch_HTTP_Handler_Factory : public HTTP_Handler_Factory, public ACE_Service_Handler { public: /** * The HTTP handler will call this method from HTTP_Handler::done to * tell the factory to reap up the handler as it is now done with * the protocol */ void destroy_http_handler (HTTP_Handler &handler, JAWS_IO &io); /** * is called by to initialize a new * instance of ACE_Service_Handler that has been created after the a * new connection is accepted. * * This will act as a creation point for new handlers. */ virtual void open (ACE_HANDLE handle, ACE_Message_Block &message_block); private: /** * This method is private as users are not allowed to create new * handlers. New handlers can only be created by the framework when * new client connections arrive. */ HTTP_Handler *create_http_handler (); }; #endif /* ACE_HAS_WIN32_OVERLAPPED_IO */ #endif /* HTTP_HANDLER_H */ ace-8.0.4+dfsg.orig/apps/JAWS/server/JAWS_IO.cpp0000644000175000017500000003404315027201773020047 0ustar sudipsudip#include "ace/OS_NS_string.h" #include "ace/OS_NS_sys_uio.h" #include "ace/OS_NS_sys_socket.h" #include "ace/Message_Block.h" #include "ace/SOCK_Stream.h" #include "ace/Filecache.h" #include "JAWS_IO.h" #include "HTTP_Helpers.h" #include "ace/OS_NS_fcntl.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_sys_stat.h" #include "ace/Basic_Types.h" #include #include JAWS_IO::JAWS_IO () : handler_ (0) { } JAWS_IO::~JAWS_IO () { } void JAWS_IO::handler (JAWS_IO_Handler *handler) { this->handler_ = handler; } JAWS_IO_Handler::~JAWS_IO_Handler () { } JAWS_Synch_IO::JAWS_Synch_IO () : handle_ (ACE_INVALID_HANDLE) { } JAWS_Synch_IO::~JAWS_Synch_IO () { ACE_OS::closesocket (this->handle_); } ACE_HANDLE JAWS_Synch_IO::handle () const { return this->handle_; } void JAWS_Synch_IO::handle (ACE_HANDLE handle) { this->handle_ = handle; } void JAWS_Synch_IO::read (ACE_Message_Block &mb, int size) { ACE_SOCK_Stream stream; stream.set_handle (this->handle_); int result = stream.recv (mb.wr_ptr (), size); if (result <= 0) this->handler_->read_error (); else { mb.wr_ptr (result); this->handler_->read_complete (mb); } } void JAWS_Synch_IO::receive_file (const char *filename, void *initial_data, int initial_data_length, int entire_length) { ACE_Filecache_Handle handle (ACE_TEXT_CHAR_TO_TCHAR (filename), entire_length); int result = handle.error (); if (result == ACE_Filecache_Handle::ACE_SUCCESS) { ACE_SOCK_Stream stream; stream.set_handle (this->handle_); int const bytes_to_memcpy = (std::min) (entire_length, initial_data_length); ACE_OS::memcpy (handle.address (), initial_data, bytes_to_memcpy); int bytes_to_read = entire_length - bytes_to_memcpy; int bytes = stream.recv_n ((char *) handle.address () + initial_data_length, bytes_to_read); if (bytes == bytes_to_read) this->handler_->receive_file_complete (); else result = -1; } if (result != ACE_Filecache_Handle::ACE_SUCCESS) this->handler_->receive_file_error (result); } void JAWS_Synch_IO::transmit_file (const char *filename, const char *header, int header_size, const char *trailer, int trailer_size) { ACE_Filecache_Handle handle (ACE_TEXT_CHAR_TO_TCHAR (filename)); int result = handle.error (); if (result == ACE_Filecache_Handle::ACE_SUCCESS) { #if defined (ACE_JAWS_BASELINE) || defined (ACE_WIN32) ACE_SOCK_Stream stream; stream.set_handle (this->handle_); if ((stream.send_n (header, header_size) == header_size) && (stream.send_n (handle.address (), handle.size ()) == handle.size ()) && (stream.send_n (trailer, trailer_size) == trailer_size)) this->handler_->transmit_file_complete (); else result = -1; #else // Attempting to use writev // Is this faster? iovec iov[3]; int iovcnt = 0; if (header_size > 0) { iov[iovcnt].iov_base = const_cast (header); iov[iovcnt].iov_len = header_size; iovcnt++; } if (handle.size () > 0) { iov[iovcnt].iov_base = reinterpret_cast (handle.address ()); iov[iovcnt].iov_len = handle.size (); iovcnt++; } if (trailer_size > 0) { iov[iovcnt].iov_base = const_cast (trailer); iov[iovcnt].iov_len = trailer_size; iovcnt++; } if (ACE_OS::writev (this->handle_, iov, iovcnt) < 0) result = -1; else this->handler_->transmit_file_complete (); #endif /* ACE_JAWS_BASELINE */ } if (result != ACE_Filecache_Handle::ACE_SUCCESS) this->handler_->transmit_file_error (result); } void JAWS_Synch_IO::send_confirmation_message (const char *buffer, int length) { this->send_message (buffer, length); this->handler_->confirmation_message_complete (); } void JAWS_Synch_IO::send_error_message (const char *buffer, int length) { this->send_message (buffer, length); this->handler_->error_message_complete (); } void JAWS_Synch_IO::send_message (const char *buffer, int length) { ACE_SOCK_Stream stream; stream.set_handle (this->handle_); stream.send_n (buffer, length); } // This only works on Win32 #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) JAWS_Asynch_IO::JAWS_Asynch_IO () { } JAWS_Asynch_IO::~JAWS_Asynch_IO () { ACE_OS::closesocket (this->handle_); } void JAWS_Asynch_IO::read (ACE_Message_Block& mb, int size) { ACE_Asynch_Read_Stream ar; if (ar.open (*this, this->handle_) == -1 || ar.read (mb, size) == -1) this->handler_->read_error (); } // This method will be called when an asynchronous read completes on a // stream. void JAWS_Asynch_IO::handle_read_stream (const ACE_Asynch_Read_Stream::Result &result) { // This callback is for this->receive_file() if (result.act () != 0) { int code = 0; if (result.success () && result.bytes_transferred () != 0) { if (result.message_block ().length () == result.message_block ().size ()) code = ACE_Filecache_Handle::ACE_SUCCESS; else { ACE_Asynch_Read_Stream ar; if (ar.open (*this, this->handle_) == -1 || ar.read (result.message_block (), result.message_block ().size () - result.message_block ().length (), result.act ()) == -1) code = -1; else return; } } else code = -1; if (code == ACE_Filecache_Handle::ACE_SUCCESS) this->handler_->receive_file_complete (); else this->handler_->receive_file_error (code); delete &result.message_block (); delete (ACE_Filecache_Handle *) result.act (); } else { // This callback is for this->read() if (result.success () && result.bytes_transferred () != 0) this->handler_->read_complete (result.message_block ()); else this->handler_->read_error (); } } void JAWS_Asynch_IO::receive_file (const char *filename, void *initial_data, int initial_data_length, int entire_length) { ACE_Message_Block *mb = 0; ACE_Filecache_Handle *handle; ACE_NEW (handle, ACE_Filecache_Handle (filename, entire_length, ACE_NOMAP)); int result = handle->error (); if (result == ACE_Filecache_Handle::ACE_SUCCESS) { ACE_OS::memcpy (handle->address (), initial_data, initial_data_length); int bytes_to_read = entire_length - initial_data_length; ACE_NEW (mb, ACE_Message_Block ((char *)handle->address () + initial_data_length, bytes_to_read)); if (mb == 0) { errno = ENOMEM; result = -1; } else { ACE_Asynch_Read_Stream ar; if (ar.open (*this, this->handle_) == -1 || ar.read (*mb, mb->size () - mb->length (), handle) == -1) result = -1; } } if (result != ACE_Filecache_Handle::ACE_SUCCESS) { this->handler_->receive_file_error (result); delete mb; delete handle; } } void JAWS_Asynch_IO::transmit_file (const char *filename, const char *header, int header_size, const char *trailer, int trailer_size) { ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer = 0; ACE_Filecache_Handle *handle = new ACE_Filecache_Handle (filename, ACE_NOMAP); int result = handle->error (); if (result == ACE_Filecache_Handle::ACE_SUCCESS) { ACE_Message_Block header_mb (header, header_size); ACE_Message_Block trailer_mb (trailer, trailer_size); header_and_trailer = new ACE_Asynch_Transmit_File::Header_And_Trailer (&header_mb, header_size, &trailer_mb, trailer_size); ACE_Asynch_Transmit_File tf; if (tf.open (*this, this->handle_) == -1 || tf.transmit_file (handle->handle (), // file handle header_and_trailer, // header and trailer data 0, // bytes_to_write 0, // offset 0, // offset_high 0, // bytes_per_send 0, // flags handle // act ) == -1) result = -1; } if (result != ACE_Filecache_Handle::ACE_SUCCESS) { this->handler_->transmit_file_error (result); delete header_and_trailer; delete handle; } } // This method will be called when an asynchronous transmit file completes. void JAWS_Asynch_IO::handle_transmit_file (const ACE_Asynch_Transmit_File::Result &result) { if (result.success ()) this->handler_->transmit_file_complete (); else this->handler_->transmit_file_error (-1); delete result.header_and_trailer (); delete (ACE_Filecache_Handle *) result.act (); } void JAWS_Asynch_IO::send_confirmation_message (const char *buffer, int length) { this->send_message (buffer, length, CONFORMATION); } void JAWS_Asynch_IO::send_error_message (const char *buffer, int length) { this->send_message (buffer, length, ERROR_MESSAGE); } void JAWS_Asynch_IO::send_message (const char *buffer, int length, int act) { ACE_Message_Block *mb = 0; ACE_NEW (mb, ACE_Message_Block (buffer, length)); if (mb == 0) { this->handler_->error_message_complete (); return; } ACE_Asynch_Write_Stream aw; if (aw.open (*this, this->handle_) == -1 || aw.write (*mb, length, (void *) static_cast (act)) == -1) { mb->release (); if (act == CONFORMATION) this->handler_->confirmation_message_complete (); else this->handler_->error_message_complete (); } } void JAWS_Asynch_IO::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result) { result.message_block ().release (); if (result.act () == (void *) CONFORMATION) this->handler_->confirmation_message_complete (); else this->handler_->error_message_complete (); } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO */ //-------------------Adding SYNCH IO no Caching JAWS_Synch_IO_No_Cache::JAWS_Synch_IO_No_Cache () : handle_ (ACE_INVALID_HANDLE) { } JAWS_Synch_IO_No_Cache::~JAWS_Synch_IO_No_Cache () { ACE_OS::closesocket (this->handle_); } ACE_HANDLE JAWS_Synch_IO_No_Cache::handle () const { return this->handle_; } void JAWS_Synch_IO_No_Cache::handle (ACE_HANDLE handle) { this->handle_ = handle; } void JAWS_Synch_IO_No_Cache::read (ACE_Message_Block &mb, int size) { ACE_SOCK_Stream stream; stream.set_handle (this->handle_); int result = stream.recv (mb.wr_ptr (), size); if (result <= 0) this->handler_->read_error (); else { mb.wr_ptr (result); this->handler_->read_complete (mb); } } void JAWS_Synch_IO_No_Cache::receive_file (const char *, void *, int, int) { //ugly hack to send HTTP_Status_Code::STATUS_FORBIDDEN this->handler_->receive_file_error (5); } void JAWS_Synch_IO_No_Cache::transmit_file (const char *filename, const char *header, int header_size, const char *trailer, int trailer_size) { int result = 0; // Can we access the file? if (ACE_OS::access (filename, R_OK) == -1) { //ugly hack to send in HTTP_Status_Code::STATUS_NOT_FOUND result = ACE_Filecache_Handle::ACE_ACCESS_FAILED; this->handler_->transmit_file_error (result); return; } ACE_stat stat; // Can we stat the file? if (ACE_OS::stat (filename, &stat) == -1) { //ugly hack to send HTTP_Status_Code::STATUS_FORBIDDEN result = ACE_Filecache_Handle::ACE_STAT_FAILED; this->handler_->transmit_file_error (result); return; } ACE_OFF_T size = stat.st_size; // Can we open the file? ACE_HANDLE handle = ACE_OS::open (filename, O_RDONLY); if (handle == ACE_INVALID_HANDLE) { //ugly hack to send HTTP_Status_Code::STATUS_FORBIDDEN result = ACE_Filecache_Handle::ACE_OPEN_FAILED; this->handler_->transmit_file_error (result); return; } char* f = new char[size]; std::unique_ptr file (f); ACE_OS::read_n (handle, f, size); ACE_SOCK_Stream stream; stream.set_handle (this->handle_); if ((stream.send_n (header, header_size) == header_size) && (stream.send_n (f, size) == size) && (stream.send_n (trailer, trailer_size) == trailer_size)) { this->handler_->transmit_file_complete (); } else { //ugly hack to default to HTTP_Status_Code::STATUS_INTERNAL_SERVER_ERROR result = -1; this->handler_->transmit_file_error (result); } ACE_OS::close (handle); } void JAWS_Synch_IO_No_Cache::send_confirmation_message (const char *buffer, int length) { this->send_message (buffer, length); this->handler_->confirmation_message_complete (); } void JAWS_Synch_IO_No_Cache::send_error_message (const char *buffer, int length) { this->send_message (buffer, length); this->handler_->error_message_complete (); } void JAWS_Synch_IO_No_Cache::send_message (const char *buffer, int length) { ACE_SOCK_Stream stream; stream.set_handle (this->handle_); stream.send_n (buffer, length); } ace-8.0.4+dfsg.orig/apps/JAWS/server/JAWS_Pipeline_Handler.h0000644000175000017500000000115015027201773022400 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_PIPELINE_HANDLER_H #define JAWS_PIPELINE_HANDLER_H #include "JAWS_Pipeline.h" template class JAWS_Pipeline_Handler : public JAWS_Pipeline_Task // = TITLE // Methods that are common to pipeline components { public: JAWS_Pipeline_Handler (); // ACE_Task hooks virtual int put (ACE_Message_Block *mb, ACE_Time_Value *tv = 0); // inherited from ACE_Task virtual int handle_put (TYPE *data, ACE_Time_Value *tv) = 0; // Callback hook for specialized data processing }; #include "JAWS_Pipeline_Handler.cpp" #endif /* !defined (JAWS_PIPELINE_HANDLER_H) */ ace-8.0.4+dfsg.orig/apps/JAWS/server/JAWS_IO.h0000644000175000017500000002007315027201773017512 0ustar sudipsudip/* -*- c++ -*- */ //============================================================================= /** * @file JAWS_IO.h * * @author James Hu */ //============================================================================= #ifndef JAWS_IO_H #define JAWS_IO_H #include "ace/ACE.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Asynch_IO.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Message_Block; ACE_END_VERSIONED_NAMESPACE_DECL class JAWS_IO_Handler; /** * @class JAWS_IO * * @brief This class defines the abstract interface for an I/O class in * the context of Web-likes servers * * An I/O class should have the following interface. Derived * classes will define the exactly how the I/O will take place * (Asynchronous, Synchronous, Reactive) */ class JAWS_IO { public: JAWS_IO (); virtual ~JAWS_IO (); void handler (JAWS_IO_Handler *handler); virtual void handle (ACE_HANDLE h) = 0; virtual ACE_HANDLE handle () const = 0; // James, please add documentation here. /// read from the handle size bytes into the message block. virtual void read (ACE_Message_Block& mb, int size) = 0; /// send header, filename, trailer to the handle. virtual void transmit_file (const char *filename, const char *header, int header_size, const char *trailer, int trailer_size) = 0; /// read data from the handle and store in filename. virtual void receive_file (const char *filename, void *initial_data, int initial_data_length, int entire_length) = 0; /// send a confirmation message to the handle. virtual void send_confirmation_message (const char *buffer, int length) = 0; /// send an error message to the handle. virtual void send_error_message (const char *buffer, int length) = 0; protected: JAWS_IO_Handler *handler_; }; /** * @class JAWS_IO_Handler * * @brief This class defines the abstract interface for an I/O handler class in * the context of Web-likes servers */ class JAWS_IO_Handler { public: /// Destructor. virtual ~JAWS_IO_Handler (); /// This method is called by the IO class when new client data shows /// up. virtual void read_complete (ACE_Message_Block &data) = 0; /// This method is called by the IO class when there was an error in /// reading new data from the client. virtual void read_error () = 0; /// This method is called by the IO class when the requested file has /// been successfully transmitted to the client. virtual void transmit_file_complete () = 0; /// This method is called by the IO class when there was an error in /// transmitting the requested file to the client. virtual void transmit_file_error (int result) = 0; /// This method is called by the IO class when the requested file has /// been successfully received from the client. virtual void receive_file_complete () = 0; /// This method is called by the IO class when there was an error in /// receiving the requested file from the client. virtual void receive_file_error (int result) = 0; /// This method is called by the IO class when there was an error in /// writing data to the client. virtual void write_error () = 0; /// This method is called by the IO class when the confirmation /// message has been delivered to the client. virtual void confirmation_message_complete () = 0; /// This method is called by the IO class when the error message has /// been delivered to the client. virtual void error_message_complete () = 0; }; /** * @class JAWS_Synch_IO * * @brief This class defines the interface for a Synchronous I/O class. */ class JAWS_Synch_IO : public JAWS_IO { public: JAWS_Synch_IO (); ~JAWS_Synch_IO (); virtual void handle (ACE_HANDLE h); virtual ACE_HANDLE handle () const; void read (ACE_Message_Block& mb, int size); void transmit_file (const char *filename, const char *header, int header_size, const char *trailer, int trailer_size); void receive_file (const char *filename, void *initial_data, int initial_data_length, int entire_length); void send_confirmation_message (const char *buffer, int length); void send_error_message (const char *buffer, int length); protected: virtual void send_message (const char *buffer, int length); ACE_HANDLE handle_; }; // This only works on Win32 #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) /** * @class JAWS_Asynch_IO * * @brief This class defines the interface for a Asynchronous I/O class. */ class JAWS_Asynch_IO : public JAWS_IO, public ACE_Handler { public: JAWS_Asynch_IO (); ~JAWS_Asynch_IO (); virtual void handle (ACE_HANDLE h) { ACE_Handler::handle (h); }; virtual ACE_HANDLE handle () const { return ACE_Handler::handle (); }; void read (ACE_Message_Block& mb, int size); void transmit_file (const char *filename, const char *header, int header_size, const char *trailer, int trailer_size); void receive_file (const char *filename, void *initial_data, int initial_data_length, int entire_length); void send_confirmation_message (const char *buffer, int length); void send_error_message (const char *buffer, int length); protected: enum Message_Types { CONFORMATION, ERROR_MESSAGE }; virtual void send_message (const char *buffer, int length, int act); /// This method will be called when an asynchronous read completes on /// a stream. virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result); /// This method will be called when an asynchronous write completes /// on a stream. virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result); /// This method will be called when an asynchronous transmit file /// completes. virtual void handle_transmit_file (const ACE_Asynch_Transmit_File::Result &result); }; #endif /* ACE_HAS_WIN32_OVERLAPPED_IO */ //-------------------Adding SYNCH IO no Caching /** * @class JAWS_Synch_IO_No_Cache * * @brief This class defines the interface for a Synchronous I/O class, * however in this class we do not use any caching. * * Wondering how this is useful? * The ACE_Filecache ACE_NOMAP option is broken and even if it were not, there * are other use cases in which we want to avoid caching altogether. For example, * we use JAWS in conjunction with the CIAO Repository Manager, however the two * do not have any explicit knowledge of each other. Therefore if the RM tried * to remove a package and its files from disk, its operation would [partially] * fail if JAWS still holds some of the files in its cache. */ class JAWS_Synch_IO_No_Cache : public JAWS_IO { public: JAWS_Synch_IO_No_Cache (); ~JAWS_Synch_IO_No_Cache (); virtual void handle (ACE_HANDLE h); virtual ACE_HANDLE handle () const; void read (ACE_Message_Block& mb, int size); void transmit_file (const char *filename, const char *header, int header_size, const char *trailer, int trailer_size); void receive_file (const char *filename, void *initial_data, int initial_data_length, int entire_length); void send_confirmation_message (const char *buffer, int length); void send_error_message (const char *buffer, int length); protected: virtual void send_message (const char *buffer, int length); ACE_HANDLE handle_; }; //------------------- #endif /* JAWS_IO_H */ ace-8.0.4+dfsg.orig/apps/JAWS/server/test.cgi0000755000175000017500000000012515027201773017650 0ustar sudipsudip#!/bin/sh echo Content-type: text/plain echo echo args -- $* env echo Done! exit 0 ace-8.0.4+dfsg.orig/apps/JAWS/stress_testing/0000755000175000017500000000000015046037655017765 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/JAWS/stress_testing/http.h0000644000175000017500000000055315027201773021111 0ustar sudipsudip#include "global.h" #define CONTENT_ENCODING_HEADER "Content-encoding: " #define CONTENT_TYPE_HEADER "Content-type: " #define INCOMING_FILE_NAME "/tmp/sumedh.web.inc" #define TEMPORARY_FILE_NAME "/tmp/sumedh.web.tmp" #define ENCODING_TAB "./encoding.tab" #define CONTENT_TAB "./content.tab" int demime(); int decode(char *encoding); int view(char *content); ace-8.0.4+dfsg.orig/apps/JAWS/stress_testing/util.cpp0000644000175000017500000000206415027201773021441 0ustar sudipsudip#include "util.h" URL::URL(char *input_buf) { char *buffer = new char[BUFSIZ]; ACE_OS::strcpy(buffer,input_buf); if(buffer == 0) return; char *temp; char *lasts; if((temp = ACE_OS::strtok_r(buffer,": ",&lasts))) { protocol_ = (char *) ACE_OS::malloc(ACE_OS::strlen(temp) + 1); ACE_OS::strcpy(protocol_, temp); } if((temp = ACE_OS::strtok_r(0,"/",&lasts))) { hostname_ = (char *) ACE_OS::malloc(ACE_OS::strlen(temp) + 1); ACE_OS::strcpy(hostname_, temp); } if((temp = ACE_OS::strtok_r(0,"\0",&lasts))) { filename_ = (char *) ACE_OS::malloc(ACE_OS::strlen(temp) + 1); ACE_OS::strcpy(filename_, temp); } else { filename_ = (char *) ACE_OS::malloc(ACE_OS::strlen(INDEX_NAME) + 1); ACE_OS::strcpy(filename_,INDEX_NAME); } } char *URL::get_protocol() { return protocol_; } char *URL::get_hostname() { return hostname_; } char *URL::get_filename() { return filename_; } void cleanup() { ACE_OS::unlink(TEMPORARY_FILE_NAME); ACE_OS::unlink(INCOMING_FILE_NAME); } void sigint(int) { cleanup(); } ace-8.0.4+dfsg.orig/apps/JAWS/stress_testing/cp.h0000644000175000017500000000030515027201773020527 0ustar sudipsudip#include "util.h" #include "stats.h" class Client_Parameters { public: Client_Parameters(int); URL *url; static Stats *stats; static int tcp_nodelay; static int sockbufsiz; int id; }; ace-8.0.4+dfsg.orig/apps/JAWS/stress_testing/client.h0000644000175000017500000000013415027201773021403 0ustar sudipsudip#include "global.h" #include "util.h" #include "http.h" #include "cp.h" #include "stats.h" ace-8.0.4+dfsg.orig/apps/JAWS/stress_testing/cp.cpp0000644000175000017500000000011315027201773021057 0ustar sudipsudip#include "cp.h" Client_Parameters::Client_Parameters(int i) { id = i; } ace-8.0.4+dfsg.orig/apps/JAWS/stress_testing/util.h0000644000175000017500000000067415027201773021113 0ustar sudipsudip#include "connection.h" #ifndef _D_URL #define _D_URL class URL { public: URL(char *buffer); char *get_protocol(); char *get_hostname(); char *get_filename(); private: char *protocol_; char *hostname_; char *filename_; }; void cleanup(); void sigint(int); int copier(connection in); #define INDEX_NAME "/index.html" #define INCOMING_FILE_NAME "/tmp/sumedh.web.inc" #define TEMPORARY_FILE_NAME "/tmp/sumedh.web.tmp" #endif ace-8.0.4+dfsg.orig/apps/JAWS/stress_testing/connection.cpp0000644000175000017500000000472415027201773022630 0ustar sudipsudip#include "connection.h" // Make the connection to the WEB server int connection::connect(char *hostname_opt_port, int tcp_nodelay, int sockbufsiz) { if(!hostname_opt_port) return 1; char *hostname_with_port; // Check to see if portnumber is specified in the hostnameport // If not, append :80 if(!ACE_OS::strchr(hostname_opt_port,':')) { hostname_with_port = new char[ACE_OS::strlen(hostname_opt_port) + 3]; ACE_OS::sprintf(hostname_with_port, "%s:%d", hostname_opt_port, 80); } else { hostname_with_port = hostname_opt_port; } // Beyond this point, hostname_with_port is of the form hostname:port ACE_INET_Addr server_addr(hostname_with_port); // Connect to server ACE_SOCK_Connector con; if(con.connect(stream_, server_addr) == -1) { ACE_OS::perror("ACE_SOCK_Connector::connect"); return 1; } // tcp_nodelay processing. // turn off weird ack things if(tcp_nodelay) { struct protoent *p = ACE_OS::getprotobyname ("tcp"); int one = 1; if (p && stream_.set_option (p->p_proto, TCP_NODELAY, (char *)& one, sizeof (one))) { ACE_OS::perror("tcp_nodelay"); return 1; } } if(sockbufsiz) if (stream_.set_option (SOL_SOCKET, SO_RCVBUF, (char *) &sockbufsiz, sizeof sockbufsiz) == -1) { ACE_OS::perror("socket_queue_size"); return 1; } return 0; } int connection::read(void *buffer, size_t maxlen, unsigned int timeout_seconds) { ACE_UNUSED_ARG (timeout_seconds); return stream_.recv(buffer, maxlen); } int connection::write(const void *buffer, size_t maxlen, unsigned int timeout_seconds) { ACE_UNUSED_ARG (timeout_seconds); return stream_.send(buffer, maxlen); } int connection::write_n(const void *buffer, size_t len, unsigned int timeout_seconds) { ACE_UNUSED_ARG (timeout_seconds); if(stream_.send_n(buffer, len) == -1) ACE_ERROR_RETURN((LM_ERROR, "Write failed for %s", buffer),1); return 0; } int connection::read_n(void *buffer, size_t maxlen, unsigned int timeout_seconds) { ACE_UNUSED_ARG (timeout_seconds); if(stream_.recv_n(buffer, maxlen) == -1) ACE_ERROR_RETURN((LM_ERROR, "Read failed.."),1); return 1; } int connection::close() { stream_.close_reader(); stream_.close_writer(); stream_.close(); return 0; } connection::~connection() { this->close(); } ace-8.0.4+dfsg.orig/apps/JAWS/stress_testing/http_tester.cpp0000644000175000017500000001222515027201773023031 0ustar sudipsudip#include "client.h" int Client_Parameters::tcp_nodelay; int Client_Parameters::sockbufsiz; Stats *Client_Parameters::stats; static void * client_thread(void *data) { Client_Parameters *cp = (Client_Parameters *) data; float latency = 0, throughput; URL *u = cp->url; // Check for presence of protocol, hostname and filename. if(!(u->get_protocol() && u->get_hostname() && u->get_filename())) { cerr << "Invalid URL" << endl; return 0; } cp->stats->i_have_started(cp->id); // Attempt connection connection webserver; if(webserver.connect(u->get_hostname(), cp->tcp_nodelay, cp->sockbufsiz)) return 0; // Send the request now. char request[BUFSIZ]; ACE_Profile_Timer throughput_timer, latency_timer; throughput_timer.start(); latency_timer.start(); ACE_OS::sprintf(request,"GET /%s HTTP/1.0\r\n\r\n",u->get_filename()); webserver.write_n(request, ACE_OS::strlen(request)) ; char buffer[BUFSIZ]; ssize_t num_read = 0, total_read = 0; unsigned int first_time = 1; for(;;) { num_read = webserver.read(buffer, sizeof buffer); if(first_time) { ACE_Profile_Timer::ACE_Elapsed_Time et; latency_timer.stop(); latency_timer.elapsed_time(et); latency = et.real_time; first_time = 0; } if(num_read <= 0) break; total_read += num_read; } cp->stats->i_am_done(cp->id); ACE_Profile_Timer::ACE_Elapsed_Time et; throughput_timer.stop(); throughput_timer.elapsed_time(et); throughput = (8 * total_read/et.real_time) / (1000 * 1000); //pow(10,6) ; cp->stats->log(cp->id, throughput, latency); webserver.close(); return 0; } int driver(char *id, int total_num, float requests_sec, char *url1, float p1, char *url2, float p2, char *url3, float p3, int tcp_nodelay, int sockbufsiz) { // construct the client parameters packet Client_Parameters::tcp_nodelay = tcp_nodelay; Client_Parameters::sockbufsiz = sockbufsiz; Client_Parameters::stats = new Stats(total_num); int missed_deadlines = 0; // sleep_time is in microseconds, and requests_sec is per second, hence the pow(10,6) float sleep_time = (1/requests_sec) * (1000.0 * 1000.0); // pow(10,6); float delta = 0; ACE_OS::srand(ACE_OS::time(0)); for(int i = 0; i < total_num; i++) { // i is used as a id for threads ACE_Profile_Timer timer; if(sleep_time < delta) { // cerr << "Requested rate is too high, sleep_time == " << sleep_time << ", and delta = " << delta << ", after " << i << " iterations! " << endl; missed_deadlines++; } else { ACE_Time_Value tv(0, (long int) (sleep_time - delta)); ACE_OS::sleep(tv); timer.start(); } Client_Parameters *cp = new Client_Parameters(i); double r = ((double)ACE_OS::rand()/(double)RAND_MAX); // cerr << " choosing between " << url1 << url2 << url3 << " with r == " << r; if(r <= p1) cp->url = new URL(url1); if( (r > p1) && (r <= (p1 + p2))) cp->url = new URL(url2); if( (r > (p1 + p2)) && (r <= p1 + p2 + p3)) cp->url = new URL(url3); // cerr << "The URL being requested is " << cp->url->get_filename() << endl; (ACE_Thread_Manager::instance ())->spawn(client_thread, (void *) cp); timer.stop(); ACE_Profile_Timer::ACE_Elapsed_Time et; timer.elapsed_time(et); delta = ( (0.4 * fabs(et.real_time * (1000 * 1000))) + (0.6 * delta) ); // pow(10,6) } // Join the other threads.. (ACE_Thread_Manager::instance ())->wait(); // Now output the data for this test cout << id; Client_Parameters::stats->output(); cout << endl; if (missed_deadlines != 0) { cout << "missed deadlines " << missed_deadlines << endl; cout << "missed deadlines as a % of total requests: " << (float) missed_deadlines / total_num * 100 << endl; } return 0; } ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { // This will set the global scale factor if the ACE_SCALE_FACTOR // environment variable is set. ACE_High_Res_Timer::get_env_global_scale_factor (); if(argc < 3) { cerr << "Usage: " << argv[0] << " infile outfile " << endl; cerr << "The input file contains lines, with the following fields: " << endl; cerr << "experiment_id total_number_of_requests request_rate url1 p1 url2 p2 url3 p3 TCP_NODELAY SOCKET_RECV_BUFSIZ " << endl; return 1; } FILE *fp = ACE_OS::fopen(argv[1],"r"); if(fp == 0) { ACE_POS::perror("fopen"); return 2; } ACE_OS::close(1); int fd = ACE_OS::open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0644); if(fd == -1) { ACE_OS::perror("open"); return 3; } int total_num, tcp, sock; char *id = new char[BUFSIZ]; float rate, p1, p2, p3; char *url1 = new char[BUFSIZ]; char *url2 = new char[BUFSIZ]; char *url3 = new char[BUFSIZ]; while(!feof(fp)) { fscanf(fp,"%s %d %f %s %f %s %f %s %f %d %d\n", id, &total_num, &rate, url1, &p1, url2, &p2, url3, &p3, &tcp, &sock); if (id[0] == '#') continue; ACE_OS::fprintf(stderr,"----\n"); ACE_OS::fprintf(stderr,"\tNow performing experiment:%s\n\tSending %d requests at %f requests/second\n", id, total_num, rate); driver(id, total_num, rate, url1, p1, url2, p2, url3, p3, tcp, sock); } ACE_OS::fclose(fp); ACE_OS::close(fd); return 0; } ace-8.0.4+dfsg.orig/apps/JAWS/stress_testing/config0000644000175000017500000000015315027201773021145 0ustar sudipsudip1.0 1 1 http://localhost:5432/IO.h 1 a 0 b 0 1 65536 2.0 1 1 http://localhost:5432/IO.h 1 a 0 b 0 1 65536 ace-8.0.4+dfsg.orig/apps/JAWS/stress_testing/stats.cpp0000644000175000017500000000362015027201773021621 0ustar sudipsudip#include "stats.h" Stats::Stats(int size) { throughput_ = new float[size]; latency_ = new float[size]; thread_count_ = size; init_fini_ = new Init_Fini_t[2*size]; for(int i = 0; i < size; i++) throughput_[i] = latency_[i] = 0; } void Stats::log(int id, float throughput, float latency) { throughput_[id] = throughput; latency_[id] = latency; } // Unused for now. void Stats::print(char *message) { ACE_UNUSED_ARG (message); // char time_buf[64]; // long ltime; // time(<ime); // ACE_OS::ctime_r(<ime, time_buf, sizeof time_buf); // if(ACE_OS::gettimeofday() == -1) { // perror("gettimeofday"); // } // time_buf[strlen(time_buf)-1] = 0; // printf("%010ld%09ld \t %s %s\n", tp.tv_sec, tp.tv_usec, time_buf, message); } int comp(const void *a, const void *b) { Init_Fini_t *A = (Init_Fini_t *)a; Init_Fini_t *B = (Init_Fini_t *)b; return (A->timestamp < B->timestamp) ? -1 : (A->timestamp > B->timestamp); } void Stats::output() { int i; float tavg = 0, lavg = 0; ACE_OS::qsort(init_fini_, 2*thread_count_, sizeof(Init_Fini_t), comp); int max = 0,thread_peak = 0; for(i = 0; i < 2*thread_count_; i++) { // cerr << " " << ((init_fini_[i].type == THREAD_START) ? "START": "END") << " " << init_fini_[i].timestamp.sec() << "." << init_fini_[i].timestamp.usec() << endl; if(init_fini_[i].type == THREAD_START) { if(++thread_peak > max) max = thread_peak; } else thread_peak--; } for(i = 0; i < thread_count_; i++) { tavg += throughput_[i]; lavg += latency_[i]; } cout << " " << tavg/thread_count_ << " " << lavg/thread_count_ << " " << max; } void Stats::i_have_started(int id) { init_fini_[2*id].type = THREAD_START; init_fini_[2*id].timestamp = ACE_OS::gettimeofday(); } void Stats::i_am_done(int id) { init_fini_[(2*id)+1].type = THREAD_END; init_fini_[(2*id)+1].timestamp = ACE_OS::gettimeofday(); } ace-8.0.4+dfsg.orig/apps/JAWS/stress_testing/connection.h0000644000175000017500000000111215027201773022261 0ustar sudipsudip#include "global.h" #ifndef _D_connection #define _D_connection class connection { public: int connect(char *hostname_opt_port, int tcp_nodelay, int sockbufsiz); int read(void *buffer, size_t maxlen, unsigned int timeout_seconds = 60); int write(const void *buffer, size_t maxlen, unsigned int timeout_seconds = 60); int write_n(const void *buffer, size_t len, unsigned int timeout_seconds = 60); int read_n(void *buffer, size_t maxlen, unsigned int timeout_seconds = 60); int close(); ~connection(); private: ACE_SOCK_Stream stream_; char sockbuf[66000]; }; #endif ace-8.0.4+dfsg.orig/apps/JAWS/stress_testing/stats.h0000644000175000017500000000101015027201773021255 0ustar sudipsudip#include "global.h" #ifndef _D_Stats #define _D_Stats #define THREAD_START 42 #define THREAD_END 43 class Init_Fini_t { public: int type; // 0 is start, 1 is end ACE_Time_Value timestamp; }; class Stats { public: Stats(int); void log(int, float, float); void i_have_started(int); void i_am_done(int); void print (char *); void output(); private: float *throughput_; float *latency_; Init_Fini_t *init_fini_; // Array (2n deep) to count peak no. of active threads int thread_count_; }; #endif ace-8.0.4+dfsg.orig/apps/JAWS/stress_testing/out0000644000175000017500000000006315027201773020507 0ustar sudipsudip1.0 0.47895 0.00859167 1 2.0 0.562603 0.00185976 1 ace-8.0.4+dfsg.orig/apps/JAWS/stress_testing/README0000644000175000017500000000247115027201773020642 0ustar sudipsudip http_tester ----------- This is the http_tester suite, an ACE based HTTP benchmarking tool, used to evaluate the performance of JAWS and other HTTP servers. Usage ----- To use the http_tester, you need to use a config file "infile", which consists of a list of experiments, one on each line. http_tester logs output data in the "outfile". Usage: http_tester infile outfile Experiments ----------- Each experiment consists of several space-delimited compulsory fields, as follows: experiment_id (string) total_number_of_requests (integer) request_rate (float) url1 (first URL) p1 (probability of requesting the first URL) url2 (second URL) p2 (probability of requesting the second URL) url3 (third URL) p3 (probability of requesting the third URL) TCP_NODELAY (boolean, 1 == TCP_NODELAY is set) SOCKET_RECV_BUFSIZ (usually 65536) URLS must be of the form: http://www.cs.wustl.edu:8888/~sumedh/index.html (the port number is required, im making it optional in the next version). Please see the sample file "config", for an example. Output file ----------- The output file consists of the following space delimited fields: Experiment Id (string) Average throughput of connection (float) Average latency of connection (float) Maximum number of active connections at any given time (int) Sumedh Mungee ace-8.0.4+dfsg.orig/apps/JAWS/stress_testing/benchd.cpp0000644000175000017500000001311115027201773021702 0ustar sudipsudip// benchd: Adapted from the "ntalker" example. // Sumedh Mungee #include "ace/Process.h" #include "ace/INET_Addr.h" #include "ace/SOCK_Dgram_Mcast.h" #include "ace/Reactor.h" #include "ace/Get_Opt.h" #include "ace/ARGV.h" #include "ace/OS_NS_stdio.h" #if defined (ACE_HAS_IP_MULTICAST) // network interface to subscribe to // this is hardware specific. // use netstat (1M) to find whether your interface // is le0 or ie0 // Maximum number of arguments supported for a request static const int MAX_ARGS = 16; // Name of the client benchmarking tool static const char *TESTER = "http_tester"; static int QUIET = 0; static const char *INTERFACE = "le0"; static const char *MCAST_ADDR = ACE_DEFAULT_MULTICAST_ADDR; static const u_short UDP_PORT = ACE_DEFAULT_MULTICAST_PORT; static const char *OUTPUT_FILE_NAME = "benchd.log"; static ACE_HANDLE OUTPUT_FILE; // Handle both multicast and stdin events. class Handle_Events : public ACE_Event_Handler { public: Handle_Events (u_short udp_port, const char *ip_addr, const char *interface_, ACE_Reactor &reactor); ~Handle_Events (); virtual int handle_input (ACE_HANDLE); virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask); private: int serve (char *buf); ACE_SOCK_Dgram_Mcast mcast_; ACE_Handle_Set handle_set_; }; int Handle_Events::handle_input (ACE_HANDLE h) { char buf[BUFSIZ]; if (h == 0) { int readresult = ACE_OS::read (h, buf, BUFSIZ); if (readresult > 0) { if (this->mcast_.send (buf, readresult) != readresult) { ACE_OS::perror ("send error"); return -1; } return 0; } else if (readresult == -1) ACE_OS::perror ("can't read from STDIN"); return -1; } else { ACE_INET_Addr remote_addr; // receive message from multicast group int retcode = this->mcast_.recv (buf, sizeof buf, remote_addr); if (retcode != -1) { /* cout << "received datagram from host " << remote_addr.get_host_name () << " on port " << remote_addr.get_port_number () << " bytes = " << retcode << endl; */ serve (buf); return 0; } ACE_OS::perror ("Something amiss."); return -1; } } int Handle_Events::handle_close (ACE_HANDLE h, ACE_Reactor_Mask) { if (h == 0) ACE_DEBUG ((LM_DEBUG, "STDIN_Events handle removed from reactor.\n")); else ACE_DEBUG ((LM_DEBUG, "Mcast_Events handle removed from reactor.\n")); return 0; } Handle_Events::~Handle_Events () { // ACE_OS::exit on error (bogus)... if (this->mcast_.unsubscribe () == -1) ACE_OS::perror ("unsubscribe fails"), ACE_OS::exit (1); } Handle_Events::Handle_Events (u_short udp_port, const char *ip_addr, const char *interface_, ACE_Reactor &reactor) { // Create multicast address to listen on. ACE_INET_Addr sockmc_addr (udp_port, ip_addr); // subscribe to multicast group. if (this->mcast_.subscribe (sockmc_addr, 1, interface_) == -1) ACE_OS::perror ("can't subscribe to multicast group"), ACE_OS::exit (1); // Disable loopbacks. // if (this->mcast_.set_option (IP_MULTICAST_LOOP, 0) == -1 ) // ACE_OS::perror (" can't disable loopbacks " ), ACE_OS::exit (1); if (!QUIET) { this->handle_set_.set_bit (0); } this->handle_set_.set_bit (this->mcast_.get_handle ()); // Register callbacks with the ACE_Reactor. if (reactor.register_handler (this->handle_set_, this, ACE_Event_Handler::READ_MASK) == -1) ACE_OS::perror ("can't register events"), ACE_OS::exit (1); } // This method handles multicast requests.. // These requests are of the following form: // command (arguments) // currently only one is supported (and indeed needed :-)) http_tester // arguments int Handle_Events::serve (char *buf) { ACE_ARGV arguments (buf); if (ACE_OS::strcmp (arguments[0], TESTER) == 0) { ACE_Process_Options po; ACE_Process p; po.set_handles (ACE_INVALID_HANDLE, OUTPUT_FILE, OUTPUT_FILE); po.command_line (arguments.argv ()); p.spawn (po); return 0; } else return -1; } static void parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("i:u:q")); int c; while ((c = get_opt ()) != -1) switch (c) { case 'q': QUIET = 1; case 'i': INTERFACE = get_opt.opt_arg (); break; case 'u': // Usage, same as error ACE_FALLTHROUGH; default: ACE_DEBUG ((LM_DEBUG, "%s -i interface\n", argv[0])); ACE_OS::exit (1); } } static sig_atomic_t done = 0; // Signal handler. extern "C" void handler (int) { done = 1; } int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT); ACE_OS::signal (SIGCLD, SIG_IGN); ACE_UNUSED_ARG (sa); parse_args (argc, argv); OUTPUT_FILE = ACE_OS::open (OUTPUT_FILE_NAME, O_CREAT | O_WRONLY, 0644); if (OUTPUT_FILE == 0) return 1; ACE_Reactor reactor; Handle_Events handle_events (UDP_PORT, MCAST_ADDR, INTERFACE, reactor); // main loop while (!done) reactor.handle_events (); ACE_OS::close (OUTPUT_FILE); cout << "\nbenchd done.\n"; return 0; } #else int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { ACE_ERROR ((LM_ERROR, "error: %s must be run on a platform that support IP multicast\n", argv[0])); return 0; } #endif /* ACE_HAS_IP_MULTICAST */ ace-8.0.4+dfsg.orig/apps/JAWS/stress_testing/global.h0000644000175000017500000000066415027201773021375 0ustar sudipsudip#include "ace/ACE.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/SOCK_Acceptor.h" #include "ace/SOCK_Connector.h" #include "ace/Pipe.h" #include "ace/SOCK_Stream.h" #include "ace/INET_Addr.h" #include "ace/Profile_Timer.h" #include "ace/Thread.h" #include "ace/Thread_Manager.h" #include "ace/Service_Config.h" // FUZZ: disable check_for_math_include #include ace-8.0.4+dfsg.orig/apps/JAWS/README0000644000175000017500000000105415027201773015556 0ustar sudipsudipThis directory contains the source code and test examples for JAWS, which is a high-performance HTTP Web server written with ACE. more information on JAWS, please see The subdirectories in this directory contain the following components . clients -- This contains the source code for various client applications that exercise the file uploading and downloading features of JAWS . server -- This contains the source code for the JAWS HTTP Web server. It illustrates a number of sophisticated ACE concurrency and event demultiplexing strategies. ace-8.0.4+dfsg.orig/apps/JAWS/clients/0000755000175000017500000000000015046037655016346 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/0000755000175000017500000000000015046037655017702 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/URL_Locator.h0000644000175000017500000000663715027201773022205 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file URL_Locator.h * * @author Nanbor Wang */ //============================================================================= #ifndef ACE_URL_LOCATOR_H #define ACE_URL_LOCATOR_H #include "URL_Properties.h" /** * @class ACE_URL_Locator * * @brief Abstract Base class designates what interfaces a URL_Locator * should provide. * * This class defines the basic URL_Locator APIs. * An URL locator provides services for URL clients to * query specific URL location that has certain properties * and URL providers to export their services and a set of * APIs to maintain their offers. */ class ACE_Svc_Export ACE_URL_Locator { public: // Request type enum ACE_URL_Locator_Op_Type { QUERY = 0, EXPORT, WITHDRAW, DESCRIBE, MODIFY, INVALID_OPERATION // LAST }; /// Human Readable operation name. static const char * const opname[]; // = Specify how to select offers. enum ACE_Selection_Criteria { NONE = 0, // URL that contains none of the properties. SOME, // URL that contains some of the properties. ALL, // URL that contains all of the properties. INVALID_SELECTION // Invalid. }; static const char * const selection_name[]; /// errno will set to one of these value. enum ACE_URL_Locator_Error { OK, // Everything is fine. OFFER_EXIST, // trying to register an offer. // that is already exist in repository. NO_SUCH_OFFER, // No such offer in the repository. INVALID_ARGUMENT, // Invalid argument encountered. UNIMPLEMENTED, // function not implemented. UNKNOWN, // Unknown error. MAX_URL_ERROR }; // Possible error code of URL_Locator. /// Human readable error status. static const char * const err_name[]; /// Default destructor. virtual ~ACE_URL_Locator () = 0; /** * Query the locator for HTTP with designate properties (none, some, * or all). The locator being queried will return a sequence of * offers with offers in it. This interface allocates * so users must deallocate it after use. */ virtual int url_query (const ACE_Selection_Criteria how, const ACE_URL_Property_Seq *pseq, const size_t how_many, size_t &num_query, ACE_URL_Offer_Seq *offer) = 0; /// Export an offer to the locator. virtual int export_offer (ACE_URL_Offer *offer, ACE_WString &offer_id) = 0; /// Withdraw an offer. return 0 if succeed, -1 otherwise. virtual int withdraw_offer (const ACE_WString &offer_id) = 0; /// Query a specific offer. virtual int describe_offer (const ACE_WString &offer_id, ACE_URL_Offer *offer) = 0; /// Modify a previously registered offer. virtual int modify_offer (const ACE_WString &offer_id, const ACE_WString *url = 0, const ACE_URL_Property_Seq *del = 0, const ACE_URL_Property_Seq *modify = 0) = 0; /// Provide a human readable error status. virtual const char *error_status (); }; #endif /* ACE_WEB_LOCATOR_H */ ace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/URL_Properties.cpp0000644000175000017500000000627415027201773023266 0ustar sudipsudip#if !defined (ACE_URL_PROPERTIES_C) #define ACE_URL_PROPERTIES_C #include "URL_Properties.h" #if !defined (__ACE_INLINE__) #include "URL_Properties.inl" #endif /* __ACE_INLINE__ */ #include "URL_Array_Helper.h" #include size_t ACE_WString_Helper::encode (void *buf, const ACE_WString &wstr) { ACE_UINT16 *wptr = (ACE_UINT16 *) buf; size_t i; for (i= 0; i <= wstr.length (); i++) wptr[i] = htons (wstr[i]); return i * sizeof (ACE_UINT16); } size_t ACE_WString_Helper::decode (void *buf) { ACE_UINT16 *wptr = (ACE_UINT16 *) buf; size_t i; for (i = 0; wptr[i] != 0; i++) wptr[i] = ntohs (wptr[i]); return (i + 1) * sizeof (ACE_UINT16); } size_t ACE_URL_Property::encode (void *buf) const { size_t blen = ACE_WString_Helper::encode (buf, this->name_); blen += ACE_WString_Helper::encode ((void *) ((char *) buf + blen), this->value_); return blen; } size_t ACE_URL_Property::decode (void *buf) { char *cbuf = (char *) buf; size_t len = ACE_WString_Helper::decode(buf); this->name ((ACE_UINT16 *) cbuf); cbuf += len; len += ACE_WString_Helper::decode ((void *) cbuf); this->value ((ACE_UINT16 *) cbuf); return len; } void ACE_URL_Property::dump () const { ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); if (this->name_.length () > 0) ACE_DEBUG ((LM_DEBUG, "\n name_: \"%s\"\n", std::unique_ptr (this->name_.char_rep ()).get ())); else ACE_DEBUG ((LM_DEBUG, "\n name_: \"\"\n")); if (this->value_.length () > 0) ACE_DEBUG ((LM_DEBUG, " value_: \"%s\"\n", std::unique_ptr (this->value_.char_rep ()).get ())); else ACE_DEBUG ((LM_DEBUG, " value_: \"\"\n")); ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } size_t ACE_URL_Offer::size () const { size_t sum = (this->url_.length () + 1) * sizeof (ACE_UINT16); sum += ::ace_array_size (this->prop_); return sum; } size_t ACE_URL_Offer::encode (void *buf) const { ACE_UINT32 *s_buf = (ACE_UINT32 *) buf; *s_buf = htonl (this->prop_.size ()); size_t len = sizeof (ACE_UINT32); len += ACE_WString_Helper::encode ((void *) ((char *) buf + len), this->url_); len += ::ace_array_encode ((void *) ((char *) buf + len), this->prop_); return len; } size_t ACE_URL_Offer::decode (void *buf) { size_t len = sizeof (ACE_UINT32); size_t a_size = (size_t) ntohl (*(ACE_UINT32 *) buf); len += ACE_WString_Helper::decode ((void *) ((char *) buf + len)); this->url ((ACE_UINT16 *) ((char *) buf + len)); ACE_URL_Property_Seq prop_seq (a_size); this->url_properties (prop_seq); len += ::ace_array_decode ((void *)((char *) buf + len), this->prop_); return len; } void ACE_URL_Offer::dump () const { ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); if (this->url_.length () > 0) ACE_DEBUG ((LM_DEBUG, "\n url_: \"%s\"\n", std::unique_ptr (this->url_.char_rep ()).get ())); else ACE_DEBUG ((LM_DEBUG, "\n url_: \"\"\n")); for (size_t i = 0; i < this->prop_.size (); i++) this->prop_[i].dump (); ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } #endif /* ACE_URL_PROPERTIES_C */ ace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/test_URL.cpp0000644000175000017500000000077615027201773022112 0ustar sudipsudip#include "Locator_Request_Reply.h" int ACE_TMAIN (int , ACE_TCHAR *[]) { ACE_URL_Locator_Request original, derived; ACE_URL_Property_Seq ouch1(3); ouch1[0].name ("name 1"); ouch1[0].value ("value 1"); ouch1[1].name ("name 2"); ouch1[1].value ("value 2"); ouch1[2].name ("name 3"); ouch1[2].value ("value 3"); original.url_query (1, ouch1, 3); original.dump (); derived.dump (); original.encode (); derived.decode ((void*) original.buffer ()); derived.dump (); return 0; } ace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/Locator_Request_Reply.inl0000644000175000017500000000430215027201773024664 0ustar sudipsudip/* -*- C++ -*- */ #include "URL_Locator.h" ACE_INLINE ACE_URL_Locator_Request::ACE_URL_Locator_Request () : code_(ACE_URL_Locator::INVALID_OPERATION), seq1_ (0), seq2_ (0), offer_ (0), buffer_ (0) { } ACE_INLINE ACE_URL_Locator_Request::~ACE_URL_Locator_Request () { delete this->seq1_; delete this->seq2_; delete this->offer_; delete [] this->buffer_; } ACE_INLINE const int ACE_URL_Locator_Request::how () const { return this-> how_; } ACE_INLINE const int ACE_URL_Locator_Request::how_many () const { return this->how_many_; } ACE_INLINE const u_int ACE_URL_Locator_Request::opcode () const { return this->code_; } ACE_INLINE const ACE_URL_Property_Seq * ACE_URL_Locator_Request::seq () const { return this->seq1_; } ACE_INLINE const ACE_URL_Property_Seq * ACE_URL_Locator_Request::del () const { return this->seq1_; } ACE_INLINE const ACE_URL_Property_Seq * ACE_URL_Locator_Request::modify () const { return this->seq2_; } ACE_INLINE const ACE_URL_Offer * ACE_URL_Locator_Request::offer () const { return this->offer_; } ACE_INLINE const ACE_WString & ACE_URL_Locator_Request::id () const { return this->id_; } ACE_INLINE const ACE_WString & ACE_URL_Locator_Request::url () const { return this->url_; } ACE_INLINE const char * ACE_URL_Locator_Request::buffer () const { return this->buffer_; } ACE_INLINE ACE_URL_Locator_Reply::ACE_URL_Locator_Reply () : code_ (ACE_URL_Locator::INVALID_OPERATION), offer_ (0), offers_ (0), buffer_ (0) { } ACE_INLINE ACE_URL_Locator_Reply::~ACE_URL_Locator_Reply () { delete this->offer_; delete this->offers_; delete [] this->buffer_; } ACE_INLINE const size_t ACE_URL_Locator_Reply::num_offers () const { return this->num_offers_; } ACE_INLINE const ACE_URL_Offer * ACE_URL_Locator_Reply::offer () const { return this->offer_; } ACE_INLINE const ACE_URL_Offer_Seq * ACE_URL_Locator_Reply::offers () const { return this->offers_; } ACE_INLINE const u_int ACE_URL_Locator_Reply::opcode () const { return this->code_; } ACE_INLINE const u_int ACE_URL_Locator_Reply::status () const { return this->status_; } ACE_INLINE const char * ACE_URL_Locator_Reply::buffer () const { return this->buffer_; } ace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/Local_Locator.cpp0000644000175000017500000001717615027201773023130 0ustar sudipsudip#if !defined (ACE_LOCAL_LOCATOR_C) #define ACE_LOCAL_LOCATOR_C #include "Local_Locator.h" #if !defined (__ACE_INLINE__) #include "Local_Locator.inl" #endif /* __ACE_INLINE__ */ int ACE_URL_Local_Locator::url_query (const ACE_URL_Locator::ACE_Selection_Criteria how, const ACE_URL_Property_Seq *pseq, const size_t how_many, size_t &num_query, ACE_URL_Offer_Seq *offer) { ACE_URL_Record *item = 0; ACE_NEW_RETURN (offer, ACE_URL_Offer_Seq (how_many), -1); if (how >= ACE_URL_Locator::INVALID_SELECTION) { errno = ACE_URL_Locator::INVALID_ARGUMENT; return -1; } num_query = 0; for (ACE_Unbounded_Set_Iterator iter (this->repository_); iter.next (item) != 0; iter.advance ()) { size_t i_query; size_t i_db; int found = 0; // Now this is a stupid implementation. Perhaps we can // implement this using Hash_Map. Better yet, I think we should // put this in a database and put SQL query here. for (i_query = 0; found == 0 && i_query < pseq->size (); i_query++) for (i_db = 0; i_db < item->offer_->url_properties ().size (); i_db++) { if ((*pseq)[i_query].name () == item->offer_->url_properties ()[i_db].name ()) if (how == ACE_URL_Locator::SOME) ; // if match and Some, copy to , inc , advance iterator // else if All, advance iterator // else if None, check next property in . if (all properties checked and found and ALL) copy to ; inc ; else if (all properties checked and not found and NONE) copy to ; inc ; else shouldn't happen, internal error if (num_query == how_many) break; } return 0; } int ACE_URL_Local_Locator::export_offer (ACE_URL_Offer *offer, ACE_WString &offer_id) { ACE_URL_Record *item = 0; // First check if we have registered this URL already. for (ACE_Unbounded_Set_Iterator iter (this->repository_); iter.next (item) != 0; iter.advance ()) if (*item->offer_->url () == *offer->url ()) { errno = ACE_URL_Locator::OFFER_EXIST; return -1; } ACE_URL_Record *new_offer; // Offer is not in repository, we can add new one in safely. ACE_NEW_RETURN (new_offer, ACE_URL_Record (offer), ACE_URL_Locator::NOMEM); this->repository_.push (*new_offer); offer_id = *new_offer->id_; return 0; } int ACE_URL_Local_Locator::withdraw_offer (const ACE_WString &offer_id) { ACE_URL_Record *item = 0; // Iterate thru repository and remove offer with . for (ACE_Unbounded_Set_Iterator iter (this->repository_); iter.next (item) != 0; iter.advance ()) if (offer_id == *item->id_) { if (this->repository_.remove (*item) == 0) return 0 else { errno = ACE_URL_Locator::UNKNOWN; return -1; } } errno = ACE_URL_Locator::NO_SUCH_OFFER; return 0; } int ACE_URL_Local_Locator::describe_offer (const ACE_WString &offer_id, ACE_URL_Offer *offer) { ACE_URL_Record *item = 0; // Iterate thru the repository and produce a copy of offer's // description. for (ACE_Unbounded_Set_Iterator iter (this->repository_); iter.next (item) != 0; iter.advance ()) if (offer_id == *item->id_) { ACE_NEW_RETURN (offer, ACE_URL_Offer (*item->offer_), -1); return 0; } errno = ACE_URL_Locator::NO_SUCH_OFFER; return -1; } int ACE_URL_Local_Locator::modify_offer (const ACE_WString &offer_id, const ACE_WString *url, const ACE_URL_Property_Seq *del, const ACE_URL_Property_Seq *modify) { ACE_Unbounded_Set_Iterator iter (this->repository_); ACE_URL_Record *item = 0; ACE_URL_Record *target = 0; // Errno Checking for (; iter.next (item) != 0; iter.advance ()) { if (url != 0 && *url == item->offer_->url ()) { errno = ACE_URL_Locator::OFFER_EXIST; return -1; } if (offer_id == *item->id_) target = item; } if (target != 0) // Aha, we found a target to work on { if (del != 0 && modify != 0) { // We need to make a copy of the original property sequence // so if any error occurs, we can revert our change easily. // First we need to calculate the maximum number of perperties. int psize = target->offer_->url_properties ().size (); if (del != 0) if ((psize -= del->size ()) < 0) { // If you try to delete more properties than we have, // you are doomed. No need to proceed. errno = ACE_URL_Locator::INVALID_ARGUMENT; return -1; } if (modify != 0) // In the worst case, all properties in will be added. psize += modify->size (); // Now, create a temporary work space. ACE_URL_Property_Seq working (psize); size_t sz = 0; for (; sz < item->offer_->url_properties ().size ()) working[sz] = item->offer_->url_properties() [sz]; if (del != 0) { // Argh, this is really a stupid design. // Go thru every property we want to delete for (size_t i = 0; i < del->size () && sz > 0; i++) // For earch, go thru our property sequence and // search for the property. for (size_t j = 0; j < sz; j++) if ((*del)[i].name () == working[j].name ()) { sz -= 1; working[j] = working[sz]; // pack the array. break; } // Doesn't generate error when we want to delete an // imaginary property. Is this appropriate? } if (modify != 0) { // This is also stupid. // Go thru every property we want to modify/add for (size_t i = 0; i < modify->size () && sz > 0; i++) { // For each property, go thru our property list // and search for the matching property for (size_t j = 0; j < sz; j++) if ((*modify)[i].name () == working[j].name ()) { // A match found. working[j].value ((*modify)[i].value ().fast_rep ()); break; } // No matching property name were found, // We want to add this property into the list. if (j == sz) working[sz++] = (*modify)[i]; } } } // Yes, all operations passed. We can now copy the working version back. item->offer_->url_properties (ACE_URL_Property_Seq (sz)); for (size_t i = 0; i < sz; i ++) item->offer_->url_properties ()[i] = working[i]; if (url != 0) item->offer_->url (url->fast_rep ()); // replace URL location. return 0; } errno = ACE_URL_Locator::NO_SUCH_OFFER; return -1; } #endif /* ACE_LOCAL_LOCATOR_C */ ace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/URL_Properties.h0000644000175000017500000001200115027201773022714 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file URL_Properties.h * * @author Nanbor Wang */ //============================================================================= #ifndef ACE_URL_PROPERTIES_H #define ACE_URL_PROPERTIES_H #include "ace/SString.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Containers.h" /** * @class ACE_WString_Helper * * @brief Some helper functions for manipulate ACE_WString. * * These functions simplify encoding/decoding of * ACE_WString objects for network communication. */ class ACE_Svc_Export ACE_WString_Helper { public: /// Returns the actual size (in bytes) required to contain the /// ACE_WString. static size_t size (const ACE_WString &wstr); /// Encode into for network communication. /// Return total octets consumed. static size_t encode (void *buf, const ACE_WString &wstr); /** * This function doesn't relate to ACE_WString directly. * It converts an ACE_UINT16 string from network * byte order to host byte order. Returns size of the string. */ static size_t decode (void *buf); }; /** * @class ACE_URL_Property * * @brief Defines a property of a URL. * * A property contains a and a . * A URL may contain some properties and we can "locate" * the URL's we are looking for by examming URL for certain * properties that match our need. */ class ACE_Svc_Export ACE_URL_Property { public: /// Create a new property. ACE_URL_Property (const char *name = 0, const char *value=0); /// Create a new property using wchar strings. This is mostly used /// to support DBCS or UNICODE. ACE_URL_Property (const ACE_UINT16 *name, const ACE_UINT16 *value); /// Copy constructor. ACE_URL_Property (const ACE_URL_Property &p); /// Destructor. ~ACE_URL_Property (); /// Assignment operator. ACE_URL_Property &operator= (const ACE_URL_Property &rhs); /// Equals operator. bool operator== (const ACE_URL_Property &rhs) const; /// Inequality operator. bool operator!= (const ACE_URL_Property &rhs) const; // = Query property name. ACE_WString &name_rep (); const ACE_WString &name () const; // = Set property name. void name (const ACE_UINT16 *n); void name (const char *n); // = Query property value. ACE_WString &value_rep (); const ACE_WString &value () const; // = Set property value. void value (const ACE_UINT16 *v); void value (const char *v); // = Helper functions for encoding and decoding. /// Returns memory size (in bytes) required to encode this object. size_t size () const; /// Encodes this object into buf for network transmission. size_t encode (void *buf) const; /// Decodes buf and modifies this object, you should /// probably create this with default ctor. size_t decode (void *buf); /// Dump out this object for debug. void dump () const; protected: /// Property name pointer. ACE_WString name_; /// Property value. ACE_WString value_; } ; typedef ACE_Array ACE_URL_Property_Seq; // type of URL_Property collections. /** * @class ACE_URL_Offer * * @brief Defines a URL offer. * * A URL offer is defined by a and an * . An offer is stored at server end * thru registering or reported back to querying client from the * sever. */ class ACE_Svc_Export ACE_URL_Offer { public: /// Create an offer. ACE_URL_Offer (const size_t size = 1, const char *url = 0); /// Copy ctor. ACE_URL_Offer (const ACE_URL_Offer &o); /// Default destructor. ~ACE_URL_Offer (); /// Assignment operator. ACE_URL_Offer &operator= (const ACE_URL_Offer &rhs); /// Equality operator. bool operator== (const ACE_URL_Offer &rhs) const; /// Inequality operator. bool operator!= (const ACE_URL_Offer &rhs) const; // = Get URL string. ACE_WString &url_rep (); const ACE_WString &url () const; // = Set URL. void url (const char *url); void url (const ACE_UINT16 *url); /// Get properties of this offer. ACE_URL_Property_Seq &url_properties (); /// Set properties of this offer. This operation virtually get a /// copy of the passed in prop. void url_properties (const ACE_URL_Property_Seq &prop); // = Helper functions for encoding and decoding. /// Returns memory size (in bytes) required to encode this object. size_t size () const; /// Encodes this object into buf for network transmission. size_t encode (void *buf) const; /// Decodes buf into current object, you better use /// the default ctor. size_t decode (void *buf); /// Dump this object for debug. void dump () const; protected: /// URL of this offer. ACE_WString url_; /// Properties associate with this offer. ACE_URL_Property_Seq prop_; }; typedef ACE_Array ACE_URL_Offer_Seq; // type of URL offer collections. #if defined (__ACE_INLINE__) #include "URL_Properties.inl" #endif /* __ACE_INLINE__ */ #endif /* ACE_WEB_PROPERTIES_H */ ace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/ID_Generator.h0000644000175000017500000000254615027201773022355 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file ID_Generator.h * * @author Nanbor Wang */ //============================================================================= #ifndef ACE_ID_GENERATOR_H #define ACE_ID_GENERATOR_h #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #define ACE_OFFER_ID_LENGTH 21 /** * @class ACE_ID_Generator * * @brief An unique ID generator. */ class ACE_ID_Generator // Generate an offer ID according to current time and avoid // duplicate ID. It guarantees ID uniqueness within a process, // i.e. no two threads may get the same ID string. Using a // similar method like the backery algorithm. { public: /// allocate a new ID string and point to it. static char *get_new_id (char *id); private: /// Atomically get info required to generate an offer ID. static void get_serial_id (time_t &t, size_t &s); /// Get the lock instance. static ACE_SYNCH_MUTEX *get_lock (); /// Record the time last offer ID generated. static time_t last_time_; /// Record serial number of last offer ID with same /// generation time. static size_t last_number_; /// mutex to access private member. static ACE_SYNCH_MUTEX *lock_; }; #endif /* ACE_ID_GENERATOR_H */ ace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/caching.mpc0000644000175000017500000000027615027201773021775 0ustar sudipsudip// -*- MPC -*- project(http_client) : aceexe { avoids += ace_for_tao requires += ace_filecache exename = http_client Source_Files { http_handler.cpp http_client.cpp } } ace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/URL_Array_Helper.cpp0000644000175000017500000000141315027201773023475 0ustar sudipsudip// URL_Array_Helper.cpp #ifndef ACE_URL_ARRAY_HELPER_C #define ACE_URL_ARRAY_HELPER_C #include "URL_Array_Helper.h" // Some helper functions for encoding/decoding template size_t ace_array_size (const T &x) { size_t sum = sizeof (ACE_UINT32); for (size_t i = 0; i < x.size (); i++) sum += x[i].size (); return sum; } template size_t ace_array_encode (void *buf, const T &x) { size_t len = 0; for (size_t i = 0; i < x.size (); i++) len+= x[i].encode ((void *) ((char *) buf + len)); return len ; } template size_t ace_array_decode (void *buf, T &x) { size_t len = 0; for (size_t i = 0; i < x.size (); i++) len += x[i].decode ((void *) ((char *) buf + len)); return len; } #endif /* ACE_URL_ARRAY_HELPER_C */ ace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/http_handler.h0000644000175000017500000000331215027201773022517 0ustar sudipsudip/* -*- c++ -*- */ //============================================================================= /** * @file http_handler.h * * @author James Hu */ //============================================================================= #include "ace/SOCK_Connector.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Connector.h" #include "ace/Svc_Handler.h" /** * @class HTTP_Handler * * @brief A simple HTTP protocol handler for clients. * * Checks to see if the requested file is already cached. If * so, it says so. If not, the request is issued to the * connection. The fetched file is cached. */ class HTTP_Handler : public ACE_Svc_Handler { public: HTTP_Handler (); HTTP_Handler (const char * path); /// Open hook. virtual int open (void *); /// Entry points defined by the abstract Svc_Handler. virtual int svc (); /// Accessor to the file being fetched. const char *filename () const; private: char request_[BUFSIZ]; size_t request_size_; char filename_[BUFSIZ]; size_t response_size_; }; /** * @class HTTP_Connector * * @brief A simple HTTP connector. * * Creates an HTTP Handler based on the URL, and then delegates * to to the SOCK_CONNECTOR. Adapter pattern. */ class HTTP_Connector { public: /// User entry point into the HTTP connector. int connect (const char * url); private: /// Helper function. int parseurl (const char *url, char *host, u_short *port, char *path); private: /// Factory that actively establishes a connection with an HTTP /// server. ACE_Connector connector_; }; ace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/ID_Generator.cpp0000644000175000017500000000247415027201773022710 0ustar sudipsudip#if !defined (ACE_ID_GENERATOR_C) #define ACE_ID_GENERATOR_C #include "ace/Object_Manager.h" #include "ID_Generator.h" time_t ACE_ID_Generator::last_time_ = 0; size_t ACE_ID_Generator::last_number_ = 0; ACE_SYNCH_MUTEX *ACE_ID_Generator::lock_ = 0; char * ACE_ID_Generator::get_new_id (char *id) { time_t t; size_t sn; ACE_ID_Generator::get_serial_id (t, sn); ACE_NEW_RETURN (id, char [ACE_OFFER_ID_LENGTH], 0); ACE_OS::sprintf (id, "%014d%06d", t, sn); return id; } void ACE_ID_Generator::get_serial_id (time_t &t, size_t &s) { ACE_MT (ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, *ACE_ID_Generator::get_lock ())); ACE_OS::time (&t); if (t != ACE_ID_Generator::last_time_) { ACE_ID_Generator::last_time_ = t; s = ACE_ID_Generator::last_number_ = 0; } else s = ACE_ID_Generator::last_number_++; } ACE_SYNCH_MUTEX * ACE_ID_Generator::get_lock () { #if defined (ACE_HAS_THREADS) if (ACE_ID_Generator::lock_ == 0) { ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, *ACE_Static_Object_Lock::instance (), 0)); // Double-checked Locking Optimization. if (ACE_ID_Generator::lock_ == 0) ACE_NEW_RETURN (ACE_ID_Generator::lock_, ACE_SYNCH_MUTEX, 0); } #endif /* ACE_HAS_THREADS */ return ACE_ID_Generator::lock_; } #endif /* ACE_ID_GENERATOR_C */ ace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/Local_Locator.inl0000644000175000017500000000125615027201773023120 0ustar sudipsudip// -*- C++ -*- ACE_INLINE ACE_URL_Record::ACE_URL_Record () : id_ (0), offer_ (0) { } ACE_INLINE ACE_URL_Record::ACE_URL_Record (ACE_URL_Offer *offer) : offer_ (offer) { char buf[ACE_OFFER_ID_LENGTH]; ACE_NEW (this->id_, ACE_WString (ACE_ID_Generator::get_new_id (buf))); } ACE_INLINE ACE_URL_Record::~ACE_URL_Record () { delete this->id_; delete this->offer_; } ACE_INLINE bool ACE_URL_Record::operator== (const ACE_URL_Record &rhs) const { return this == &rhs || *this->id_ == *rhs.id_; } ACE_INLINE bool ACE_URL_Record::operator!= (const ACE_URL_Record &rhs) const { return !(*this == rhs); } ACE_INLINE ACE_URL_Local_Locator::~ACE_URL_Local_Locator () { } ace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/Locator_Request_Reply.cpp0000644000175000017500000003104115027201773024664 0ustar sudipsudip#if !defined (ACE_LOCATOR_REQUEST_REPLY_C) #define ACE_LOCATOR_REQUEST_REPLY_C #include "Locator_Request_Reply.h" #if !defined (__ACE_INLINE__) #include "Locator_Request_Reply.inl" #endif #include "URL_Properties.h" #include "URL_Array_Helper.h" #include "URL_Locator.h" #include int ACE_URL_Locator_Request::url_query (const int how, const ACE_URL_Property_Seq &pseq, const int how_many) { ACE_TRACE ("ACE_URL_Locator_Request::url_query"); if (how >= ACE_URL_Locator::INVALID_SELECTION) return -1; ACE_NEW_RETURN (this->seq1_, ACE_URL_Property_Seq (pseq), -1); this->how_ = how; this->how_many_ = how_many; this->code_ = ACE_URL_Locator::QUERY; return 0; } int ACE_URL_Locator_Request::export_offer (const ACE_URL_Offer &offer) { ACE_TRACE ("ACE_URL_Locator_Request::export_offer"); ACE_NEW_RETURN (this->offer_, ACE_URL_Offer (offer), -1); this->code_ = ACE_URL_Locator::EXPORT; return 0; } int ACE_URL_Locator_Request::withdraw_offer (const ACE_WString &offer_id) { ACE_TRACE ("ACE_URL_Locator_Request::withdraw_offer"); this->id_ = offer_id; this->code_ = ACE_URL_Locator::WITHDRAW; return 0; } int ACE_URL_Locator_Request::describe_offer (const ACE_WString &offer_id) { ACE_TRACE ("ACE_URL_Locator_Request::describe_offer"); this->id_ = offer_id; this->code_ = ACE_URL_Locator::DESCRIBE; return 0; } int ACE_URL_Locator_Request::modify_offer (const ACE_WString &offer_id, const ACE_WString *url, const ACE_URL_Property_Seq &del, const ACE_URL_Property_Seq &modify) { ACE_TRACE ("ACE_URL_Locator_Request::modify_offer"); ACE_NEW_RETURN (this->seq1_, ACE_URL_Property_Seq (del), -1); ACE_NEW_RETURN (this->seq2_, ACE_URL_Property_Seq (modify), -1); if (url != 0) this->url_ = *url; this->id_ = offer_id; this->code_ = ACE_URL_Locator::MODIFY; return 0; } #define ENCODE_UINT32(ADDR,LEN,V) \ * (ACE_UINT32 *) (ADDR+LEN) = htonl (V); \ LEN += sizeof (ACE_UINT32); #define DECODE_UINT32(ADDR,LEN,V) \ V = ntohl (* (ACE_UINT32 *) (ADDR+LEN)); \ LEN += sizeof (ACE_UINT32); size_t ACE_URL_Locator_Request::encode () { ACE_TRACE ("ACE_URL_Locator_Request::encode"); size_t buf_size = this->size (); size_t total_length = 0; ACE_NEW_RETURN (this->buffer_, char [buf_size], 0); ENCODE_UINT32 (this->buffer_, total_length, buf_size); // Encode buffer size. ENCODE_UINT32 (this->buffer_, total_length, this->code_); // Encode Op code. ENCODE_UINT32 (this->buffer_, total_length, this->how_); // Encode selection criteria. ENCODE_UINT32 (this->buffer_, total_length, this->how_many_); // Encode number of offers interested. ENCODE_UINT32 (this->buffer_, total_length, this->valid_ptr_); // Encode valide pointer flag. if (this->seq1_ != 0) { ENCODE_UINT32 (this->buffer_, total_length, this->seq1_->size ()); total_length += ace_array_encode (this->buffer_ + total_length, *this->seq1_); } if (this->seq2_ != 0) { ENCODE_UINT32 (this->buffer_, total_length, this->seq2_->size ()); total_length += ace_array_encode (this->buffer_ + total_length, *this->seq2_); } if (this->offer_ != 0) total_length += this->offer_->encode (this->buffer_ + total_length); total_length += ACE_WString_Helper::encode (this->buffer_ + total_length, this->id_); total_length += ACE_WString_Helper::encode (this->buffer_ + total_length, this->url_); ACE_ASSERT (total_length == buf_size); return total_length; } size_t ACE_URL_Locator_Request::decode (void *buffer) { ACE_TRACE ("ACE_URL_Locator_Request::decode"); if (buffer == 0) return 0; // Check if we have a valid buffer available. char *cbuffer = (char *) buffer; size_t buf_size; size_t total_length = 0; DECODE_UINT32 (cbuffer, total_length, buf_size); // Decode length of buffer size first. DECODE_UINT32 (cbuffer, total_length, this->code_); // Get the operation code. DECODE_UINT32 (cbuffer, total_length, this->how_); // Decode selection criteria. DECODE_UINT32 (cbuffer, total_length, this->how_many_); // Decode number of offers interested. DECODE_UINT32 (cbuffer, total_length, this->valid_ptr_); // Decode valide pointer flag. if ((this->valid_ptr_ & VALID_SEQ1) != 0) { size_t n; DECODE_UINT32 (cbuffer, total_length, n); ACE_NEW_RETURN (this->seq1_, ACE_URL_Property_Seq (n), 0); total_length += ace_array_decode (cbuffer + total_length, *this->seq1_); } if ((this->valid_ptr_ & VALID_SEQ2) != 0) { size_t n; DECODE_UINT32 (cbuffer, total_length, n); ACE_NEW_RETURN (this->seq2_, ACE_URL_Property_Seq (n), 0); total_length += ace_array_decode (cbuffer + total_length, *this->seq2_); } if ((this->valid_ptr_ & VALID_OFFER) != 0) { ACE_NEW_RETURN (this->offer_, ACE_URL_Offer, 0); total_length += this->offer_->decode (cbuffer + total_length); } this->id_ = ACE_WString ((ACE_UINT16 *) (cbuffer + total_length)); total_length += ACE_WString_Helper::decode (cbuffer + total_length); this->url_ = ACE_WString ((ACE_UINT16 *) (cbuffer + total_length)); total_length += ACE_WString_Helper::decode (cbuffer + total_length); ACE_ASSERT (total_length == buf_size); return total_length; } size_t ACE_URL_Locator_Request::size () { ACE_TRACE ("ACE_URL_Locator_Request::size"); size_t total_length = 5 * sizeof (ACE_UINT32); // There are 5 UINT32 variables at the beginning // of the buffer. , , , // , . this->valid_ptr_ = 0; // Check valid pointers and mark corresponding flag in . if (this->seq1_ != 0) { this->valid_ptr_ |= VALID_SEQ1; total_length += ace_array_size (*this->seq1_); } if (this->seq2_ != 0) { this->valid_ptr_ |= VALID_SEQ2; total_length += ace_array_size (*this->seq2_); } if (this->offer_ != 0) { this->valid_ptr_ |= VALID_OFFER; total_length += this->offer_->size (); } total_length += ACE_WString_Helper::size (this->id_); total_length += ACE_WString_Helper::size (this->url_); return total_length; } void ACE_URL_Locator_Request::dump () const { //ACE_TRACE ("ACE_URL_Locator_Request::dump"); size_t i; ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); if (this->code_ < ACE_URL_Locator::INVALID_OPERATION) ACE_DEBUG ((LM_DEBUG, "%s Request:\n", ACE_URL_Locator::opname[this->code_])); else ACE_DEBUG ((LM_DEBUG, "Invalid Operation: %d\n", this->code_)); if (this->how_ < ACE_URL_Locator::INVALID_SELECTION) ACE_DEBUG ((LM_DEBUG, "Select: %s\n", ACE_URL_Locator::selection_name[this->how_])); else ACE_DEBUG ((LM_DEBUG, "Invalid selection method: %d\n", this->how_)); ACE_DEBUG ((LM_DEBUG, "At most %d reply.\n", this->how_many_)); ACE_DEBUG ((LM_DEBUG, "Valid pointer pattern: %x\n", this->valid_ptr_)); ACE_DEBUG ((LM_DEBUG, "Property sequence 1: %x\n", this->seq1_)); if (this->seq1_ != 0) for (i = 0; i < this->seq1_->size (); i++) (*this->seq1_)[i].dump (); ACE_DEBUG ((LM_DEBUG, "Property sequence 2: %x\n", this->seq2_)); if (this->seq2_ != 0) for (i = 0; i < this->seq2_->size (); i++) (*this->seq2_)[i].dump(); ACE_DEBUG ((LM_DEBUG, "Offer: %x\n", this->offer_)); if (this->offer_ != 0) this->offer_->dump (); if (this->id_.length () > 0) ACE_DEBUG ((LM_DEBUG, "Offer ID: %s\n", std::unique_ptr (this->id_.char_rep ()).get ())); else ACE_DEBUG ((LM_DEBUG, "Offer ID: \"\"\n")); if (this->url_.length () > 0) ACE_DEBUG ((LM_DEBUG, "URL: %s\n", std::unique_ptr (this->url_.char_rep ()).get ())); else ACE_DEBUG ((LM_DEBUG, "URL: \"\"\n")); ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } int ACE_URL_Locator_Reply::status_reply (u_int op, int result) { ACE_TRACE ("ACE_URL_Locator_Reply::status_reply"); this->code_ = op; this->status_ = result; return 0; } int ACE_URL_Locator_Reply::query_reply (int result, size_t num, const ACE_URL_Offer_Seq &offers) { ACE_TRACE ("ACE_URL_Locator_Reply::query_reply"); this->code_ = ACE_URL_Locator::QUERY; this->status_ = result; ACE_NEW_RETURN (this->offers_, ACE_URL_Offer_Seq (offers), -1); return 0; } int ACE_URL_Locator_Reply::describe_reply (int result, const ACE_URL_Offer &offer) { ACE_TRACE ("ACE_URL_Locator_Reply::describe_reply"); this->code_ = ACE_URL_Locator::DESCRIBE; this->status_ = result; ACE_NEW_RETURN (this->offer_, ACE_URL_Offer (offer), -1); return 0; } size_t ACE_URL_Locator_Reply::encode () { ACE_TRACE ("ACE_URL_Locator_Reply::encode"); size_t buf_size = this->size (); size_t total_length = 0; ACE_NEW_RETURN (this->buffer_, char [buf_size], 0); ENCODE_UINT32 (this->buffer_, total_length, buf_size); // Encode buffer size. ENCODE_UINT32 (this->buffer_, total_length, this->code_); // Encode Op code. ENCODE_UINT32 (this->buffer_, total_length, this->status_); // Encode Op result status. ENCODE_UINT32 (this->buffer_, total_length, this->num_offers_); // Encode number of offers in this->offers_. ENCODE_UINT32 (this->buffer_, total_length, this->valid_ptr_); // Encode valid pointers mask. if (this->offer_ != 0) total_length += this->offer_->encode (this->buffer_ + total_length); if (this->offers_ != 0) { ENCODE_UINT32 (this->buffer_, total_length, this->offers_->size ()); total_length += ace_array_encode (this->buffer_ + total_length, *this->offers_); } ACE_ASSERT (total_length == buf_size); return 0; } size_t ACE_URL_Locator_Reply::decode (void *buffer) { ACE_TRACE ("ACE_URL_Locator_Reply::decode"); if (buffer == 0) return 0; // Check if we have a buffer available. char *cbuffer = (char *) buffer; size_t buf_size; size_t total_length = 0; DECODE_UINT32 (cbuffer, total_length, buf_size); // Get the length of the buffer first. DECODE_UINT32 (cbuffer, total_length, this->code_); // Decode Op code. DECODE_UINT32 (cbuffer, total_length, this->status_); // Decode Op result status. DECODE_UINT32 (cbuffer, total_length, this->num_offers_); // Decode number of offers in this->offers_. DECODE_UINT32 (cbuffer, total_length, this->valid_ptr_); // Decode valid pointers mask. if ((this->valid_ptr_ & VALID_OFFER) != 0) { ACE_NEW_RETURN (this->offer_, ACE_URL_Offer, 0); total_length += this->offer_->decode (cbuffer + total_length); } if ((this->valid_ptr_ & VALID_OFFERS) != 0) { size_t n; DECODE_UINT32 (cbuffer, total_length, n); ACE_NEW_RETURN (this->offers_, ACE_URL_Offer_Seq (n), 0); total_length += ace_array_decode (cbuffer + total_length, *this->offers_); } ACE_ASSERT (total_length ==buf_size); return 0; } size_t ACE_URL_Locator_Reply::size () { ACE_TRACE ("ACE_URL_Locator_Reply:size"); size_t total_length = 5 * sizeof (ACE_UINT32); // size for 5 ACE_UINT32 objects: , , // , , and . this->valid_ptr_ = 0; if (this->offer_ != 0) { this->valid_ptr_ |= VALID_OFFER; total_length += this->offer_->size (); } if (this->offers_ != 0) { this->valid_ptr_ |= VALID_OFFERS; total_length += ace_array_size (*this->offers_); } return total_length; } void ACE_URL_Locator_Reply::dump () const { //ACE_TRACE ("ACE_URL_Locator_Reply::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); if (this->code_ < ACE_URL_Locator::INVALID_OPERATION) ACE_DEBUG ((LM_DEBUG, "Original request: %s\n", ACE_URL_Locator::opname[this->code_])); else ACE_DEBUG ((LM_DEBUG, "Invalid Original Request: %d\n", this->code_)); if (this->status_ < ACE_URL_Locator::MAX_URL_ERROR) ACE_DEBUG ((LM_DEBUG, "Reply status: %s\n", ACE_URL_Locator::err_name[this->status_])); else ACE_DEBUG ((LM_DEBUG, "Invalid reply status: %d\n", this->status_)); ACE_DEBUG ((LM_DEBUG, "Number of offers: %d\n", this->num_offers_)); ACE_DEBUG ((LM_DEBUG, "Valid pointer pattern: %x\n", this->valid_ptr_)); ACE_DEBUG ((LM_DEBUG, "Offer: %x\n", this->offer_)); if (this->offer_ != 0) this->offer_->dump (); ACE_DEBUG ((LM_DEBUG, "Offer sequence: %x\n", this->offers_)); if (this->offers_ != 0) for (size_t i = 0; i < this->offers_->size (); i++) (*this->offers_)[i].dump(); ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } #endif /* ACE_LOCATOR_REQUEST_REPLY_C */ ace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/Locator_Request_Reply.h0000644000175000017500000001344615027201773024342 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Locator_Request_Reply.h * * @author Nanbor Wang */ //============================================================================= #ifndef ACE_LOCATOR_REQUEST_REPLY_H #define ACE_LOCATOR_REQUEST_REPLY_H #include "URL_Properties.h" /** * @class ACE_URL_Locator_Request * * @brief A URL request message formater/wrapper. * * This class defines a URL request data. It is used * to transform requests to an object so that we can * ship them across network. */ class ACE_Svc_Export ACE_URL_Locator_Request { public: /// Default ctor. ACE_URL_Locator_Request (); /// Default dtor. ~ACE_URL_Locator_Request (); /** * Query the locator for HTTP with designate properties (none, some, * or all). The locator being queried will return a sequence of * offers with offers in it. This interface allocates * so users must deallocate it after use. */ int url_query (const int how, const ACE_URL_Property_Seq &pseq, const int how_many); /// Export an offer to the locator. int export_offer (const ACE_URL_Offer &offer); /// Withdraw an offer. return 0 if succeed, -1 otherwise. int withdraw_offer (const ACE_WString &offer_id); /// Query a specific offer. int describe_offer (const ACE_WString &offer_id); /// Modify a previously registered offer. int modify_offer (const ACE_WString &offer_id, const char *url = 0, const ACE_URL_Property_Seq &del = 0, const ACE_URL_Property_Seq &modify = 0); /// Modify a previously registered offer. int modify_offer (const ACE_WString &offer_id, const ACE_WString *url = 0, const ACE_URL_Property_Seq &del = 0, const ACE_URL_Property_Seq &modify = 0); /// Encode request for network communication. If succeed, /// returns the size of the buffer, otherwise, return 0. size_t encode (); /** * Restore from network data. Returns size of the buffer * if succeed, 0 otherwise. When passing in a buffer, * caller must take the responsibility to delete the buffer * afterward, if so needed. */ size_t decode (void *buffer); /// A bunch of methods to access internal data. const int how () const; const int how_many () const; const u_int opcode () const; const ACE_URL_Property_Seq *seq () const; const ACE_URL_Property_Seq *del () const; const ACE_URL_Property_Seq *modify () const; const ACE_URL_Offer *offer () const; const ACE_WString &id () const; const ACE_WString &url () const; const char *buffer () const; /// Print out this object. void dump () const; protected: /// Return the size of the buffer required to encode /// this request. size_t size (); enum { VALID_SEQ1 = 0x1, VALID_SEQ2 = 0X2, VALID_OFFER = 0X4 }; // These constants used to indicate which pointers are valid. /// Request type code. u_int code_; /// Query method (if code_ == QUERY.) int how_; /// How many offers are we interested in in this query. int how_many_; /// Bit flag to mark valid pointers within this object. int valid_ptr_; /// For query or del in modify_offer. ACE_URL_Property_Seq *seq1_; /// For modify seq. in modify_offer. ACE_URL_Property_Seq *seq2_; /// Offer to export. ACE_URL_Offer *offer_; /// Offer ID. ACE_WString id_; /// URL of this offer. ACE_WString url_; /// Buffer to store encoded data. char *buffer_; }; /** * @class ACE_URL_Locator_Reply * * @brief A URL reply message formater/wrapper. * * This class defines a URL reply data. It is used * to transform reply messages to an object so that we can * ship them across network. */ class ACE_Svc_Export ACE_URL_Locator_Reply { public: /// Default ctor. ACE_URL_Locator_Reply (); /// Default dtor. ~ACE_URL_Locator_Reply (); /// Setup a reply message for EXPORT, WITHDRAW, or MODIFY operations. int status_reply (u_int op, int result); /// Setup a reply for QUERY operation. int query_reply (int result, size_t num, const ACE_URL_Offer_Seq &offers); /// Construct a reply for DESCRIBE operation. int describe_reply (int result, const ACE_URL_Offer &offer); /// Encode request for network communication. If succeed, /// returns the size of the buffer, otherwise, return 0. size_t encode (); /** * Restore from network data. Returns size of the buffer * if succeed, 0 otherwise. When passing in a buffer, * caller must take the responsibility to delete the buffer * afterward, if so needed. */ size_t decode (void *buffer); // Accessor function. const size_t num_offers () const; const ACE_URL_Offer *offer () const; const ACE_URL_Offer_Seq *offers () const; const u_int opcode () const; const u_int status () const; const char *buffer () const ; /// Print out this object. void dump () const ; protected: /// Return the size of the buffer required to encode /// this request. size_t size (); enum { VALID_OFFER = 0x1, VALID_OFFERS = 0x2 }; // Valid pointer masks. /// Holds the original op code. u_int code_; /// Holds the result of an operation from the Location Server. int status_; /// Holds the number of valid offers in the offers_ sequence. size_t num_offers_; /// Flag that marks valid internal pointers. int valid_ptr_; /// Holds a single offer. Used in query offer property. ACE_URL_Offer *offer_; /// Holds the replying offer sequence from a Locator. ACE_URL_Offer_Seq *offers_; /// Buffer to store encoded data. char *buffer_; }; #if defined (__ACE_INLINE__) #include "Locator_Request_Reply.inl" #endif /* __ACE_INLINE__ */ #endif /* ACE_LOCATOR_REQUEST_REPLY_H */ ace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/URL_Array_Helper.h0000644000175000017500000000126215027201773023144 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file URL_Array_Helper.h * * @author Nanbor Wang */ //============================================================================= #ifndef ACE_URL_ARRAY_HELPER_H #define ACE_URL_ARRAY_HELPER_H // ### These template functions are probably named improperly. // You should find some way to avoid name space polution. template size_t ace_array_size (const T &x); template size_t ace_array_encode (void *buf, const T &x); template size_t ace_array_decode (void *buf, T &x); #include "URL_Array_Helper.cpp" #endif /* ACE_URL_ARRAY_HELPER_H */ ace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/http_client.cpp0000644000175000017500000000317215027201773022717 0ustar sudipsudip //============================================================================= /** * @file http_client.cpp * * This is a very simple client. It accepts URLs from a prompt, and * will try to fetch them. Also accepts shell escapes. * * @author James Hu */ //============================================================================= #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_ctype.h" #include "http_handler.h" int ACE_TMAIN (int, ACE_TCHAR *[]) { // Present a command line. // * Accept a URL. // Pass it to the HTTP_Connector. // Connect. // Report status. // * Accept shell escape character. char buf[BUFSIZ]; ACE_DEBUG ((LM_DEBUG, "* ")); while (ACE_OS::fgets (buf, sizeof (buf), stdin) != 0) { char *s = buf; // get rid of trailing '\n' int len = ACE_OS::strlen (s); if (len > 0 && s[len - 1] == '\n') s[len - 1] = 0; while (ACE_OS::ace_isspace (*s)) s++; if (*s == '!') { do s++; while (ACE_OS::ace_isspace (*s)); // Shell command. if (ACE_OS::system (ACE_TEXT_CHAR_TO_TCHAR (s)) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT (" ! Error executing: %C\n"), s)); } else if (ACE_OS::strncmp (s, "http://", 7) == 0) { // URL HTTP_Connector connector; connector.connect (s); } else ACE_ERROR ((LM_ERROR, ACE_TEXT (" ? I don't understand: %C\n"), s)); ACE_ERROR ((LM_ERROR, ACE_TEXT ("* "))); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nBye!\n"))); return 0; } ace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/http_handler.cpp0000644000175000017500000001271315027201773023057 0ustar sudipsudip //============================================================================= /** * @file http_handler.cpp * * @author James Hu */ //============================================================================= #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/Filecache.h" #include "http_handler.h" HTTP_Handler::HTTP_Handler () { } HTTP_Handler::HTTP_Handler (const char * path) { // How long is the request going to be? this->request_[0] = '\0'; this->request_size_ = ACE_OS::strlen ("GET ") + ACE_OS::strlen (path) + ACE_OS::strlen (" HTTP/1.0\r\nAccept: HTTP/1.0\r\n\r\n"); // Make the request. if ((u_int) this->request_size_ < sizeof (this->request_)) ACE_OS::sprintf (this->request_, "GET %s HTTP/1.0\r\nAccept: HTTP/1.0\r\n\r\n", path); // Find the filename. const char *last = ACE_OS::strrchr (path, '/'); if (last == 0) last = path; else if (last[1] == '\0') last = "index.html"; else last = last+1; ACE_OS::sprintf (this->filename_, "%s", last); } int HTTP_Handler::open (void *) { // If you want threads, use the activate stuff. #if 0 if (this->activate () != 0) { ACE_ERROR_RETURN ((LM_ERROR, "HTTP_Handler::open, whups!\n"), -1); } return 0; #else return this->svc (); #endif /* 0 */ } int HTTP_Handler::svc () { static char buf[BUFSIZ]; int count = 0; ACE_DEBUG ((LM_DEBUG, "[%t] sending request --\n%s", this->request_)); this->peer ().send_n (this->request_, this->request_size_); // Read in characters until encounter \r\n\r\n int done = 0; char *contentlength; do { while (((count += this->peer ().recv_n (buf + count, 1)) > 0) && ((u_int) count < sizeof (buf))) { buf[count] = '\0'; if (count < 2) continue; done = ACE_OS::strcmp (buf + count - 4, "\n\n") == 0; if (done) break; if (count < 4) continue; done = ACE_OS::strcmp (buf + count - 4, "\r\n\r\n") == 0; if (done) break; } if (!done) { char *last = ACE_OS::strrchr (buf, '\n'); last[0] = '\0'; if ((contentlength = ACE_OS::strstr (buf, "\nContent-length:")) || (contentlength = ACE_OS::strstr (buf, "\nContent-Length:"))) done = 1; else { last[0] = '\n'; count = ACE_OS::strlen (last); ACE_OS::memmove (buf, last, count + 1); } } else { contentlength = ACE_OS::strstr (buf, "\nContent-length:"); if (!contentlength) contentlength = ACE_OS::strstr (buf, "\nContent-Length:"); } } while (!done); // ASSERT (contentlength != 0) int size = 0; if (contentlength && (::sscanf (contentlength, "\nContent-%*[lL]ength: %d ", &size) == 1)) { this->response_size_ = size; ACE_Filecache_Handle afh (ACE_TEXT_CHAR_TO_TCHAR (this->filename_), this->response_size_); this->peer ().recv_n (afh.address (), this->response_size_); ACE_DEBUG ((LM_DEBUG, " ``%s'' is now cached.\n", this->filename_)); } else { // Maybe we should do something more clever here, such as extend // ACE_Filecache_Handle to allow the creation of cache objects // whose size is unknown? // Another possibility is to write the contents out to a file, // and then cache it. // Perhaps make ACE_Filecache_Handle more savvy, and allow a // constructor which accepts a PEER as a parameter. ACE_DEBUG ((LM_DEBUG, "HTTP_Handler, no content-length header!\n")); } return 0; } const char * HTTP_Handler::filename () const { return this->filename_; } int HTTP_Connector::connect (const char * url) { char host[BUFSIZ]; u_short port; char path[BUFSIZ]; if (this->parseurl (url, host, &port, path) == -1) { ACE_DEBUG ((LM_DEBUG, "HTTP_Connector, error parsing url: %s\n", url)); return -1; } HTTP_Handler hh (path); HTTP_Handler *hhptr = &hh; // First check the cache. if (ACE_Filecache::instance ()->find (ACE_TEXT_CHAR_TO_TCHAR (hh.filename ())) == 0) { ACE_DEBUG ((LM_DEBUG, " ``%s'' is already cached.\n", hh.filename ())); return 0; } return this->connector_.connect (hhptr, ACE_INET_Addr (port, host)); } #define DEFAULT_SERVER_PORT 80 // extract the main components of a URL int HTTP_Connector::parseurl (const char *url, char *host, u_short *port, char *path) { int status = 0; // hackish, but useful if (3 != ::sscanf (url, "http://%[^:/]:%hu%s", host, port, path)) { if (2 != ::sscanf (url, "http://%[^:/]:%hu", host, port)) { if (2 != ::sscanf (url, "http://%[^:/]%s", host, path)) { if (1 != ::sscanf (url, "http://%[^:/]", host)) status = -1; else { *port = DEFAULT_SERVER_PORT; ACE_OS::strcpy (path, "/"); } } else *port = DEFAULT_SERVER_PORT; } else ACE_OS::strcpy (path, "/"); } // 0 => success // -1 => error return status; } ace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/URL_Properties.inl0000644000175000017500000000647115027201773023265 0ustar sudipsudip// -*- C++ -*- ACE_INLINE size_t ACE_WString_Helper::size (const ACE_WString &wstr) { return (wstr.length () + 1) * sizeof (ACE_UINT16); } ACE_INLINE ACE_URL_Property::ACE_URL_Property (const char *name, const char *value) : name_ (name), value_ (value) { } ACE_INLINE ACE_URL_Property::ACE_URL_Property (const ACE_UINT16 *name, const ACE_UINT16 *value) : name_ (name), value_ (value) { } ACE_INLINE ACE_URL_Property::ACE_URL_Property (const ACE_URL_Property &p) : name_ (p.name_), value_ (p.value_) { } ACE_INLINE ACE_URL_Property::~ACE_URL_Property () { } ACE_INLINE ACE_URL_Property & ACE_URL_Property::operator= (const ACE_URL_Property &rhs) { if (this != &rhs) { this->name_ = rhs.name_; this->value_ = rhs.value_; } return *this; } ACE_INLINE bool ACE_URL_Property::operator== (const ACE_URL_Property &rhs) const { if (this == &rhs || this->name_ != rhs.name_ || this->value_ != rhs.value_) return true; else return false; } ACE_INLINE bool ACE_URL_Property::operator!= (const ACE_URL_Property &rhs) const { return !(*this == rhs); } ACE_INLINE ACE_WString & ACE_URL_Property::name_rep () { return this->name_; } ACE_INLINE const ACE_WString & ACE_URL_Property::name () const { return this->name_; } ACE_INLINE void ACE_URL_Property::name (const char *n) { this->name_ = ACE_WString (n); } ACE_INLINE void ACE_URL_Property::name (const ACE_UINT16 *n) { this->name_ = ACE_WString (n); } ACE_INLINE ACE_WString & ACE_URL_Property::value_rep () { return this->value_; } ACE_INLINE const ACE_WString & ACE_URL_Property::value () const { return this->value_; } ACE_INLINE void ACE_URL_Property::value (const char *v) { this->value_ = ACE_WString (v); } ACE_INLINE void ACE_URL_Property::value (const ACE_UINT16 *v) { this->value_ = ACE_WString (v); } ACE_INLINE size_t ACE_URL_Property::size () const { size_t len = 2; len += this->name_.length () + this->value_.length (); return len * sizeof (ACE_UINT16); } ACE_INLINE ACE_URL_Offer::ACE_URL_Offer (const size_t size, const char *url) : url_ (url), prop_ (size) { } ACE_INLINE ACE_URL_Offer::ACE_URL_Offer (const ACE_URL_Offer &o) : url_ (o.url_), prop_ (o.prop_) { } ACE_INLINE ACE_URL_Offer::~ACE_URL_Offer () { } ACE_INLINE ACE_URL_Offer & ACE_URL_Offer::operator= (const ACE_URL_Offer &rhs) { if (this != &rhs) { this->url_ = rhs.url_; this->prop_ = rhs.prop_; } return *this; } ACE_INLINE bool ACE_URL_Offer::operator== (const ACE_URL_Offer &rhs) const { if (this == &rhs && this->url_ == rhs.url_ && this->prop_ == rhs.prop_) return true; else return false; } ACE_INLINE bool ACE_URL_Offer::operator!= (const ACE_URL_Offer &rhs) const { return !(*this == rhs); } ACE_INLINE ACE_WString & ACE_URL_Offer::url_rep () { return this->url_; } ACE_INLINE const ACE_WString & ACE_URL_Offer::url () const { return this->url_; } ACE_INLINE void ACE_URL_Offer::url (const ACE_UINT16 *url) { this->url_ = ACE_WString (url); } ACE_INLINE void ACE_URL_Offer::url (const char *url) { this->url_ = ACE_WString (url); } ACE_INLINE ACE_URL_Property_Seq & ACE_URL_Offer::url_properties () { return this->prop_; } ACE_INLINE void ACE_URL_Offer::url_properties (const ACE_URL_Property_Seq &prop) { this->prop_ = prop; } ace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/README0000644000175000017500000000476215027201773020564 0ustar sudipsudip# -*- text -*- # Hey, Emacs! This is a TEXT file. ---------------------------------- README for the caching http_client ---------------------------------- This is the README file for the simple caching http_client. ------------ 1. Compiling ------------ 1a. Compiling on UNIX. On UNIX, with a properly configured ACE distribution, just type make (using GNU make, of course). 1b. Compiling on NT. Thus far, this code has only been tested under UNIX. A Windows NT version will be out soon. ------------ 2. Executing ------------ 2a. Command line parameters. The program does not support any command line parameters. 2b. General information. When the program runs, the client offers a ``*'' as a prompt. At the prompt, you may enter a URL. The client will check to see if the filename portion of the URL has already been cached. If so, a message appears saying so. If not, the client will fetch the file from the HTTP server and then cache it. Furthermore, the client supports the ``!'' shell escape command. The content after the ``!'' will be executed by a shell. To exit the session, send the end-of-file character (typically, ^D in UNIX). unix$ ./http_client * http://www.cs.wustl.edu/cs/Art/brookings.gif [1] sending request -- GET /cs/Art/brookings.gif HTTP/1.0 Accept: HTTP/1.0 ``brookings.gif'' is now cached. * http://www.cs.wustl.edu/cs/Art/brookings.gif ``brookings.gif'' is already cached. * !ls Makefile http_client http_handler.cpp zJAWSAAAa000Yg brookings.gif http_client.cpp http_handler.h * ^D Bye! unix$ ls Makefile http_client http_handler.cpp brookings.gif http_client.cpp http_handler.h unix$ -------------- 3. Limitations -------------- The caching mechanism as currently implemented requires a ``Content-length:'' to appear in the response header of the HTTP response. This is because the caching utilizes mmap () to allocate space for the file to be cached before the file is received. Unitl the caching mecahnism is extended, you are limited to using servers which will report the size of the file being transmitted. Currently, the cache creates temporary files (see the above sample execution). The cache is not persistent between executions. Suggestions and other correspondence should be sent to me: James Hu ace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/URL_Locator.cpp0000644000175000017500000000130515027201773022523 0ustar sudipsudip#if !defined (ACE_URL_LOCATOR_C) #define ACE_URL_LOCATOR_C #include "URL_Locator.h" const char * const ACE_URL_Locator::opname[] = // Human readable operation name { "Query", "Export", "Withdraw", "Describe", "Modify", "Invalid Operation" }; const char * const ACE_URL_Locator::selection_name[] = { "None", "Some", "All", "Invalid Selection" }; const char * const ACE_URL_Locator::err_name[] = { "No error", "Offer already exist", "no such offer", "invalid argument", "function not implemented", "unknown error" }; ACE_URL_Locator::~ACE_URL_Locator () { } const char * ACE_URL_Locator::error_status () { return "Not implemented yet."; } #endif /* ACE_URL_LOCATOR_C */ ace-8.0.4+dfsg.orig/apps/JAWS/clients/Caching/Local_Locator.h0000644000175000017500000000647315027201773022573 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Local_Locator.h * * @author Nanbor Wang */ //============================================================================= #ifndef ACE_LOCAL_LOCATOR_H #define ACE_LOCAL_LOCATOR_H #include "URL_Locator.h" #include "ace/Containers.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ID_Generator.h" /** * @class ACE_URL_Record * * @brief A URL Record. * * A record placed in URL repository. Notice that * both member pointers are own by URL_Record. * They will get deallocated when the object goes * out of scope. */ class ACE_Svc_Export ACE_URL_Record { /** * We are making ACE_Node as friend class because we don't want * others to access default constructor and pushing in an invalid * record. However, container classes need to use default constructor * for its head record. */ friend class ACE_URL_Local_Locator; friend class ACE_Node; public: /// ctor. ACE_URL_Record (ACE_URL_Offer *offer); /// dtor. ~ACE_URL_Record (); /// Two records are equal if they have the same offer id. bool operator== (const ACE_URL_Record &rhs) const; /// Unequal, complement of equal. bool operator!= (const ACE_URL_Record &rhs) const; private: /// Default ctor. This is put here to prevent users from /// pushing in an invalid record. ACE_URL_Record (); /// Offer ID in the repository. ACE_WString *id_; /// Offer (and its properties). ACE_URL_Offer *offer_; }; /** * @class ACE_URL_Local_Locator * * @brief A simple URL repository to store URL offer locally. * * This class manage a collection of URL offers * for local query and registration. But we should * really use it within a server. */ class ACE_Svc_Export ACE_URL_Local_Locator { /// Default destructor. virtual ~ACE_URL_Local_Locator (); /** * Query the locator for HTTP with designate properties (none, some, * or all). The locator being queried will return a sequence of * offers with offers in it. This interface allocates * so users must deallocate it after use. */ virtual int url_query (const ACE_URL_Locator::ACE_Selection_Criteria how, const ACE_URL_Property_Seq *pseq, const size_t how_many, size_t &num_query, ACE_URL_Offer_Seq *offer); /// Export an offer to the locator. virtual int export_offer (ACE_URL_Offer *offer, ACE_WString &offer_id); /// Withdraw an offer. return 0 if succeed, -1 otherwise. virtual int withdraw_offer (const ACE_WString &offer_id); /// Query a specific offer. virtual int describe_offer (const ACE_WString &offer_id, ACE_URL_Offer *offer); /// Modify a previously registered offer. virtual int modify_offer (const ACE_WString &offer_id, const ACE_WString *url = 0, const ACE_URL_Property_Seq *del = 0, const ACE_URL_Property_Seq *modify = 0); protected: ACE_Unbounded_Set repository_; }; #if defined (__ACE_INLINE__) #include "Local_Locator.inl" #endif /* __ACE_INLINE__ */ #endif /* ACE_LOCAL_LOCATOR_H */ ace-8.0.4+dfsg.orig/apps/JAWS/clients/Blobby/0000755000175000017500000000000015046037655017557 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/JAWS/clients/Blobby/Blob.h0000644000175000017500000000443115027201773020601 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Blob.h * * This is the ACE_Blob class, which is the API for doing file * uploads/downloads. * * @author Prashant Jain and Sumedh Mungee */ //============================================================================= #ifndef ACE_BLOB_H #define ACE_BLOB_H #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/INET_Addr.h" #include "ace/Svc_Handler.h" #include "ace/SOCK_Connector.h" #include "ace/Connector.h" #include "ace/Message_Block.h" #include "Blob_Handler.h" /** * @class ACE_Blob * * @brief Blob is intended to provide application API to * classes that wish to do network i/o at a very * high level of abstraction. * = This class provides the ability to retrieve data from * the network, of specified length and offset, and potentially * use any protocol "under the hood" to do so. It currently * uses HTTP. See Blob_Handler also. */ class ACE_Blob { public: ACE_Blob (); ~ACE_Blob (); /// initializes the class with the given filename, hostname and port. /// it should be called with the filename, before any read/write calls int open (const ACE_TCHAR *filename, const ACE_TCHAR *hostname = ACE_DEFAULT_SERVER_HOST, u_short port = 80); /** * starts a connection, and reads a file from the server, * of length and offset as specified, into Message_Block mb * The message block should have capacity to hold length number * of bytes */ int read (ACE_Message_Block *mb, size_t length, size_t offset); /** * starts a connection, and writes a file to the server, * of length and offset as specified, from Message_Block mb * thus the message block should contain atleast length + offset * bytes of data */ int write (ACE_Message_Block *mb, size_t length, size_t offset); /// Frees memory allocated for filename. int close (); private: /// store the internet address of the server ACE_INET_Addr inet_addr_; /// The filename ACE_TCHAR *filename_; /// The connector endpoint to initiate the client connection ACE_Connector connector_; }; #endif /* ACE_BLOB_H */ ace-8.0.4+dfsg.orig/apps/JAWS/clients/Blobby/Blob_Handler.cpp0000644000175000017500000002517015027201773022574 0ustar sudipsudip#include "Blob_Handler.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_strings.h" // Empty constructor for compliance with new Connector behavior. ACE_Blob_Handler::ACE_Blob_Handler () { } // Always use this constructor ACE_Blob_Handler::ACE_Blob_Handler (ACE_Message_Block * mb, size_t length, size_t offset, ACE_TCHAR *filename) : mb_ (mb), length_ (length), offset_ (offset), filename_ (ACE_OS::strdup (filename)), bytecount_ (0) { } ACE_Blob_Handler::~ACE_Blob_Handler () { if (filename_) { ACE_OS::free ((void *) filename_); filename_ = 0; } } // Called by Connector after connection is established int ACE_Blob_Handler::open (void *) { if (this->send_request () != 0) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Blob_Handler::open():send_request failed"), -1); if (this->receive_reply () != 0) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Blob_Handler::open():receive_reply failed"), -1); return 0; } // No-op int ACE_Blob_Handler::close (u_long flags) { ACE_UNUSED_ARG (flags); return 0; } // Always overridden by the derived classes int ACE_Blob_Handler::send_request () { return -1; } // Always overridden by the derived classes int ACE_Blob_Handler::receive_reply () { return -1; } // used to retrieve the number of bytes read/written by the // last operation on the Blob int ACE_Blob_Handler::byte_count () { return bytecount_; } // Reader ************************************************** ACE_Blob_Reader::ACE_Blob_Reader (ACE_Message_Block * mb, size_t length, size_t offset, ACE_TCHAR *filename, const char *request_prefix, const char *request_suffix) : ACE_Blob_Handler (mb, length, offset, filename), request_prefix_ (request_prefix), request_suffix_ (request_suffix) { } // Send the HTTP request int ACE_Blob_Reader::send_request () { char mesg [MAX_HEADER_SIZE]; // Check to see if the request is too big if (MAX_HEADER_SIZE < (ACE_OS::strlen (request_prefix_) + ACE_OS::strlen (filename_) + ACE_OS::strlen (request_suffix_) + 4)) ACE_ERROR_RETURN((LM_ERROR,"Request too large!"), -1); // Create a message to send to the server requesting retrieval of the file int len = ACE_OS::sprintf (mesg, "%s %s %s", request_prefix_, ACE_TEXT_ALWAYS_CHAR (filename_), request_suffix_); // Send the message to server if (peer ().send_n (mesg, len) != len) ACE_ERROR_RETURN((LM_ERROR,"Error sending request"), -1); return 0; } // Recieve the HTTP Reply int ACE_Blob_Reader::receive_reply () { ssize_t len; char buf [MAX_HEADER_SIZE + 1]; char *buf_ptr; size_t bytes_read = 0; size_t bytes_left = this->length_; size_t offset_left = this->offset_; // Receive the first MAX_HEADER_SIZE bytes to be able to strip off the // header. Note that we assume that the header will fit into the // first MAX_HEADER_SIZE bytes of the transmitted data. if ((len = peer ().recv_n (buf, MAX_HEADER_SIZE)) >= 0) { buf[len] = '\0'; // Search for the header termination string "\r\n\r\n", or "\n\n". If // found, move past it to get to the data portion. if ((buf_ptr = ACE_OS::strstr (buf,"\r\n\r\n")) != 0) buf_ptr += 4; else if ((buf_ptr = ACE_OS::strstr (buf, "\n\n")) != 0) buf_ptr += 2; else buf_ptr = buf; // Determine number of data bytes read. This is equal to the // total bytes read minus number of header bytes. bytes_read = (buf + len) - buf_ptr; } else ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Blob_Reader::receiveReply():Error while reading header"), -1); // *************************************************************** // At this point, we have stripped off the header and are ready to // process data. buf_ptr points to the data // First adjust for offset. There are two cases: // (1) The first block of data encountered the offset. In this case // we simply increment the buf_ptr by offset. // (2) The first block of data did not encounter the offset. That // is, the offset needs to go past the number of data bytes already read. if (bytes_read > offset_left) { // The first case is true -- that is offset is less than the // data bytes we just read. buf_ptr += offset_left; // Determine how many data bytes are actually there. This is // basically the total number of data bytes we read minus any // offset we have. size_t data_bytes = bytes_read - offset_left; // Check for the case where the bytes read are enough to fulfill // our request (for length bytes). If this is the case, then we // don't need to do any extra recvs and can simply return with // the data. if (data_bytes >= bytes_left) { // The first block contains enough data to satisfy the // length. So copy the data into the message buffer. if (mb_->copy (buf_ptr, bytes_left) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE Blob_Reader::receiveReply():Error copying data into Message_Block"), -1); bytecount_ = length_; return 0; } // Copy over all the data bytes into our message buffer. if (mb_->copy (buf_ptr, data_bytes) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Blob_Reader::receiveReply():Error copying data into Message_Block" ), -1); // Adjust bytes left bytes_left -= data_bytes; // No more offset left. So set it to zero. offset_left = 0; } else { // The second case is true -- that is offset is greater than // the data bytes we just read. offset_left -= bytes_read; } // If we ad any offset left, take care of that. while (offset_left > 0) { // MAX_HEADER_SIZE in which case we should do a receive of // offset bytes into a temporary buffer. Otherwise, we should // receive MAX_HEADER_SIZE bytes into temporary buffer and // decrement offset_left. if (offset_left < (sizeof buf)) len = offset_left; else len = sizeof buf; if (peer().recv_n (buf, len) != len) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Blob_Reader::receiveReply():Read error" ), -1); offset_left -= len; } // ***************************************************************** // At this point we are all set to receive the actual data which the // user wants. We have made adjustments for offset and are ready to // receive the actual data. Receive the data directly into the // message buffer. len = peer().recv_n (mb_->wr_ptr (), bytes_left); if (len < 0 || static_cast (len) != bytes_left) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Blob_Reader::receiveReply():Read error" ), -1); // Adjust the message buffer write pointer by number of bytes we // received. mb_->wr_ptr (len); // Set the byte count to number of bytes received this->bytecount_ = length_; return 0; } // Writer ************************************************** ACE_Blob_Writer::ACE_Blob_Writer (ACE_Message_Block * mb, size_t length, size_t offset, ACE_TCHAR *filename, const char *request_prefix, const char *request_suffix) : ACE_Blob_Handler (mb, length, offset, filename), request_prefix_ (request_prefix), request_suffix_ (request_suffix) { } int ACE_Blob_Writer::send_request () { // Check for sanity -- check if we have any data to send. if (offset_+ length_ > mb_->length ()) ACE_ERROR_RETURN((LM_ERROR, "%p\n", "ACE_Blob_Writer::sendRequest():Invalid offset/length"), -1); // Determine the length of the header message we will be sending to // the server. Note that we add 32 for safety -- this corresponds to // the number of bytes needed for the length field. size_t mesglen = ACE_OS::strlen (request_prefix_) + ACE_OS::strlen (filename_) + ACE_OS::strlen (request_suffix_) + 32; // safety // Allocate a buffer to hold the header char *mesg = 0; ACE_NEW_RETURN (mesg, char [mesglen], -1); // Create the header, store the actual length in mesglen. mesglen = ACE_OS::sprintf (mesg, "%s /%s %s " ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "\n\n", request_prefix_, ACE_TEXT_ALWAYS_CHAR (filename_), request_suffix_, length_); // Send the header followed by the data // First send the header if (peer ().send_n (mesg, mesglen) == -1) ACE_ERROR_RETURN((LM_ERROR, "%p\n", "Error sending request"), -1); // "Consume" the offset by moving the read pointer of the message // buffer mb_->rd_ptr (offset_); // Now send the data if (peer ().send_n (mb_->rd_ptr (), length_) != (int)length_) ACE_ERROR_RETURN((LM_ERROR, "%p\n", "Error sending file"), -1); // Adjust the read pointer of the mesage buffer mb_->rd_ptr (length_); return 0; } int ACE_Blob_Writer::receive_reply () { // Allocate a buffer big enough to hold the header char buf[MAX_HEADER_SIZE]; // Receive the reply from the server size_t num_recvd = 0; ssize_t len = peer ().recv_n (buf, sizeof buf - 1, 0, &num_recvd); // reserve one byte to store the \0 if (len ==-1) ACE_ERROR_RETURN((LM_ERROR, "%p\n", "Error reading header"), -1); buf [num_recvd] = 0; // Parse the header char *lasts = 0; // First check if this was a valid header -- HTTP/1.0 char *token = ACE_OS::strtok_r (buf, " \t", &lasts); if ( (token == 0) || (ACE_OS::strcasecmp (token, "HTTP/1.0") != 0)) ACE_ERROR_RETURN((LM_ERROR, "%p\n", "Did not receive a HTTP/1.0 response"), -1); // Get the return code. int return_code = ACE_OS::atoi (ACE_OS::strtok_r (0, " \t", &lasts)); // Check if the transaction succeeded. The only success codes are in // the range of 200-299 (HTTP specification). if (return_code >= 200 && return_code < 300) return 0; else { // Something went wrong! // Get the description from the header message of what went wrong. char *description = ACE_OS::strtok_r (0, "\n\r", &lasts); ACE_ERROR_RETURN((LM_ERROR, "%p\n", description), -1); } ACE_NOTREACHED(return 0); } ace-8.0.4+dfsg.orig/apps/JAWS/clients/Blobby/Blob.cpp0000644000175000017500000000273015027201773021134 0ustar sudipsudip#include "Blob.h" #include "Blob_Handler.h" #include "ace/OS_NS_string.h" ACE_Blob::ACE_Blob () { } ACE_Blob::~ACE_Blob () { this->close (); } // initialize address and filename. No network i/o in open int ACE_Blob::open (const ACE_TCHAR *filename, const ACE_TCHAR *hostname , u_short port) { filename_ = ACE_OS::strdup (filename); inet_addr_.set (port, hostname); return 0; } // read from connection length bytes from offset, into Message block int ACE_Blob::read (ACE_Message_Block *mb, size_t length, size_t offset) { // Create a Blob Reader ACE_Blob_Reader blob_reader (mb, length, offset, filename_); ACE_Blob_Handler *brp = &blob_reader; // Connect to the server if (connector_.connect (brp, inet_addr_) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Blob::read():Connector error"), -1); return blob_reader.byte_count (); } // write to connection length bytes from offset, into Message block int ACE_Blob::write (ACE_Message_Block *mb, size_t length, size_t offset) { // Create a Blob Writer ACE_Blob_Writer blob_writer (mb, length, offset, filename_); ACE_Blob_Handler *bwp = &blob_writer; // Connect to the server if (connector_.connect (bwp, inet_addr_) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Blob::write():Connector error"), -1); return blob_writer.byte_count (); } // close down the blob int ACE_Blob::close () { if (filename_) { ACE_OS::free ((void *) filename_); filename_ = 0; } return 0; } ace-8.0.4+dfsg.orig/apps/JAWS/clients/Blobby/Blob_Handler.h0000644000175000017500000000572415027201773022244 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Blob_Handler.h * * ACE_Blob_Handler is a base class for ACE_Blob_Reader and * ACE_Blob_Writer which are created in response to calls to * read/write, as appropriate * * @author Prashant Jain and Sumedh Mungee */ //============================================================================= #ifndef ACE_BLOB_HANDLER_H #define ACE_BLOB_HANDLER_H #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/SOCK_Stream.h" #include "ace/Svc_Handler.h" #include "ace/Message_Block.h" /** * @class ACE_Blob_Handler * * @brief Blob is intended to provide application API to * classes that wish to do network i/o at a very * high level of abstraction. * = This class provides the ability to retrieve data from * the network, of specified length and offset, and potentially * use any protocol "under the hood" to do so. It currently * uses HTTP. See Blob_Handler also. */ class ACE_Blob_Handler : public ACE_Svc_Handler { public: /// Null constructor, insures that it works properly with Connector ACE_Blob_Handler (); /// Always use this constructor to make Blob_Handlers ACE_Blob_Handler (ACE_Message_Block *mb, size_t length, size_t offset, ACE_TCHAR *filename); /// returns the number of bytes read/written in the last operation. int byte_count (); /// Activate this instance of the virtual int open (void * = 0); /// Close down the Blob virtual int close (u_long flags = 0); ~ACE_Blob_Handler (); protected: virtual int send_request (); virtual int receive_reply (); ACE_Message_Block *mb_; size_t length_; size_t offset_; ACE_TCHAR *filename_; int bytecount_; enum { MAX_HEADER_SIZE = 2048 // The handler assumes that the first 2048 bytes of a server response // contains the header }; }; class ACE_Blob_Reader : public ACE_Blob_Handler { public: ACE_Blob_Reader (ACE_Message_Block *mb, size_t length, size_t offset, ACE_TCHAR *filename, const char *request_prefix = "GET", const char *request_suffix = "HTTP/1.0\r\n\r\n"); private: int send_request (); int receive_reply (); const char *request_prefix_; const char *request_suffix_; }; class ACE_Blob_Writer : public ACE_Blob_Handler { public: ACE_Blob_Writer (ACE_Message_Block *mb, size_t length, size_t offset, ACE_TCHAR *filename, const char *request_prefix = "PUT", const char *request_suffix = "HTTP/1.0\nContent-length:"); private: int send_request (); int receive_reply (); const char *request_prefix_; const char *request_suffix_; }; #endif /* ACE_BLOB_HANDLER_H */ ace-8.0.4+dfsg.orig/apps/JAWS/clients/Blobby/blobby.cpp0000644000175000017500000000714515027201773021534 0ustar sudipsudip //============================================================================= /** * @file blobby.cpp * * Simple client application to illustrate the use of the ACE_Blob class * * It reads "length" number of bytes, after skipping offset "offset" * from hostname, port and filename as specified. (if -r specified) * * It writes "length" number of bytes, after skipping offset "offset" * to hostname, port and filename as specified (if -w specified) * * @author Prashant Jain and Sumedh Mungee */ //============================================================================= #include "Options.h" #include "ace/OS_main.h" #include "ace/OS_NS_fcntl.h" #include "ace/OS_NS_unistd.h" int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { // Options is a singleton Options *options = Options::instance (); options->parse_args (argc, argv); // Explain what is going to happen if (options->debug_) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("hostname = %C, port = %d, filename = %s, ") ACE_TEXT ("length = %d, offset = %d, operation = %c\n"), options->hostname_, options->port_, options->filename_, options->length_, options->offset_, options->operation_)); // Create a blob ACE_Blob blob; // User requested a read if (options->operation_ == 'r') { ACE_Message_Block mb (0, options->length_); // Open the blob if (blob.open (options->filename_, options->hostname_, options->port_) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open error")), -1); // Read from it if (blob.read (&mb, options->length_, options->offset_) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("read error")), -1); // Write to STDOUT if (ACE_OS::write (ACE_STDOUT, mb.rd_ptr(), mb.length()) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("write error")), -1); } else { int total = options->length_ + options->offset_; ACE_Message_Block mb (total); // Open the file to be sent ACE_HANDLE h = ACE_OS::open (options->filename_, O_RDONLY); if (h == ACE_INVALID_HANDLE) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("file open error")), -1); // Open the blob if (blob.open (options->filename_, options->hostname_, options->port_) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("connection open error")), -1); // Read from the file if (ACE_OS::read (h, mb.wr_ptr (), total) != total) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("file read error")), -1); // Close the file ACE_OS::close (h); // Adjust the offset mb.wr_ptr (mb.size ()); // Write to the blob if (blob.write (&mb, options->length_, options->offset_) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("network write error")), -1); } blob.close (); return 0; } ace-8.0.4+dfsg.orig/apps/JAWS/clients/Blobby/Options.cpp0000644000175000017500000000320015027201773021702 0ustar sudipsudip#include "ace/Get_Opt.h" #include "ace/ARGV.h" #include "Blob.h" #include "Blob_Handler.h" #include "Options.h" Options *Options::instance_ = 0; Options * Options::instance () { if (Options::instance_ == 0) Options::instance_ = new Options; return Options::instance_; } void Options::parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("rwh:p:f:l:o:d")); int c; while ((c = get_opt ()) != -1) switch (c) { case 'd': this->debug_ = 1; break; case 'r': this->operation_ = 'r'; break; case 'w': this->operation_ = 'w'; break; case 'h': this->hostname_ = get_opt.opt_arg (); break; case 'p': this->port_ = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'f': this->filename_ = get_opt.opt_arg (); break; case 'l': this->length_ = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'o': this->offset_ = ACE_OS::atoi (get_opt.opt_arg ()); break; default: ACE_DEBUG ((LM_DEBUG, "%s -h hostname -f filename -[r/w] [-p port] [-l length] [-o offset] [-d]\n", argv[0])); ACE_OS::exit (1); } if (this->hostname_ == 0 || this->filename_ == 0) { ACE_DEBUG ((LM_DEBUG, "%s -h hostname -f filename -[r/w] [-p port] [-l length] [-o offset] [-d]\n", argv[0])); ACE_OS::exit (1); } } Options::Options () : hostname_ (0), port_ (ACE_DEFAULT_HTTP_SERVER_PORT), filename_ (0), length_ (0), offset_ (0), operation_ ('r'), debug_ (0) { } ace-8.0.4+dfsg.orig/apps/JAWS/clients/Blobby/Options.h0000644000175000017500000000233415027201773021356 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Options.h * * Options is an Singleton for blobby * * @author Prashant Jain and Sumedh Mungee */ //============================================================================= #ifndef ACE_BLOBBY_OPTIONS_H #define ACE_BLOBBY_OPTIONS_H #include "Blob.h" #include "Blob_Handler.h" #include "ace/Get_Opt.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/ARGV.h" class Options { public: /// Returns the singleton instance static Options *instance (); /// parses commandline arguments void parse_args (int argc, ACE_TCHAR *argv[]); /// Hostname to connect to ACE_TCHAR *hostname_; /// Port number to use u_short port_; /// Filename to upload/download ACE_TCHAR *filename_; /// number of bytes to read/write int length_; /// offset to read/write int offset_; /// "r" means download (read), and "w" means upload (write). char operation_; /// turns on verbosity int debug_; protected: Options (); // protected constructor, singleton /// the singleton static Options *instance_; }; #endif /* ACE_BLOBBY_OPTIONS_H */ ace-8.0.4+dfsg.orig/apps/JAWS/clients/Blobby/blobby.mpc0000644000175000017500000000022615027201773021522 0ustar sudipsudip// -*- MPC -*- project(blobby) : aceexe { exename = blobby Source_Files { blobby.cpp Blob.cpp Blob_Handler.cpp Options.cpp } } ace-8.0.4+dfsg.orig/apps/JAWS/clients/Blobby/README0000644000175000017500000000217415027201773020434 0ustar sudipsudip README for blobby, the example application for JAWS --------------------------------------------------- Blobby is a simple application written using the ACE_Blob class, which is capable of doing both file uploads and downloads from the JAWS server. If a file is downloaded, the downloaded data is sent to standard output, so that it can be piped as necessary. It is an ACE application, and should be compiled exactly like any other ACE application. It accepts the following command line arguments: -r Read (download) the file from the server -w Write (upload) the file to the server (Default is Read file) -h hostname Use the server running on hostname (Default is localhost) -p port Port number of the server (Default is 80) -f filename The file to upload/download from the server -l length The number of bytes to read/write from the server -o offset The offset into the file to be read/written -d Puts blobby into debug mode, where it echoes its command line arguments ace-8.0.4+dfsg.orig/apps/JAWS/clients/README0000644000175000017500000000050115027201773017213 0ustar sudipsudipThis directory contains the source code for various clients related to JAWS, which is a high-performance HTTP Web server written with ACE. The subdirectories in this directory contain the following components . Blobby - a Blobby client . Caching - a Web client which caches . WebSTONE - modified to be multi-threaded ace-8.0.4+dfsg.orig/apps/JAWS3/0000755000175000017500000000000015046037655014770 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/JAWS3/bench/0000755000175000017500000000000015046037655016047 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/JAWS3/bench/average.cpp0000644000175000017500000000065215027201773020161 0ustar sudipsudipint ACE_TMAIN(int, ACE_TCHAR *[]) { double sum = 0; double count = 0; int input; char buf[BUFSIZ]; while (ACE_OS::fgets (buf, sizeof (buf), stdin) != 0) { input = ACE_OS::atoi (buf); sum += input; count++; } ACE_OS::printf ("sum of input is: %f\n", sum); ACE_OS::printf ("number of inputs is: %f\n", count); ACE_OS::printf ("average of input is: %f\n", sum / count); return 0; } ace-8.0.4+dfsg.orig/apps/JAWS3/bench/mkfiles.cpp0000644000175000017500000000651615027201773020206 0ustar sudipsudip#include "ace/Get_Opt.h" //FUZZ: disable check_for_math_include/ #include static float gammln (float xx); static float poidev (float xm); int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt options (argc, argv, ACE_TEXT("m:s:x:n:")); // m -- median file size in kB // x -- maximum file size in kB // n -- number of files long median = 8; long maximum = 1024; long number = 1000; int c; while ((c = options ()) != -1) { switch (c) { case 'm': median = ACE_OS::atoi (options.optarg); break; case 'x': maximum = ACE_OS::atoi (options.optarg); break; case 'n': number = ACE_OS::atoi (options.optarg); break; default: break; } } char filename[1024]; const char *seventyfive_bytes = "\ 01010101010101010101010101010101010101010101010101010101010101010101010101\n\ "; int seen_max = 0; long i; for (i = 0; i < number; i++) { long size = 0; float p = ACE_OS::floor (::pow (2, poidev (::log (2 * median)/::log (2)) - 1)); if (p > maximum) p = maximum; p *= 1024; if (p < 1.0) p = 1.0; size = (long) p; if (i == (number - 1)) if (! seen_max) size = maximum * 1024; else seen_max = (size == (maximum * 1024)); ACE_OS::sprintf (filename, "file%011ld.html", i); FILE *fp = ACE_OS::fopen (filename, "w+b"); while (size > 75) { ACE_OS::fprintf (fp, "%s", seventyfive_bytes); size -= 75; } if (size > 15) { ACE_OS::fprintf (fp, "%0*.0f\n", (int) (size - 1), p); } else { ACE_OS::fprintf (fp, "%015.0f\n", p + 16 - size); } ACE_OS::fclose (fp); } return 0; } static float gammln (float xx) { double x, y, tmp, ser; static const double cof[6] = { 76.18009172947146, -86.50532032941677, 24.01409824083091, -1.231739572450155, 0.1208650973866179e-2, -0.5395239384953e-5 }; int j; y = x = xx; tmp = x + 5.5; tmp -= (x+0.5) * ::log (tmp); ser = 1.000000000190015; for (j = 0; j < 6; j++) ser += cof[j]/++y; return -tmp + ::log (2.5066282746310005 * ser / x); } static float poidev (float xm) { static const double PI = 3.141592654; static float sq, alxm, g, oldm = -1.0; float em, t, y, fem; if (xm < 2.0) { if (xm != oldm) { oldm = xm; g = ::exp (-xm); } em = -1.0; t = 1.0; do { ++em; t *= (1.0 + ACE_OS::rand ())/RAND_MAX; } while (t > g); } else { if (xm != oldm) { oldm = xm; sq = ::sqrt (2.0 + xm); alxm = log (xm); g = xm * alxm - gammln (xm + 1.0); } do { do { y = ::tan (PI * (1.0 + ::rand ())/RAND_MAX); em = sq * y + xm; } while (em < 0.0); fem = ACE_OS::floor (em); t = 0.9 * (1.0 + y * y) * ::exp (fem * alxm - gammln (fem + 1.0) - g); } while ((1.0 + ACE_OS::rand ())/RAND_MAX > t); } return em; } ace-8.0.4+dfsg.orig/apps/JAWS3/bench/rqfiles.cpp0000644000175000017500000001431015027201773020210 0ustar sudipsudip#include "ace/Get_Opt.h" #include "ace/Svc_Handler.h" #include "ace/Reactor.h" #include "ace/Select_Reactor.h" #include "ace/Connector.h" #include "ace/SOCK_Connector.h" //FUZZ: disable check_for_math_include/ #include static char **requests; static int number_of_urls; static int number_of_outstanding_requests; class HTTP_Sink_Svc_Handler : public ACE_Svc_Handler { public: //FUZZ: disable check_for_lack_ACE_OS int open (void *) { //FUZZ: enable check_for_lack_ACE_OS ACE_Reactor::instance () ->register_handler (this, ACE_Event_Handler::WRITE_MASK); return 0; } int handle_input (ACE_HANDLE handle) { char buf[8 * 1024]; int result = this->peer ().recv (buf, sizeof (buf)); if (result <= 0) { ACE_Reactor::instance () ->cancel_wakeup (handle, ACE_Event_Handler::READ_MASK); if (--number_of_outstanding_requests == 0) ACE_Reactor::instance ()->end_event_loop (); return -1; } return 0; } int handle_output (ACE_HANDLE handle) { int random_number; random_number = (int) ((ACE_OS::rand () / (1.0 + RAND_MAX)) * number_of_urls); const char *random_request = requests[random_number]; size_t random_request_length = ACE_OS::strlen (random_request); ssize_t result = 0; result = this->peer ().send_n (random_request, random_request_length); ACE_Reactor::instance () ->cancel_wakeup (handle, ACE_Event_Handler::WRITE_MASK); if (result < 0) return -1; ACE_Reactor::instance () ->schedule_wakeup (handle, ACE_Event_Handler::READ_MASK); return 0; } }; typedef ACE_Connector HTTP_Sink_Connector; class HTTP_Make_Request_Event_Handler : public ACE_Event_Handler { public: HTTP_Make_Request_Event_Handler (const ACE_Time_Value &request_rate, int number_of_requests = -1, const char *website = 0) : number_of_requests_ (number_of_requests) , addr_ (website ? website : "localhost:5432") { number_of_outstanding_requests = number_of_requests; this->timer_id_ = ACE_Reactor::instance ()->schedule_timer (this, 0, 0, request_rate); } int handle_timeout (const ACE_Time_Value &, const void *) { if (this->number_of_requests_ > 0) this->number_of_requests_--; int tries = 0; int result = 0; do { HTTP_Sink_Svc_Handler *handler = 0; result = this->connector_.connect (handler, this->addr_, ACE_Synch_Options::asynch); tries++; } while (result < 0 && tries < 100); if (ACE_Reactor::instance ()->event_loop_done ()) this->number_of_requests_ = 0; if (this->number_of_requests_ == 0 || result < 0) ACE_Reactor::instance ()->cancel_timer (this->timer_id_); if (result < 0) { ACE_Reactor::instance ()->end_event_loop (); return -1; } return 0; } int handle_close (ACE_HANDLE, ACE_Reactor_Mask) { delete this; return 0; } private: int number_of_requests_; int number_of_outstanding_requests_; HTTP_Sink_Connector connector_; ACE_INET_Addr addr_; long timer_id_; }; class Signal_Handler : public ACE_Event_Handler { public: int handle_signal (int signo, siginfo_t *, ucontext_t *) { switch (signo) { case SIGINT: ACE_Reactor::instance ()->end_event_loop (); break; default: break; } return 0; } }; typedef ACE_Select_Reactor_Token_T ACE_Select_Reactor_Noop_Token; typedef ACE_Select_Reactor_T ACE_Select_NULL_LOCK_Reactor; int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { ACE_Select_NULL_LOCK_Reactor *select_reactor; select_reactor = new ACE_Select_NULL_LOCK_Reactor; ACE_Reactor::instance (new ACE_Reactor (select_reactor, 1), 1); // Install signal handlers Signal_Handler *signal_handler = new Signal_Handler; ACE_Reactor::instance ()->register_handler (SIGINT, signal_handler); ACE_OS::signal (SIGPIPE, SIG_IGN); ACE_Get_Opt options (argc, argv, ACE_TEXT("f:r:n:w:")); // f -- file list // r -- request rate in requests per second // n -- number of requests to generate // w -- website in form of hostname:port (e.g., www.yahoo.com:80) char *filelist_name = 0; double request_rate = 1.0; char *website = 0; int number_of_requests = 0; int c; while ((c = options ()) != -1) { switch (c) { case 'f': filelist_name = options.optarg; break; case 'r': request_rate = ACE_OS::atof (options.optarg); if (request_rate == 0.0) request_rate = 1.0; break; case 'n': number_of_requests = ACE_OS::atoi (options.optarg); break; case 'w': website = options.optarg; break; default: break; } } if (filelist_name == 0) ACE_OS::abort (); double rq_interval_sec; double rq_interval_usec; rq_interval_usec = 1000000 * ::modf (1/request_rate, &rq_interval_sec); ACE_Time_Value tv ((long) rq_interval_sec, (long) rq_interval_usec); // Scan file for number of lines. FILE *fp = ACE_OS::fopen (filelist_name, "r+b"); while ((c = ACE_OS::fgetc (fp)) != EOF) { if (c == '\n') number_of_urls++; } ACE_OS::fclose (fp); requests = (char **) ACE_OS::malloc (number_of_urls * sizeof (char *)); // Read in the file list and create requests int i = 0; static char buf[BUFSIZ]; fp = ACE_OS::fopen (filelist_name, "r+b"); while (ACE_OS::fgets (buf, sizeof (buf), fp) != 0) { static char rq[BUFSIZ]; ACE_OS::sprintf (rq, "GET /%s\r\n", buf); requests[i++] = ACE_OS::strdup (rq); } ACE_OS::fclose (fp); // Create a series of requests HTTP_Make_Request_Event_Handler *eh; eh = new HTTP_Make_Request_Event_Handler (tv, number_of_requests, website); while (! ACE_Reactor::instance ()->event_loop_done ()) ACE_Reactor::instance ()->handle_events (); // Cleanup for (i = 0; i < number_of_urls; i++) ACE_OS::free (requests[i]); ACE_OS::free (requests); return 0; } ace-8.0.4+dfsg.orig/apps/JAWS3/zTHANKS0000644000175000017500000000770715027201773016101 0ustar sudipsudipACKNOWLEDGEMENTS The design of the JAWS Framework has received inspiration from various collaborators I have had the distinct honor of working with while pursuing my degree at Washington University in St. Louis. Darrell Brunsch Chris Cleeland Chris Gill Tim Harrison Del Hart Michael Kircher David Levine Peter McCann Sumedh Mungee Amy Murphy Carlos O'Ryan Irfan Pyarali Catalin Roman Douglas Schmidt Seth Widoff In addition, I am indebted to Entera, Inc., for adopting early versions of the JAWS architecture and for permitting me to continue to develop JAWS while I am under their employ. Steven West John Scharber Doug Robertson Venkat Prasad The engineering team at Entera has been particular helpful with their insight into where JAWS functionality could use much needed improvement. J Geagan Mike Grupenhoff Stephen Head Chris Healey Mike Kellner Michael Morgan Alagu Periyannan Cathy White David Zink I would also like to thank all the following people who have also contributed to JAWS significantly during its developmental stages and continued development. I am sorry if I have left anyone out from this list. If you feel you are one I have neglected, please let me know! If you feel are have been included by mistake, let me know about that too! A Vijay Srinivas Benoit Boulat Bill Landi Bill Rizzi Bill Trudell Chris Hafey Craig Perras Dann Corbit Darrin Edelman David Armstrong David Dyke Dean Gaudet Detlef Becker Dominic Williams Erich Nahum Farnam Jahanian Girish P. Chandranmenon Greg Gallant Hans Rohnert Hussayn Dabbous Jam Hamidi James Dabbs Jan Perman Jayasimha Nagaraja Joey Zhu John Aughey John Mills John Studarus Joo C. Chung Karen M Amestoy Karlheinz Dorn Loren J. Rittle Malte Muenke Mark D. Wood Michael Quigley Neil Gunther Nnamdi Anunini Ofer Rosenberg Pat Niemeyer Patrick J. McNerthney Peter Sommerlad Rick H. Wesson Sridhara R. Sabbella Stephen Shaffer Steve Huston Steven Wu Supriya Sharma Tan Wee Hong Thomas Dunbar Todd L. Montgomery Torsten Kuepper Xianfeng Gu XuYifeng Yigong Liu Yoo In_Seon Yuval Yosef Zed A. Shaw Thank you all very much! James Hu jxh@entera.com ace-8.0.4+dfsg.orig/apps/JAWS3/zREADME0000644000175000017500000000676615027201773016052 0ustar sudipsudip The framework is organized roughly around these high level component categories. The sublevels indicate the JAWS components that participate in the category. Event Framework JAWS_Event_Dispatcher JAWS_Event_Completer JAWS_Event_Result Input/Output Events JAWS_IO JAWS_IO_Impl JAWS_Asynch_IO JAWS_Synch_IO JAWS_Reactive_IO Timing Events JAWS_Timer JAWS_Timer_Impl JAWS_Task_Timer Protocol Framework JAWS_Protocol_Handler JAWS_Protocol_State Concurrency Framework JAWS_Concurrency JAWS_Concurrency_Impl JAWS_THYBRID_Concurrency JAWS_TPOOL_Concurrency JAWS_TPR_Concurrency The Event Framework: The JAWS_Event_Dispatcher remains hidden to the application developer. It is initialized from the main program which is built within the jaws3 subdirectory, and uses ACE_Reactor and ACE_Proactor. The JAWS_Event_Completer is a callback helper class that is used by the JAWS_Event_Dispatcher. A completer is passed into the Event Framework whenever an application developer wants to initiate an event. When the event completes, the completer is called for notification. The JAWS_Event_Result is a class that describes the result of the event for the completer when the completer gets called back. Input/Output Events The JAWS_IO class bridges IO event dispatching methods to the JAWS_IO_Impl abstraction. It delegates its IO interfaces to corresponding methods in JAWS_IO_Impl. JAWS_Asynch_IO, JAWS_Synch_IO, and JAWS_Reactive_IO all derive from JAWS_IO_Impl. The usage API for these classes follows an asynchronous usage interface. This enables an application to experiment with different underlying IO implementations to see how it impacts performance without redesigning/rewriting the entire application. Timer Events The JAWS_Timer class bridges timer dispatching methods to the JAWS_Timer_Impl abstraction. JAWS_Task_Timer derives from JAWS_Timer_Impl, and uses a task coupled with an ACE_Timer_Wheel to implement timers. Protocol Framework The JAWS_Protocol_Handler plays the role of Context in the State pattern, while the JAWS_Protocol_State plays the role of State. The JAWS_Protocol_Handler's service() method delegates to the service() method of an associated JAWS_Protocol_State. In addition, the JAWS_Protocol_Handler also derives from JAWS_Event_Completer. The idea is that the application developer will derive from JAWS_Protocol_State to fill out the programmatical details of their protocol. At the end of the state, an asynchronous event will be initiated, and the state returns the control of the thread back to the framework. When the event completes, the associated JAWS_Protocol_Handler is called back, and it then triggers a call into the JAWS_Protocol_State's transition() method. This method is to return the next state or the protocol. The event completion callback then enqueues itself with one of the concurrency implementations of the Concurrency Framework. Concurrency Framework The JAWS_Concurrency class bridges concurrency mechanisms to the JAWS_Concurrency_Impl abstraction. JAWS_THYBRID_Concurrency, JAWS_TPOOL_Concurrency and JAWS_TPR_Concurrency derive from JAWS_Concurrency_Impl. They are active objects that dequeue JAWS_Protocol_Handlers and call into their service() methods. ace-8.0.4+dfsg.orig/apps/JAWS3/zFAQ0000644000175000017500000000221715027201773015507 0ustar sudipsudipFAQ List for JAWS Q1: Is JAWS an acronym? A1: Yes. It expands to JAWS Adaptive Web System. Q2: Does JAWS support SSL? A2: No. When ACE finishes its wrappers, it will be an easy matter to add support to JAWS. Q3: Is JAWS faster than Apache? A3: Yes. Q4: Why does everyone use Apache instead of JAWS? A4: JAWS is not a feature complete server. JAWS is not a drop in replacement for the NCSA HTTP server like Apache. Apache has tens if not hundreds of developers working on it, while JAWS has just me. Help me! Q5: Who else uses JAWS? A5: I have seen hints of many different people using JAWS. I have acknowledged all those I am aware of in the file labeled zTHANKS. Q6: Does JAWS compile on my platform? A6: In principle, JAWS should compile on all platforms that ACE compiles on. JAWS only works on platforms that support threads, however. Q7: What is the development platform of JAWS? A7: JAWS is developed on a FreeBSD box at my home, Solaris x86 at my work, and Solaris Sparcs at school. Periodically, it will get some attention on WinNT to see if it compiles. Q8: What's with JAWS, JAWS2, and JAWS3? A8: ace-8.0.4+dfsg.orig/apps/JAWS3/small/0000755000175000017500000000000015046037655016100 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/JAWS3/small/svc.conf0000644000175000017500000000014115027201773017527 0ustar sudipsudip dynamic TeraSS_Acceptor Service_Object * TeraSS:_make_TeraSS_Acceptor() "ss_acceptor -p 5432" ace-8.0.4+dfsg.orig/apps/JAWS3/small/SS_Service_Handler.cpp0000644000175000017500000000207415027201773022242 0ustar sudipsudip#define ACE_BUILD_SVC_DLL #include "ace/Get_Opt.h" #include "jaws3/Concurrency.h" #include "SS_Service_Handler.h" #include "SS_State_READ.h" #include "SS_Data.h" TeraSS_Service_Handler::TeraSS_Service_Handler () : JAWS_Protocol_Handler (TeraSS_State_READ::instance (), & this->data_) , data_ (this) { } int TeraSS_Service_Handler::open (void *) { int result = JAWS_Concurrency::instance ()->putq (this); if (result < 0) return -1; return 0; } int TeraSS_Service_Handler::close (unsigned long) { delete this; return 0; } int TeraSS_Acceptor::init (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt opt (argc, argv, ACE_TEXT("p:")); unsigned short p = 0; int c; while ((c = opt ()) != -1) switch (c) { case 'p': p = (unsigned short) ACE_OS::atoi (opt.optarg); break; default: break; } if (p == 0) p = 5555; if (this->open (ACE_INET_Addr (p)) == -1) { ACE_DEBUG ((LM_DEBUG, "%p\n", "ACE_Acceptor::open")); return -1; } return 0; } ACE_SVC_FACTORY_DEFINE (TeraSS_Acceptor) ace-8.0.4+dfsg.orig/apps/JAWS3/small/SS_State_PARSE.cpp0000644000175000017500000000276715027201773021230 0ustar sudipsudip#include "SS_State_READ.h" #include "SS_State_PARSE.h" #include "SS_State_WRITE.h" #include "SS_State_ERROR.h" #include "SS_State_DONE.h" #include "SS_Data.h" int TeraSS_State_PARSE::service (JAWS_Event_Completer *ec, void *data) { JAWS_Event_Result fake_good_result (0, JAWS_Event_Result::JE_OK); JAWS_Event_Result fake_bad_result (0, JAWS_Event_Result::JE_ERROR); // Parse the request. TeraSS_Data *tdata = (TeraSS_Data *) data; char *p = tdata->mb ().rd_ptr (); while (p < tdata->mb ().wr_ptr () && *p != '\r' && *p != '\n') p++; if (p == tdata->mb ().wr_ptr ()) { // Return to the READ state. ec->input_complete (fake_bad_result, 0); return 0; } *p = '\0'; // Make us transition into the WRITE state. ec->input_complete (fake_good_result, 0); return 0; } JAWS_Protocol_State * TeraSS_State_PARSE::transition ( const JAWS_Event_Result &result , void * , void * ) { // In the PARSE state, we transition to WRITE on success, // and to READ on failure. JAWS_Protocol_State *next_state = 0; switch (result.status ()) { case JAWS_Event_Result::JE_OK: next_state = TeraSS_State_WRITE::instance (); break; case JAWS_Event_Result::JE_ERROR: next_state = TeraSS_State_READ::instance (); break; default: // Just bail unceremoniously. next_state = TeraSS_State_DONE::instance (); break; } return next_state; } ace-8.0.4+dfsg.orig/apps/JAWS3/small/SS_Templates.cpp0000644000175000017500000000034615027201773021143 0ustar sudipsudip#include "ace/SOCK_Acceptor.h" #include "ace/Singleton.h" #include "SS_Service_Handler.h" #include "SS_State_READ.h" #include "SS_State_PARSE.h" #include "SS_State_WRITE.h" #include "SS_State_ERROR.h" #include "SS_State_DONE.h" ace-8.0.4+dfsg.orig/apps/JAWS3/small/SS_State_ERROR.cpp0000644000175000017500000000126615027201773021240 0ustar sudipsudip#include "jaws3/IO.h" #include "SS_State_ERROR.h" #include "SS_State_DONE.h" #include "SS_Data.h" int TeraSS_State_ERROR::service (JAWS_Event_Completer *ec, void *data) { // Send an error message. TeraSS_Data *tdata = (TeraSS_Data *) data; tdata->mb ().reset (); tdata->mb ().copy ("FAIL\r\n", 6); JAWS_IO::instance ()->send ( tdata->peer ().get_handle () , & tdata->mb () , ec ); return 0; } JAWS_Protocol_State * TeraSS_State_ERROR::transition (const JAWS_Event_Result &, void *, void *) { // In the ERROR state, always transition to DONE. return TeraSS_State_DONE::instance (); } ace-8.0.4+dfsg.orig/apps/JAWS3/small/SS_State_WRITE.cpp0000644000175000017500000000360715027201773021242 0ustar sudipsudip#include "ace/FILE_Connector.h" #include "ace/FILE_Addr.h" #include "ace/FILE_IO.h" #include "jaws3/IO.h" #include "SS_State_WRITE.h" #include "SS_State_ERROR.h" #include "SS_State_DONE.h" #include "SS_Data.h" int TeraSS_State_WRITE::service (JAWS_Event_Completer *ec, void *data) { JAWS_Event_Result fake_bad_result (0, JAWS_Event_Result::JE_ERROR); // Retrieve context TeraSS_Data *tdata = (TeraSS_Data *) data; ACE_FILE_Addr file_addr (tdata->mb ().rd_ptr ()); ACE_FILE_Connector file_connector; if (file_connector.connect ( tdata->file_io () , file_addr , 0 , ACE_Addr::sap_any , 0 , O_RDONLY ) < 0) { ec->output_complete (fake_bad_result, & tdata->file_io ()); return 0; } JAWS_IO::instance ()->transmit ( tdata->peer ().get_handle () , tdata->file_io ().get_handle () , ec , & tdata->file_io () ); return 0; } JAWS_Protocol_State * TeraSS_State_WRITE::transition ( const JAWS_Event_Result &result , void *data , void *act ) { // Clean up FILE. ((ACE_FILE_IO *) act)->close (); // In the WRITE state, move to DONE state if success, ERROR if error. JAWS_Protocol_State *next_state = 0; switch (result.status ()) { case JAWS_Event_Result::JE_OK: next_state = TeraSS_State_DONE::instance (); break; case JAWS_Event_Result::JE_ERROR: next_state = TeraSS_State_ERROR::instance (); break; default: // Just bail unceremoniously. next_state = TeraSS_State_DONE::instance (); break; } return next_state; } ace-8.0.4+dfsg.orig/apps/JAWS3/small/SS_Data.h0000644000175000017500000000071715027201773017525 0ustar sudipsudip/* -*- c++ -*- */ #ifndef TERA_SS_DATA_H #define TERA_SS_DATA_H #include "ace/FILE_IO.h" #include "ace/SOCK_Stream.h" #include "ace/Message_Block.h" class TeraSS_Service_Handler; class TeraSS_Data { public: TeraSS_Data (TeraSS_Service_Handler *sh); ACE_SOCK_Stream & peer (); ACE_Message_Block & mb (); ACE_FILE_IO & file_io (); private: ACE_Message_Block mb_; TeraSS_Service_Handler *sh_; ACE_FILE_IO file_io_; }; #endif /* TERA_SS_DATA_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/small/SS_Data.cpp0000644000175000017500000000053615027201773020057 0ustar sudipsudip#include "SS_Data.h" #include "SS_Service_Handler.h" TeraSS_Data::TeraSS_Data (TeraSS_Service_Handler *sh) : mb_ (8 * 1024) , sh_ (sh) { } ACE_SOCK_Stream & TeraSS_Data::peer () { return this->sh_->peer (); } ACE_Message_Block & TeraSS_Data::mb () { return this->mb_; } ACE_FILE_IO & TeraSS_Data::file_io () { return this->file_io_; } ace-8.0.4+dfsg.orig/apps/JAWS3/small/SS_State_READ.cpp0000644000175000017500000000233215027201773021055 0ustar sudipsudip#include "jaws3/IO.h" #include "jaws3/Event_Completer.h" #include "SS_State_READ.h" #include "SS_State_PARSE.h" #include "SS_State_ERROR.h" #include "SS_State_DONE.h" #include "SS_Data.h" int TeraSS_State_READ::service (JAWS_Event_Completer *ec, void *data) { // Recover state. TeraSS_Data *tdata = (TeraSS_Data *) data; // Read until we see a newline. JAWS_IO::instance ()->recv ( tdata->peer ().get_handle () , & tdata->mb () , ec ); return 0; } JAWS_Protocol_State * TeraSS_State_READ::transition ( const JAWS_Event_Result &result , void * , void * ) { // In the READ state, move to PARSE if success. // Otherwise ERROR. JAWS_Protocol_State *next_state = 0; switch (result.status ()) { case JAWS_Event_Result::JE_OK: next_state = TeraSS_State_PARSE::instance (); break; case JAWS_Event_Result::JE_ERROR: next_state = TeraSS_State_ERROR::instance (); break; default: // Just bail unceremoniously. next_state = TeraSS_State_DONE::instance (); break; } return next_state; } ace-8.0.4+dfsg.orig/apps/JAWS3/small/SS_State_DONE.h0000644000175000017500000000121715027201773020535 0ustar sudipsudip/* -*- c++ -*- */ #ifndef TERA_SS_STATE_DONE_H #define TERA_SS_STATE_DONE_H #include "ace/Singleton.h" #include "ace/Synch_Traits.h" #include "jaws3/Protocol_Handler.h" class TeraSS_State_DONE : public JAWS_Protocol_State { public: int service (JAWS_Event_Completer *, void *data); JAWS_Protocol_State * transition ( const JAWS_Event_Result &result , void *data , void *act ); static JAWS_Protocol_State * instance () { return ACE_Singleton::instance (); } }; #endif /* TERA_SS_STATE_DONE_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/small/jaws.conf0000644000175000017500000000015615027201773017706 0ustar sudipsudip JAWS_IO = REACTIVE #JAWS_CONCURRENCY = TPOOL #JAWS_MIN_TPR_THREADS #JAWS_MAX_TPR_THREADS #JAWS_TPOOL_THREADS ace-8.0.4+dfsg.orig/apps/JAWS3/small/SS_State_DONE.cpp0000644000175000017500000000061515027201773021071 0ustar sudipsudip#include "SS_State_DONE.h" #include "SS_Data.h" int TeraSS_State_DONE::service (JAWS_Event_Completer *, void *) { // Returning -1 means it is time for the protocol handler to shut // itself down. return -1; } JAWS_Protocol_State * TeraSS_State_DONE::transition (const JAWS_Event_Result &, void *, void *) { // In the DONE state, this won't get called. ACE_ASSERT (0); return 0; } ace-8.0.4+dfsg.orig/apps/JAWS3/small/SS_State_ERROR.h0000644000175000017500000000116615027201773020704 0ustar sudipsudip/* -*- c++ -*- */ #ifndef TERA_SS_STATE_ERROR_H #define TERA_SS_STATE_ERROR_H #include "ace/Singleton.h" #include "jaws3/Protocol_Handler.h" class TeraSS_State_ERROR : public JAWS_Protocol_State { public: int service (JAWS_Event_Completer *, void *data); JAWS_Protocol_State * transition ( const JAWS_Event_Result &result , void *data , void *act ); static JAWS_Protocol_State * instance () { return ACE_Singleton::instance (); } }; #endif /* TERA_SS_STATE_ERROR_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/small/SS_State_READ.h0000644000175000017500000000121615027201773020522 0ustar sudipsudip/* -*- c++ -*- */ #ifndef TERA_SS_STATE_READ_H #define TERA_SS_STATE_READ_H #include "ace/Singleton.h" #include "ace/Synch_Traits.h" #include "jaws3/Protocol_Handler.h" class TeraSS_State_READ : public JAWS_Protocol_State { public: int service (JAWS_Event_Completer *, void *data); JAWS_Protocol_State * transition ( const JAWS_Event_Result &result , void *data , void *act ); static JAWS_Protocol_State * instance () { return ACE_Singleton::instance (); } }; #endif /* TERA_SS_STATE_READ_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/small/SS_State_WRITE.h0000644000175000017500000000116615027201773020705 0ustar sudipsudip/* -*- c++ -*- */ #ifndef TERA_SS_STATE_WRITE_H #define TERA_SS_STATE_WRITE_H #include "ace/Singleton.h" #include "jaws3/Protocol_Handler.h" class TeraSS_State_WRITE : public JAWS_Protocol_State { public: int service (JAWS_Event_Completer *, void *data); JAWS_Protocol_State * transition ( const JAWS_Event_Result &result , void *data , void *act ); static JAWS_Protocol_State * instance () { return ACE_Singleton::instance (); } }; #endif /* TERA_SS_STATE_WRITE_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/small/SS_Service_Handler.h0000644000175000017500000000265315027201773021712 0ustar sudipsudip/* -*- c++ -*- */ #ifndef TERA_SS_SERVICE_HANDLER_H #define TERA_SS_SERVICE_HANDLER_H #include "ace/Synch.h" #include "ace/Acceptor.h" #include "ace/Svc_Handler.h" #include "ace/SOCK_Acceptor.h" #include "ace/svc_export.h" #include "jaws3/Protocol_Handler.h" #include "SS_Data.h" class TeraSS_Service_Handler : public ACE_Svc_Handler , public JAWS_Protocol_Handler // = TITLE // The Small Server service handler. // // = DESCRIPTION // This class is responsible for initializing the JAWS_Protocol_Handler // with the correct state and data so that the Small Server can // be properly serviced by the underlying framework. // // This class should perhaps be factored out into a template so that // there is less programming effort. { public: TeraSS_Service_Handler (); int open (void *); int close (unsigned long); private: TeraSS_Data data_; }; class ACE_Svc_Export TeraSS_Acceptor : public ACE_Acceptor // = TITLE // The Small Server acceptor. // // = DESCRIPTION // The role of this class is to serve the acceptor role in the // acceptor pattern. It interacts with the Reactor to perform // accepts asynchronously. Upon completion, the service handler // is created. { public: int init (int argc, ACE_TCHAR *argv[]); }; ACE_SVC_FACTORY_DECLARE (TeraSS_Acceptor) #endif /* TERA_SS_SERVICE_HANDLER_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/small/SS_State_PARSE.h0000644000175000017500000000116615027201773020665 0ustar sudipsudip/* -*- c++ -*- */ #ifndef TERA_SS_STATE_PARSE_H #define TERA_SS_STATE_PARSE_H #include "ace/Singleton.h" #include "jaws3/Protocol_Handler.h" class TeraSS_State_PARSE : public JAWS_Protocol_State { public: int service (JAWS_Event_Completer *, void *data); JAWS_Protocol_State * transition ( const JAWS_Event_Result &result , void *data , void *act ); static JAWS_Protocol_State * instance () { return ACE_Singleton::instance (); } }; #endif /* TERA_SS_STATE_PARSE_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/http/0000755000175000017500000000000015046037655015747 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/JAWS3/http/HTTP_States.h0000644000175000017500000000651515027201773020222 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_HTTP_STATES_H #define JAWS_HTTP_STATES_H #include "ace/Singleton.h" #include "jaws3/Protocol_Handler.h" #define JAWS_HTTP_STATE_MACRO(JAWS_HTTP_STATE_NAME) \ \ class JAWS_HTTP_STATE_NAME : protected JAWS_Protocol_State \ { \ public: \ \ int service (JAWS_Event_Completer *, JAWS_HTTP_Data *); \ \ JAWS_Protocol_State * transition ( const JAWS_Event_Result & \ , JAWS_HTTP_Data * \ , void * \ ); \ \ static JAWS_Protocol_State * instance () \ { \ return ACE_Singleton \ ::instance (); \ } \ \ private: \ \ int service (JAWS_Event_Completer *ec, void *d) \ { \ JAWS_HTTP_Data *hd = static_cast (d); \ return this->service (ec, hd); \ } \ \ JAWS_Protocol_State * transition ( const JAWS_Event_Result &r \ , void d* \ , void a* \ ) \ { \ JAWS_HTTP_Data *hd = static_cast (d); \ return this->transition (r, hd, a); \ } \ \ } JAWS_HTTP_STATE_MACRO (JAWS_HTTP_Read_Request); JAWS_HTTP_STATE_MACRO (JAWS_HTTP_Read_Headers); JAWS_HTTP_STATE_MACRO (JAWS_HTTP_Parse_Error); JAWS_HTTP_STATE_MACRO (JAWS_HTTP_GET); JAWS_HTTP_STATE_MACRO (JAWS_HTTP_HEAD); JAWS_HTTP_STATE_MACRO (JAWS_HTTP_PUT); JAWS_HTTP_STATE_MACRO (JAWS_HTTP_POST); JAWS_HTTP_STATE_MACRO (JAWS_HTTP_GET_Response); JAWS_HTTP_STATE_MACRO (JAWS_HTTP_HEAD_Response); JAWS_HTTP_STATE_MACRO (JAWS_HTTP_PUT_Response); JAWS_HTTP_STATE_MACRO (JAWS_HTTP_POST_Response); JAWS_HTTP_STATE_MACRO (JAWS_HTTP_Auth_Response); JAWS_HTTP_STATE_MACRO (JAWS_HTTP_Transmit_File); JAWS_HTTP_STATE_MACRO (JAWS_HTTP_Send_Message); JAWS_HTTP_STATE_MACRO (JAWS_HTTP_Spawn_CGI); JAWS_HTTP_STATE_MACRO (JAWS_HTTP_Send_CGI_Status); JAWS_HTTP_STATE_MACRO (JAWS_HTTP_Wait_CGI); JAWS_HTTP_STATE_MACRO (JAWS_HTTP_DONE); #endif /* JAWS_HTTP_STATES_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/http/HTTP_Data.h0000644000175000017500000000074415027201773017626 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_HTTP_DATA_H #define JAWS_HTTP_DATA_H #include "ace/FILE_IO.h" #include "ace/SOCK_Stream.h" #include "ace/Message_Block.h" class JAWS_HTTP_Service_Handler; class JAWS_HTTP_Data { public: JAWS_HTTP_Data (JAWS_HTTP_Service_Handler *sh); ACE_SOCK_Stream & peer (); ACE_Message_Block & mb (); ACE_FILE_IO & file_io (); private: JAWS_HTTP_Service_Handler *sh_; ACE_Message_Block mb_; ACE_FILE_IO file_io_; }; #endif /* JAWS_HTTP_DATA_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/http/HTTP_Service_Handler.cpp0000644000175000017500000000212515027201773022340 0ustar sudipsudip#define ACE_BUILD_SVC_DLL #include "ace/Get_Opt.h" #include "jaws3/Concurrency.h" #include "HTTP_Service_Handler.h" #include "HTTP_States.h" #include "HTTP_Data.h" JAWS_HTTP_Service_Handler::JAWS_HTTP_Service_Handler () : JAWS_Protocol_Handler (JAWS_HTTP_Read_Request::instance (), & this->data_) , data_ (this) { } int JAWS_HTTP_Service_Handler::open (void *) { int result = JAWS_Concurrency::instance ()->putq (this); if (result < 0) return -1; return 0; } int JAWS_HTTP_Service_Handler::close (unsigned long) { delete this; return 0; } int JAWS_HTTP_Acceptor::init (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt opt (argc, argv, ACE_TEXT("p:")); unsigned short p = 0; int c; while ((c = opt ()) != -1) switch (c) { case 'p': p = (unsigned short) ACE_OS::atoi (opt.optarg); break; default: break; } if (p == 0) p = 8000; if (this->open (ACE_INET_Addr (p)) == -1) { ACE_DEBUG ((LM_DEBUG, "%p\n", "ACE_Acceptor::open")); return -1; } return 0; } ACE_SVC_FACTORY_DEFINE (JAWS_HTTP_Acceptor) ace-8.0.4+dfsg.orig/apps/JAWS3/http/HTTP_Service_Handler.h0000644000175000017500000000264615027201773022015 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_HTTP_SERVICE_HANDLER_H #define JAWS_HTTP_SERVICE_HANDLER_H #include "ace/Synch.h" #include "ace/Acceptor.h" #include "ace/Svc_Handler.h" #include "ace/SOCK_Acceptor.h" #include "jaws3/Protocol_Handler.h" #include "HTTP_Data.h" class JAWS_HTTP_Service_Handler : public ACE_Svc_Handler , public JAWS_Protocol_Handler // = TITLE // An HTTP Server service handler. // // = DESCRIPTION // This class is responsible for initializing the JAWS_Protocol_Handler // with the correct state and data so that the HTTP Server can // be properly serviced by the underlying framework. // // This class should perhaps be factored out into a template so that // there is less programming effort. { public: JAWS_HTTP_Service_Handler (); int open (void *); int close (unsigned long); private: JAWS_HTTP_Data data_; }; class ACE_Svc_Export JAWS_HTTP_Acceptor : public ACE_Acceptor // = TITLE // An HTTP Server acceptor. // // = DESCRIPTION // The role of this class is to serve the acceptor role in the // acceptor pattern. It interacts with the Reactor to perform // accepts asynchronously. Upon completion, the service handler // is created. { public: int init (int argc, ACE_TCHAR *argv[]); }; ACE_SVC_FACTORY_DECLARE (JAWS_HTTP_Acceptor) #endif /* JAWS_HTTP_SERVICE_HANDLER_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/zTODO0000644000175000017500000000033715027201773015646 0ustar sudipsudipImplement timers /* reactive */. Implement SOCK acceptor /* reactive only */. Implement SOCK connector /* reactive only */. Implement FILE Cache. Provide user defined event framework (lambda events). Implement HTTP server. ace-8.0.4+dfsg.orig/apps/JAWS3/docs/0000755000175000017500000000000015046037655015720 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/JAWS3/docs/web/0000755000175000017500000000000015046037655016475 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/JAWS3/docs/web/index.html0000644000175000017500000000143115027201773020462 0ustar sudipsudip JAWS3: Web System Application Framework

JAWS3


ace-8.0.4+dfsg.orig/apps/JAWS3/docs/web/images/0000755000175000017500000000000015046037655017742 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/JAWS3/docs/web/images/jaws3_components.fig0000644000175000017500000000420715027201773023721 0ustar sudipsudip#FIG 3.2 Landscape Center Inches Letter 100.00 Single -2 1200 2 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 1 1 2.00 60.00 120.00 4500 3300 3300 3075 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 1 1 2.00 60.00 120.00 4500 3675 3300 3750 2 3 0 1 0 7 50 0 10 0.000 0 0 -1 0 0 13 2100 1800 2100 5100 2400 5100 2400 4200 3000 4200 3000 3900 3300 3600 3300 3300 3000 3000 3000 2700 2400 2700 2400 1800 2100 1800 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 1 1 2.00 60.00 120.00 2700 4650 3750 4425 2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 1 1 2.00 60.00 120.00 2700 2025 3750 2250 2 2 0 0 7 29 53 0 47 0.000 0 0 -1 0 0 5 1800 1125 7200 1125 7200 6225 1800 6225 1800 1125 2 3 0 1 0 6 51 0 30 0.000 0 0 -1 0 0 22 5100 2700 4800 2400 5100 2100 4500 2100 4500 2400 4200 2400 4500 2700 4500 3000 4800 3300 4800 3600 4500 3900 4500 4200 4200 4500 4800 4500 4800 4800 5400 4800 5100 4500 5100 4200 5400 3900 5400 3000 5700 2700 5100 2700 2 3 0 1 0 2 51 0 30 0.000 0 0 -1 0 0 21 5400 3900 5100 4200 5100 4500 5400 4800 4800 4800 4800 4500 4200 4500 4500 4200 3900 4200 3900 5100 6900 5100 6900 3600 6600 3900 6600 3300 6600 3300 6300 3600 6300 3900 6300 4200 6000 4200 5700 3900 5400 3900 2 3 0 1 0 20 51 0 30 0.000 0 0 -1 0 0 9 5400 3000 5700 2700 6300 2700 6300 3900 6300 4200 6000 4200 5700 3900 5400 3900 5400 3000 2 3 0 1 0 11 51 0 30 0.000 0 0 -1 0 0 17 3900 2700 3900 1800 6900 1800 6900 3600 6600 3900 6600 3300 6600 3300 6300 3600 6300 2700 5100 2700 4800 2400 5100 2100 4500 2100 4500 2400 4200 2400 4500 2700 3900 2700 4 1 0 50 0 4 18 0.0000 0 255 1530 6000 2400 Concurrency\001 4 0 0 50 0 4 14 0.0000 0 165 765 3525 3975 callback\001 4 0 0 50 0 4 14 0.0000 0 165 765 3525 3000 callback\001 4 0 0 50 0 4 24 0.0000 0 330 2190 2100 5925 Specific Code\001 4 1 0 50 0 4 18 4.7124 0 195 990 4950 3450 Protocol\001 4 1 0 50 0 4 18 0.0000 0 195 825 6000 4650 Events\001 4 0 0 50 0 4 14 0.0000 0 210 825 2775 1950 registers\001 4 0 0 50 0 4 14 0.0000 0 210 825 2700 4875 registers\001 4 0 0 50 0 4 24 0.0000 0 330 1725 2100 5550 Application\001 4 2 0 50 0 4 24 0.0000 0 285 2895 6900 1650 JAWS Framework\001 4 1 0 50 0 4 18 4.7124 0 255 990 6000 3450 Caching\001 ace-8.0.4+dfsg.orig/apps/JAWS3/docs/web/images/jaws3_components.gif0000644000175000017500000003027215027201773023722 0ustar sudipsudipGIF87ahTpp1:@`PP`@00@`````t@@``@@ bs```@@: @@@q @ `Qz`,hT@(C,ã\*N#4JRQS>HT$Woج |=Ͽ|xv}z~zBđǴН҄նӠػڤ~;N=SoÃF\8!ċ! q8g<G#Q!RY`nEfM+m.:Q؛[O}e˳G?|u׻+wǫO_-z]L&xTv$2 p( q'" 2a(A x(N``؇H=iLxǍL$FniJE~q! h%yL%HNInI%a&Zi~i(ZxJfI6 TI' \ J`#&*X**jcJHJ% i&:$j&~+#Rz:xdHa6Nhqc ^ʤv m@! sr|g_}E(@H@"oi\Ļ2poAg`{ J 4W4 )%wsh(o15BWޥ$pc@N[< ~H(A hgBh?ѯpe=Sa{= SaRH Pq1A`M)i8O,)JP]D g;ATЛaxFХhԡg'@z[tF#J]SΣ/RMhH#Z*6no\٪ @ajy3,V/Cki-͖[*@[._7RUfFLmb*Qiqk+ĖL#͗T׀3EpBŨ&<⎠L-67m %ɧ6;'L [ΰ7OX @&.p}TIwpgL8αw@c#D(N2U߮4r1L*[XβX`6=4Xgk WQ$_$&%`g 1rcZ5E3rW8RԨq'aG 6(ASpE SmSPi]RNve]Vհ.e:TPRebr@f]}hGnE l5[:5]+,{?F>puOpw ޽,Ët-E.BgU y.SCf8-"h;)yU7si[5f*"LrD|(/mRU( SEJT-̫^{C.zL0=QHRW]U >_[lq.vL^ǀfTf&uUMmOys/`j}/$ĜF=_k^G7bӋkɞX2o{~-'!`}Z]鏏+ɖeg߻qS؈}?ˉw4o \S 0Xx~fwut@(tu=|yD "8$Xp#'/@yY{X8dh8"*xlb7&&f+V+GrP5(d7NX<؃+W-X|7`3 2 Hc  2V2`Y @6IX=sx>Ǝ;()( 8)cRƎ3c`)c6ɓ7Ig~D}&*c, .qَ:gH ) 9cIf9hdQ9E(wՕ;t@3S9cSـِyzɘJ{Uihcac1晟 }Yc2!ٛٛ4iYwgH\ycicIcԈ: pٖ`6ɛ9Fic\[wp8e8pَvɐuٞg?Y)YcHYp|؍ş7;DfHt)e Rf؀y fxِ&MIQŇJ6 BLjIcd晜V8ʑ",c @j{BbqC6 ئ'Љ``Ij挢(zz{ZfI5VhCJ"V֣>*D\HdOi?JviتvX*:HcX K8jz?֜U7]h ɪD\vz#hje"$mY #JxȭsȨe*bJej|ة˗eA6z]Ȩe +>6Iyv䚱ۋΚY|y] Q${&{zezzgy p{6Z6[cc<}|*C+cEyK۳N+P;Si:Fڵ'jb;JXjfhjanFZ QKcS,˪j[{˷~cj8`{-w/K  xm{`; ;ck˶x`{țʻ̋+ػwi_;r[۽۽[ ׶+ ٫x ۭ{af׋ے+ܼ1{{;<\,<" )ʧ#TTB%\s\ȧ{Ȥ,l:ʼ OY#2fW5ά1S7i"jt2hEʍ;ʿ\HQK̶Ei!Q~0T6E5|0%M Rp䬳XW ,ol9M9T5*OV@:g\§@yȩQkuTgIq "˱V|ќ`;k& r5#EI4m;L( M!#!@ jӰv|h*{ttw*".7uT,}Pp=Q !PkS];XM|Zm{ L{o !tm|Ճfm<_؎- ت0Νk~~%zOڒ}kשY0̳n`Ί%՚ mͼƍܨO]h=M= sڪ}߽%X|yR2}O 𦍭] 0խי]jM؆Ms%'oε `y|4f~:n~!~؉mז E1f0U)$.?.|UnF^rHJjQ.坨S&.[ntV)LP~PۅHAٛܥ[}ĭ@'݊Nui>x-̻ρVpN3οmR`ߵ U= !&ءN74O׫n=۵n~`q|⾮ &LC^~d~~PW h툜^זnŷ9~^>~Sl܎λ`~}p.:.wx L-xm[|nGL*hJp.z,y> -AddMM nCO&. }PX`p>P8ŒFOA}ߝ__aKI<,iBn~?Xvvxb|Ͽ.c]TzӞz텤irߜ_?UmoĮ9B6X#oې>S_Ûνq/;FſBʝ.E Hk>C?Xeo-B@ E#@aT.ENU+8[ݝP wȐ}0Pp`nQnN2R2S) 44ⱑPvvO17QwrDY(s Yzz+ 7W϶wu]$YA`B(mۺJ')$r(Vb;8ز"!59% `pn`lKE;o͎]aI% LS^`,C3E 2tڕW&4{Nװcٮe+[rƥkW#K10.Y-MZtvmٳi)-ƚr΀.[E&I_1Sp4-C ɔy_ 'p]`>UwV0س)ݽkB=RO1hK{.?$8{[ Onz {Ay/ 0?4ܑ$0DFLFSSy*:Q;GqqH p<2(z3I~Fɒ<̫ ܉ <= lPCb&H2tpN:BL2+tS;8+uD*&J[4J-01,C5F>0Lbd}g4475'[V:qu*Ds_EaԒ#eUdX?;Ǵqq-ůp7LdS'Yږe9yO> ˌffR g%_6'#XFl=C~s`m) {^nѡnhHKzO4{r7ٝ>Fuj2֔h]*3׃yfIZ̰c\k;FZ6US >6rkbBwIR3Im֭p_ȷa.{2{>W )4nnyȗsGwtiP.gXl>\ E/ƌ|m:(H7җl9?Rr\g]Ez6@bq6i/>|ro3>Ř]|{^}׸q'~c/y͟~&|+JKozߞ Mw9^[<Ʌo}/ꔗ=ПV+ťOvGy]സԧ+b?˿>5!}yrd|APYKm+d Ez!N #0:O,,o YB:EF O ~22v,zXP q vxOB pKPҴtyn0(@skT܆B *@&03?8[DkDa~k抮*\T4+:BlSC#21*@W^a~&E,dހH,*JM=sTG Ac跞#HeHtId(TKT ,|tIH媐Ԕ:HgNTCQ;mB@ Z+@2t;SPKx<}+\v3qEABGɔVw5¢VsT{PM8+u5;vKB*YTEJTRUYU53P60a|\õ/u] FK{<]^k7csZ*!7p6`_cA^>L`q/a|`-6#Vc丳OSUEX b7V->r;Su؄w-IGX^*jkծΰΐcX];w؆mjR؋8Oxz#(Il V0%+ ́x#؏W]v}E]5_)Y+y#,K`q ڥ_;XAYaCzJ[ w8(`wjuؐAaݔحx݀y 9/D` y9p`8˘4 4XYtAEeTԣRJ}8oY} 7t5MԟtZzAyD)@hȓI@[z]z^}BZk:70kO*ٕ/7BVљ3ZyXF>ڟm9{ZGڝAzWɸz)Y99.9s-8:S+2].۰ተ185--qZ,#%ە+%[1 .PMӴX%O25;3ٷ AdZT8zy;٩:#mڮNʟ[Lx>8ښuZaz?*]Y!F:;[1쵽Aک"廪;ۭڻߚk &9Ԏ0ZU)Lꐐ+ۺ\;H-\;_i?<;4EߙV|@ɉDUQHt!P9ŵڬSe yLT I|!i zu5ǿ<{|K*[ gw}u[/nٶӯ)'7;1ZX ]üavR_Yc=]ai@YJe=wؗ=yأǮ_ 3\Lܻ{yy'ZؤǎˁЧ޻o5WIWXIɰ9-R$VRwMC!}(+aҏv։+97>})}>GY>1µ՗ZƎɛ)(ލ]ޝ}"[g$qexڙ%]E̅L1z|e|I$ƹGjq ={}]ژ뙳<Z[ŋo9@W^K?;1kxڤAhMk_չ~+;=Y`?}𿽌nM'' ;>oDbB|+z@7:MG<;g % @ c#$<0)SIAMjXR!yVW4n]_f1LY!)%-%1R2V:ya4n^a}nEVUR  R3.N/S,R;LWwfSlS4'7{e P?K߇xO> CO! M6{-$.!4l.D"vq6'%) ~w.ϺB{WC$#Ro0cT\Ѥ.MϮA>Um5{7֬_.h(6hKF3coo6Ǡ A N*翬~g=%깙vZ|l$S7Sa^̊0+_c0YAǏ}_%Ugxzʦ^Z3tR (!v|8ED`# %J%+HDPxE ȇ  /Nw0Yu`el%W~ZNfcz]kdav։aY:azaw$t{:J"hrZifڢ0e)꩞zj:+*'T*k,:":h*qI:n mm܎ m .NJn+/mY 'rko|0 ܰ c-;<c0[1 g2Gf,K s?es 8sDmt m:R4Sc]fWkMu]+d#mva-leMw\mwi;7w7~7x\(?>rS.y0~,[^9c..'w^蓛9ħJk>q枫zꮋ{ں|j;_o3|„N:.Wzo?z;ace-8.0.4+dfsg.orig/apps/JAWS3/docs/web/images/jaws3_banner.fig0000644000175000017500000000043315027201773022776 0ustar sudipsudip#FIG 3.2 Landscape Center Inches Letter 100.00 Single -3 1200 2 2 2 0 3 19 19 50 0 -1 0.000 0 0 -1 0 0 5 900 2400 9900 2400 9900 5700 900 5700 900 2400 4 1 0 50 0 4 150 0.0000 0 1725 8115 5400 4500 JAWS 3\001 4 1 19 50 0 4 48 0.0000 0 690 7890 5400 5325 Web System Framework\001 ace-8.0.4+dfsg.orig/apps/JAWS3/docs/web/images/jaws3_banner.png0000644000175000017500000001046315027201773023021 0ustar sudipsudipPNG  IHDR+; pHYs M MέN!tEXtSoftwareAladdin Ghostscript 5.10nZIDATxY:FQ˱X5|!oˡ&,Yq7'M9@ `c<{ӝ`@ci@J+_pMޒؔm9#R *Z3*Wd8yhd ԤBҒ`oWZSv@NyU I}$2d t(PQr,1&C*+roƙo1r RN?=&'"+[Z5UrIN*f۾׋@e/d tVSe-(;wYۮX`73nAN!< a^WGuYOLtσD2/Cmev˷d_,4.FhU62;f41&N!ϲ^п" 'DukL"ɒ1|3ϱ3|sᵸ^]q]dt}dml,+ә Us-Z?3gN?3'Z$ijZBNbMR ,ЯSԁt:2#%{{ڙh,v9_pO~;=HVw|)OjQ+ט e{1WM,rcaE!HPm{")2ʔ~Xxbƌ W 1^iώL"[&H%`@P@oy`aH!bl4 d,k+CB qܑ,L0 qS7قXI[iR,~|} #aw%φIA24*_H{5ıa)ϐl @DsZl,0*@u.B\/@6x=X?V5^(gV岕pC t2PV-X!@Ԗ&l(IE;baqէP%İbT~?/!nta{dG2,%Ƃk?oz5ERQuu7ٖ@!8Hm5X&F T|+"1CZ ˵a!N)=jW(Gvz=ST!8"`tN+԰Xa*u/FpJzbBZYJNΞtJ8p7VPشB2*`4(q-̇%rmdʼnwZ⩍. K3d S0C0"N@@#d`&u. 1' s"و6)*I3Sg'P 4_uM$*qbDÈgs|yl%&=POa2cNBg²IILƜU>R},ǠRO;5S)31'v)n:*\CIa-n^sWcag"COiVDB)dVV@'%d0V4NL"&@{[&Ck#a Uf~ ԄCG'qBa!mG[57 By2j$2o %067^Wa_4\/"1}OZ0u}s ;s +4{~J~Xs4\*kynӠe02>CVit́0X~]%bu]tJ2;bȋW#"OrhkåL%@F foV2ww p2^D6smas $K A`bd RW6@+ݕem4s4~YKV͂s F^-[HNGl| I6 )|UT)H$4]bIEl/-X mҖs Lź $o/ʵ%X7qU4LBݯ}: dSt~gBiTB7&>cgT能eXTJYW zal$t7I?7eЬs&'>c-Nk 3eEo\OTo* ?ky!xi8~a0=M.x2znu~ 7"`:/8&snxhLT/1Mfa&^?%N?KXg2mc e>}HT]L>j\ 3fKxSL = MaI4Rį˪x#p"*Kp"UYE[Hb7:Â>JMzֶCV"t-ۧZ&xE߉S/ [@<ժ@˰EHY˟L^[6 8Sj봄..?>g&O}_ۑm d4~&5pǾtchm_n0g'>~_Е")ThrH{v"cNvZ'[+{00aszԲ73Ev~=mЯXYXyM&A' &{plcyn~̴ ((k,> 5R|~+ <?]wԁPy^Tם?Ya^jHG0"@AwO4s쀍G46d)~ü7b2|P] a h/fUF;x N>#Ӯů_>kԅ'uȦ^fgj?kZN:SlأѮ?ܛ]ڲ&@ާ*IjLxd2SӕW{:oZ[FŔ5]O<pyV5sKuk$dQo{/]j e(5W]b:U7LxUt}=yZA`~Ö"}/UVȮnM~ZM:f~\RzG7ƻI8K.Kb4\I_o'~uv-׍pV ~q,a~KL4,<;u\X[\& _ٮH86%O9WW{͍+ӡf l?_(m:.ҏ_"Ǫmb-Lݏ |F?_\ho%^hRdBV@h77}?:kvF %8Y@a HEU7(9D X *  _̂NϲIENDB`ace-8.0.4+dfsg.orig/apps/JAWS3/docs/web/images/jaws3_banner.gif0000644000175000017500000001133415027201773023000 0ustar sudipsudipGIF89a׀@@@@@!,I8ͻ`(dihl;D,tmx|pH,Ȥr tJZجv=>aOxL.z&p{N^~}qrd{)j&۷""H{0cS`4J|(&ā*^8fFM $ǐfL <@$L$/\Se =rᚗh< N]XP;/j1k T+6ĀWHIЃtӀMӶը-r ,ӬH* Eӷc\ev!X%8@-&*j[ \2hqGD~v!1,=<o=[r܍Rx2+;Na샮c@WG^'\ŞH S5 G>B TcDׅn^$P,~o A]_ +YՀ($ q`ҍ! fHK`"f,P@)И2YTc7A 8AgdzGx|g۱t ~ДjҘtm0!f Zv)F¢D^D(4ij Rx>MYdJy)g(KܴJirϦY jCN+uz7l V `b򻮈'.אQfsQyK¨mt1g[ {`N,1m8騐 p/`,!s=p2~O_ Җ?9Kz-QNF;W#?<WBp; R4 Sܣ4)FscYwJ0aI:癃bxO;0frK\V109ϲTt=gWe8v+xh'Ivnˬ^ظ_&P[Bptw.5Q]`%A5$*7Qiuc4VϮ}m-[o֔DEdb)[sزoj 1wTd-kuk`̵k槝B@%<(@Hs w}WjbJ& ,y:a;OCqD?yJn/oüqN]'$‚8QN|%]p/tZ7҅ u w~n*ϥw#{-A&P]u01F;Ѱ1eO]tذ:j'9ӰEK%9B0JctI%\\!G7z=2:=M o񋶸E7C#W $'7]4S~ګ맏}rK9ok-X %|twp~VSXQ'J#v qgRy ƀdžX"x#]8iYqfo_%+%}gmzw* gT uv`{$A؃OzzQUJX # w}W`q^dX6fdUj؆nrX`v@z؇~X@ (g1@p0'8hQpWVÉ 8HX;0P<0E &(؊q34pzQ;10X؉0(82xb k؊pPH؇NܘȸX HYЎh ɏ(r" !h@2y(i$/5YP %3 yJVxXJْVԸ!&Jy8 4h؎ey@hCiQi3zIh)H`6iXِ-ayf)m,yO 𔒙И @>607pi`7p hvٍzI i9陧mXc9:pI/)i^i1`ޙs`H9IuIٟ`ٌ)9I؞ YIAK)+I\y晐sYĩyhT)ٟTQii":99yBj6ʜ:4 LJEɠ虃EC?#Jcj9^ u  ׉dz!ZczXxzZ*xQT: Y8|ڨIĹKzɧ队٤Wz`zYJ}zg:bڗ Ū*試zʔ2:+/ǣUY zj꫷:⚩`jt>piʟJ `zi)jɪHؔ&o꯻jHixNڡ*:`;J:;)nj I딵X  K2 *"y>p k!;JI $@^ꥣHM M+f5K' b=۱+ *YVU*/LK"Q۷i;BH )(㪥cp꺜ڢ8Gm; zIڕ *F[J+KL Ҩt[ ꬖq`0 R+zw{Ћ&#뺠@z薆uڥGk!ۊ뾘ZjF~ʟzkϻ;ٵˮIjغQjg*-;+{ܦiˮ_k+8$YqۻHֻq׸PʒꋻikJ:qꐝk+|Ŗ+1̬[SR jeo{ʺuPƐ*jvjTiGڟ3l Ƕ, |Lz9*K@(Jo\v*x치X,"j*ܭ\Xaܽ(|lh*ʨ TJx٦ük,܉MN̷T Hʥ= 짳9b4:܉<͡|5옋MkͪH܏Ipq\ \;Ņ=9zZgɫB ,I.L²좇y̗_٢ݙ0НD32]yоx-UԴT՜`խG?d݋Q-En׋r]׻@vו`zג~؆ׂ]w͆{؊_؎l@ؒ]>]ٜٚٞ٠}ڤ]ڦ}ڨڪ]ڗ;ace-8.0.4+dfsg.orig/apps/JAWS3/docs/web/overview.html0000644000175000017500000000642315027201773021227 0ustar sudipsudip JAWS Overview

JAWS Overview

  1. What is JAWS?
    JAWS is an application framework for the construction of Web systems.

    1. What is an application framework?
      On page 26 of [Gamma+95], a framework is defined as "a set of cooperating classes that make up a reusable design for a specific class of software."

      An application framework can be defined as a collection of cooperating frameworks that make up a reusable application software architecture for a specific application domain. An application framework is an application skeleton which can be customized by inheriting and instantiating from reuseable components in the software frameworks that it provides. The result is pre-fabricated design at the cost of reduced design flexibility.

    2. What is a Web system?
      A Web system is defined as any combination of services that are provided through the Internet and the World Wide Web (WWW). This includes file transfer services (HTTP, FTP), caching services, e-commerce, etc.

  2. What classes are part of JAWS, and how do they cooperate?
    The JAWS framework is roughly organized as 4 sub-frameworks.
    1. Events Framework
    2. Concurrency Framework
    3. Protocol Framework
    4. Caching Framework (still under development)

    JAWS Components

    1. What is the JAWS Events Framework?
      The JAWS Events Framework is arguably the most complicated sub-framework within JAWS. It contains the most number of interacting classes.

    2. What is the JAWS Concurrency Framework?

    3. What is the JAWS Protocol Framework?

    4. What is the JAWS Caching Framework?
      There is nothing to say about it, since it is not finished yet.

References

[Gamma+95]

Design Patterns: Elements of Reusable Object-Oriented Software, by E. Gamma, R. Helm, R. Johnson, and J. Vlissides, 1995, Addison-Wesley.

[PLoPD1]

Pattern Languages of Program Design, edited by J. Coplien and D. Schmidt, 1995, Addison-Wesley.

[PLoPD2]

Pattern Languages of Program Design 2, edited by J. Vlissides, J. Coplien, and N. Kerth, 1996, Addison-Wesley.

[PLoPD3]

Pattern Languages of Program Design 3, edited by R. Martin, D. Riehle, and F. Buschmann, 1998, Addison-Wesley.

[PLoPD4]

Pattern Languages of Program Design 4, Addison-Wesley.
ace-8.0.4+dfsg.orig/apps/JAWS3/zBUILD0000644000175000017500000000075415027201773015743 0ustar sudipsudipTo build JAWS3: (1) Obtain ACE, configure and build it. (2) Build the JAWS3 framework (in the subdirectory jaws3). (3) Build the Small Server (in the subdirectory small). To run the Small Server, go to the small subdirectory, and execute ../jaws3/main. JAWS3 is known to build using the latest ACE beta on: Solaris 2.7 (sparc) with SunCC 4.2 Solaris 2.7 (x86) with SunCC 4.2 Solaris 2.7 (x86) with gcc-2.95.2 FreeBSD 3.4 (x86) with gcc-2.7.2 RedHat Linux 6.1 (x86) with gcc-2.95.2 ace-8.0.4+dfsg.orig/apps/JAWS3/contrib/0000755000175000017500000000000015046037655016430 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/JAWS3/contrib/john_at_lyris_dot_com/0000755000175000017500000000000015046037655023000 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/JAWS3/contrib/john_at_lyris_dot_com/jaws3-cntlC.code0000644000175000017500000000575015027201773025724 0ustar sudipsudip bool PlatformSpecificInitialize() { LYRIS_PROFILE("PlatformSpecificInitialize"); bool retval; retval = SetConsoleCtrlHandler(handler_routine, TRUE); if (retval != TRUE) { trace("Note: SetConsoleCtrlHandler() did not succeed."); } retval = SetConsoleTitle(APPLICATION_NAME.c_str()); if (retval != TRUE) { trace("Note: setConsoleTitle() did not succeed."); } return lyris_success; }; BOOL WINAPI handler_routine(DWORD signal) { LYRIS_PROFILE("handler_routine"); static unsigned char handles_to_use = 3; static bool handled_already = false; if ((signal == CTRL_CLOSE_EVENT) || (signal == CTRL_SHUTDOWN_EVENT)) { // if we receive a Windows signal to shutdown, we should exit // immediately, and cleanly if (handled_already == false) { handled_already = true; //lyris_Thread::ExitApplicationNow(); DisplayMessage("Shutting down as requested"); // create shutdown thread so that signal handler can return // immediately lyris_Thread aShutDown(ShutDownNow, NULL, "Shut Down Thread"); return TRUE; } else { return FALSE; } } else if (signal == CTRL_C_EVENT) { // if we receive a Windows signal to shutdown, we should exit // immediately, and cleanly if (handles_to_use == 3) { handles_to_use--; //lyris_Thread::ExitApplicationNow(); DisplayMessage("Shutting down as requested"); // create shutdown thread so that signal handler can return // immediately lyris_Thread aShutDown(ShutDownNow, NULL, "Shut Down Thread"); return TRUE; } else if (handles_to_use > 0) { DisplayMessage("Currently shutting down: press Ctrl-C " + ULong2String(handles_to_use) + " more times to shut down immediately."); handles_to_use--; return TRUE; } else { return FALSE; } } else if (signal == CTRL_BREAK_EVENT) { if (APPLICATION_NAME == "Lyris") { if (ShouldDisplayDebugMessages() == 0) { SetShouldDisplayDebugMessages(1); } else { SetShouldDisplayDebugMessages(0); } DisplayMessage("Debug mode is now: " + Bool2String(ShouldDisplayDebugMessages())); } else if (APPLICATION_NAME == "MailShield") { specific::setReloadConfig(lyris_yes); } else { lyr_fatal; } return TRUE; } else { lyr_notify("Unknown Windows signal passed to handler: " + ULong2String(signal)); }; return FALSE; }; ace-8.0.4+dfsg.orig/apps/JAWS3/contrib/john_at_lyris_dot_com/README0000644000175000017500000000725415027201773023661 0ustar sudipsudip "John Buckman" I have not looked to see what you're using the signal handler for, but just FYI, in our own Unix/Windows command line applications, we have a Windows handler for ctrl-c and ctrl-break, which we use as substitutes for signal handling on Windows. I can give you source code for doing this if you like, if you think it is a useful substitute. There are two functions you need. A handler routine and a routine which registers that handler. The SetConsoleCtrlHandler() Windows function set the handler, and then they handler just receives a signal and returns either a true or false to ban on whether it was handled or not. Note that is only works in a console mode application and not in a graphical application. The code below is copied directly out of production source code working for several years, so there should not be any bugs in it. bool PlatformSpecificInitialize() { LYRIS_PROFILE("PlatformSpecificInitialize"); bool retval; retval = SetConsoleCtrlHandler(handler_routine, TRUE); if (retval != TRUE) { trace("Note: SetConsoleCtrlHandler() did not succeed."); } retval = SetConsoleTitle(APPLICATION_NAME.c_str()); if (retval != TRUE) { trace("Note: setConsoleTitle() did not succeed."); } return lyris_success; }; BOOL WINAPI handler_routine(DWORD signal) { LYRIS_PROFILE("handler_routine"); static unsigned char handles_to_use = 3; static bool handled_already = false; if ((signal == CTRL_CLOSE_EVENT) || (signal == CTRL_SHUTDOWN_EVENT)) { // if we receive a Windows signal to shutdown, we should exit immediately, and cleanly if (handled_already == false) { handled_already = true; //lyris_Thread::ExitApplicationNow(); DisplayMessage("Shutting down as requested"); // create shutdown thread so that signal handler can return immediately lyris_Thread aShutDown(ShutDownNow, NULL, "Shut Down Thread"); return TRUE; } else { return FALSE; } } else if (signal == CTRL_C_EVENT) { // if we receive a Windows signal to shutdown, we should exit immediately, and cleanly if (handles_to_use == 3) { handles_to_use--; //lyris_Thread::ExitApplicationNow(); DisplayMessage("Shutting down as requested"); // create shutdown thread so that signal handler can return immediately lyris_Thread aShutDown(ShutDownNow, NULL, "Shut Down Thread"); return TRUE; } else if (handles_to_use > 0) { DisplayMessage("Currently shutting down: press Ctrl-C " + ULong2String(handles_to_use) + " more times to shut down immediately."); handles_to_use--; return TRUE; } else { return FALSE; } } else if (signal == CTRL_BREAK_EVENT) { if (APPLICATION_NAME == "Lyris") { if (ShouldDisplayDebugMessages() == 0) { SetShouldDisplayDebugMessages(1); } else { SetShouldDisplayDebugMessages(0); } DisplayMessage("Debug mode is now: " + Bool2String(ShouldDisplayDebugMessages())); } else if (APPLICATION_NAME == "MailShield") { specific::setReloadConfig(lyris_yes); } else { lyr_fatal; } return TRUE; } else { lyr_notify("Unknown Windows signal passed to handler: " + ULong2String(signal)); }; return FALSE; }; ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/0000755000175000017500000000000015046037655016017 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Asynch_IO.cpp0000644000175000017500000002170515027201773020335 0ustar sudipsudip#ifndef JAWS_BUILD_DLL #define JAWS_BUILD_DLL #endif /*JAWS_BUILD_DLL*/ #include "ace/config-lite.h" #include "jaws3/Jaws_IO.h" #include "jaws3/Asynch_IO.h" #include "jaws3/Event_Completer.h" #include "jaws3/Event_Result.h" #if defined (ACE_HAS_AIO_CALLS) || defined (ACE_HAS_WIN32_OVERLAPPED_IO) #include "jaws3/Asynch_IO_Helpers.h" void JAWS_Asynch_IO::send ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act ) { JAWS_EC_AH_Adapter *jecaha; jecaha = JAWS_EC_AH_Adapter::make (completer); ACE_Asynch_Write_Stream asynch_write_stream; if (jecaha == 0 || asynch_write_stream.open (*jecaha, handle) == -1 || asynch_write_stream.write (*mb, mb->length (), act) == -1) { delete jecaha; JAWS_Event_Result io_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_SEND_FAIL ); if (completer) completer->output_complete (io_result, act); } } void JAWS_Asynch_IO::recv ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act ) { JAWS_EC_AH_Adapter *jecaha; jecaha = JAWS_EC_AH_Adapter::make (completer); ACE_Asynch_Read_Stream asynch_read_stream; if (jecaha == 0 || asynch_read_stream.open (*jecaha, handle) == -1 || asynch_read_stream.read (*mb, mb->space (), act) == -1) { delete jecaha; JAWS_Event_Result io_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_RECV_FAIL ); if (completer) completer->output_complete (io_result, act); } } void JAWS_Asynch_IO::transmit ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , void *act , ACE_Message_Block *header , ACE_Message_Block *trailer ) { JAWS_EC_AH_Adapter *jecaha; jecaha = JAWS_EC_AH_Adapter::make (completer); ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer = 0; header_and_trailer = new ACE_Asynch_Transmit_File::Header_And_Trailer ( header , header->length () , trailer , trailer->length () ); ACE_Asynch_Transmit_File asynch_transmit_file; if (source == ACE_INVALID_HANDLE || jecaha == 0 || header_and_trailer == 0 || asynch_transmit_file.open (*jecaha, handle) == -1 || asynch_transmit_file.transmit_file ( source , header_and_trailer , 0 , 0 , 0 , 0 , 0 , act ) == -1) { delete jecaha; delete header_and_trailer; JAWS_Event_Result io_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_TRANSMIT_FAIL ); if (completer) completer->output_complete (io_result, act); } } JAWS_EC_AH_Adapter * JAWS_EC_AH_Adapter::make (JAWS_Event_Completer *completer) { return new JAWS_EC_AH_Adapter (completer); } void JAWS_EC_AH_Adapter ::handle_read_stream (const ACE_Asynch_Read_Stream::Result &result) { JAWS_Event_Result io_result; io_result = this->make_io_result ( result , JAWS_Event_Result::JE_RECV_OK , JAWS_Event_Result::JE_RECV_FAIL ); // More useful diagnostics not implemented yet. void *act = const_cast (result.act ()); this->completer_->input_complete (io_result, act); delete this; } void JAWS_EC_AH_Adapter ::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result) { JAWS_Event_Result io_result; io_result = this->make_io_result ( result , JAWS_Event_Result::JE_SEND_OK , JAWS_Event_Result::JE_SEND_FAIL ); // More useful diagnostics not implemented yet. void *act = const_cast (result.act ()); this->completer_->output_complete (io_result, act); delete this; } void JAWS_EC_AH_Adapter ::handle_transmit_file (const ACE_Asynch_Transmit_File::Result &result) { JAWS_Event_Result io_result; io_result = this->make_io_result ( result , JAWS_Event_Result::JE_TRANSMIT_OK , JAWS_Event_Result::JE_TRANSMIT_FAIL ); // More useful diagnostics not implemented yet. // Watch out for files not opened in overlapped IO mode. void *act = const_cast (result.act ()); this->completer_->output_complete (io_result, act); delete this; } JAWS_Event_Result JAWS_EC_AH_Adapter ::make_io_result ( const ACE_Asynch_Result &result , JAWS_Event_Result::JE_REASON reason_ok , JAWS_Event_Result::JE_REASON reason_fail ) { size_t bytes = result.bytes_transferred (); JAWS_Event_Result::JE_STATUS status; JAWS_Event_Result::JE_REASON reason; if (result.success ()) { status = JAWS_Event_Result::JE_OK; reason = reason_ok; } else { status = JAWS_Event_Result::JE_ERROR; reason = reason_fail; } JAWS_Event_Result io_result (bytes, status, reason); return io_result; } #else /* EMULATE AIO WITH REACTOR */ #include "jaws3/Reactive_IO.h" void JAWS_Asynch_IO::send ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act ) { JAWS_Reactive_IO::instance ()->send (handle, mb, completer, act); } void JAWS_Asynch_IO::recv ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act ) { JAWS_Reactive_IO::instance ()->recv (handle, mb, completer, act); } void JAWS_Asynch_IO::transmit ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , void *act , ACE_Message_Block *header , ACE_Message_Block *trailer ) { JAWS_Reactive_IO::instance ()->transmit ( handle , source , completer , act , header , trailer ); } #endif /* ACE_HAS_AIO_CALLS || ACE_HAS_WIN32_OVERLAPPED_IO */ // For now, we will simulate timed Asynch IO with timed Reactive IO. // In the future, we will implement the timed Asynch IO with timers // and Asynch IO cancelation. #include "jaws3/Reactive_IO.h" void JAWS_Asynch_IO::send ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act ) { JAWS_Reactive_IO::instance ()->send (handle, mb, completer, tv, act); } void JAWS_Asynch_IO::recv ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act ) { JAWS_Reactive_IO::instance ()->recv (handle, mb, completer, tv, act); } void JAWS_Asynch_IO::transmit ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act , ACE_Message_Block *header , ACE_Message_Block *trailer ) { JAWS_Reactive_IO::instance ()->transmit ( handle , source , completer , tv , act , header , trailer ); } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Cached_Allocator_T.cpp0000644000175000017500000000653115027201773022153 0ustar sudipsudip#ifndef JAWS_CACHED_ALLOCATOR_T_CPP #define JAWS_CACHED_ALLOCATOR_T_CPP #include "jaws3/Cached_Allocator_T.h" template char * JAWS_Cached_Allocator::get_next_pool (char *pool) { char *next = 0; char *next_indirect = pool + (this->pool_size_); ACE_OS::memcpy (&next, next_indirect, sizeof (char *)); return next; } template void JAWS_Cached_Allocator::set_next_pool (char *pool, char *next_pool) { char *next_indirect = pool + (this->pool_size_); ACE_OS::memcpy (next_indirect, &next_pool, sizeof (char *)); } template void JAWS_Cached_Allocator::extend_pool () { char *new_pool = 0; ACE_NEW (new_pool, char[this->pool_size_ + sizeof (char *)]); for (size_t c = 0; c < (this->pool_size_ / sizeof (T)); c++) { void* placement = new_pool + c * sizeof(T); this->free_list_.add (new (placement) ACE_Cached_Mem_Pool_Node); this->set_next_pool (new_pool, 0); } if (this->pool_head_ == 0) this->pool_head_ = this->pool_tail_ = new_pool; else this->set_next_pool (this->pool_tail_, new_pool); this->pool_tail_ = new_pool; } template JAWS_Cached_Allocator::JAWS_Cached_Allocator (size_t n_chunks) : pool_size_ (n_chunks * sizeof (T)) , pool_head_ (0) , pool_tail_ (0) , free_list_ (ACE_PURE_FREE_LIST) { this->extend_pool (); } template JAWS_Cached_Allocator::~JAWS_Cached_Allocator () { char *curr = this->pool_head_; while (curr) { char *next = this->get_next_pool (curr); delete [] curr; curr = next; } } template void * JAWS_Cached_Allocator::malloc (size_t nbytes) { if (nbytes > sizeof (T)) return 0; ACE_Cached_Mem_Pool_Node *node = 0; node = this->free_list_.remove (); if (node == 0) { this->extend_pool (); node = this->free_list_.remove (); // ASSERT node != 0 } // addr() call is really not absolutely necessary because of the way // ACE_Cached_Mem_Pool_Node's internal structure arranged. return node->addr (); } template void JAWS_Cached_Allocator::free (void *ptr) { this->free_list_.add ((ACE_Cached_Mem_Pool_Node *) ptr); } template JAWS_Cached_Allocator * JAWS_TSS_Cached_Allocator::ts_allocator () { JAWS_Cached_Allocator *ts_obj = 0; ts_obj = this->ts_allocator_.ts_object (); // Don't need double-check locking since this value is // obtained from a thread specific context. if (ts_obj == 0) { ACE_NEW_RETURN (ts_obj, JAWS_CACHED_ALLOCATOR(T) (this->n_chunks_), 0); this->ts_allocator_.ts_object (ts_obj); } return ts_obj; } template JAWS_TSS_Cached_Allocator::JAWS_TSS_Cached_Allocator (size_t n_chunks) : n_chunks_ (n_chunks) { } template JAWS_TSS_Cached_Allocator::~JAWS_TSS_Cached_Allocator () { } template void * JAWS_TSS_Cached_Allocator::malloc (size_t nbytes) { return this->ts_allocator ()->malloc (nbytes); } template void JAWS_TSS_Cached_Allocator::free (void *ptr) { this->ts_allocator ()->free (ptr); } #endif /* JAWS_CACHED_ALLOCATOR_T_CPP */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/TPOOL_Concurrency.h0000644000175000017500000000106015027201773021425 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_TPOOL_CONCURRENCY_H #define JAWS_TPOOL_CONCURRENCY_H #include "jaws3/Concurrency.h" class JAWS_Export JAWS_TPOOL_Concurrency : public JAWS_Concurrency_Impl { public: JAWS_TPOOL_Concurrency (); int putq (JAWS_Protocol_Handler *ph); int getq (JAWS_Protocol_Handler *&ph); static JAWS_TPOOL_Concurrency * instance () { return ACE_Singleton::instance (); } private: int number_of_threads_; int shutdown_task_; int error_; }; #endif /* JAWS_TPOOL_CONCURRENCY_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Task_Timer.h0000644000175000017500000000274315027201773020231 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_TASK_TIMER_H #define JAWS_TASK_TIMER_H #include "ace/Singleton.h" #include "ace/Timer_Wheel.h" #include "ace/Timer_Queue_Adapters.h" #include "jaws3/Export.h" #include "jaws3/Timer.h" class JAWS_Task_Timer; class JAWS_Export JAWS_Task_Timer : public JAWS_Timer_Impl { public: JAWS_Task_Timer (); static JAWS_Timer_Impl * instance () { return ACE_Singleton::instance (); } void schedule_timer ( long *timer_id , const ACE_Time_Value &delta , JAWS_Event_Completer *completer , void *act = 0 ); void schedule_absolute_timer ( long *timer_id , const ACE_Time_Value &tv , JAWS_Event_Completer *completer , void *act = 0 ); void schedule_interval_timer ( long *timer_id , const ACE_Time_Value &interval , JAWS_Event_Completer *completer , void *act = 0 ); void cancel_timer (long timer_id); // NOTE: Cancelling the timer causes handle_close to be called, but // not handle_timeout (of couse, I mean in the ACE_Event_Handler that // is being used as the timer helper). private: ACE_Thread_Timer_Queue_Adapter timer_queue_; }; #endif /* JAWS_TASK_TIMER_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Event_Completer.h0000644000175000017500000000242415027201773021256 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_EVENT_COMPLETER_H #define JAWS_EVENT_COMPLETER_H #include "jaws3/Export.h" #include "jaws3/Event_Result.h" class JAWS_Event_Completer; class JAWS_Export JAWS_Event_Completer // = TITLE // Event completion callback class. { public: virtual ~JAWS_Event_Completer (); virtual void accept_complete (const JAWS_Event_Result &r, void *act = 0); // The callback entry point when input has been read. virtual void connect_complete (const JAWS_Event_Result &r, void *act = 0); // The callback entry point when input has been read. virtual void input_complete (const JAWS_Event_Result &r, void *act = 0); // The callback entry point when input has been read. virtual void output_complete (const JAWS_Event_Result &r, void *act = 0); // The callback entry point when output has been completely written. virtual void timer_complete (const JAWS_Event_Result &r, void *act = 0); // The callback entry point when timer has expired. virtual void lambda_complete (const JAWS_Event_Result &r, void *act = 0); // The callback entry point when a lambda event completes. virtual void default_complete (const JAWS_Event_Result &r, void *act = 0); // The defaul callback entry point when an event completes. }; #endif /* JAWS_EVENT_COMPLETER_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Cached_Allocator_T.h0000644000175000017500000000402215027201773021611 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_CACHED_ALLOCATOR_T_H #define JAWS_CACHED_ALLOCATOR_T_H #include "ace/ACE.h" #include "ace/Synch.h" #include "ace/Malloc.h" #include "ace/Free_List.h" #define JAWS_DEFAULT_ALLOCATOR_CHUNKS 10 #define JAWS_CACHED_ALLOCATOR(T) \ JAWS_Cached_Allocator< T, ACE_SYNCH_NULL_MUTEX > template class JAWS_Cached_Allocator : public ACE_New_Allocator // = TITLE // Create a cached memory pool with chunks each with // sizeof () size. // // = DESCRIPTION // This class enables caching of dynamically allocated, // fixed-sized classes. { public: JAWS_Cached_Allocator (size_t n_chunks = JAWS_DEFAULT_ALLOCATOR_CHUNKS); ~JAWS_Cached_Allocator (); void* malloc (size_t); // get a chunk of memory from free store. void free (void *); // return a chunk of memory back to free store. protected: char * get_next_pool (char *pool); void set_next_pool (char *pool, char *next_pool); void extend_pool (); private: size_t pool_size_; char *pool_head_; // Head of memory pool. char *pool_tail_; // Tail of memory pool. ACE_Locked_Free_List, ACE_LOCK> free_list_; // Maintain a cached memory free list. }; template class JAWS_TSS_Cached_Allocator : public ACE_New_Allocator // = TITLE // Create a thread specific cached memory pool with // chunks each with sizeof () size. // // = DESCRIPTION // This class enables caching of dynamically allocated, // fixed-sized classes. { public: JAWS_TSS_Cached_Allocator (size_t n_chunks = JAWS_DEFAULT_ALLOCATOR_CHUNKS); ~JAWS_TSS_Cached_Allocator (); void * malloc (size_t); // get a chunk of memory from free store. void free (void *); // return a chunk of memory back to free store. protected: JAWS_Cached_Allocator * ts_allocator (); private: size_t n_chunks_; ACE_TSS_TYPE (JAWS_CACHED_ALLOCATOR(T)) ts_allocator_; }; #include "jaws3/Cached_Allocator_T.cpp" #endif /* JAWS_CACHED_ALLOCATOR_T_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Task_Timer.cpp0000644000175000017500000000564515027201773020570 0ustar sudipsudip#ifndef JAWS_BUILD_DLL #define JAWS_BUILD_DLL #endif #include "ace/OS_NS_sys_time.h" #include "jaws3/Task_Timer.h" #include "jaws3/Timer_Helpers.h" JAWS_Task_Timer::JAWS_Task_Timer () { this->timer_queue_.activate (); } void JAWS_Task_Timer::schedule_timer ( long *timer_id , const ACE_Time_Value &delta , JAWS_Event_Completer *completer , void *act ) { JAWS_Timer_EH *eh = new JAWS_Timer_EH (completer, act); if (eh == 0 || (*timer_id = this->timer_queue_.schedule ( eh , 0 , delta + ACE_OS::gettimeofday ())) == -1) { JAWS_Event_Result timer_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_TIMER_FAIL ); if (completer) completer->timer_complete (timer_result, act); delete eh; } } void JAWS_Task_Timer::schedule_absolute_timer ( long *timer_id , const ACE_Time_Value &tv , JAWS_Event_Completer *completer , void *act ) { JAWS_Timer_EH *eh = new JAWS_Timer_EH (completer, act); if (eh == 0 || (*timer_id = this->timer_queue_.schedule (eh, 0, tv)) == -1) { JAWS_Event_Result timer_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_TIMER_FAIL ); if (completer) completer->timer_complete (timer_result, act); delete eh; } } void JAWS_Task_Timer::schedule_interval_timer ( long *timer_id , const ACE_Time_Value &interval , JAWS_Event_Completer *completer , void *act ) { JAWS_Timer_EH *eh = new JAWS_Timer_EH (completer, act); if (eh == 0 || (*timer_id = this->timer_queue_.schedule ( eh , 0 , interval + ACE_OS::gettimeofday () , interval )) == -1) { JAWS_Event_Result timer_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_TIMER_FAIL ); if (completer) completer->timer_complete (timer_result, act); delete eh; } } void JAWS_Task_Timer::cancel_timer (long timer_id) { this->timer_queue_.cancel (timer_id); } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Reactive_IO.h0000644000175000017500000000343515027201773020317 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_REACTIVE_IO_H #define JAWS_REACTIVE_IO_H #include "ace/Message_Block.h" #include "ace/Singleton.h" #include "ace/Synch_Traits.h" #include "ace/Time_Value.h" #include "jaws3/Export.h" #include "jaws3/Jaws_IO.h" #include "jaws3/Event_Result.h" class JAWS_Reactive_IO; class JAWS_Export JAWS_Reactive_IO : public JAWS_IO_Impl { public: static JAWS_Reactive_IO * instance () { return ACE_Singleton::instance (); } void send ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act = 0 ); void recv ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act = 0 ); void transmit ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , void *act = 0 , ACE_Message_Block *header = 0 , ACE_Message_Block *trailer = 0 ); void send ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act = 0 ); void recv ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act = 0 ); void transmit ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act = 0 , ACE_Message_Block *header = 0 , ACE_Message_Block *trailer = 0 ); }; #endif /* JAWS_REACTIVE_IO_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/TPOOL_Concurrency.cpp0000644000175000017500000000314615027201773021767 0ustar sudipsudip#include "ace/OS_NS_stdlib.h" #include "ace/Message_Block.h" #ifndef JAWS_BUILD_DLL #define JAWS_BUILD_DLL #endif #include "jaws3/TPOOL_Concurrency.h" #include "jaws3/Protocol_Handler.h" #include "jaws3/Options.h" JAWS_TPOOL_Concurrency::JAWS_TPOOL_Concurrency () : number_of_threads_ (5) , shutdown_task_ (0) , error_ (0) { const char *value = JAWS_Options::instance ()->getenv ("JAWS_TPOOL_THREADS"); if (value != 0) this->number_of_threads_ = ACE_OS::atoi (value); else this->number_of_threads_ = ACE_OS::atoi (JAWS_DEFAULT_TPOOL_THREADS); if (this->number_of_threads_ <= 0) this->number_of_threads_ = 5; int r; r = this->activate ( THR_BOUND | THR_JOINABLE, this->number_of_threads_); if (r < 0) { // ACE_ERROR this->error_ = 1; this->shutdown_task_ = 1; } } int JAWS_TPOOL_Concurrency::putq (JAWS_Protocol_Handler *ph) { if (this->error_) return -1; JAWS_CONCURRENCY_TASK *task = this; return task->putq (& ph->mb_); } int JAWS_TPOOL_Concurrency::getq (JAWS_Protocol_Handler *&ph) { ph = 0; JAWS_CONCURRENCY_TASK *task = this; if (this->shutdown_task_ && task->msg_queue ()->message_count () == 0) return -1; ACE_Message_Block *mb = 0; int result = task->getq (mb); if (result != -1) { ph = (JAWS_Protocol_Handler *) mb->base (); if (ph == 0) { // Shutdown this task; this->shutdown_task_ = 1; if (this->number_of_threads_ && this->number_of_threads_-- > 1) { task->putq (mb); result = -1; } } } return result; } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Signal_Task.h0000644000175000017500000000075015027201773020362 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_SIGNAL_TASK_H #define JAWS_SIGNAL_TASK_H #include "ace/Synch.h" #include "ace/Signal.h" #include "ace/Singleton.h" #include "jaws3/Export.h" class JAWS_Export JAWS_Signal_Task { public: JAWS_Signal_Task (); static JAWS_Signal_Task * instance () { return ACE_Singleton::instance (); } ACE_Sig_Set & sigset () { return this->sigset_; } private: ACE_Sig_Set sigset_; }; #endif /* JAWS_SIGNAL_TASK_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Synch_IO.cpp0000644000175000017500000001606715027201773020201 0ustar sudipsudip#include "ace/ACE.h" #ifndef JAWS_BUILD_DLL #define JAWS_BUILD_DLL #endif #include "jaws3/Jaws_IO.h" #include "jaws3/Synch_IO.h" #include "jaws3/Event_Completer.h" static JAWS_Event_Result JAWS_synch_send ( ACE_HANDLE handle , ACE_Message_Block *mb , const ACE_Time_Value *tv = 0 ) { JAWS_Event_Result io_result; ssize_t result = ACE::send_n (handle, mb->rd_ptr (), mb->length (), tv); if (result < 0) { if (errno == ETIME) { JAWS_Event_Result tmp_io_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_SEND_TIMEOUT ); io_result = tmp_io_result; } else { JAWS_Event_Result tmp_io_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_SEND_FAIL ); io_result = tmp_io_result; } } else if ((size_t) result < mb->length ()) { if (result > 0) mb->rd_ptr (result); JAWS_Event_Result tmp_io_result ( result , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_SEND_SHORT ); io_result = tmp_io_result; } else { if (result > 0) mb->rd_ptr (result); JAWS_Event_Result tmp_io_result ( result , JAWS_Event_Result::JE_OK , JAWS_Event_Result::JE_SEND_OK ); io_result = tmp_io_result; } return io_result; } void JAWS_Synch_IO::send ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act ) { JAWS_Event_Result io_result; const ACE_Time_Value *tvp = 0; if (ACE_Time_Value::zero < tv) tvp = &tv; io_result = JAWS_synch_send (handle, mb, tvp); if (completer) completer->output_complete (io_result, act); } void JAWS_Synch_IO::send ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act ) { this->send (handle, mb, completer, ACE_Time_Value::zero, act); } void JAWS_Synch_IO::recv ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act ) { JAWS_Event_Result io_result; const ACE_Time_Value *tvp = 0; if (ACE_Time_Value::zero < tv) tvp = &tv; ssize_t result = ACE::recv (handle, mb->wr_ptr (), mb->space (), tvp); if (result < 0) { JAWS_Event_Result tmp_io_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_RECV_FAIL ); io_result = tmp_io_result; } else { if (result > 0) mb->wr_ptr (result); JAWS_Event_Result tmp_io_result ( result , JAWS_Event_Result::JE_OK , JAWS_Event_Result::JE_RECV_OK ); io_result = tmp_io_result; } if (completer) completer->input_complete (io_result, act); } void JAWS_Synch_IO::recv ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act ) { this->recv (handle, mb, completer, ACE_Time_Value::zero, act); } void JAWS_Synch_IO::transmit ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act , ACE_Message_Block *header , ACE_Message_Block *trailer ) { JAWS_Event_Result io_result; const ACE_Time_Value *tvp = 0; if (ACE_Time_Value::zero < tv) tvp = &tv; size_t bytes = 0; if (header) { io_result = JAWS_synch_send (handle, header, tvp); bytes += io_result.bytes (); if (io_result.status () != JAWS_Event_Result::JE_OK) { if (completer) completer->input_complete (io_result, act); return; } } ACE_Message_Block buf (8 * 1024); ssize_t len = 0; while ((len = ACE::recv (source, buf.wr_ptr (), buf.space (), tvp)) >= 0) { if (len == 0) break; buf.wr_ptr (len); io_result = JAWS_synch_send (handle, & buf); bytes += io_result.bytes (); if (io_result.status () != JAWS_Event_Result::JE_OK) { JAWS_Event_Result tmp_io_result ( bytes , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_SEND_SHORT ); if (completer) completer->input_complete (tmp_io_result, act); return; } buf.crunch (); } if (trailer) { io_result = JAWS_synch_send (handle, trailer, tvp); bytes += io_result.bytes (); if (io_result.status () != JAWS_Event_Result::JE_OK) { JAWS_Event_Result tmp_io_result ( bytes , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_SEND_SHORT ); if (completer) completer->input_complete (tmp_io_result, act); return; } } if (len == 0) { JAWS_Event_Result tmp_io_result ( bytes , JAWS_Event_Result::JE_OK , JAWS_Event_Result::JE_SEND_OK ); io_result = tmp_io_result; } else { JAWS_Event_Result tmp_io_result ( bytes , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_SEND_SHORT ); io_result = tmp_io_result; } if (completer) completer->input_complete (io_result, act); } void JAWS_Synch_IO::transmit ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , void *act , ACE_Message_Block *header , ACE_Message_Block *trailer ) { this->transmit ( handle , source , completer , ACE_Time_Value::zero , act , header , trailer ); } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Timer_Helpers.h0000644000175000017500000000153115027201773020723 0ustar sudipsudip/* -*- c+ -*- */ #ifndef JAWS_TIMER_HELPERS_H #define JAWS_TIMER_HELPERS_H #include "ace/Singleton.h" #include "ace/Event_Handler.h" #include "jaws3/Timer.h" #include "jaws3/Event_Completer.h" #include "jaws3/Event_Result.h" class JAWS_Timer_EH : public ACE_Event_Handler { public: JAWS_Timer_EH ( JAWS_Event_Completer *completer , void *act = 0 , int interval = 0 ) : completer_ (completer) , act_ (act) , interval_ (interval) , expired_ (0) { } int handle_timeout (const ACE_Time_Value &tv, const void *act); // Called when timer expires. int handle_close (ACE_HANDLE h, ACE_Reactor_Mask m); // Called directly when timer is canceled. private: JAWS_Event_Completer *completer_; void *act_; const int interval_; int expired_; }; #endif /* JAWS_TIMER_HELPERS_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/jaws3.mpc0000644000175000017500000000316015027201773017540 0ustar sudipsudip// -*- MPC -*- project(JAWS3) : ace_output, acelib { sharedname = JAWS3 dynamicflags += JAWS_BUILD_DLL avoids += uses_wchar avoids += ace_for_tao includes += .. Source_Files { Asynch_IO.cpp Concurrency.cpp Config_File.cpp Datagram.cpp Event_Completer.cpp Event_Dispatcher.cpp FILE.cpp Jaws_IO.cpp Options.cpp Protocol_Handler.cpp Reactive_IO.cpp Signal_Task.cpp Symbol_Table.cpp Synch_IO.cpp THYBRID_Concurrency.cpp TPOOL_Concurrency.cpp TPR_Concurrency.cpp Task_Timer.cpp Templates.cpp Timer.cpp Timer_Helpers.cpp } Template_Files{ Cached_Allocator_T.cpp Concurrency_T.cpp } Header_Files{ Asynch_IO.h Asynch_IO_Helpers.h Cached_Allocator_T.h Concurrency.h Concurrency_T.h Config_File.h Datagram.h Event_Completer.h Event_Dispatcher.h Event_Result.h Export.h FILE.h Jaws_IO.h Options.h Protocol_Handler.h Reactive_IO.h Reactive_IO_Helpers.h Signal_Task.h Symbol_Table.h Synch_IO.h Task_Timer.h THYBRID_Concurrency.h Timer.h Timer_Helpers.h TPOOL_Concurrency.h TPR_Concurrency.h } Inline_Files{ } } project(JAWS3_server) : aceexe { avoids += uses_wchar avoids += ace_for_tao includes += .. exename = main after += JAWS3 libs += JAWS3 Source_Files { main.cpp } } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/FILE.h0000644000175000017500000000175515027201773016710 0ustar sudipsudip// -*- c++ -*- #ifndef JAWS_FILE_H #define JAWS_FILE_H #include "ace/FILE_IO.h" #include "ace/Mem_Map.h" #include "jaws3/Export.h" class JAWS_Export JAWS_FILE : public ACE_FILE_IO // // Like ACE_FILE_IO, but support for ACE_Mem_Map; { public: JAWS_FILE (); ~JAWS_FILE (); ACE_Mem_Map *mem_map (int length = -1, int prot = PROT_RDWR, int share = ACE_MAP_PRIVATE, void *addr = 0, ACE_OFF_T offset = 0, LPSECURITY_ATTRIBUTES sa = 0); ACE_Mem_Map *mem_map (int length = -1, int prot = PROT_RDWR, int share = ACE_MAP_PRIVATE, void *addr = 0, ACE_OFF_T offset = 0, LPSECURITY_ATTRIBUTES sa = 0) const; ACE_Mem_Map *map () const; void can_map (int); private: ACE_SYNCH_MUTEX lock_; ACE_Mem_Map *map_; int can_map_; }; #endif /* JAWS_FILE_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Event_Dispatcher.h0000644000175000017500000000235015027201773021410 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_EVENT_DISPATCHER_H #define JAWS_EVENT_DISPATCHER_H #include "ace/Reactor.h" #include "ace/Reactor_Token_T.h" #include "ace/Select_Reactor.h" #include "jaws3/Export.h" // We are using the Reactor in a single threaded manner, // so if we are using the Select Reactor, get rid of the // big reactor lock. typedef ACE_Reactor_Token_T ACE_Select_Reactor_Noop_Token; typedef ACE_Select_Reactor_T ACE_Select_NULL_LOCK_Reactor; #if !defined (ACE_WIN32) \ || !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) \ || defined (ACE_USE_SELECT_REACTOR_FOR_REACTOR_IMPL) \ || defined (ACE_USE_TP_REACTOR_FOR_REACTOR_IMPL) #define ACE_REACTOR_INSTANCE_INIT \ do { \ ACE_Select_NULL_LOCK_Reactor *select_reactor; \ select_reactor = new ACE_Select_NULL_LOCK_Reactor; \ ACE_Reactor::instance (new ACE_Reactor (select_reactor, 1), 1); \ } while (0) #else #define ACE_REACTOR_INSTANCE_INIT ACE_Reactor::instance () #endif /* ACE_WIN32 */ class JAWS_Event_Dispatcher; class JAWS_Export JAWS_Event_Dispatcher { public: static void end_event_loop (); static void run_event_loop (); }; #endif /* JAWS_EVENT_DISPATCHER_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Config_File.cpp0000644000175000017500000001570115027201773020664 0ustar sudipsudip#include "ace/OS_NS_stdlib.h" #include "ace/OS_NS_string.h" #include "ace/FILE_Connector.h" #include "ace/Message_Block.h" #include "ace/Singleton.h" #include "ace/Unbounded_Queue.h" #ifndef JAWS_BUILD_DLL #define JAWS_BUILD_DLL #endif #include "jaws3/Config_File.h" #include "jaws3/Symbol_Table.h" // = Helper class to manage "constant" strings. class JAWS_strings { public: ~JAWS_strings () { void *p; while (this->queue_.dequeue_head (p) != -1) ACE_OS::free (p); } const ACE_TCHAR * duplicate (const ACE_TCHAR *s) { void **x; const ACE_TCHAR *d = 0; ACE_Unbounded_Queue_Iterator iter (this->queue_); while (iter.next (x)) { d = (const ACE_TCHAR *) *x; if (ACE_OS::strcmp (d, s) == 0) break; d = 0; iter.advance (); } if (d == 0) { d = ACE_OS::strdup (s); this->queue_.enqueue_tail ((void *) d); } return d; } private: ACE_Unbounded_Queue queue_; }; // = Underlying implementation class. class JAWS_Config_File_Impl { public: JAWS_Config_File_Impl (const ACE_TCHAR *config_file); ~JAWS_Config_File_Impl (); int find (const ACE_TCHAR *key, const ACE_TCHAR *&value); void parse_file (); void reset (); void dump (); enum { JAWS_CONFIG_FILE_SYMBOL_TABLE_SIZE = 211 }; private: ACE_FILE_Addr faddr_; JAWS_strings *strings_; JAWS_Symbol_Table *symbols_; }; JAWS_Config_File_Impl::JAWS_Config_File_Impl (const ACE_TCHAR *config_file) : faddr_ (config_file) , strings_ (0) , symbols_ (0) { this->strings_ = new JAWS_strings; this->symbols_ = new JAWS_Symbol_Table (JAWS_CONFIG_FILE_SYMBOL_TABLE_SIZE); this->parse_file (); } JAWS_Config_File_Impl::~JAWS_Config_File_Impl () { delete this->symbols_; this->symbols_ = 0; delete this->strings_; this->strings_ = 0; } int JAWS_Config_File_Impl::find (const ACE_TCHAR *key, const ACE_TCHAR *&value) { return this->symbols_->find (key, value); } void JAWS_Config_File_Impl::parse_file () { ACE_FILE_Connector fconnector; ACE_FILE_IO fio; if (fconnector.connect ( fio , this->faddr_ , 0 , ACE_Addr::sap_any , 0 , O_RDONLY ) == -1) return; ACE_Message_Block buffer (8192); ACE_Message_Block line (4096); ssize_t count = 0; const ACE_TCHAR *sym_name; const ACE_TCHAR *sym_value; int last_line_was_read = 0; ACE_TCHAR *end_of_current_line = 0; ACE_TCHAR *p = 0; while (last_line_was_read || (count = fio.recv (buffer.wr_ptr (), buffer.space () - 2)) >= 0) { end_of_current_line = 0; // Make sure input is newline terminated if it is the last line, // and always null terminated. if (! last_line_was_read) { if (count > 0) { buffer.wr_ptr (count); // Scan forward for at least one newline character p = buffer.rd_ptr (); while (p != buffer.wr_ptr ()) { if (*p == '\n') break; p++; } if (p == buffer.wr_ptr ()) continue; end_of_current_line = p; } else { if (buffer.wr_ptr ()[-1] != '\n') { buffer.wr_ptr ()[0] = '\n'; buffer.wr_ptr (1); } last_line_was_read = 1; } buffer.wr_ptr ()[0] = '\0'; } if (end_of_current_line == 0) { end_of_current_line = buffer.rd_ptr (); while (*end_of_current_line != '\n') end_of_current_line++; } // If buffer is not pointing to a continuation line, or there is // no more input, then can commit the scanned configuration // line. if (line.length () != 0 && ((last_line_was_read && buffer.length () == 0) || (buffer.rd_ptr ()[0] != ' ' && buffer.rd_ptr ()[0] != '\t'))) { ACE_TCHAR *name = 0; ACE_TCHAR *value = 0; name = line.rd_ptr (); for (p = name; *p != '\0'; p++) { if (*p == '=') { line.rd_ptr (p+1); while (p != name && (p[-1] == ' ' || p[-1] == '\t')) p--; *p = '\0'; } } if (*name) { value = line.rd_ptr (); while (*value == ' ' || *value == '\t') value++; p = line.wr_ptr (); while (p != value && (p[-1] == ' ' || p[-1] == '\t')) p--; *p = '\0'; sym_name = this->strings_->duplicate (name); sym_value = this->strings_->duplicate (value); this->symbols_->rebind (sym_name, sym_value); } line.reset (); } // If we are done, we are done! if (last_line_was_read && buffer.length () == 0) break; // If the buffer is pointing at a comment line, ignore it. if (buffer.rd_ptr ()[0] == '#' || buffer.rd_ptr ()[0] == '\n' || (buffer.rd_ptr ()[0] == '\r' && buffer.rd_ptr ()[1] == '\n')) { buffer.rd_ptr (end_of_current_line + 1); buffer.crunch (); continue; } // Whatever is left is either the start of a name-value-pair or a // continuation of one. line.copy (buffer.rd_ptr (), end_of_current_line - buffer.rd_ptr ()); p = line.wr_ptr (); while (p != line.rd_ptr () && (p[-1] == ' ' || p[-1] == '\t')) p--; line.wr_ptr (p); line.wr_ptr ()[0] = '\0'; buffer.rd_ptr (end_of_current_line + 1); buffer.crunch (); } fio.close (); } void JAWS_Config_File_Impl::reset () { delete this->symbols_; delete this->strings_; this->strings_ = new JAWS_strings; this->symbols_ = new JAWS_Symbol_Table (JAWS_CONFIG_FILE_SYMBOL_TABLE_SIZE); this->parse_file (); } void JAWS_Config_File_Impl::dump () { JAWS_SYMBOL_TABLE_ITERATOR iter (*this->symbols_); JAWS_SYMBOL_TABLE_ENTRY *entry = 0; while (iter.next (entry)) { ACE_DEBUG ((LM_DEBUG, "[%D|%t] %s=%s\n", entry->ext_id_, entry->int_id_)); iter.advance (); } } JAWS_Config_File::JAWS_Config_File (const ACE_TCHAR *config_file, const ACE_TCHAR *config_dir) { ACE_TCHAR filename[MAXPATHLEN]; ACE_OS::strcpy (filename, config_dir); ACE_OS::strcat (filename, config_file); this->impl_ = new JAWS_Config_File_Impl (filename); } int JAWS_Config_File::find (const ACE_TCHAR *key, const ACE_TCHAR *&value) { return this->impl_->find (key, value); } void JAWS_Config_File::reset () { this->impl_->reset (); } void JAWS_Config_File::dump () { this->impl_->dump (); } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Templates.cpp0000644000175000017500000000550615027201773020460 0ustar sudipsudip#include "ace/Reactor.h" #include "ace/Select_Reactor.h" #include "ace/Svc_Handler.h" #include "ace/SOCK_Stream.h" #include "ace/LSOCK_Stream.h" #ifndef JAWS_BUILD_DLL #define JAWS_BUILD_DLL #endif #include "jaws3/Asynch_IO.h" #include "jaws3/Concurrency.h" #include "jaws3/Export.h" #include "jaws3/Jaws_IO.h" #include "jaws3/Event_Dispatcher.h" #include "jaws3/Event_Completer.h" #include "jaws3/Options.h" #include "jaws3/Protocol_Handler.h" #include "jaws3/Reactive_IO.h" #include "jaws3/Signal_Task.h" #include "jaws3/Symbol_Table.h" #include "jaws3/Synch_IO.h" #include "jaws3/TPOOL_Concurrency.h" #include "jaws3/TPR_Concurrency.h" #include "jaws3/THYBRID_Concurrency.h" #include "jaws3/Timer.h" #include "jaws3/Task_Timer.h" #define ACE_EHHTU_RW \ ACE_Event_Handler_Handle_Timeout_Upcall #define ACE_EHHTU_R \ ACE_Event_Handler_Handle_Timeout_Upcall #define ACE_WHEEL_TEMPLATE_ARGS_RW \ ACE_Event_Handler *, ACE_EHHTU_RW, ACE_SYNCH_RW_MUTEX #define ACE_WHEEL_TEMPLATE_ARGS_R \ ACE_Event_Handler *, ACE_EHHTU_R, ACE_SYNCH_RECURSIVE_MUTEX #define ACE_TWT_RW \ ACE_Timer_Wheel_T #define ACE_TWT_R \ ACE_Timer_Wheel_T #define ACE_TWIT_RW \ ACE_Timer_Wheel_Iterator_T #define ACE_TWIT_R \ ACE_Timer_Wheel_Iterator_T #define ACE_TQT_RW \ ACE_Timer_Queue_T #define ACE_TQT_R \ ACE_Timer_Queue_T #define ACE_TQIT_RW \ ACE_Timer_Queue_Iterator_T #define ACE_TQIT_R \ ACE_Timer_Queue_Iterator_T ACE_SINGLETON_TEMPLATE_INSTANTIATE(ACE_Singleton, ACE_Message_Block, ACE_Null_Mutex); ACE_SINGLETON_TEMPLATE_INSTANTIATE(ACE_Singleton, JAWS_Asynch_IO, ACE_Thread_Mutex); ACE_SINGLETON_TEMPLATE_INSTANTIATE(ACE_Singleton, JAWS_Concurrency, ACE_Thread_Mutex); ACE_SINGLETON_TEMPLATE_INSTANTIATE(ACE_Singleton, JAWS_IO, ACE_Thread_Mutex); ACE_SINGLETON_TEMPLATE_INSTANTIATE(ACE_Singleton, JAWS_Options, ACE_Thread_Mutex); ACE_SINGLETON_TEMPLATE_INSTANTIATE(ACE_Singleton, JAWS_Reactive_IO, ACE_Thread_Mutex); ACE_SINGLETON_TEMPLATE_INSTANTIATE(ACE_Singleton, JAWS_Signal_Task, ACE_Thread_Mutex); ACE_SINGLETON_TEMPLATE_INSTANTIATE(ACE_Singleton, JAWS_Synch_IO, ACE_Thread_Mutex); ACE_SINGLETON_TEMPLATE_INSTANTIATE(ACE_Singleton, JAWS_THYBRID_Concurrency, ACE_Thread_Mutex); ACE_SINGLETON_TEMPLATE_INSTANTIATE(ACE_Singleton, JAWS_TPOOL_Concurrency, ACE_Thread_Mutex); ACE_SINGLETON_TEMPLATE_INSTANTIATE(ACE_Singleton, JAWS_TPR_Concurrency, ACE_Thread_Mutex); ACE_SINGLETON_TEMPLATE_INSTANTIATE(ACE_Singleton, JAWS_Task_Timer, ACE_Thread_Mutex); ACE_SINGLETON_TEMPLATE_INSTANTIATE(ACE_Singleton, JAWS_Timer, ACE_Thread_Mutex); ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Timer_Helpers.cpp0000644000175000017500000000163715027201773021265 0ustar sudipsudip#ifndef JAWS_BUILD_DLL #define JAWS_BUILD_DLL #endif #include "jaws3/Timer_Helpers.h" int JAWS_Timer_EH::handle_timeout (const ACE_Time_Value &, const void *) { JAWS_Event_Result timer_result ( 0 , JAWS_Event_Result::JE_OK , JAWS_Event_Result::JE_TIMER_OK ); if (this->completer_) this->completer_->timer_complete (timer_result, this->act_); if (this->interval_) return 0; this->expired_ = 1; return -1; } int JAWS_Timer_EH::handle_close (ACE_HANDLE, ACE_Reactor_Mask) { JAWS_Event_Result timer_result ( 0 , JAWS_Event_Result::JE_CANCEL , JAWS_Event_Result::JE_TIMER_CANCEL ); if (! this->expired_ && this->completer_) this->completer_->timer_complete (timer_result, this->act_); return 0; } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Symbol_Table.cpp0000644000175000017500000000026015027201773021066 0ustar sudipsudip#ifndef JAWS_BUILD_DLL #define JAWS_BUILD_DLL #endif #include "jaws3/Symbol_Table.h" JAWS_Symbol_Table::JAWS_Symbol_Table (size_t size) : JAWS_SYMBOL_TABLE_BASE (size) { } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/THYBRID_Concurrency.cpp0000644000175000017500000000566215027201773022204 0ustar sudipsudip#include "ace/OS_NS_stdlib.h" #include "ace/Message_Block.h" #ifndef JAWS_BUILD_DLL #define JAWS_BUILD_DLL #endif #include "jaws3/Concurrency.h" #include "jaws3/THYBRID_Concurrency.h" #include "jaws3/Protocol_Handler.h" #include "jaws3/Options.h" JAWS_THYBRID_Concurrency::JAWS_THYBRID_Concurrency () : getting_ (0) , min_number_of_threads_ (1) , max_number_of_threads_ (-1) , shutdown_task_ (0) , error_ (0) { const char *value; value = JAWS_Options::instance ()->getenv ("JAWS_MIN_THYBRID_THREADS"); if (value != 0) this->min_number_of_threads_ = ACE_OS::atoi (value); else this->min_number_of_threads_ = ACE_OS::atoi (JAWS_DEFAULT_MIN_THYBRID_THREADS); if (this->min_number_of_threads_ <= 0) this->min_number_of_threads_ = 1; value = JAWS_Options::instance ()->getenv ("JAWS_MAX_THYBRID_THREADS"); if (value != 0) this->max_number_of_threads_ = ACE_OS::atoi (value); else this->max_number_of_threads_ = ACE_OS::atoi (JAWS_DEFAULT_MAX_THYBRID_THREADS); if (this->max_number_of_threads_ <= 0) this->max_number_of_threads_ = -1; else if (this->max_number_of_threads_ < this->min_number_of_threads_) this->max_number_of_threads_ = this->min_number_of_threads_; int r; r = this->activate (THR_BOUND | THR_JOINABLE, this->min_number_of_threads_); if (r < 0) { this->shutdown_task_ = 1; this->error_ = 1; } } int JAWS_THYBRID_Concurrency::putq (JAWS_Protocol_Handler *ph) { if (this->error_) return -1; JAWS_CONCURRENCY_TASK *task = this; int result = task->putq (& ph->mb_); if (result != -1) { if (this->getting_ < this->min_number_of_threads_ && (this->max_number_of_threads_ < 0 || this->thr_count () < (size_t) this->max_number_of_threads_)) { int r; r = this->activate ( THR_BOUND | THR_JOINABLE , 1 // number of threads , 1 // force active ); if (r < 0) { // ACE_ERROR return -1; } } } return result; } int JAWS_THYBRID_Concurrency::getq (JAWS_Protocol_Handler *&ph) { ph = 0; JAWS_CONCURRENCY_TASK *task = this; if (this->shutdown_task_ && task->msg_queue ()->message_count () == 0) return -1; int getting = ++(this->getting_); if (getting > this->min_number_of_threads_) { if (task->msg_queue ()->message_count () == 0) { --(this->getting_); return -1; } } ACE_Message_Block *mb = 0; int result = task->getq (mb); if (result != -1) { ph = (JAWS_Protocol_Handler *) mb->base (); if (ph == 0) { // Shutdown this task; this->shutdown_task_ = 1; if (this->getting_ > 1) { task->putq (mb); result = -1; } } } --(this->getting_); return result; } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Export.h0000644000175000017500000000235415027201773017446 0ustar sudipsudip// Definition for Win32 Export directives. // This file is generated automatically by // ${TAO_ROOT}/TAO_IDL/GenExportH.BAT // ------------------------------ #ifndef JAWS_EXPORT_H #define JAWS_EXPORT_H #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #if defined (ACE_AS_STATIC_LIBS) # if !defined (JAWS_HAS_DLL) # define JAWS_HAS_DLL 0 # endif /* ! ACE_HAS_DLL */ #else # if !defined (JAWS_HAS_DLL) # define JAWS_HAS_DLL 1 # endif /* ! ACE_HAS_DLL */ #endif /* ACE_AS_STATIC_LIB */ #if defined (JAWS_HAS_DLL) # if (JAWS_HAS_DLL == 1) # if defined (JAWS_BUILD_DLL) # define JAWS_Export ACE_Proper_Export_Flag # define JAWS_SINGLETON_DECLARATION(T) \ ACE_EXPORT_SINGLETON_DECLARATION (T) # else # define JAWS_Export ACE_Proper_Import_Flag # define JAWS_SINGLETON_DECLARATION(T) \ ACE_IMPORT_SINGLETON_DECLARATION (T) # endif /* JAWS_BUILD_DLL */ # else # define JAWS_Export # define JAWS_SINGLETON_DECLARATION(T) # endif /* ! JAWS_HAS_DLL == 1 */ #else # define JAWS_Export # define JAWS_SINGLETON_DECLARATION(T) #endif /* JAWS_HAS_DLL */ #endif /* JAWS_EXPORT_H */ // End of auto generated file. ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Event_Result.h0000644000175000017500000000365515027201773020611 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_EVENT_RESULT_H #define JAWS_EVENT_RESULT_H #include "ace/OS_NS_errno.h" #include "ace/os_include/os_stddef.h" /* Needed for size_t */ #include "jaws3/Export.h" class JAWS_Event_Result; class JAWS_Export JAWS_Event_Result { public: enum JE_STATUS { JE_IDLE , JE_OK , JE_PENDING , JE_CANCEL , JE_ERROR }; enum JE_REASON { JE_NO_REASON , JE_ACCEPT_OK , JE_ACCEPT_PENDING , JE_ACCEPT_TIMEOUT , JE_ACCEPT_FAIL , JE_CONNECT_OK , JE_CONNECT_PENDING , JE_CONNECT_TIMEOUT , JE_CONNECT_FAIL , JE_SEND_OK , JE_SEND_PENDING , JE_SEND_BLOCKED , JE_SEND_SHORT , JE_SEND_TIMEOUT , JE_SEND_FAIL , JE_RECV_OK , JE_RECV_PENDING , JE_RECV_BLOCKED , JE_RECV_SHORT , JE_RECV_TIMEOUT , JE_RECV_FAIL , JE_TRANSMIT_OK , JE_TRANSMIT_PENDING , JE_TRANSMIT_BLOCKED , JE_TRANSMIT_SHORT , JE_TRANSMIT_TIMEOUT , JE_TRANSMIT_FAIL , JE_TIMER_OK , JE_TIMER_CANCEL , JE_TIMER_PENDING , JE_TIMER_FAIL , JE_LAMBDA_OK , JE_LAMBDA_CANCEL , JE_LAMBDA_PENDING , JE_LAMBDA_SHORT , JE_LAMBDA_TIMEOUT , JE_LAMBDA_FAIL }; JAWS_Event_Result ( size_t bytes = 0 , JE_STATUS status = JE_IDLE , JE_REASON reason = JE_NO_REASON , int error_number = -1 , void * data = 0 ) : bytes_ (bytes) , status_ (status) , reason_ (reason) , error_number_ (error_number) , data_ (data) { if (this->error_number_ == -1) this->error_number_ = errno; } size_t bytes () const { return this->bytes_; } int status () const { return this->status_; } int reason () const { return this->reason_; } int error_number () const { return (errno = this->error_number_); } void * data () const { return this->data_; } private: size_t bytes_; JE_STATUS status_; JE_REASON reason_; int error_number_; void *data_; }; #endif /* JAWS_EVENT_RESULT_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Event_Dispatcher.cpp0000644000175000017500000000200115027201773021734 0ustar sudipsudip#include "ace/Log_Msg.h" #include "ace/Thread.h" #include "ace/Reactor.h" #include "ace/Proactor.h" #include "ace/POSIX_Proactor.h" #ifndef JAWS_BUILD_DLL #define JAWS_BUILD_DLL #endif /*JAWS_BUILD_DLL*/ #include "jaws3/Event_Dispatcher.h" static ACE_THR_FUNC_RETURN JAWS_Event_Dispatcher_Proactor_Event_Loop (void *) { ACE_Proactor::run_event_loop (); return 0; } void JAWS_Event_Dispatcher::end_event_loop () { ACE_Reactor::end_event_loop (); } void JAWS_Event_Dispatcher::run_event_loop () { // First, initiate the proactor thread int result; result = ACE_Thread::spawn ( JAWS_Event_Dispatcher_Proactor_Event_Loop , 0 , THR_BOUND ); if (result < 0) { ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Thread::spawn")); return; } // Now, enter the reactor's event loop. ACE_Reactor::run_event_loop (); // End the proactor's event loop if reactor was interrupted. ACE_Proactor::end_event_loop (); } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Jaws_IO.cpp0000644000175000017500000000535515027201773020017 0ustar sudipsudip#ifndef JAWS_BUILD_DLL #define JAWS_BUILD_DLL #endif /*JAWS_BUILD_DLL*/ #include "ace/OS_NS_strings.h" #include "jaws3/Jaws_IO.h" #include "jaws3/Asynch_IO.h" #include "jaws3/Synch_IO.h" #include "jaws3/Reactive_IO.h" #include "jaws3/Options.h" JAWS_IO::JAWS_IO (JAWS_IO_Impl *impl) : impl_ (impl) { // Use synchronous IO by default. It is the most efficient // in terms of calls needed, but provides the least amount // of support for concurrency. if (this->impl_ == 0) { const char *io_type = JAWS_Options::instance ()->getenv ("JAWS_IO"); if (io_type == 0) io_type = JAWS_DEFAULT_IO; if (ACE_OS::strcasecmp (io_type, "SYNCH") == 0) this->impl_ = JAWS_Synch_IO::instance (); else if (ACE_OS::strcasecmp (io_type, "ASYNCH") == 0) this->impl_ = JAWS_Asynch_IO::instance (); else if (ACE_OS::strcasecmp (io_type, "REACTIVE") == 0) this->impl_ = JAWS_Reactive_IO::instance (); else this->impl_ = JAWS_Synch_IO::instance (); } } JAWS_IO::~JAWS_IO () { } void JAWS_IO::send ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act ) { this->impl_->send (handle, mb, completer, act); } void JAWS_IO::recv ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act ) { this->impl_->recv (handle, mb, completer, act); } void JAWS_IO::transmit ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , void *act , ACE_Message_Block *header , ACE_Message_Block *trailer ) { this->impl_->transmit (handle, source, completer, act, header, trailer); } void JAWS_IO::send ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act ) { this->impl_->send (handle, mb, completer, tv, act); } void JAWS_IO::recv ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act ) { this->impl_->recv (handle, mb, completer, tv, act); } void JAWS_IO::transmit ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act , ACE_Message_Block *header , ACE_Message_Block *trailer ) { this->impl_->transmit (handle, source, completer, tv, act, header, trailer); } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Protocol_Handler.cpp0000644000175000017500000000303615027201773021754 0ustar sudipsudip#ifndef JAWS_BUILD_DLL #define JAWS_BUILD_DLL #endif #include "jaws3/Protocol_Handler.h" #include "jaws3/Concurrency.h" JAWS_Protocol_State::~JAWS_Protocol_State () { } JAWS_Protocol_Handler::JAWS_Protocol_Handler ( JAWS_Protocol_State *state , void *data ) : state_ (state) , data_ (data) , mb_ (& this->db_) { this->db_.base ((char *) this, 0 /* an infinite queue */); } JAWS_Protocol_Handler::~JAWS_Protocol_Handler () { this->mb_.replace_data_block (0); } int JAWS_Protocol_Handler::service () { if (this->state_ == 0) return -1; return this->state_->service (this, this->data_); } void JAWS_Protocol_Handler::event_complete ( const JAWS_Event_Result &result , void *act ) { // This call is done in the context of the dispatching // thread (e.g., by the Reactor thread, or by one of the // threads in the Proactor, or by the invoker of the IO // if the IO is synchronous). this->state_ = this->state_->transition (result, this->data_, act); // At this point, we need to cue this Handler back into // the concurrency mechanism. This probably means the // Message Queue of some Concurrency Task. JAWS_Concurrency::instance ()->putq (this); // Doing it this way is less efficient than calling into // the service() method of the next state directly from // here, but it gains the flexibility of a more modular // concurrency mechanism. } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Signal_Task.cpp0000644000175000017500000000314015027201773020711 0ustar sudipsudip#include "ace/OS_NS_signal.h" #include "ace/OS_NS_Thread.h" #include "ace/Thread.h" #ifndef JAWS_BUILD_DLL #define JAWS_BUILD_DLL #endif #include "jaws3/Signal_Task.h" #include "jaws3/Event_Dispatcher.h" #include "jaws3/THYBRID_Concurrency.h" #include "jaws3/TPOOL_Concurrency.h" #include "jaws3/TPR_Concurrency.h" ACE_THR_FUNC_RETURN JAWS_Signal_Task_function (void *) { int done = 0; while (! done) { int signo = ACE_OS::sigwait (JAWS_Signal_Task::instance ()->sigset ()); switch (signo) { case SIGINT: case SIGTERM: JAWS_Concurrency::instance ()->shutdown (); JAWS_Event_Dispatcher::end_event_loop (); done = 1; break; # if !defined (ACE_WIN32) case SIGHUP: // In the future, re-read jaws.conf and svc.conf, // and then reset the JAWS singletons. // For now, just ignore it. break; case SIGPIPE: #endif // !defined (ACE_WIN32) default: break; } } return 0; } JAWS_Signal_Task::JAWS_Signal_Task () { // Set our signal mask. this->sigset_.empty_set (); this->sigset_.sig_add (SIGINT); this->sigset_.sig_add (SIGTERM); this->sigset_.sig_add (SIGPIPE); #if 0 this->sigset_.fill_set (); #endif ACE_OS::sigprocmask (SIG_BLOCK, this->sigset_, 0); int result; result = ACE_Thread::spawn ( JAWS_Signal_Task_function , 0 , THR_BOUND ); if (result < 0) { ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Thread::spawn")); return; } } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Jaws_IO.h0000644000175000017500000000703515027201773017461 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_IO_H #define JAWS_IO_H #include "ace/Message_Block.h" #include "ace/Singleton.h" #include "ace/Synch_Traits.h" #include "jaws3/Export.h" class JAWS_IO; class JAWS_Event_Completer; class JAWS_Export JAWS_IO_Impl // = TITLE // IO inteface for the implementation classes on the RHS of the // Bridge Pattern. { public: virtual ~JAWS_IO_Impl () {} // = Regular IO methods. virtual void send ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act = 0 ) = 0; virtual void recv ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act = 0 ) = 0; virtual void transmit ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , void *act = 0 , ACE_Message_Block *header = 0 , ACE_Message_Block *trailer = 0 ) = 0; // = Timed IO methods. virtual void send ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act = 0 ) = 0; virtual void recv ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act = 0 ) = 0; virtual void transmit ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act = 0 , ACE_Message_Block *header = 0 , ACE_Message_Block *trailer = 0 ) = 0; }; class JAWS_Export JAWS_IO { public: JAWS_IO (JAWS_IO_Impl *impl = 0); ~JAWS_IO (); static JAWS_IO * instance () { return ACE_Singleton::instance (); } void send ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act = 0 ); void recv ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act = 0 ); void transmit ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , void *act = 0 , ACE_Message_Block *header = 0 , ACE_Message_Block *trailer = 0 ); void send ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act = 0 ); void recv ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act = 0 ); void transmit ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act = 0 , ACE_Message_Block *header = 0 , ACE_Message_Block *trailer = 0 ); private: JAWS_IO_Impl *impl_; }; #endif /* JAWS_IO_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Options.cpp0000644000175000017500000000063015027201773020146 0ustar sudipsudip#include "ace/OS_NS_stdlib.h" #ifndef JAWS_BUILD_DLL #define JAWS_BUILD_DLL #endif /*JAWS_BUILD_DLL*/ #include "jaws3/Options.h" JAWS_Options::JAWS_Options () { this->cf_ = new JAWS_Config_File ("jaws.conf"); } const char * JAWS_Options::getenv (const char *key) { const char *value = 0; if (this->cf_ == 0 || this->cf_->find (key, value) < 0) value = ACE_OS::getenv (key); return value; } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/TPR_Concurrency.h0000644000175000017500000000116215027201773021200 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_TPR_CONCURRENCY_H #define JAWS_TPR_CONCURRENCY_H #include "ace/Atomic_Op.h" #include "jaws3/Concurrency.h" class JAWS_Export JAWS_TPR_Concurrency : public JAWS_Concurrency_Impl { public: JAWS_TPR_Concurrency (); int putq (JAWS_Protocol_Handler *ph); int getq (JAWS_Protocol_Handler *&ph); static JAWS_TPR_Concurrency * instance () { return ACE_Singleton::instance (); } private: ACE_Atomic_Op getting_; int min_number_of_threads_; int shutdown_task_; int error_; }; #endif /* JAWS_TPR_CONCURRENCY_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/jaws.conf0000644000175000017500000000040215027201773017617 0ustar sudipsudip # See jaws3/Options.h for default values # #JAWS_IO = SYNCH # SYNCH, ASYNCH, or REACTIVE #JAWS_CONCURRENCY = TPOOL # TPOOL, TPR, or THYBRID #JAWS_MIN_THYBRID_THREADS = 1 #JAWS_MAX_THYBRID_THREADS = -1 # -1 means no upper bound #JAWS_TPOOL_THREADS = 20 ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Options.h0000644000175000017500000000125015027201773017612 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_OPTIONS_H #define JAWS_OPTIONS_H #include "ace/Singleton.h" #include "ace/Synch.h" #include "jaws3/Export.h" #include "jaws3/Config_File.h" #define JAWS_DEFAULT_MIN_THYBRID_THREADS "1" #define JAWS_DEFAULT_MAX_THYBRID_THREADS "-1" #define JAWS_DEFAULT_TPOOL_THREADS "5" #define JAWS_DEFAULT_IO "SYNCH" #define JAWS_DEFAULT_CONCURRENCY "TPR" class JAWS_Options; class JAWS_Export JAWS_Options { public: JAWS_Options (); const char *getenv (const char *key); static JAWS_Options * instance () { return ACE_Singleton::instance (); } private: JAWS_Config_File *cf_; }; #endif /* JAWS_OPTIONS_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Concurrency.h0000644000175000017500000000242015027201773020451 0ustar sudipsudip// -*- C++ -*- #ifndef JAWS_CONCURRENCY_H #define JAWS_CONCURRENCY_H #include "ace/Task.h" #include "ace/Singleton.h" #include "ace/Synch_Traits.h" #include "jaws3/Export.h" #include "jaws3/Protocol_Handler.h" typedef ACE_Task JAWS_CONCURRENCY_TASK; class JAWS_Export JAWS_Concurrency_Impl : public JAWS_CONCURRENCY_TASK { public: virtual ~JAWS_Concurrency_Impl () {}; virtual int putq (JAWS_Protocol_Handler *ph) = 0; virtual int getq (JAWS_Protocol_Handler *&ph) = 0; int svc (); }; // Include the templates here. #include "jaws3/Concurrency_T.h" template<> class JAWS_Export JAWS_Concurrency_Bridge { public: JAWS_Concurrency_Bridge (JAWS_Concurrency_Impl *impl = 0); int putq (JAWS_Protocol_Handler *ph); int getq (JAWS_Protocol_Handler *&ph); void shutdown (); protected: JAWS_Concurrency_Impl *impl_; }; #ifndef JAWS_CONCURRENCY_CONCRETE_IMPL #define JAWS_CONCURRENCY_CONCRETE_IMPL JAWS_Concurrency_Impl #endif /* JAWS_CONCURRENCY_CONCRETE_IMPL */ class JAWS_Export JAWS_Concurrency : public JAWS_Concurrency_Bridge { public: static JAWS_Concurrency * instance () { return ACE_Singleton::instance (); } }; #endif /* JAWS_CONCURRENCY_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Asynch_IO_Helpers.h0000644000175000017500000000241215027201773021456 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_ASYNCH_IO_HELPERS_H #define JAWS_ASYNCH_IO_HELPERS_H #include "ace/Asynch_IO.h" #include "ace/Singleton.h" #include "jaws3/Jaws_IO.h" #include "jaws3/Event_Result.h" #include "jaws3/Event_Completer.h" class JAWS_Asynch_IO; class JAWS_EC_AH_Adapter : public ACE_Handler // = TITLE // A JAWS_Event_Completer - ACE_Handler adapter. // // = DESCRIPTION // This class will be conditionally #included by jaws3/Asynch_IO.cpp // if the given platform supports POSIX or WIN32 asynch IO. { public: static JAWS_EC_AH_Adapter * make (JAWS_Event_Completer *); void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result); void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result); void handle_transmit_file (const ACE_Asynch_Transmit_File::Result &result); private: JAWS_EC_AH_Adapter (JAWS_Event_Completer *completer) : completer_ (completer) { } protected: JAWS_Event_Result make_io_result ( const ACE_Asynch_Result &result , JAWS_Event_Result::JE_REASON reason_ok , JAWS_Event_Result::JE_REASON reason_fail ); private: JAWS_Event_Completer *completer_; }; #endif /* JAWS_ASYNCH_IO_HELPERS_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/THYBRID_Concurrency.h0000644000175000017500000000127015027201773021640 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_THYBRID_CONCURRENCY_H #define JAWS_THYBRID_CONCURRENCY_H #include "ace/Atomic_Op.h" #include "jaws3/Concurrency.h" class JAWS_Export JAWS_THYBRID_Concurrency : public JAWS_Concurrency_Impl { public: JAWS_THYBRID_Concurrency (); int putq (JAWS_Protocol_Handler *ph); int getq (JAWS_Protocol_Handler *&ph); static JAWS_THYBRID_Concurrency * instance () { return ACE_Singleton ::instance (); } private: ACE_Atomic_Op getting_; int min_number_of_threads_; int max_number_of_threads_; int shutdown_task_; int error_; }; #endif /* JAWS_THYBRID_CONCURRENCY_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Timer.h0000644000175000017500000000516315027201773017246 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_TIMER_H #define JAWS_TIMER_H #include "ace/Singleton.h" #include "ace/Timer_Wheel.h" #include "ace/Timer_Queue_Adapters.h" #include "jaws3/Export.h" #include "jaws3/Event_Completer.h" class JAWS_Timer; class JAWS_Timer_Impl; class JAWS_Export JAWS_Timer_Impl // = TITLE // Implementation base class for Timers that corresponds to the // RHS of the Bridge pattern. { public: virtual ~JAWS_Timer_Impl () {} virtual void schedule_timer ( long *timer_id , const ACE_Time_Value &delta , JAWS_Event_Completer *completer , void *act = 0 ) = 0; // Schedule a timer to expire at now+delta. virtual void schedule_absolute_timer ( long *timer_id , const ACE_Time_Value &tv , JAWS_Event_Completer *completer , void *act = 0 ) = 0; // Schedule a timer to expire at tv. virtual void schedule_interval_timer ( long *timer_id , const ACE_Time_Value &interval , JAWS_Event_Completer *completer , void *act = 0 ) = 0; // Schedule a timer to expire at now+interval, and every interval following. virtual void cancel_timer (long timer_id) = 0; // Cancel a timer. }; class JAWS_Export JAWS_Timer // = TITLE // Abstraction base class for Timers that corresponds to the LHS of the // Bridge pattern. { public: JAWS_Timer (JAWS_Timer_Impl *impl = 0); static JAWS_Timer * instance () { return ACE_Singleton::instance (); } void schedule_timer ( long *timer_id , const ACE_Time_Value &delta , JAWS_Event_Completer *completer , void *act = 0 ); void schedule_absolute_timer ( long *timer_id , const ACE_Time_Value &tv , JAWS_Event_Completer *completer , void *act = 0 ); void schedule_interval_timer ( long *timer_id , const ACE_Time_Value &interval , JAWS_Event_Completer *completer , void *act = 0 ); void cancel_timer (long timer_id); private: JAWS_Timer_Impl *impl_; }; #endif /* JAWS_TIMER_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Concurrency.cpp0000644000175000017500000000460015027201773021006 0ustar sudipsudip#include "ace/OS_NS_strings.h" #include "ace/Message_Block.h" #include "ace/Singleton.h" #include "ace/Synch_Traits.h" #include "ace/Null_Mutex.h" #ifndef JAWS_BUILD_DLL #define JAWS_BUILD_DLL #endif #include "jaws3/Concurrency.h" #include "jaws3/TPOOL_Concurrency.h" #include "jaws3/TPR_Concurrency.h" #include "jaws3/THYBRID_Concurrency.h" #include "jaws3/Options.h" typedef ACE_Singleton JAWS_Empty_Message_Block; int JAWS_Concurrency_Impl::svc () { JAWS_Protocol_Handler *ph; while (this->getq (ph) != -1) { if (ph == 0) continue; if (ph->service () == -1) { // TODO: Do I really want to call close here, or // let the protocol handler close itself? ph->dismiss (); continue; } } return 0; } JAWS_Concurrency_Bridge ::JAWS_Concurrency_Bridge (JAWS_Concurrency_Impl *impl) : impl_ (impl) { if (this->impl_ == 0) { const char *concurrency; concurrency = JAWS_Options::instance ()->getenv ("JAWS_CONCURRENCY"); if (concurrency == 0) concurrency = JAWS_DEFAULT_CONCURRENCY; if (ACE_OS::strcasecmp (concurrency, "TPR") == 0) this->impl_ = JAWS_TPR_Concurrency::instance (); else if (ACE_OS::strcasecmp (concurrency, "TPOOL") == 0) this->impl_ = JAWS_TPOOL_Concurrency::instance (); else if (ACE_OS::strcasecmp (concurrency, "THYBRID") == 0) this->impl_ = JAWS_THYBRID_Concurrency::instance (); else this->impl_ = JAWS_THYBRID_Concurrency::instance (); // Since synchronous IO is the default IO, need an aggressive // default concurrency mechanism. } } int JAWS_Concurrency_Bridge ::putq (JAWS_Protocol_Handler *ph) { return this->impl_->putq (ph); } int JAWS_Concurrency_Bridge ::getq (JAWS_Protocol_Handler *&ph) { return this->impl_->getq (ph); } void JAWS_Concurrency_Bridge::shutdown () { ACE_Message_Block *empty_mb = JAWS_Empty_Message_Block::instance (); JAWS_CONCURRENCY_TASK *task; task = JAWS_THYBRID_Concurrency::instance (); task->putq (empty_mb); task->wait (); task = JAWS_TPOOL_Concurrency::instance (); task->putq (empty_mb); task->wait (); task = JAWS_TPR_Concurrency::instance (); task->putq (empty_mb); task->wait (); } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Reactive_IO.cpp0000644000175000017500000004001515027201773020645 0ustar sudipsudip#include "ace/ACE.h" #include "ace/OS_NS_unistd.h" #include "ace/Reactor.h" #ifndef JAWS_BUILD_DLL #define JAWS_BUILD_DLL #endif #include "jaws3/Jaws_IO.h" #include "jaws3/Reactive_IO.h" #include "jaws3/Reactive_IO_Helpers.h" #include "jaws3/Event_Completer.h" void JAWS_Reactive_IO::send ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act ) { if (mb->length () == 0) { JAWS_Event_Result io_result ( 0 , JAWS_Event_Result::JE_OK , JAWS_Event_Result::JE_SEND_OK ); if (completer) completer->output_complete (io_result, act); return; } JAWS_IO_Reactive_Send *rs; rs = JAWS_IO_Reactive_Send::make (handle, mb, completer, tv, act); if (rs == 0) { JAWS_Event_Result io_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_SEND_FAIL ); if (completer) completer->output_complete (io_result, act); return; } rs->open (); } void JAWS_Reactive_IO::send ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act ) { this->send (handle, mb, completer, ACE_Time_Value::zero, act); } void JAWS_Reactive_IO::recv ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act ) { JAWS_IO_Reactive_Recv *rr; rr = JAWS_IO_Reactive_Recv::make (handle, mb, completer, tv, act); if (rr == 0) { JAWS_Event_Result io_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_RECV_FAIL ); if (completer) completer->output_complete (io_result, act); return; } rr->open (); } void JAWS_Reactive_IO::recv ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act ) { this->recv (handle, mb, completer, ACE_Time_Value::zero, act); } void JAWS_Reactive_IO::transmit ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act , ACE_Message_Block *header , ACE_Message_Block *trailer ) { JAWS_IO_Reactive_Transmit *rt; rt = JAWS_IO_Reactive_Transmit::make ( handle , source , completer , tv , header , trailer , act ); if (rt == 0) { JAWS_Event_Result io_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_TRANSMIT_FAIL ); if (completer) completer->output_complete (io_result, act); return; } rt->open (); } void JAWS_Reactive_IO::transmit ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , void *act , ACE_Message_Block *header , ACE_Message_Block *trailer ) { this->transmit ( handle , source , completer , ACE_Time_Value::zero , act , header , trailer ); } void JAWS_IO_Reactive_Handler::open () { int result = ACE_Reactor::instance ()->notify (this); if (result < 0) this->close (result); } void JAWS_IO_Reactive_Handler::close (int result) { if (result < 0) { if (ACE_BIT_ENABLED (this->mask_, ACE_Event_Handler::WRITE_MASK)) { JAWS_Event_Result io_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_SEND_FAIL ); this->io_result_ = io_result; } else if (ACE_BIT_ENABLED (this->mask_, ACE_Event_Handler::READ_MASK)) { JAWS_Event_Result io_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_RECV_FAIL ); this->io_result_ = io_result; } this->handle_close (this->handle_, this->mask_); } } int JAWS_IO_Reactive_Handler::handle_timeout (const ACE_Time_Value &, const void *) { if (this->was_active_) { this->was_active_ = 0; this->timer_id_ = ACE_Reactor::instance ()->schedule_timer (this, 0, this->tv_); return 0; } ACE_Reactor::instance () ->remove_handler ( this , ACE_Event_Handler::RWE_MASK|ACE_Event_Handler::DONT_CALL ); this->timer_id_ = -1; if (ACE_BIT_ENABLED (this->mask_, ACE_Event_Handler::WRITE_MASK)) { JAWS_Event_Result io_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_SEND_TIMEOUT , ETIME ); this->io_result_ = io_result; } else if (ACE_BIT_ENABLED (this->mask_, ACE_Event_Handler::READ_MASK)) { JAWS_Event_Result io_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_RECV_TIMEOUT , ETIME ); this->io_result_ = io_result; } return -1; } int JAWS_IO_Reactive_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask) { if (this->completer_) { if (ACE_BIT_ENABLED (this->mask_, ACE_Event_Handler::WRITE_MASK)) this->completer_->output_complete (this->io_result_, this->act_); else if (ACE_BIT_ENABLED (this->mask_, ACE_Event_Handler::READ_MASK)) this->completer_->input_complete (this->io_result_, this->act_); } ACE_Reactor::instance () ->remove_handler ( this , ACE_Event_Handler::RWE_MASK|ACE_Event_Handler::DONT_CALL ); delete this; return 0; } int JAWS_IO_Reactive_Handler::handle_exception (ACE_HANDLE handle) { if (handle == ACE_INVALID_HANDLE) { // We are being called back from a notify call. // This is our cue to register ourselves with the Reactor. int result; result = ACE_Reactor::instance () ->register_handler (this, this->mask_|ACE_Event_Handler::EXCEPT_MASK); if (result < 0) this->close (result); return 0; } // back to our regularly scheduled except mask handling. if (ACE_BIT_ENABLED (this->mask_, ACE_Event_Handler::WRITE_MASK)) { JAWS_Event_Result io_result ( this->bytes_ , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_SEND_SHORT ); this->io_result_ = io_result; } else if (ACE_BIT_ENABLED (this->mask_, ACE_Event_Handler::READ_MASK)) { JAWS_Event_Result io_result ( this->bytes_ , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_RECV_SHORT ); this->io_result_ = io_result; } return -1; } int JAWS_IO_Reactive_Send::handle_output (ACE_HANDLE handle) { this->was_active_ = 1; ssize_t count = ACE::send ( handle , this->mb_->rd_ptr () , this->mb_->length () ); if (count <= 0 && this->bytes_ == 0) { JAWS_Event_Result io_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_SEND_FAIL ); this->io_result_ = io_result; } else if (count <= 0 && this->bytes_ > 0) { JAWS_Event_Result io_result ( this->bytes_ , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_SEND_SHORT ); this->io_result_ = io_result; } else { if (count > 0) this->mb_->rd_ptr (count); this->bytes_ += count; JAWS_Event_Result io_result ( this->bytes_ , JAWS_Event_Result::JE_OK , JAWS_Event_Result::JE_SEND_OK ); this->io_result_ = io_result; } if (count <= 0 || this->mb_->length () == 0) return -1; // Not done yet, so stay registered. return 0; } int JAWS_IO_Reactive_Recv::handle_input (ACE_HANDLE handle) { ssize_t count = ACE::recv ( handle , this->mb_->wr_ptr () , this->mb_->space () ); if (count < 0) { JAWS_Event_Result io_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_RECV_FAIL ); this->io_result_ = io_result; } else { if (count > 0) this->mb_->wr_ptr (count); JAWS_Event_Result io_result ( count , JAWS_Event_Result::JE_OK , JAWS_Event_Result::JE_RECV_OK ); this->io_result_ = io_result; } return -1; } int JAWS_IO_Reactive_Transmit::handle_output (ACE_HANDLE handle) { this->was_active_ = 1; if (this->header_ && this->header_->length () > 0) return this->handle_output_header (handle); else this->header_ = 0; if (this->source_ != ACE_INVALID_HANDLE) return this->handle_output_source (handle); if (this->trailer_ && this->trailer_->length () > 0) return this->handle_output_trailer (handle); else this->trailer_ = 0; JAWS_Event_Result io_result ( this->bytes_ , JAWS_Event_Result::JE_OK , JAWS_Event_Result::JE_TRANSMIT_OK ); this->io_result_ = io_result; return -1; } int JAWS_IO_Reactive_Transmit::handle_output_header (ACE_HANDLE handle) { return this->handle_output_mb (handle, this->header_); } int JAWS_IO_Reactive_Transmit::handle_output_source (ACE_HANDLE handle) { ACE_Message_Block *mb = this->source_buf_; if (mb == 0) return -1; // Try to read data into the mb if data is still available. if (mb->space () && this->source_ != ACE_INVALID_HANDLE) { ssize_t count; count = ACE_OS::read (this->source_, mb->wr_ptr (), mb->space ()); if (count < 0) { this->source_ = ACE_INVALID_HANDLE; this->source_buf_ = 0; if (this->bytes_ == 0) { JAWS_Event_Result io_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_TRANSMIT_FAIL ); this->io_result_ = io_result; } else if (this->bytes_ > 0) { JAWS_Event_Result io_result ( this->bytes_ , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_TRANSMIT_SHORT ); this->io_result_ = io_result; } return -1; } else if (count == 0) this->source_ = ACE_INVALID_HANDLE; else mb->wr_ptr (count); } int result = 0; if (mb->length () > 0) result = this->handle_output_mb (handle, mb); if (result < 0) { this->source_ = ACE_INVALID_HANDLE; this->source_buf_ = 0; } else if (mb == 0 && this->source_ == ACE_INVALID_HANDLE) this->source_buf_ = 0; else this->source_buf_->crunch (); return result; } int JAWS_IO_Reactive_Transmit::handle_output_trailer (ACE_HANDLE handle) { int result = this->handle_output_mb (handle, this->trailer_); if (result == 0 && this->trailer_ == 0) { JAWS_Event_Result io_result ( this->bytes_ , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_TRANSMIT_SHORT ); this->io_result_ = io_result; return -1; } return result; } int JAWS_IO_Reactive_Transmit::handle_output_mb ( ACE_HANDLE handle , ACE_Message_Block *&mb ) { ssize_t count = ACE::send (handle, mb->rd_ptr (), mb->length ()); if (count <= 0 && this->bytes_ == 0) { JAWS_Event_Result io_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_TRANSMIT_FAIL ); this->io_result_ = io_result; } else if (count <= 0 && this->bytes_ > 0) { JAWS_Event_Result io_result ( this->bytes_ , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_TRANSMIT_SHORT ); this->io_result_ = io_result; } else { mb->rd_ptr (count); this->bytes_ += count; } if (count <= 0) return -1; if (mb->length () == 0) mb = 0; return 0; } void JAWS_IO_Reactive_Transmit::close (int result) { if (result < 0) { JAWS_Event_Result io_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_TRANSMIT_FAIL ); this->io_result_ = io_result; this->handle_close (this->handle_, this->mask_); } } int JAWS_IO_Reactive_Transmit::handle_timeout (const ACE_Time_Value &, const void *) { if (this->was_active_) { this->was_active_ = 0; this->timer_id_ = ACE_Reactor::instance ()->schedule_timer (this, 0, this->tv_); return 0; } ACE_Reactor::instance () ->remove_handler ( this , ACE_Event_Handler::RWE_MASK|ACE_Event_Handler::DONT_CALL ); this->timer_id_ = -1; JAWS_Event_Result io_result ( 0 , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_TRANSMIT_TIMEOUT , ETIME ); this->io_result_ = io_result; return -1; } int JAWS_IO_Reactive_Transmit::handle_exception (ACE_HANDLE handle) { if (handle == ACE_INVALID_HANDLE) { // We are being called back from a notify call. // This is our cue to register ourselves with the Reactor. int result; result = ACE_Reactor::instance () ->register_handler (this, this->mask_|ACE_Event_Handler::EXCEPT_MASK); if (result < 0) this->close (result); return 0; } // back to our regularly scheduled except mask handling. JAWS_Event_Result io_result ( this->bytes_ , JAWS_Event_Result::JE_ERROR , JAWS_Event_Result::JE_TRANSMIT_SHORT ); this->io_result_ = io_result; return -1; } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Config_File.h0000644000175000017500000000327615027201773020335 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_CONFIG_FILE_H #define JAWS_CONFIG_FILE_H #include "jaws3/Export.h" class JAWS_Config_File; class JAWS_Config_File_Impl; class JAWS_Export JAWS_Config_File // = TITLE // A simple configuration file manager. // // = DESCRIPTION // Reads in a configuration file. The syntax of the configuration // file is: // = BEGIN // := // // := [] // // := // | // // := '=' // // := // // := [] [] // // := [] // // := [] // // := [] // // := '#' // // := [] // = END // No is to exceed 4094 characters. { public: // = Initialization JAWS_Config_File (const ACE_TCHAR *config_file, const ACE_TCHAR *config_dir = "./"); // Parse the specified in the . // = Searching int find (const ACE_TCHAR *key, const ACE_TCHAR *&value); // Find the associated with . public: void reset (); // Re-read the configuration file. void dump (); // Dump the values of all configuration variables. private: JAWS_Config_File_Impl *impl_; // Opaque implementation. }; #endif /* JAWS_CONFIG_FILE_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Event_Completer.cpp0000644000175000017500000000171715027201773021615 0ustar sudipsudip#ifndef JAWS_BUILD_DLL #define JAWS_BUILD_DLL #endif #include "jaws3/Event_Completer.h" // Default do nothing completers. JAWS_Event_Completer::~JAWS_Event_Completer () { } void JAWS_Event_Completer::default_complete (const JAWS_Event_Result &, void *) { } void JAWS_Event_Completer::accept_complete (const JAWS_Event_Result &r, void *d) { this->default_complete (r, d); } void JAWS_Event_Completer::connect_complete (const JAWS_Event_Result &r, void *d) { this->default_complete (r, d); } void JAWS_Event_Completer::input_complete (const JAWS_Event_Result &r, void *d) { this->default_complete (r, d); } void JAWS_Event_Completer::output_complete (const JAWS_Event_Result &r, void *d) { this->default_complete (r, d); } void JAWS_Event_Completer::timer_complete (const JAWS_Event_Result &r, void *d) { this->default_complete (r, d); } void JAWS_Event_Completer::lambda_complete (const JAWS_Event_Result &r, void *d) { this->default_complete (r, d); } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Synch_IO.h0000644000175000017500000000313715027201773017640 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_SYNCH_IO_H #define JAWS_SYNCH_IO_H #include "ace/Singleton.h" #include "jaws3/Jaws_IO.h" class JAWS_Export JAWS_Synch_IO : public JAWS_IO_Impl { public: static JAWS_Synch_IO * instance () { return ACE_Singleton::instance (); } void send ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act = 0 ); void recv ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act = 0 ); void transmit ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , void *act = 0 , ACE_Message_Block *header = 0 , ACE_Message_Block *trailer = 0 ); void send ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act = 0 ); void recv ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act = 0 ); void transmit ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act = 0 , ACE_Message_Block *header = 0 , ACE_Message_Block *trailer = 0 ); }; #endif /* JAWS_SYNCH_IO_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/main.cpp0000644000175000017500000000132715027201773017443 0ustar sudipsudip#include "ace/Log_Msg.h" #include "ace/Reactor.h" #include "ace/Select_Reactor.h" #include "ace/Service_Config.h" #include "ace/Thread_Manager.h" #include "jaws3/Event_Dispatcher.h" #include "jaws3/Signal_Task.h" int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { ACE_REACTOR_INSTANCE_INIT; JAWS_Signal_Task::instance (); if (ACE_Service_Config::open (argc, argv) == -1 && errno != ENOENT) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), 1); // Run forever, performing the configured services until we // shutdown. JAWS_Event_Dispatcher::run_event_loop (); ACE_Thread_Manager::instance ()->wait (); return 0; } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Concurrency_T.h0000644000175000017500000000171015027201773020735 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_CONCURRENCY_T_H #define JAWS_CONCURRENCY_T_H #include "ace/config-lite.h" class JAWS_Protocol_Handler; template class JAWS_Concurrency_Bridge // = TITLE // The Concurrency Bridge uses the Concrete Bridge pattern. // // = DESCRIPTION // The Concurrency Bridge class plays the role of Abstraction // in the Bridge pattern. If the CONCURRENCY_IMPL is the // base class JAWS_Concurrency_Impl, then it plays the classic // role. If the CONCURRENCY_IMPL is one of the Concrete // Implementors, then its role is more that of an Adapter, // which is like Bridge, but without the polymorphism overhead. // { public: JAWS_Concurrency_Bridge (CONCURRENCY_IMPL *impl = 0); int putq (JAWS_Protocol_Handler *ph); int getq (JAWS_Protocol_Handler *&ph); void shutdown (); protected: CONCURRENCY_IMPL *impl_; }; #include "jaws3/Concurrency_T.cpp" #endif /* JAWS_CONCURRENCY_T_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Concurrency_T.cpp0000644000175000017500000000202515027201773021270 0ustar sudipsudip#include "ace/Message_Block.h" #include "ace/Singleton.h" #include "ace/Synch_Traits.h" #include "ace/Null_Mutex.h" #include "jaws3/Concurrency_T.h" typedef ACE_Singleton JAWS_Empty_Message_Block; template JAWS_Concurrency_Bridge ::JAWS_Concurrency_Bridge (CONCURRENCY_IMPL *impl) : impl_ (impl) { if (this->impl_ == 0) this->impl_ = CONCURRENCY_IMPL::instance (); } template int JAWS_Concurrency_Bridge::putq (JAWS_Protocol_Handler *ph) { return this->impl_->putq (ph); } template int JAWS_Concurrency_Bridge::getq (JAWS_Protocol_Handler *&ph) { return this->impl_->getq (ph); } template void JAWS_Concurrency_Bridge::shutdown () { ACE_Message_Block *empty_mb = JAWS_Empty_Message_Block::instance (); JAWS_CONCURRENCY_TASK *task; task = this->impl_; task->putq (empty_mb); task->wait (); } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/FILE.cpp0000644000175000017500000000352515027201773017240 0ustar sudipsudip#include "ace/config-all.h" #include "ace/Guard_T.h" #include "ace/Synch_Traits.h" #include "ace/Thread_Mutex.h" #ifndef JAWS_BUILD_DLL #define JAWS_BUILD_DLL #endif #include "jaws3/FILE.h" JAWS_FILE::JAWS_FILE () : map_ (0) , can_map_ (0) { } JAWS_FILE::~JAWS_FILE () { delete this->map_; this->map_ = 0; } ACE_Mem_Map * JAWS_FILE::mem_map (int length, int prot, int share, void *addr, ACE_OFF_T offset, LPSECURITY_ATTRIBUTES sa) const { if (this->can_map_ == 0) return 0; JAWS_FILE *mutable_this = (JAWS_FILE *) this; return mutable_this->mem_map (length, prot, share, addr, offset, sa); } ACE_Mem_Map * JAWS_FILE::mem_map (int length, int prot, int share, void *addr, ACE_OFF_T offset, LPSECURITY_ATTRIBUTES sa) { if (this->can_map_ == 0) return 0; if (this->map_ == 0) { ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, g, this->lock_, 0); if (this->map_ == 0) { this->map_ = new ACE_Mem_Map; if (this->map_ != 0) { int r = this->map_->map (this->get_handle (), static_cast (length), prot, share, addr, offset, sa); if (r < 0) { delete this->map_; this->map_ = 0; } } } } return this->map_; } ACE_Mem_Map * JAWS_FILE::map () const { return this->map_; } void JAWS_FILE::can_map (int flag) { this->can_map_ = (flag != 0); } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Datagram.cpp0000644000175000017500000000452615027201773020243 0ustar sudipsudip #ifndef JAWS_BUILD_DLL #define JAWS_BUILD_DLL #endif /*JAWS_BUILD_DLL*/ #include "jaws3/Datagram.h" JAWS_Datagram::JAWS_Datagram (JAWS_Datagram_Impl *impl) : impl_ (impl) { } void JAWS_Datagram::accept ( const ACE_Addr &local_sap , ACE_SOCK_Dgram &new_dgram , JAWS_Event_Completer *completer , void *act ) { this->impl_->accept (local_sap, new_dgram, completer, act); } void JAWS_Datagram::connect ( const ACE_Addr &remote_sap , ACE_SOCK_Dgram &new_dgram , JAWS_Event_Completer *completer , void *act ) { this->impl_->connect (remote_sap, new_dgram, completer, act); } void JAWS_Datagram::connect ( const ACE_Addr &remote_sap , ACE_SOCK_Dgram &new_dgram , const ACE_Addr &local_sap , JAWS_Event_Completer *completer , void *act ) { this->impl_->connect (remote_sap, new_dgram, local_sap, completer, act); } void JAWS_Datagram::accept ( const ACE_Addr &local_sap , ACE_SOCK_Dgram &new_dgram , JAWS_Event_Completer *completer , const ACE_Time_Value &timeout , void *act ) { this->impl_->accept (local_sap, new_dgram, completer, timeout, act); } void JAWS_Datagram::connect ( const ACE_Addr &remote_sap , ACE_SOCK_Dgram &new_dgram , JAWS_Event_Completer *completer , const ACE_Time_Value &timeout , void *act ) { this->impl_->connect (remote_sap, new_dgram, completer, timeout, act); } void JAWS_Datagram::connect ( const ACE_Addr &remote_sap , ACE_SOCK_Dgram &new_dgram , const ACE_Addr &local_sap , JAWS_Event_Completer *completer , const ACE_Time_Value &timeout , void *act ) { this->impl_->connect ( remote_sap , new_dgram , local_sap , completer , timeout , act ); } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Protocol_Handler.h0000644000175000017500000000304715027201773021423 0ustar sudipsudip#ifndef JAWS_PROTOCOL_HANDLER_H #define JAWS_PROTOCOL_HANDLER_H #include "ace/Message_Block.h" #include "jaws3/Export.h" #include "jaws3/Event_Completer.h" class JAWS_Export JAWS_Protocol_State { friend class JAWS_Protocol_Handler; public: virtual ~JAWS_Protocol_State (); protected: virtual int service (JAWS_Event_Completer *, void *data) = 0; virtual JAWS_Protocol_State * transition ( const JAWS_Event_Result & , void *data , void *act ) = 0; }; class JAWS_Export JAWS_Protocol_Handler : public JAWS_Event_Completer // = TITLE // Abstraction that interacts with concurrency dispatching. { friend class JAWS_TPOOL_Concurrency; friend class JAWS_TPR_Concurrency; friend class JAWS_THYBRID_Concurrency; public: JAWS_Protocol_Handler (JAWS_Protocol_State *state = 0, void *data = 0); virtual int service (); virtual void dismiss () { delete this; } protected: virtual ~JAWS_Protocol_Handler (); // Try to guarantee this class will be created dynamically. protected: void event_complete (const JAWS_Event_Result &result, void *act); // The event completion routine that triggers the transition // to the next Protocol State. void default_complete (const JAWS_Event_Result &result, void *act) { this->event_complete (result, act); } private: JAWS_Protocol_State *state_; void *data_; ACE_Data_Block db_; ACE_Message_Block mb_; }; #endif /* JAWS_PROTOCOL_HANDLER_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Datagram.h0000644000175000017500000001065715027201773017712 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_DATAGRAM_H #define JAWS_DATAGRAM_H #include "ace/Addr.h" #include "ace/Synch.h" #include "ace/Singleton.h" #include "ace/SOCK_Dgram.h" #include "jaws3/Export.h" #include "jaws3/Event_Completer.h" class JAWS_Export JAWS_Datagram_Impl { public: virtual ~JAWS_Datagram_Impl () {} virtual void accept ( const ACE_Addr &local_sap , ACE_SOCK_Dgram &new_dgram , JAWS_Event_Completer *completer , void *act = 0 ) = 0; // The address to new_dgram is passed back as the data member of // the JAWS_Event_Result that is returned to the completer. virtual void connect ( const ACE_Addr &remote_sap , ACE_SOCK_Dgram &new_dgram , JAWS_Event_Completer *completer , void *act = 0 ) = 0; // The address to new_dgram is passed back as the data member of // the JAWS_Event_Result that is returned to the completer. // ADDR_ANY is assumed for the local access point. virtual void connect ( const ACE_Addr &remote_sap , ACE_SOCK_Dgram &new_dgram , const ACE_Addr &local_sap , JAWS_Event_Completer *completer , void *act = 0 ) = 0; // The address to new_dgram is passed back as the data member of // the JAWS_Event_Result that is returned to the completer. // Use the specified local access point. virtual void accept ( const ACE_Addr &local_sap , ACE_SOCK_Dgram &new_dgram , JAWS_Event_Completer *completer , const ACE_Time_Value &timeout , void *act = 0 ) = 0; // The address to new_dgram is passed back as the data member of // the JAWS_Event_Result that is returned to the completer. virtual void connect ( const ACE_Addr &remote_sap , ACE_SOCK_Dgram &new_dgram , JAWS_Event_Completer *completer , const ACE_Time_Value &timeout , void *act = 0 ) = 0; // The address to new_dgram is passed back as the data member of // the JAWS_Event_Result that is returned to the completer. // ADDR_ANY is assumed for the local access point. virtual void connect ( const ACE_Addr &remote_sap , ACE_SOCK_Dgram &new_dgram , const ACE_Addr &local_sap , JAWS_Event_Completer *completer , const ACE_Time_Value &timeout , void *act = 0 ) = 0; // The address to new_dgram is passed back as the data member of // the JAWS_Event_Result that is returned to the completer. // Use the specified local access point. }; class JAWS_Export JAWS_Datagram { public: JAWS_Datagram (JAWS_Datagram_Impl *impl = 0); static JAWS_Datagram * instance () { return ACE_Singleton::instance (); } void accept ( const ACE_Addr &local_sap , ACE_SOCK_Dgram &new_dgram , JAWS_Event_Completer *completer , void *act = 0 ); void connect ( const ACE_Addr &remote_sap , ACE_SOCK_Dgram &new_dgram , JAWS_Event_Completer *completer , void *act = 0 ); void connect ( const ACE_Addr &remote_sap , ACE_SOCK_Dgram &new_dgram , const ACE_Addr &local_sap , JAWS_Event_Completer *completer , void *act = 0 ); void accept ( const ACE_Addr &local_sap , ACE_SOCK_Dgram &new_dgram , JAWS_Event_Completer *completer , const ACE_Time_Value &timeout , void *act = 0 ); void connect ( const ACE_Addr &remote_sap , ACE_SOCK_Dgram &new_dgram , JAWS_Event_Completer *completer , const ACE_Time_Value &timeout , void *act = 0 ); void connect ( const ACE_Addr &remote_sap , ACE_SOCK_Dgram &new_dgram , const ACE_Addr &local_sap , JAWS_Event_Completer *completer , const ACE_Time_Value &timeout , void *act = 0 ); private: JAWS_Datagram_Impl *impl_; }; #endif /* JAWS_DATAGRAM_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Timer.cpp0000644000175000017500000000267015027201773017601 0ustar sudipsudip#ifndef JAWS_BUILD_DLL #define JAWS_BUILD_DLL #endif #include "jaws3/Timer.h" #include "jaws3/Task_Timer.h" JAWS_Timer::JAWS_Timer (JAWS_Timer_Impl *impl) : impl_ (impl) { // TODO: Change this to use JAWS_Options after we have more than // one way of handling timers. if (this->impl_ == 0) this->impl_ = JAWS_Task_Timer::instance (); } void JAWS_Timer::schedule_timer ( long *timer_id , const ACE_Time_Value &delta , JAWS_Event_Completer *completer , void *act ) { this->impl_->schedule_timer (timer_id, delta, completer, act); } void JAWS_Timer::schedule_absolute_timer ( long *timer_id , const ACE_Time_Value &tv , JAWS_Event_Completer *completer , void *act ) { this->impl_->schedule_absolute_timer (timer_id, tv, completer, act); } void JAWS_Timer::schedule_interval_timer ( long *timer_id , const ACE_Time_Value &interval , JAWS_Event_Completer *completer , void *act ) { this->impl_->schedule_interval_timer (timer_id, interval, completer, act); } void JAWS_Timer::cancel_timer (long timer_id) { this->impl_->cancel_timer (timer_id); } ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Asynch_IO.h0000644000175000017500000000341415027201773017777 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_ASYNCH_IO_H #define JAWS_ASYNCH_IO_H #include "ace/Asynch_IO.h" #include "ace/Message_Block.h" #include "ace/Singleton.h" #include "ace/Time_Value.h" #include "jaws3/Export.h" #include "jaws3/Jaws_IO.h" #include "jaws3/Event_Result.h" class JAWS_Asynch_IO; class JAWS_Export JAWS_Asynch_IO : public JAWS_IO_Impl { public: static JAWS_Asynch_IO * instance () { return ACE_Singleton::instance (); } void send ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act = 0 ); void recv ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act = 0 ); void transmit ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , void *act = 0 , ACE_Message_Block *header = 0 , ACE_Message_Block *trailer = 0 ); void send ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act = 0 ); void recv ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act = 0 ); void transmit ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act = 0 , ACE_Message_Block *header = 0 , ACE_Message_Block *trailer = 0 ); }; #endif /* JAWS_ASYNCH_IO_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Reactive_IO_Helpers.h0000644000175000017500000002157115027201773022002 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_REACTIVE_IO_HELPERS_H #define JAWS_REACTIVE_IO_HELPERS_H #include "ace/Event_Handler.h" #include "ace/Message_Block.h" #include "ace/Singleton.h" #include "ace/Time_Value.h" #include "jaws3/Export.h" #include "jaws3/Jaws_IO.h" #include "jaws3/Event_Result.h" #include "jaws3/Event_Completer.h" class JAWS_Reactive_IO; class JAWS_IO_Reactive_Handler : public ACE_Event_Handler { friend class JAWS_IO_Reactive_Send; friend class JAWS_IO_Reactive_Recv; friend class JAWS_IO_Reactive_Transmit; public: virtual void open (); int handle_timeout (const ACE_Time_Value &, const void *); int handle_close (ACE_HANDLE, ACE_Reactor_Mask); int handle_exception (ACE_HANDLE); ACE_HANDLE get_handle () const { return this->handle_; } void set_handle (ACE_HANDLE handle) { this->handle_ = handle; } protected: virtual void close (int result); private: JAWS_IO_Reactive_Handler ( ACE_HANDLE handle , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act , ACE_Reactor_Mask mask ) : bytes_ (0) , handle_ (handle) , completer_ (completer) , tv_ (tv) , act_ (act) , mask_ (mask) , timer_id_ (-1) , was_active_ (0) { if (ACE_Time_Value::zero < this->tv_) this->timer_id_ = ACE_Reactor::instance ()->schedule_timer (this, 0, this->tv_); } public: // needed for destructor due to "aCC: HP ANSI C++ B3910B A.03.39" compiler bug ~JAWS_IO_Reactive_Handler () { if (this->timer_id_ != -1) ACE_Reactor::instance ()->cancel_timer (this->timer_id_); } private: JAWS_Event_Result io_result_; size_t bytes_; ACE_HANDLE handle_; JAWS_Event_Completer *completer_; ACE_Time_Value tv_; void *act_; ACE_Reactor_Mask mask_; long timer_id_; int was_active_; }; class JAWS_IO_Reactive_Send : public JAWS_IO_Reactive_Handler { friend class JAWS_Reactive_IO; public: int handle_output (ACE_HANDLE handle); static JAWS_IO_Reactive_Send * make ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act ) { return new JAWS_IO_Reactive_Send ( handle , mb , completer , ACE_Time_Value::zero , act , ACE_Event_Handler::WRITE_MASK ); } static JAWS_IO_Reactive_Send * make ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act ) { return new JAWS_IO_Reactive_Send ( handle , mb , completer , tv , act , ACE_Event_Handler::WRITE_MASK ); } private: JAWS_IO_Reactive_Send ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act , ACE_Reactor_Mask mask ) : JAWS_IO_Reactive_Handler (handle, completer, tv, act, mask) , mb_ (mb) { } private: ACE_Message_Block *mb_; }; class JAWS_IO_Reactive_Recv : public JAWS_IO_Reactive_Handler { friend class JAWS_Reactive_IO; public: int handle_input (ACE_HANDLE handle); static JAWS_IO_Reactive_Recv * make ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , void *act ) { return new JAWS_IO_Reactive_Recv ( handle , mb , completer , ACE_Time_Value::zero , act , ACE_Event_Handler::READ_MASK ); } static JAWS_IO_Reactive_Recv * make ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act ) { return new JAWS_IO_Reactive_Recv ( handle , mb , completer , tv , act , ACE_Event_Handler::READ_MASK ); } private: JAWS_IO_Reactive_Recv ( ACE_HANDLE handle , ACE_Message_Block *mb , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , void *act , ACE_Reactor_Mask mask ) : JAWS_IO_Reactive_Handler (handle, completer, tv, act, mask) , mb_ (mb) { } private: ACE_Message_Block *mb_; }; class JAWS_IO_Reactive_Transmit : public JAWS_IO_Reactive_Handler { friend class JAWS_Reactive_IO; public: int handle_timeout (const ACE_Time_Value &, const void *); int handle_output (ACE_HANDLE handle); int handle_exception (ACE_HANDLE handle); static JAWS_IO_Reactive_Transmit * make ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , ACE_Message_Block *header , ACE_Message_Block *trailer , void *act ) { return new JAWS_IO_Reactive_Transmit ( handle , source , completer , ACE_Time_Value::zero , header , trailer , act , ACE_Event_Handler::WRITE_MASK ); } static JAWS_IO_Reactive_Transmit * make ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , ACE_Message_Block *header , ACE_Message_Block *trailer , void *act ) { return new JAWS_IO_Reactive_Transmit ( handle , source , completer , tv , header , trailer , act , ACE_Event_Handler::WRITE_MASK ); } protected: void close (int result); int handle_output_header (ACE_HANDLE handle); int handle_output_source (ACE_HANDLE handle); int handle_output_trailer (ACE_HANDLE handle); int handle_output_mb (ACE_HANDLE handle, ACE_Message_Block *&mb); private: JAWS_IO_Reactive_Transmit ( ACE_HANDLE handle , ACE_HANDLE source , JAWS_Event_Completer *completer , const ACE_Time_Value &tv , ACE_Message_Block *header , ACE_Message_Block *trailer , void *act , ACE_Reactor_Mask mask ) : JAWS_IO_Reactive_Handler (handle, completer, tv, act, mask) , source_ (source) , source_mb_ (8 * 1024) , source_buf_ (& this->source_mb_) , header_ (header) , trailer_ (trailer) { } private: ACE_HANDLE source_; ACE_Message_Block source_mb_; ACE_Message_Block *source_buf_; ACE_Message_Block *header_; ACE_Message_Block *trailer_; }; #endif /* JAWS_REACTIVE_IO_HELPERS_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/Symbol_Table.h0000644000175000017500000000331015027201773020532 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_SYMBOL_TABLE_H #define JAWS_SYMBOL_TABLE_H #include "ace/Hash_Map_Manager.h" #include "ace/Synch.h" #include "jaws3/Export.h" #define JAWS_SYMBOL_TABLE_ENTRY \ ACE_Hash_Map_Entry #define JAWS_SYMBOL_TABLE_BASE \ ACE_Hash_Map_Manager_Ex, ACE_Equal_To, \ ACE_SYNCH_NULL_MUTEX> #define JAWS_SYMBOL_TABLE_ITERATOR_BASE \ ACE_Hash_Map_Iterator_Base_Ex, \ ACE_Equal_To, \ ACE_SYNCH_NULL_MUTEX> #define JAWS_SYMBOL_TABLE_ITERATOR \ ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, \ ACE_SYNCH_NULL_MUTEX> #define JAWS_SYMBOL_TABLE_REVERSE_ITERATOR \ ACE_Hash_Map_Reverse_Iterator_Ex, \ ACE_Equal_To, \ ACE_SYNCH_NULL_MUTEX> class JAWS_Symbol_Table; class JAWS_Export JAWS_Symbol_Table : public JAWS_SYMBOL_TABLE_BASE // = TITLE // A class the associates a string with another string. { public: JAWS_Symbol_Table (size_t size = 211); // Hash table should be a prime. }; #endif /* JAWS_SYMBOL_TABLE_H */ ace-8.0.4+dfsg.orig/apps/JAWS3/jaws3/TPR_Concurrency.cpp0000644000175000017500000000311415027201773021532 0ustar sudipsudip#include "ace/Message_Block.h" #ifndef JAWS_BUILD_DLL #define JAWS_BUILD_DLL #endif #include "jaws3/Concurrency.h" #include "jaws3/TPR_Concurrency.h" #include "jaws3/Protocol_Handler.h" #include "jaws3/Options.h" JAWS_TPR_Concurrency::JAWS_TPR_Concurrency () : getting_ (0) , shutdown_task_ (0) , error_ (0) { int r; r = this->activate (THR_BOUND | THR_JOINABLE); if (r < 0) { this->error_ = 1; this->shutdown_task_ = 1; } } int JAWS_TPR_Concurrency::putq (JAWS_Protocol_Handler *ph) { if (this->error_) return -1; JAWS_CONCURRENCY_TASK *task = this; int result = task->putq (& ph->mb_); if (result != -1) { int r; r = this->activate ( THR_BOUND | THR_JOINABLE , 1 // number of threads , 1 // force active ); if (r < 0) { // ACE_ERROR return -1; } } return result; } int JAWS_TPR_Concurrency::getq (JAWS_Protocol_Handler *&ph) { ph = 0; JAWS_CONCURRENCY_TASK *task = this; if (this->shutdown_task_ && task->msg_queue ()->message_count () == 0) return -1; int getting = ++(this->getting_); if (getting > 1 && task->msg_queue ()->message_count () == 0) { --(this->getting_); return -1; } ACE_Message_Block *mb = 0; int result = task->getq (mb); if (result != -1) { ph = (JAWS_Protocol_Handler *) mb->base (); if (ph == 0) { // Shutdown this task; this->shutdown_task_ = 1; } } --(this->getting_); return result; } ace-8.0.4+dfsg.orig/apps/JAWS3/zCHANGES0000644000175000017500000000400315027201773016143 0ustar sudipsudipRevision 1.1 2003/08/25 07:40:34 kobica Added JAWS3 to ACE_wrappers repo Revision 1.11 2000/09/29 23:31:20 jxh * jaws3/Cached_Allocator_T.cpp: * jaws3/Cached_Allocator_T.h: New template class for faster allocation. Revision 1.10 2000/09/29 23:16:41 jxh * jaws3/Config_File.cpp: * jaws3/Config_File.h: * jaws3/Symbol_Table.h: * jaws3/main.cpp: Changes to make JAWS3 comply with new ACE_TEXT macro. * jaws3/Makefile: New dependencies. Revision 1.9 2000/08/10 05:18:17 jxh * contrib/john_at_lyris_dot_com/README * contrib/john_at_lyris_dot_com/jaws3-cntlC.code Contibutions from John Buckman to capture Control-C and Control-BREAK on the console. Revision 1.8 2000/08/04 18:03:10 jxh * jaws3/Protocol_Handler.h Redo some changes I inadvertently undid, regarding lambda events and default_complete. Revision 1.7 2000/08/04 00:07:53 jxh * docs/web/overview.html: Minor update. * jaws3/Event_Dispatcher.cpp: Use the default proactor instead of one of my invention. * jaws3/Protocol_Handler.h: jaws3/Protocol_Handler.cpp: Make the creation of the message block more efficient. * jaws3-todo/Makefile: jaws3-todo/Reactive_Socket.cpp: jaws3-todo/Reactive_Socket_Helpers.cpp: jaws3-todo/Reactive_Socket_Helpers.h: Flushing this out some more. Revision 1.6 2000/07/25 05:08:01 jxh * jaws3/THYBRID_Concurrency.cpp: jaws3/TPOOL_Concurrency.cpp: Changes made to make all the threads die eventually. Revision 1.5 2000/07/17 08:18:36 jxh * bench/rqfiles.cpp: Wait until the last request is actually finished. Revision 1.4 2000/07/16 18:39:25 jxh * bench/rqfiles.cpp: Added a missing explicit template instantiation. Revision 1.3 2000/07/06 22:30:12 jxh Complete the "lambda" event callbacks. Added a new "default_complete" callback which the other callback methods call by default. This simplifies the Protocol_Handler header file. Revision 1.2 2000/06/19 01:57:00 jxh Testing out the use of the change log file. Revision 1.1 2000/06/19 01:51:36 jxh Add a change log file and a Makefile. ace-8.0.4+dfsg.orig/apps/JAWS3/zCOPYING0000644000175000017500000000566215027201773016217 0ustar sudipsudip _________________________________________________________________ Copyright and Licensing Information for JAWS Adaptive Web Server, version 3 (JAWS3). JAWS3 is copyrighted by James Hu and Entera, Inc., Copyright (c) 2000, all rights reserved. Since JAWS3 is open source, free software, you are free to use, modify, and distribute the JAWS3 source code and object code produced or otherwise derived from JAWS3, provided you include this copyright statement in all versions of such code. In particular, you can use JAWS3 in proprietary software and are under no obligation to redistribute any of your source code that is derived from JAWS3. Note, however, that you may not modify the JAWS3 code in any way, or take any other action such as copyrighting it yourself or claiming authorship of the JAWS3 code, that will prevent JAWS3 from being distributed freely using an open source development model. JAWS3 is provided as is with no warranties of any kind, including the warranties of design, merchantibility and fitness for a particular purpose, noninfringement, or arising from a course of dealing, usage or trade practice. Moreover, JAWS3 is provided with no support and without any obligation on the part of Entera, Inc., or its employees. Entera, Inc., and its employees shall have no liability with respect to the infringement of copyrights, trade secrets or any patents by JAWS3 or any part thereof. Moreover, in no event will Entera, Inc., or its employees, be liable for any lost revenue or profits or other special, indirect and consequential damages. By submitting comments, suggestions, code, code snippets, techniques (including that of usage), and algorithms, submitters acknowledge that they have the right to do so, that any such submissions are given freely and unreservedly, and that they waive any claims to copyright or ownership. In addition, submitters acknowledge that any such submission might become part of the copyright maintained on the overall body of code, which comprises the JAWS3 software. By making a submission, submitters agree to these terms. Furthermore, submitters acknowledge that the incorporation or modification of such submissions is entirely at the discretion of the moderators of the open source JAWS3 project or their designees. The names JAWS3 and Entera, Inc., may not be used to endorse or promote products or services derived from this source without express written permission from Entera, Inc. Further, products or services derived from this source may not be called JAWS3 nor may the name Entera, Inc., appear in their names, without express written permission from Entera, Inc. If you have any suggestions, additions, comments, or questions, please let me know. James C. Hu Entera, Inc. jxh@entera.com _________________________________________________________________ ace-8.0.4+dfsg.orig/apps/JAWS3/zCONTRIB0000644000175000017500000000141215027201773016174 0ustar sudipsudipIf you have comments, bug reports, bug fixes, or improvements, please feel free to send them to me, and I will gladly review them for inclusion into the main JAWS3 release. Thanks, James Hu jxh@entera.com Codes: X -> applied R -> under review ? -> don't understand patch date: Wed May 3 16:02:30 GMT 2000 contributor: John M. Mills bugfix (X): Timer.cpp: implementation of a function should not override the default value given in the interface definition. contrib ( ): jaws3.dep: MSVC++ 6.0 dependencies generated contrib ( ): jaws3.dsp: MSVC++ 6.0 project file generated contrib ( ): jaws3.dsw: MSVC++ 6.0 workspace file generated contrib ( ): jaws3.dsw: MSVC++ 6.0 NMAKE file generated ace-8.0.4+dfsg.orig/apps/Gateway/0000755000175000017500000000000015046037655015542 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/Gateway/Gateway/0000755000175000017500000000000015046037655017143 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/Gateway/Gateway/Event_Channel.cpp0000644000175000017500000004442315027201773022360 0ustar sudipsudip#define ACE_BUILD_SVC_DLL #include "Connection_Handler_Connector.h" #include "Event_Channel.h" #include "ace/OS_NS_sys_select.h" #include "ace/Signal.h" Event_Channel::~Event_Channel () { } #if defined (_MSC_VER) # pragma warning (push) # pragma warning (disable:4355) /* Use of 'this' in initializer list */ # endif Event_Channel::Event_Channel () : supplier_acceptor_ (*this, 'S'), consumer_acceptor_ (*this, 'C') { } #if defined (_MSC_VER) # pragma warning (pop) #endif int Event_Channel::compute_performance_statistics () { ACE_DEBUG ((LM_DEBUG, "(%t) doing the performance timeout here...\n")); CONNECTION_MAP_ITERATOR cmi (this->connection_map_); // If we've got a then use it to suspend all // the threads. This will enable us to get an accurate count. if (Options::instance ()->threading_strategy () != Options::REACTIVE) { if (ACE_Thread_Manager::instance ()->suspend_all () == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "suspend_all"), -1); ACE_DEBUG ((LM_DEBUG, "(%t) suspending all threads...")); } size_t total_bytes_in = 0; size_t total_bytes_out = 0; // Iterate through the connection map summing up the number of bytes // sent/received. for (CONNECTION_MAP_ENTRY *me = 0; cmi.next (me) != 0; cmi.advance ()) { Connection_Handler *connection_handler = me->int_id_; if (connection_handler->connection_role () == 'C') total_bytes_out += connection_handler->total_bytes (); else // connection_handler->connection_role () == 'S' total_bytes_in += connection_handler->total_bytes (); } ACE_DEBUG ((LM_DEBUG, "(%t) after %d seconds, \ntotal_bytes_in = %d\ntotal_bytes_out = %d\n", Options::instance ()->performance_window (), total_bytes_in, total_bytes_out)); ACE_DEBUG ((LM_DEBUG, "(%t) %f Mbits/sec received.\n", (float) (total_bytes_in * 8 / (float) (1024 * 1024 * Options::instance ()->performance_window ())))); ACE_DEBUG ((LM_DEBUG, "(%t) %f Mbits/sec sent.\n", (float) (total_bytes_out * 8 / (float) (1024 * 1024 * Options::instance ()->performance_window ())))); // Resume all the threads again. if (Options::instance ()->threading_strategy () != Options::REACTIVE) { if (ACE_Thread_Manager::instance ()->resume_all () == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "resume_all"), -1); ACE_DEBUG ((LM_DEBUG, "(%t) resuming all threads...")); } return 0; } int Event_Channel::handle_timeout (const ACE_Time_Value &, const void *) { // This is called periodically to compute performance statistics. return this->compute_performance_statistics (); } int Event_Channel::put (ACE_Message_Block *event, ACE_Time_Value *) { // We got a valid event, so determine its type, which is stored in // the first of the two s, which are chained // together by . Event_Key *event_key = (Event_Key *) event->rd_ptr (); // Skip over the address portion and get the data, which is in the // second . ACE_Message_Block *data = event->cont (); switch (event_key->type_) { case ROUTING_EVENT: this->routing_event (event_key, data); break; case SUBSCRIPTION_EVENT: this->subscription_event (data); break; } // Release the memory in the message block. event->release (); return 0; } void Event_Channel::subscription_event (ACE_Message_Block *data) { Event *event = (Event *) data->rd_ptr (); ACE_DEBUG ((LM_DEBUG, "(%t) received a subscription with %d bytes from connection id %d\n", event->header_.len_, event->header_.connection_id_)); Subscription *subscription = (Subscription *) event->data_; // Convert the subscription into host byte order so that we can // access it directly without having to repeatedly muck with it... subscription->decode (); ACE_DEBUG ((LM_DEBUG, "(%t) connection_id_ = %d, total_consumers_ = %d\n", subscription->connection_id_, subscription->total_consumers_)); for (ACE_INT32 i = 0; i < subscription->total_consumers_; i++) ACE_DEBUG ((LM_DEBUG, "(%t) consumers_[%d] = %d\n", i, subscription->consumers_[i])); } void Event_Channel::routing_event (Event_Key *forwarding_address, ACE_Message_Block *data) { Consumer_Dispatch_Set *dispatch_set = 0; // Initialize the to points to the set of Consumers // associated with this forwarding address. if (this->efd_.find (*forwarding_address, dispatch_set) == -1) // Failure. ACE_ERROR ((LM_DEBUG, "(%t) find failed on connection id = %d, type = %d\n", forwarding_address->connection_id_, forwarding_address->type_)); else { // Check to see if there are any consumers. if (dispatch_set->size () == 0) ACE_DEBUG ((LM_WARNING, "there are no active consumers for this event currently\n")); else // There are consumers, so forward the event. { // Initialize the interator. Consumer_Dispatch_Set_Iterator dsi (*dispatch_set); // At this point, we should assign a thread-safe locking // strategy to the is we're running in a // multi-threaded configuration. data->locking_strategy (Options::instance ()->locking_strategy ()); for (Connection_Handler **connection_handler = 0; dsi.next (connection_handler) != 0; dsi.advance ()) { // Only process active connection_handlers. if ((*connection_handler)->state () == Connection_Handler::ESTABLISHED) { // Duplicate the event portion via reference // counting. ACE_Message_Block *dup_msg = data->duplicate (); ACE_DEBUG ((LM_DEBUG, "(%t) forwarding to Consumer %d\n", (*connection_handler)->connection_id ())); if ((*connection_handler)->put (dup_msg) == -1) { if (errno == EWOULDBLOCK) // The queue has filled up! ACE_ERROR ((LM_ERROR, "(%t) %p\n", "gateway is flow controlled, so we're dropping events")); else ACE_ERROR ((LM_ERROR, "(%t) %p transmission error to peer %d\n", "put", (*connection_handler)->connection_id ())); // We are responsible for releasing an // ACE_Message_Block if failures occur. dup_msg->release (); } } } } } } int Event_Channel::initiate_connection_connection (Connection_Handler *connection_handler, int sync_directly) { ACE_Synch_Options synch_options; if (sync_directly) // In separated connection handler thread, connection can be // initiated by block mode (synch mode) directly. synch_options = ACE_Synch_Options::synch; else if (Options::instance ()->blocking_semantics () == ACE_NONBLOCK) synch_options = ACE_Synch_Options::asynch; else synch_options = ACE_Synch_Options::synch; return this->connector_.initiate_connection (connection_handler, synch_options); } int Event_Channel::complete_connection_connection (Connection_Handler *connection_handler) { int option = connection_handler->connection_role () == 'S' ? SO_RCVBUF : SO_SNDBUF; int socket_queue_size = Options::instance ()->socket_queue_size (); if (socket_queue_size > 0) if (connection_handler->peer ().set_option (SOL_SOCKET, option, &socket_queue_size, sizeof (int)) == -1) ACE_ERROR ((LM_ERROR, "(%t) %p\n", "set_option")); connection_handler->thr_mgr (ACE_Thread_Manager::instance ()); // Our state is now "established." connection_handler->state (Connection_Handler::ESTABLISHED); // Restart the timeout to 1. connection_handler->timeout (1); ACE_INT32 id = htonl (connection_handler->connection_id ()); // Send the connection id to the peerd. ssize_t const n = connection_handler->peer ().send ((const void *) &id, sizeof id); if (n != (ssize_t) sizeof id) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", n == 0 ? "peer has closed down unexpectedly" : "send"), -1); return 0; } // Restart connection (blocking_semantics dicates whether we restart // synchronously or asynchronously). int Event_Channel::reinitiate_connection_connection (Connection_Handler *connection_handler) { // Cancel asynchronous connecting before re-initializing. It will // close the peer and cancel the asynchronous connecting. this->cancel_connection_connection(connection_handler); if (connection_handler->state () != Connection_Handler::DISCONNECTING) { ACE_DEBUG ((LM_DEBUG, "(%t) scheduling reinitiation of Connection_Handler %d\n", connection_handler->connection_id ())); // Reschedule ourselves to try and connect again. ACE_Time_Value const timeout (connection_handler->timeout ()); if (ACE_Reactor::instance ()->schedule_timer (connection_handler, 0, timeout) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "schedule_timer"), -1); } return 0; } // It is useful to provide a separate method to cancel the // asynchronous connecting. int Event_Channel::cancel_connection_connection (Connection_Handler *connection_handler) { // Skip over proxies with deactivated handles. if (connection_handler->get_handle () != ACE_INVALID_HANDLE) { // Make sure to close down peer to reclaim descriptor. connection_handler->peer ().close (); // Cancel asynchronous connecting before re-initializing. return this->connector_.cancel(connection_handler); } return 0; } // Initiate active connections with the Consumer and Supplier Peers. void Event_Channel::initiate_connector () { if (Options::instance ()->enabled (Options::CONSUMER_CONNECTOR | Options::SUPPLIER_CONNECTOR)) { CONNECTION_MAP_ITERATOR cmi (this->connection_map_); // Iterate through the Consumer Map connecting all the // Connection_Handlers. for (CONNECTION_MAP_ENTRY *me = 0; cmi.next (me) != 0; cmi.advance ()) { Connection_Handler *connection_handler = me->int_id_; if (this->initiate_connection_connection (connection_handler) == -1) continue; // Failures are handled elsewhere... } } } // Initiate passive acceptor to wait for Consumer and Supplier Peers // to accept. int Event_Channel::initiate_acceptors () { if (Options::instance ()->enabled (Options::CONSUMER_ACCEPTOR)) { ACE_INET_Addr consumer_addr (Options::instance ()->consumer_acceptor_port ()); if (this->consumer_acceptor_.open (consumer_addr, ACE_Reactor::instance (), Options::instance ()->blocking_semantics ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "cannot register acceptor"), -1); else ACE_DEBUG ((LM_DEBUG, "accepting Consumers at %d\n", Options::instance ()->consumer_acceptor_port ())); } if (Options::instance ()->enabled (Options::SUPPLIER_ACCEPTOR)) { ACE_INET_Addr supplier_addr (Options::instance ()->supplier_acceptor_port ()); if (this->supplier_acceptor_.open (supplier_addr, ACE_Reactor::instance (), Options::instance ()->blocking_semantics ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "cannot register acceptor"), -1); else ACE_DEBUG ((LM_DEBUG, "accepting Suppliers at %d\n", Options::instance ()->supplier_acceptor_port ())); } return 0; } // This method gracefully shuts down all the Handlers in the // Connection_Handler Connection Map. int Event_Channel::close (u_long) { if (Options::instance ()->threading_strategy () != Options::REACTIVE) { if (ACE_Thread_Manager::instance ()->suspend_all () == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "suspend_all"), -1); ACE_DEBUG ((LM_DEBUG, "(%t) suspending all threads\n")); } // First tell everyone that the spaceship is here... { CONNECTION_MAP_ITERATOR cmi (this->connection_map_); // Iterate over all the handlers and shut them down. for (CONNECTION_MAP_ENTRY *me = 0; // It's safe to reset me to 0. cmi.next (me) != 0; cmi.advance ()) { Connection_Handler *connection_handler = me->int_id_; ACE_DEBUG ((LM_DEBUG, "(%t) closing down connection %d\n", connection_handler->connection_id ())); // If have no this statement, the gatewayd will abort when exiting // with some Consumer/Supplier not connected. if (connection_handler->state()==Connection_Handler::CONNECTING) this->cancel_connection_connection(connection_handler); // Mark Connection_Handler as DISCONNECTING so we don't try to // reconnect... connection_handler->state (Connection_Handler::DISCONNECTING); } } // Close down the connector this->connector_.close (); // Close down the supplier acceptor. this->supplier_acceptor_.close (); // Close down the consumer acceptor. this->consumer_acceptor_.close (); // Now tell everyone that it is now time to commit suicide. { CONNECTION_MAP_ITERATOR cmi (this->connection_map_); for (CONNECTION_MAP_ENTRY *me = 0; // It's safe to reset me to 0. cmi.next (me) != 0; cmi.advance ()) { Connection_Handler *connection_handler = me->int_id_; // Deallocate Connection_Handler resources. connection_handler->destroy (); // Will trigger a delete. } } return 0; } int Event_Channel::find_proxy (ACE_INT32 connection_id, Connection_Handler *&connection_handler) { return this->connection_map_.find (connection_id, connection_handler); } int Event_Channel::bind_proxy (Connection_Handler *connection_handler) { int result = this->connection_map_.bind (connection_handler->connection_id (), connection_handler); switch (result) { case -1: ACE_ERROR_RETURN ((LM_ERROR, "(%t) bind failed for connection %d\n", connection_handler->connection_id ()), -1); /* NOTREACHED */ case 1: // Oops, found a duplicate! ACE_ERROR_RETURN ((LM_ERROR, "(%t) duplicate connection %d, already bound\n", connection_handler->connection_id ()), -1); /* NOTREACHED */ case 0: // Success. return 0; /* NOTREACHED */ default: ACE_ERROR_RETURN ((LM_DEBUG, "(%t) invalid result %d\n", result), -1); /* NOTREACHED */ } ACE_NOTREACHED (return 0); } int Event_Channel::subscribe (const Event_Key &event_addr, Consumer_Dispatch_Set *cds) { int result = this->efd_.bind (event_addr, cds); // Bind with consumer map, keyed by peer address. switch (result) { case -1: ACE_ERROR_RETURN ((LM_ERROR, "(%t) bind failed for connection %d\n", event_addr.connection_id_), -1); /* NOTREACHED */ case 1: // Oops, found a duplicate! ACE_ERROR_RETURN ((LM_DEBUG, "(%t) duplicate consumer map entry %d, " "already bound\n", event_addr.connection_id_), -1); /* NOTREACHED */ case 0: // Success. return 0; default: ACE_ERROR_RETURN ((LM_DEBUG, "(%t) invalid result %d\n", result), -1); /* NOTREACHED */ } ACE_NOTREACHED (return 0); } int Event_Channel::open (void *) { // Ignore so each can handle it. ACE_Sig_Action sig ((ACE_SignalHandler) SIG_IGN, SIGPIPE); ACE_UNUSED_ARG (sig); // Actively initiate Peer connections. this->initiate_connector (); // Passively initiate Peer acceptor. if (this->initiate_acceptors () == -1) return -1; // If we're not running reactively, then we need to make sure that // reference counting operations are // thread-safe. Therefore, we create an that is // parameterized by to prevent race conditions. if (Options::instance ()->threading_strategy () != Options::REACTIVE) { ACE_Lock_Adapter *la; ACE_NEW_RETURN (la, ACE_Lock_Adapter, -1); Options::instance ()->locking_strategy (la); } return 0; } ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/svc.conf0000644000175000017500000000024115027201773020573 0ustar sudipsudip #static Svc_Manager "-d -p 2913" dynamic Gateway Service_Object * Gateway:_make_Gateway() active "-b -d -c C|S -a C|S -P connection_config -C consumer_config" ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/gateway.mpc0000644000175000017500000000076715027201773021310 0ustar sudipsudip// -*- MPC -*- project(Gateway) : acelib, ace_output { sharedname = Gateway Source_Files { Concrete_Connection_Handlers.cpp Config_Files.cpp File_Parser.cpp Gateway.cpp Event_Channel.cpp Event_Forwarding_Discriminator.cpp Options.cpp Connection_Handler.cpp Connection_Handler_Acceptor.cpp Connection_Handler_Connector.cpp } } project(gatewayd) : aceexe { exename = gatewayd after += Gateway libs += Gateway Source_Files { gatewayd.cpp } } ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/File_Parser.cpp0000644000175000017500000000636215027201773022042 0ustar sudipsudip#ifndef FILE_PARSER_C #define FILE_PARSER_C #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_stdlib.h" #include "File_Parser.h" // This fixes a nasty bug with cfront-based compilers (like // Centerline). typedef FPRT::Return_Type FP_RETURN_TYPE; // File_Parser stuff. template File_Parser::~File_Parser () { } template int File_Parser::open (const ACE_TCHAR filename[]) { this->infile_ = ACE_OS::fopen (filename, ACE_TEXT ("r")); if (this->infile_ == 0) return -1; else return 0; } template int File_Parser::close () { return ACE_OS::fclose (this->infile_); } template FP_RETURN_TYPE File_Parser::getword (char buf[]) { return this->readword (buf); } // Get the next string from the file via this->readword() // Check make sure the string forms a valid number. template FP_RETURN_TYPE File_Parser::getint (ACE_INT32 &value) { char buf[BUFSIZ]; FP_RETURN_TYPE read_result = this->readword (buf); if (read_result == FPRT::RT_SUCCESS) { // Check to see if this is the "use the default value" symbol? if (buf[0] == '*') return FPRT::RT_DEFAULT; else { // ptr is used for error checking with ACE_OS::strtol. char *ptr = 0; // try to convert the buf to a decimal number value = ACE_OS::strtol (buf, &ptr, 10); // check if the buf is a decimal or not if (value == 0 && ptr == buf) return FPRT::RT_PARSE_ERROR; else return FPRT::RT_SUCCESS; } } else return read_result; } template FP_RETURN_TYPE File_Parser::readword (char buf[]) { int wordlength = 0; int c; // Skip over leading delimiters and get word. while ((c = ACE_OS::getc (this->infile_)) != EOF && c != '\n') if (this->delimiter (c)) { // We've reached the end of a "word". if (wordlength > 0) break; } else buf[wordlength++] = c; buf[wordlength] = '\0'; if (c == EOF) { // If EOF is just a delimiter, don't return EOF so that the word // gets processed. if (wordlength > 0) { ACE_OS::ungetc (c, this->infile_); return FPRT::RT_SUCCESS; } else // else return EOF so that read loops stop return FPRT::RT_EOFILE; } else if (c == '\n') { // if the EOLINE is just a delimiter, don't return EOLINE // so that the word gets processed if (wordlength > 0) ACE_OS::ungetc (c, this->infile_); else return FPRT::RT_EOLINE; } // Skip comments. if (this->comments (buf[0])) { if (this->skipline () == EOF) return FPRT::RT_EOFILE; else return FPRT::RT_COMMENT; } else return FPRT::RT_SUCCESS; } template int File_Parser::delimiter (char ch) { return ch == ' ' || ch == ',' || ch == '\t'; } template int File_Parser::comments (char ch) { return ch == '#'; } template int File_Parser::skipline () { // Skip the remainder of the line. int c; while ((c = ACE_OS::getc (this->infile_)) != '\n' && c != EOF) continue; return c; } #endif /* _FILE_PARSER_C */ ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/Config_Files.cpp0000644000175000017500000001353115027201773022172 0ustar sudipsudip#define ACE_BUILD_SVC_DLL #include "Config_Files.h" #include "Options.h" #if defined (GATEWAY_DEBUGGING) #include "ace/Log_Msg.h" #endif /* GATEWAY_DEBUGGING */ // This fixes a nasty bug with cfront-based compilers (like // Centerline). typedef FPRT::Return_Type FP_RETURN_TYPE; FP_RETURN_TYPE Consumer_Config_File_Parser::read_entry (Consumer_Config_Info &entry, int &line_number) { FP_RETURN_TYPE result; // Increment the line count. line_number++; // Ignore comments, check for EOF and EOLINE if this succeeds, we // have our connection id. while ((result = this->getint (entry.connection_id_)) != FPRT::RT_SUCCESS) if (result == FPRT::RT_EOFILE) return FPRT::RT_EOFILE; else if (result == FPRT::RT_EOLINE || result == FPRT::RT_COMMENT) line_number++; // Get the payload type. result = this->getint (entry.type_); if (result != FPRT::RT_SUCCESS) return result; // get all the consumers. entry.total_consumers_ = 0; while ((result = this->getint (entry.consumers_[entry.total_consumers_])) == FPRT::RT_SUCCESS) ++entry.total_consumers_; // do nothing (should check against max...) if (result == FPRT::RT_EOLINE || result == FPRT::RT_EOFILE) return FPRT::RT_SUCCESS; else return result; } FP_RETURN_TYPE Connection_Config_File_Parser::read_entry (Connection_Config_Info &entry, int &line_number) { char buf[BUFSIZ]; FP_RETURN_TYPE result; // Increment the line count. ++line_number; // Ignore comments, check for EOF and EOLINE if this succeeds, we // have our connection id while ((result = this->getint (entry.connection_id_)) != FPRT::RT_SUCCESS) if (result == FPRT::RT_EOFILE) return FPRT::RT_EOFILE; else if (result == FPRT::RT_EOLINE || result == FPRT::RT_COMMENT) ++line_number; // Get the hostname. result = this->getword (entry.host_); if (result != FPRT::RT_SUCCESS) return result; ACE_INT32 port; // Get the port number. result = this->getint (port); if (result == FPRT::RT_DEFAULT) { // Get the proxy role, i.e., 'C' (Consumer) or 'S' (Supplier). result = this->getword (buf); if (result != FPRT::RT_SUCCESS) return result; else entry.connection_role_ = buf[0]; if (entry.connection_role_ == 'C') entry.remote_port_ = Options::instance ()->consumer_connector_port (); else if (entry.connection_role_ == 'S') entry.remote_port_ = Options::instance ()->supplier_connector_port (); else // Yikes, this is a *weird* error! entry.remote_port_ = 0; } else if (result != FPRT::RT_SUCCESS) return result; else { entry.remote_port_ = (unsigned short) port; // Get the proxy role, i.e., 'C' (Consumer) or 'S' (Supplier). result = this->getword (buf); if (result != FPRT::RT_SUCCESS) return result; else entry.connection_role_ = buf[0]; } // Get the max retry delay. result = this->getint (entry.max_retry_timeout_); if (result == FPRT::RT_DEFAULT) entry.max_retry_timeout_ = Options::instance ()->max_timeout (); else if (result != FPRT::RT_SUCCESS) return result; // Get the local port number. result = this->getint (port); if (result == FPRT::RT_DEFAULT) entry.local_port_ = 0; // @@ Should make this an option. else if (result != FPRT::RT_SUCCESS) return result; else entry.local_port_ = (unsigned short) port; ACE_INT32 priority; // Get the priority. result = this->getint (priority); if (result != FPRT::RT_SUCCESS) return result; else entry.priority_ = priority; return FPRT::RT_SUCCESS; } #if defined (GATEWAY_DEBUGGING) int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { FP_RETURN_TYPE result; int line_number = 0; { Connection_Config_Info entry; Connection_Config_File_Parser connection_config_file; connection_config_file.open (argc > 1 ? argv[1] : "connection_config"); int line_number = 0; ACE_DEBUG ((LM_DEBUG, "ConnID\tHost\t\tRPort\tRole\tRetry\tLPort\tPriority\n")); // Read config file line at a time. while ((result = connection_config_file.read_entry (entry, line_number)) != FPRT::RT_EOFILE) if (result == FPRT::RT_PARSE_ERROR) ACE_DEBUG ((LM_DEBUG, "Error line %d.\n", line_number)); else ACE_DEBUG ((LM_DEBUG, "%d\t%s\t%d\t%c\t%d\t%d\t%d\n", entry.connection_id_, entry.host_, entry.remote_port_, entry.connection_role_, entry.max_retry_timeout_, entry.local_port_, entry.priority_)); connection_config_file.close (); } { Consumer_Config_Info entry; Consumer_Config_File_Parser consumer_config_file; consumer_config_file.open (argc > 2 ? argv[2] : "consumer_config"); line_number = 0; ACE_DEBUG ((LM_DEBUG, "\nConnID\tLogic\tPayload\tDestinations\n")); // Read config file line at a time. while ((result = consumer_config_file.read_entry (entry, line_number)) != FPRT::RT_EOFILE) if (result == FPRT::RT_PARSE_ERROR) ACE_DEBUG ((LM_DEBUG, "Error line %d.\n", line_number)); else { ACE_DEBUG ((LM_DEBUG, "%d\t%d\t", entry.connection_id_, entry.type_)); while (--entry.total_consumers_ >= 0) ACE_DEBUG ((LM_DEBUG, "%d,", entry.consumers_[entry.total_consumers_])); ACE_DEBUG ((LM_DEBUG, "\n")); } consumer_config_file.close (); } return 0; } #endif /* GATEWAY_DEBUGGING */ ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/Connection_Handler_Acceptor.h0000644000175000017500000000326515027201773024667 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Connection_Handler_Acceptor.h * * @author Doug Schmidt */ //============================================================================= #ifndef _CONNECTION_HANDLER_ACCEPTOR #define _CONNECTION_HANDLER_ACCEPTOR #include "ace/Acceptor.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/SOCK_Acceptor.h" #include "Connection_Handler.h" // Forward declaration class Event_Channel; /** * @class Connection_Handler_Acceptor * * @brief A concrete factory class that setups connections to peerds * and produces a new Connection_Handler object to do the dirty * work... */ class Connection_Handler_Acceptor : public ACE_Acceptor { public: /// Constructor. Connection_Handler_Acceptor (Event_Channel &, char connection_role); /// Hook method for creating an appropriate . virtual int make_svc_handler (Connection_Handler *&ch); /// Hook method for accepting a connection into the /// . virtual int accept_svc_handler (Connection_Handler *ch); protected: /// Make life easier later on. typedef ACE_Acceptor inherited; /// Reference to the event channel. Event_Channel &event_channel_; /// Keeps track of what type of proxy we need to create. Connection_Config_Info connection_config_info_; /// Make the appropriate type of . Connection_Handler_Factory connection_handler_factory_; }; #endif /* _CONNECTION_HANDLER_ACCEPTOR */ ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/Config_Files.h0000644000175000017500000000451315027201773021637 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Config_Files.h * * @author Doug Schmidt */ //============================================================================= #ifndef _CONFIG_FILES #define _CONFIG_FILES #include "File_Parser.h" #include "Event.h" // Forward declaration. class Event_Channel; /** * @class Connection_Config_Info * * @brief Stores connection configuration information. */ class Connection_Config_Info { public: /// Connection id for this Connection_Handler. ACE_INT32 connection_id_; /// Host to connect with. char host_[BUFSIZ]; /// Port to connect with. u_short remote_port_; /// 'S' (supplier) or 'C' (consumer). char connection_role_; /// Maximum amount of time to wait for reconnecting. ACE_INT32 max_retry_timeout_; /// Our local port number. u_short local_port_; /// Priority by which different Consumers and Suppliers should be /// serviced. ACE_INT32 priority_; /// We just need a place to store this until we can pass it along /// when creating a Connection_Handler. Event_Channel *event_channel_; }; /** * @class Connection_Config_File_Parser * * @brief Parser for the Connection_Handler Connection file. */ class Connection_Config_File_Parser : public File_Parser { public: /// Read in a entry. virtual FPRT::Return_Type read_entry (Connection_Config_Info &entry, int &line_number); }; /** * @class Consumer_Config_Info * * @brief Stores the information in a Consumer Map entry. */ class Consumer_Config_Info { public: /// Connection id. ACE_INT32 connection_id_; /// Message type. ACE_INT32 type_; /// Connection ids for consumers that will be routed information /// containing this ACE_INT32 consumers_[MAX_CONSUMERS]; /// Total number of these consumers. ACE_INT32 total_consumers_; }; /** * @class Consumer_Config_File_Parser * * @brief Parser for the Consumer Map file. */ class Consumer_Config_File_Parser : public File_Parser { public: /// Read in a entry. virtual FPRT::Return_Type read_entry (Consumer_Config_Info &entry, int &line_number); }; #endif /* _CONFIG_FILES */ ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/Concrete_Connection_Handlers.cpp0000644000175000017500000006512415027201773025411 0ustar sudipsudip#define ACE_BUILD_SVC_DLL #include "ace/OS_NS_unistd.h" #include "Event_Channel.h" #include "Concrete_Connection_Handlers.h" Consumer_Handler::Consumer_Handler (const Connection_Config_Info &pci) : Connection_Handler (pci) { this->connection_role_ = 'C'; this->msg_queue ()->high_water_mark (Options::instance ()->max_queue_size ()); } // This method should be called only when the Consumer shuts down // unexpectedly. This method simply marks the Connection_Handler as // having failed so that handle_close () can reconnect. // Do not close handler when received data successfully. // Consumer_Handler should could process received data. // For example, Consumer could send reply-event to Supplier. int Consumer_Handler::handle_input (ACE_HANDLE) { // Do not set FAILED state at here, just at real failed place. char buf[BUFSIZ]; ssize_t received = this->peer ().recv (buf, sizeof buf); switch (received) { case -1: this->state (Connection_Handler::FAILED); ACE_ERROR_RETURN ((LM_ERROR, "(%t) Peer has failed unexpectedly for Consumer_Handler %d\n", this->connection_id ()), -1); /* NOTREACHED */ case 0: this->state (Connection_Handler::FAILED); ACE_ERROR_RETURN ((LM_ERROR, "(%t) Peer has shutdown unexpectedly for Consumer_Handler %d\n", this->connection_id ()), -1); /* NOTREACHED */ default: ACE_ERROR_RETURN ((LM_ERROR, "(%t) IGNORED: Consumer is erroneously sending input to Consumer_Handler %d\n" "data size = %d\n", this->connection_id (), received), 0); // Return 0 to identify received data successfully. /* NOTREACHED */ } } // Perform a non-blocking put() of event. If we are unable to send // the entire event the remainder is re-queued at the *front* of the // Event_List. int Consumer_Handler::nonblk_put (ACE_Message_Block *event) { // Try to send the event. If we don't send it all (e.g., due to // flow control), then re-queue the remainder at the head of the // Event_List and ask the ACE_Reactor to inform us (via // handle_output()) when it is possible to try again. ssize_t n = this->send (event); if (n == -1) { // -1 is returned only when things have really gone wrong (i.e., // not when flow control occurs). Thus, let's try to close down // and set up a new reconnection by calling handle_close(). this->state (Connection_Handler::FAILED); this->handle_close (); return -1; } else if (errno == EWOULDBLOCK) { // We didn't manage to send everything, so we need to queue // things up. ACE_DEBUG ((LM_DEBUG, "(%t) queueing activated on handle %d to routing id %d\n", this->get_handle (), this->connection_id ())); // ACE_Queue in *front* of the list to preserve order. if (this->msg_queue ()->enqueue_head (event, (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "enqueue_head"), -1); // Tell ACE_Reactor to call us back when we can send again. else if (ACE_Reactor::instance ()->schedule_wakeup (this, ACE_Event_Handler::WRITE_MASK) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "schedule_wakeup"), -1); return 0; } else return n; } ssize_t Consumer_Handler::send (ACE_Message_Block *event) { ACE_DEBUG ((LM_DEBUG, "(%t) sending %d bytes to Consumer %d\n", event->length (), this->connection_id ())); ssize_t len = event->length (); ssize_t n = this->peer ().send (event->rd_ptr (), len); if (n <= 0) return errno == EWOULDBLOCK ? 0 : n; else if (n < len) { // Re-adjust pointer to skip over the part we did send. event->rd_ptr (n); errno = EWOULDBLOCK; } else // if (n == length) { // The whole event is sent, we now decrement the reference count // (which deletes itself with it reaches 0). event->release (); errno = 0; } this->total_bytes (n); return n; } // Finish sending an event when flow control conditions abate. // This method is automatically called by the ACE_Reactor. int Consumer_Handler::handle_output (ACE_HANDLE) { ACE_Message_Block *event = 0; ACE_DEBUG ((LM_DEBUG, ACE_TEXT("(%t) Receiver signalled 'resume transmission' %d\n"), this->get_handle ())); // WIN32 Notes: When the receiver blocked, we started adding to the // consumer handler's message Q. At this time, we registered a // callback with the reactor to tell us when the TCP layer signalled // that we could continue to send messages to the consumer. However, // Winsock only sends this notification ONCE, so we have to assume // at the application level, that we can continue to send until we // get any subsequent blocking signals from the receiver's buffer. #if defined (ACE_WIN32) // Win32 Winsock doesn't trigger multiple "You can write now" // signals, so we have to assume that we can continue to write until // we get another EWOULDBLOCK. // We cancel the wakeup callback we set earlier. if (ACE_Reactor::instance ()->cancel_wakeup (this, ACE_Event_Handler::WRITE_MASK) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Error in ACE_Reactor::cancel_wakeup()")), -1); // The list had better not be empty, otherwise there's a bug! while (this->msg_queue ()->dequeue_head (event, (ACE_Time_Value *) &ACE_Time_Value::zero) != -1) { switch (this->nonblk_put (event)) { case -1: // Error sending message to consumer. { // We are responsible for releasing an ACE_Message_Block if // failures occur. event->release (); ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("transmission failure"))); break; } case 0: // Partial Send - we got flow controlled by the receiver { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%D Partial Send due to flow control") ACE_TEXT ("- scheduling new wakeup with reactor\n"))); // Re-schedule a wakeup call from the reactor when the // flow control conditions abate. if (ACE_Reactor::instance ()->schedule_wakeup (this, ACE_Event_Handler::WRITE_MASK) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("Error in ACE_Reactor::schedule_wakeup()")), -1); // Didn't write everything this time, come back later... return 0; } default: // Sent the whole thing { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Sent message from message Q, Q size = %d\n"), this->msg_queue()->message_count ())); break; } } } // If we drop out of the while loop, then the message Q should be // empty...or there's a problem in the dequeue_head() call...but // thats another story. ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%D Sent all messages from consumers message Q\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) queueing deactivated on handle %d to routing id %d\n"), this->get_handle (), this->connection_id ())); #else /* !defined (ACE_WIN32) */ // The list had better not be empty, otherwise there's a bug! if (this->msg_queue ()->dequeue_head (event, (ACE_Time_Value *) &ACE_Time_Value::zero) != -1) { switch (this->nonblk_put (event)) { case 0: // Partial send. ACE_ASSERT (errno == EWOULDBLOCK); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%D Partial Send\n"))); // Didn't write everything this time, come back later... break; case -1: // We are responsible for releasing an ACE_Message_Block if // failures occur. event->release (); ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("transmission failure"))); ACE_FALLTHROUGH; default: // Sent the whole thing. // If we succeed in writing the entire event (or we did not // fail due to EWOULDBLOCK) then check if there are more // events on the Message_Queue. If there aren't, tell the // ACE_Reactor not to notify us anymore (at least until // there are new events queued up). ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("QQQ::Sent Message from consumer's Q\n"))); if (this->msg_queue ()->is_empty ()) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) queueing deactivated on handle %d to routing id %d\n"), this->get_handle (), this->connection_id ())); if (ACE_Reactor::instance ()->cancel_wakeup (this, ACE_Event_Handler::WRITE_MASK) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("cancel_wakeup"))); } } } else ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("dequeue_head - handle_output called by reactor but nothing in Q"))); #endif /* ACE_WIN32 */ return 0; } // Send an event to a Consumer (may queue if necessary). int Consumer_Handler::put (ACE_Message_Block *event, ACE_Time_Value *) { if (this->msg_queue ()->is_empty ()) // Try to send the event *without* blocking! return this->nonblk_put (event); else // If we have queued up events due to flow control then just // enqueue and return. return this->msg_queue ()->enqueue_tail (event, (ACE_Time_Value *) &ACE_Time_Value::zero); } Supplier_Handler::Supplier_Handler (const Connection_Config_Info &pci) : Connection_Handler (pci), msg_frag_ (0) { this->connection_role_ = 'S'; this->msg_queue ()->high_water_mark (0); } // Receive an Event from a Supplier. Handles fragmentation. // // The event returned from recv consists of two parts: // // 1. The Address part, contains the "virtual" routing id. // // 2. The Data part, which contains the actual data to be forwarded. // // The reason for having two parts is to shield the higher layers // of software from knowledge of the event structure. int Supplier_Handler::recv (ACE_Message_Block *&forward_addr) { if (this->msg_frag_ == 0) // No existing fragment... ACE_NEW_RETURN (this->msg_frag_, ACE_Message_Block (sizeof (Event), ACE_Message_Block::MB_DATA, 0, 0, 0, Options::instance ()->locking_strategy ()), -1); Event *event = (Event *) this->msg_frag_->rd_ptr (); ssize_t header_received = 0; const size_t HEADER_SIZE = sizeof (Event_Header); ssize_t header_bytes_left_to_read = HEADER_SIZE - this->msg_frag_->length (); if (header_bytes_left_to_read > 0) { header_received = this->peer ().recv (this->msg_frag_->wr_ptr (), header_bytes_left_to_read); if (header_received == -1 /* error */ || header_received == 0 /* EOF */) { ACE_ERROR ((LM_ERROR, "%p\n", "Recv error during header read ")); ACE_DEBUG ((LM_DEBUG, "attempted to read %d\n", header_bytes_left_to_read)); this->msg_frag_ = this->msg_frag_->release (); return header_received; } // Bump the write pointer by the amount read. this->msg_frag_->wr_ptr (header_received); // At this point we may or may not have the ENTIRE header. if (this->msg_frag_->length () < HEADER_SIZE) { ACE_DEBUG ((LM_DEBUG, "Partial header received: only %d bytes\n", this->msg_frag_->length ())); // Notify the caller that we didn't get an entire event. errno = EWOULDBLOCK; return -1; } // Convert the header into host byte order so that we can access // it directly without having to repeatedly muck with it... event->header_.decode (); if (event->header_.len_ > ACE_INT32 (sizeof event->data_)) { // This data_ payload is too big! errno = EINVAL; ACE_DEBUG ((LM_DEBUG, "Data payload is too big (%d bytes)\n", event->header_.len_)); return -1; } } // At this point there is a complete, valid header in Event. Now we // need to get the event payload. Due to incomplete reads this may // not be the first time we've read in a fragment for this message. // We account for this here. Note that the first time in here // msg_frag_->wr_ptr() will point to event->data_. Every time we do // a successful fragment read, we advance wr_ptr(). Therefore, by // subtracting how much we've already read from the // event->header_.len_ we complete the data_bytes_left_to_read... ssize_t data_bytes_left_to_read = ssize_t (event->header_.len_ - (msg_frag_->wr_ptr () - event->data_)); ssize_t data_received = !data_bytes_left_to_read ? 0 // peer().recv() should not be called when data_bytes_left_to_read is 0. : this->peer ().recv (this->msg_frag_->wr_ptr (), data_bytes_left_to_read); // Try to receive the remainder of the event. switch (data_received) { case -1: if (errno == EWOULDBLOCK) // This might happen if only the header came through. return -1; ACE_FALLTHROUGH; case 0: // Premature EOF. if (data_bytes_left_to_read) { this->msg_frag_ = this->msg_frag_->release (); return 0; } ACE_FALLTHROUGH; default: // Set the write pointer at 1 past the end of the event. this->msg_frag_->wr_ptr (data_received); if (data_received != data_bytes_left_to_read) { errno = EWOULDBLOCK; // Inform caller that we didn't get the whole event. return -1; } else { // Set the read pointer to the beginning of the event. this->msg_frag_->rd_ptr (this->msg_frag_->base ()); // Allocate an event forwarding header and chain the data // portion onto its continuation field. forward_addr = new ACE_Message_Block (sizeof (Event_Key), ACE_Message_Block::MB_PROTO, this->msg_frag_, 0, 0, Options::instance ()->locking_strategy ()); if (forward_addr == 0) { this->msg_frag_ = this->msg_frag_->release (); errno = ENOMEM; return -1; } Event_Key event_addr (this->connection_id (), event->header_.type_); // Copy the forwarding address from the Event_Key into // forward_addr. forward_addr->copy ((char *) &event_addr, sizeof (Event_Key)); // Reset the pointer to indicate we've got an entire event. this->msg_frag_ = 0; } this->total_bytes (data_received + header_received); ACE_DEBUG ((LM_DEBUG, "(%t) connection id = %d, cur len = %d, total bytes read = %d\n", event->header_.connection_id_, event->header_.len_, data_received + header_received)); if (Options::instance ()->enabled (Options::VERBOSE)) ACE_DEBUG ((LM_DEBUG, "data_ = %*s\n", event->header_.len_ - 2, event->data_)); // Encode before returning so that we can set things out in // network byte order. event->header_.encode (); return data_received + header_received; } } // Receive various types of input (e.g., Peer event from the gatewayd, // as well as stdio). int Supplier_Handler::handle_input (ACE_HANDLE) { ACE_Message_Block *event_key = 0; switch (this->recv (event_key)) { case 0: // Note that a peer shouldn't initiate a shutdown by closing the // connection. Therefore, the peer must have crashed, so we'll // need to bail out here and let the higher layers reconnect. this->state (Connection_Handler::FAILED); ACE_ERROR_RETURN ((LM_ERROR, "(%t) Peer has closed down unexpectedly for Input Connection_Handler %d\n", this->connection_id ()), -1); /* NOTREACHED */ case -1: if (errno == EWOULDBLOCK) // A short-read, we'll come back and finish it up later on! return 0; else // A weird problem occurred, shut down and start again. { this->state (Connection_Handler::FAILED); ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p for Input Connection_Handler %d\n", "Peer has failed unexpectedly", this->connection_id ()), -1); } /* NOTREACHED */ default: // Route messages to Consumers. return this->process (event_key); } } // This delegates to the to do the actual processing. // Typically, this forwards the event to its appropriate Consumer(s). int Supplier_Handler::process (ACE_Message_Block *event_key) { return this->event_channel_->put (event_key); } Thr_Consumer_Handler::Thr_Consumer_Handler (const Connection_Config_Info &pci) : Consumer_Handler (pci) { // It is not in thread svc() now. in_thread_ = 0; } // Overriding handle_close() method. If in thread svc(), no need to // process handle_close() when call peer().close(), because the // connection is blocked now. int Thr_Consumer_Handler::handle_close (ACE_HANDLE h, ACE_Reactor_Mask m) { if (in_thread_) return 0; else return Consumer_Handler::handle_close (h, m); } // This method should be called only when the Consumer shuts down // unexpectedly. This method marks the Connection_Handler as having // failed and deactivates the ACE_Message_Queue (to wake up the thread // blocked on in svc()). // Thr_Consumer_Handler::handle_close () will eventually try to // reconnect... // Let Consumer_Handler receive normal data. int Thr_Consumer_Handler::handle_input (ACE_HANDLE h) { // Call down to the to handle this first. if (this->Consumer_Handler::handle_input (h) != 0) { // Only do such work when failed. ACE_Reactor::instance ()->remove_handler (h, ACE_Event_Handler::ALL_EVENTS_MASK | ACE_Event_Handler::DONT_CALL); // Deactivate the queue while we try to get reconnected. this->msg_queue ()->deactivate (); // Will call handle_close. return -1; } return 0; } // Initialize the threaded Consumer_Handler object and spawn a new // thread. int Thr_Consumer_Handler::open (void *) { // Turn off non-blocking I/O. if (this->peer ().disable (ACE_NONBLOCK) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "disable"), -1); // Incorrect info fixed. // Call back to the to complete our initialization. else if (this->event_channel_->complete_connection_connection (this) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "complete_connection_connection"), -1); // Register ourselves to receive input events (which indicate that // the Consumer has shut down unexpectedly). else if (ACE_Reactor::instance ()->register_handler (this, ACE_Event_Handler::READ_MASK) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "register_handler"), -1); // Reactivate message queue. If it was active then this is the // first time in and we need to spawn a thread, otherwise the queue // was inactive due to some problem and we've already got a thread. else if (this->msg_queue ()->activate () == ACE_Message_Queue::ACTIVATED) { ACE_DEBUG ((LM_DEBUG, "(%t) spawning new thread\n")); // Become an active object by spawning a new thread to transmit // events to Consumers. return this->activate (THR_NEW_LWP | THR_DETACHED); } else { ACE_DEBUG ((LM_DEBUG, "(%t) reusing existing thread\n")); return 0; } } // Queue up an event for transmission (must not block since // Supplier_Handlers may be single-threaded). int Thr_Consumer_Handler::put (ACE_Message_Block *mb, ACE_Time_Value *) { // Perform non-blocking enqueue, i.e., if is full // *don't* block! return this->msg_queue ()->enqueue_tail (mb, (ACE_Time_Value *) &ACE_Time_Value::zero); } // Transmit events to the peer. Note the simplification resulting // from the use of threads, compared with the Reactive solution. int Thr_Consumer_Handler::svc () { for (in_thread_ = 1;;) { ACE_DEBUG ((LM_DEBUG, "(%t) Thr_Consumer_Handler's handle = %d\n", this->peer ().get_handle ())); // Since this method runs in its own thread it is OK to block on // output. for (ACE_Message_Block *mb = 0; this->msg_queue ()->dequeue_head (mb) != -1; ) if (this->send (mb) == -1) ACE_ERROR ((LM_ERROR, "(%t) %p\n", "send failed")); ACE_ASSERT (errno == ESHUTDOWN); ACE_DEBUG ((LM_DEBUG, "(%t) shutting down threaded Consumer_Handler %d on handle %d\n", this->connection_id (), this->get_handle ())); this->peer ().close (); // Re-establish the connection, using exponential backoff. for (this->timeout (1); // Default is to reconnect synchronously. this->event_channel_->initiate_connection_connection (this, 1) == -1; // Second parameter '1' means using sync mode directly, // don't care Options::blocking_semantics(). If don't do // so, async mode will be used to connect which won't // satisfy original design. ) { ACE_Time_Value tv (this->timeout ()); ACE_ERROR ((LM_ERROR, "(%t) reattempting connection, sec = %d\n", tv.sec ())); ACE_OS::sleep (tv); } } ACE_NOTREACHED (return 0;) } Thr_Supplier_Handler::Thr_Supplier_Handler (const Connection_Config_Info &pci) : Supplier_Handler (pci) { // It is not in thread svc() now. in_thread_ = 0; } // Overriding handle_close() method. If in thread svc(), no need to // process handle_close() when call peer().close(), because the // connection is blocked now. int Thr_Supplier_Handler::handle_close (ACE_HANDLE h, ACE_Reactor_Mask m) { if (in_thread_) return 0; else return Supplier_Handler::handle_close (h, m); } int Thr_Supplier_Handler::open (void *) { // Turn off non-blocking I/O. if (this->peer ().disable (ACE_NONBLOCK) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "disable"), -1); // Incorrect info fixed. // Call back to the to complete our initialization. else if (this->event_channel_->complete_connection_connection (this) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "complete_connection_connection"), -1); // Reactivate message queue. If it was active then this is the // first time in and we need to spawn a thread, otherwise the queue // was inactive due to some problem and we've already got a thread. else if (this->msg_queue ()->activate () == ACE_Message_Queue::ACTIVATED) { ACE_DEBUG ((LM_DEBUG, "(%t) spawning new thread\n")); // Become an active object by spawning a new thread to transmit // events to peers. return this->activate (THR_NEW_LWP | THR_DETACHED); } else { ACE_DEBUG ((LM_DEBUG, "(%t) reusing existing thread\n")); return 0; } } // Receive events from a Peer in a separate thread (note reuse of // existing code!). int Thr_Supplier_Handler::svc () { for (in_thread_ = 1;;) { ACE_DEBUG ((LM_DEBUG, "(%t) Thr_Supplier_Handler's handle = %d\n", this->peer ().get_handle ())); // Since this method runs in its own thread and processes events // for one connection it is OK to call down to the // method, which blocks on // input. while (this->Supplier_Handler::handle_input () != -1) continue; ACE_DEBUG ((LM_DEBUG, "(%t) shutting down threaded Supplier_Handler %d on handle %d\n", this->connection_id (), this->get_handle ())); this->peer ().close (); // Deactivate the queue while we try to get reconnected. this->msg_queue ()->deactivate (); // Re-establish the connection, using expoential backoff. for (this->timeout (1); // Default is to reconnect synchronously. this->event_channel_->initiate_connection_connection (this, 1) == -1; // Second parameter '1' means using sync mode directly, // don't care Options::blocking_semantics(). If don't do // so, async mode will be used to connect which won't // satisfy original design. ) { ACE_Time_Value tv (this->timeout ()); ACE_ERROR ((LM_ERROR, "(%t) reattempting connection, sec = %d\n", tv.sec ())); ACE_OS::sleep (tv); } } ACE_NOTREACHED(return 0); } ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/Gateway.h0000644000175000017500000000111215027201773020701 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Gateway.h * * Since the Gateway is an , this file defines * the entry point into the Service Configurator framework. * * @author Doug Schmidt */ //============================================================================= #ifndef ACE_GATEWAY #define ACE_GATEWAY #include "ace/svc_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ ACE_SVC_FACTORY_DECLARE (Gateway) #endif /* ACE_GATEWAY */ ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/gatewayd.cpp0000644000175000017500000000323315027201773021446 0ustar sudipsudip //============================================================================= /** * @file gatewayd.cpp * * Driver for the gateway daemon (gatewayd). Note that this is * completely generic code due to the Service Configurator * framework! * * @author Douglas C. Schmidt */ //============================================================================= #include "ace/OS_NS_unistd.h" #include "ace/Service_Config.h" #include "ace/Service_Object.h" #include "ace/Log_Msg.h" #include "ace/Reactor.h" #include "Gateway.h" int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { if (ACE_OS::access (ACE_DEFAULT_SVC_CONF, F_OK) != 0) { // Use static linking. ACE_Service_Object_Ptr sp = ACE_SVC_INVOKE (Gateway); if (sp->init (argc - 1, argv + 1) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("init")), 1); // Run forever, performing the configured services until we // are shut down by a SIGINT/SIGQUIT signal. ACE_Reactor::instance ()->run_reactor_event_loop (); // Destructor of automagically call // . } else { if (ACE_Service_Config::open (argc, argv) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), 1); else // Use dynamic linking. // Run forever, performing the configured services until we are // shut down by a signal (e.g., SIGINT or SIGQUIT). ACE_Reactor::instance ()->run_reactor_event_loop (); } return 0; } ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/Consumer_Dispatch_Set.h0000644000175000017500000000124415027201773023533 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Consumer_Dispatch_Set.h * * @author Doug Schmidt */ //============================================================================= #ifndef CONSUMER_DISPATCH_SET #define CONSUMER_DISPATCH_SET #include "ace/Containers.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ // Forward reference. class Connection_Handler; typedef ACE_Unbounded_Set Consumer_Dispatch_Set; typedef ACE_Unbounded_Set_Iterator Consumer_Dispatch_Set_Iterator; #endif /* CONSUMER_DISPATCH_SET */ ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/connection_config0000644000175000017500000000522415027201773022546 0ustar sudipsudip# Configuration file that the gatewayd process uses to determine # connection information about proxies. # # The following provides an explanation for the fields in this file, # and how they relate to fields in the corresponding "consumer_config" # file. # # 1. Connection ID -- Each Connection Handler is given a unique ID # that is used in the "consumer_config" file to specify to which # Consumers the Event Channel will forward incoming events from # Suppliers using that connection. The Connection ID field is the # "key" that is used to match up connections in this file with the # Consumer subscription requests in the "consumer_config" file. # The connection ids should start at 1 and monotonically increase # by increments of 1. This makes it possible for the Gateway to # properly allocate connection ids for Peers that connect to it. # # 2. Host -- The host name where the Supplier/Consumer peerd # process is running. # # 3. Remote Port -- The port number where the remote # Supplier/Consumer peerd process is listening on. # If this is a '*' character it is an indication to the # Gateway to use the "default value," e.g., which can be provided # on the command-line, etc. # # 4. Handler Role -- i.e., Consumer ('C') or Supplier ('S') # # 5. Max Retry Timeout -- The maximum amount of time that we'll # wait between retry attempts (these start at 1 second and # double until they reach the Max Retry Timeout). # If this is a '*' character it is an indication to the # Gateway to use the "default value," e.g., which can be provided # on the command-line, etc. # # 6. Local Port -- The port number that we want to use for # our local Proxy connection. If this is the value 0 or the '*' # character, then we'll let the socket implementation pick this # value for us. # # 7. Priority -- Each Consumer/Supplier can be given a priority # that will determine its importance relative to other # Consumers/Suppliers (this feature isn't implemented yet). # # Connection Host Remote Handler Max Retry Local Priority # ID Port Role Timeout Port # ---------- -------- ------ ------ ---------- ----- -------- 1 localhost * S * * 1 2 localhost * C * * 1 # 3 mambo.cs * C * * 1 # 4 lambada.cs * C * * 1 # 5 lambada.cs * C * * 1 # 6 tango.cs * C * * 1 # 7 tango.cs * S * * 1 # 8 tango.cs * C * * 1 ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/Connection_Handler_Connector.cpp0000644000175000017500000000367015027201773025414 0ustar sudipsudip#include "Connection_Handler_Connector.h" #include "ace/os_include/os_netdb.h" Connection_Handler_Connector::Connection_Handler_Connector () { } // Initiate (or reinitiate) a connection to the Connection_Handler. int Connection_Handler_Connector::initiate_connection (Connection_Handler *connection_handler, ACE_Synch_Options &synch_options) { ACE_TCHAR addr_buf[MAXHOSTNAMELEN]; // Mark ourselves as idle so that the various iterators will ignore // us until we are reconnected. connection_handler->state (Connection_Handler::IDLE); // We check the remote addr second so that it remains in the // addr_buf. if (connection_handler->local_addr ().addr_to_string (addr_buf, sizeof addr_buf) == -1 || connection_handler->remote_addr ().addr_to_string (addr_buf, sizeof addr_buf) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("can't obtain peer's address")), -1); // Try to connect to the Peer. if (this->connect (connection_handler, connection_handler->remote_addr (), synch_options, connection_handler->local_addr ()) == -1) { if (errno != EWOULDBLOCK) { connection_handler->state (Connection_Handler::FAILED); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) %p on address %s\n"), ACE_TEXT ("connect"), addr_buf)); return -1; } else { connection_handler->state (Connection_Handler::CONNECTING); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) in the process of connecting to %s\n"), addr_buf)); } } else { connection_handler->state (Connection_Handler::ESTABLISHED); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) connected to %s on %d\n"), addr_buf, connection_handler->get_handle ())); } return 0; } ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/Options.cpp0000644000175000017500000001775615027201773021313 0ustar sudipsudip#define ACE_BUILD_SVC_DLL #include "Event.h" #include "Options.h" #include "ace/Get_Opt.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_strings.h" #include "ace/os_include/os_fcntl.h" // Static initialization. Options *Options::instance_ = 0; // Let's have a usage prompt. void Options::print_usage () { ACE_DEBUG ((LM_INFO, "gatewayd [-a {C|S}:acceptor-port] [-c {C|S}:connector-port]" " [-C consumer_config_file] [-P connection_config_filename]" " [-q socket_queue_size] [-t OUTPUT_MT|INPUT_MT] [-w time_out]" " [-b] [-d] [-v] [-T]\n" "" "\t-a Become an Acceptor\n" "\t-b Use blocking connection establishment\n" "\t-c Become a Connector\n" "\t-d debugging\n" "\t-q Use a different socket queue size\n" "\t-t Use a different threading strategy\n" "\t-v Verbose mode\n" "\t-w Time performance for a designated amount of time\n" "\t-C Use a different proxy config filename\n" "\t-P Use a different consumer config filename\n" "\t-T Tracing\n" )); } Options * Options::instance () { if (Options::instance_ == 0) ACE_NEW_RETURN (Options::instance_, Options, 0); return Options::instance_; } Options::Options () : locking_strategy_ (0), performance_window_ (0), blocking_semantics_ (ACE_NONBLOCK), socket_queue_size_ (0), threading_strategy_ (REACTIVE), options_ (0), supplier_acceptor_port_ (DEFAULT_GATEWAY_SUPPLIER_PORT), consumer_acceptor_port_ (DEFAULT_GATEWAY_CONSUMER_PORT), supplier_connector_port_ (DEFAULT_PEER_SUPPLIER_PORT), consumer_connector_port_ (DEFAULT_PEER_CONSUMER_PORT), max_timeout_ (MAX_TIMEOUT), max_queue_size_ (MAX_QUEUE_SIZE), connection_id_ (1) { ACE_OS::strcpy (this->connection_config_file_, ACE_TEXT("connection_config")); ACE_OS::strcpy (this->consumer_config_file_, ACE_TEXT("consumer_config")); } int Options::enabled (int option) const { return ACE_BIT_ENABLED (this->options_, option); } Options::~Options () { delete this->locking_strategy_; } ACE_Lock_Adapter * Options::locking_strategy () const { return this->locking_strategy_; } void Options::locking_strategy (ACE_Lock_Adapter *ls) { this->locking_strategy_ = ls; } long Options::performance_window () const { return this->performance_window_; } CONNECTION_ID & Options::connection_id () { return this->connection_id_; } long Options::max_timeout () const { return this->max_timeout_; } int Options::blocking_semantics () const { return this->blocking_semantics_; } int Options::socket_queue_size () const { return this->socket_queue_size_; } u_long Options::threading_strategy () const { return this->threading_strategy_; } const ACE_TCHAR * Options::connection_config_file () const { return this->connection_config_file_; } const ACE_TCHAR * Options::consumer_config_file () const { return this->consumer_config_file_; } u_short Options::consumer_acceptor_port () const { return this->consumer_acceptor_port_; } u_short Options::supplier_acceptor_port () const { return this->supplier_acceptor_port_; } u_short Options::consumer_connector_port () const { return this->consumer_connector_port_; } long Options::max_queue_size () const { return this->max_queue_size_; } u_short Options::supplier_connector_port () const { return this->supplier_connector_port_; } // Parse the "command-line" arguments and set the corresponding flags. int Options::parse_args (int argc, ACE_TCHAR *argv[]) { // Assign defaults. ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("a:bC:c:dm:P:p:q:r:t:vw:"), 0); for (int c; (c = get_opt ()) != EOF; ) { switch (c) { case 'a': { // Become an Acceptor. for (ACE_TCHAR *flag = ACE_OS::strtok (get_opt.opt_arg (), ACE_TEXT("|")); flag != 0; flag = ACE_OS::strtok (0, ACE_TEXT("|"))) if (ACE_OS::strncasecmp (flag, ACE_TEXT("C"), 1) == 0) { ACE_SET_BITS (this->options_, Options::CONSUMER_ACCEPTOR); if (ACE_OS::strlen (flag) > 1) // Set the Consumer Acceptor port number. this->consumer_acceptor_port_ = ACE_OS::atoi (flag + 2); } else if (ACE_OS::strncasecmp (flag, ACE_TEXT("S"), 1) == 0) { ACE_SET_BITS (this->options_, Options::SUPPLIER_ACCEPTOR); if (ACE_OS::strlen (flag) > 1) // Set the Supplier Acceptor port number. this->supplier_acceptor_port_ = ACE_OS::atoi (flag + 2); } } break; /* NOTREACHED */ case 'b': // Use blocking connection establishment. this->blocking_semantics_ = 1; break; case 'C': // Use a different proxy config filename. ACE_OS::strncpy (this->consumer_config_file_, get_opt.opt_arg (), sizeof this->consumer_config_file_ / sizeof (ACE_TCHAR)); break; case 'c': { // Become a Connector. for (ACE_TCHAR *flag = ACE_OS::strtok (get_opt.opt_arg (), ACE_TEXT("|")); flag != 0; flag = ACE_OS::strtok (0, ACE_TEXT("|"))) if (ACE_OS::strncasecmp (flag, ACE_TEXT("C"), 1) == 0) { ACE_SET_BITS (this->options_, Options::CONSUMER_CONNECTOR); if (ACE_OS::strlen (flag) > 1) // Set the Consumer Connector port number. this->consumer_connector_port_ = ACE_OS::atoi (flag + 2); } else if (ACE_OS::strncasecmp (flag, ACE_TEXT("S"), 1) == 0) { ACE_SET_BITS (this->options_, Options::SUPPLIER_CONNECTOR); if (ACE_OS::strlen (flag) > 1) // Set the Supplier Connector port number. this->supplier_connector_port_ = ACE_OS::atoi (flag + 2); } } break; /* NOTREACHED */ case 'd': // We are debugging. ACE_SET_BITS (this->options_, Options::DEBUGGING); break; case 'P': // Use a different connection config filename. ACE_OS::strncpy (this->connection_config_file_, get_opt.opt_arg (), sizeof this->connection_config_file_); break; case 'q': // Use a different socket queue size. this->socket_queue_size_ = ACE_OS::atoi (get_opt.opt_arg ()); break; case 't': // Use a different threading strategy. { for (ACE_TCHAR *flag = ACE_OS::strtok (get_opt.opt_arg (), ACE_TEXT("|")); flag != 0; flag = ACE_OS::strtok (0, ACE_TEXT("|"))) if (ACE_OS::strcmp (flag, ACE_TEXT("OUTPUT_MT")) == 0) ACE_SET_BITS (this->threading_strategy_, Options::OUTPUT_MT); else if (ACE_OS::strcmp (flag, ACE_TEXT("INPUT_MT")) == 0) ACE_SET_BITS (this->threading_strategy_, Options::INPUT_MT); break; } case 'v': // Verbose mode. ACE_SET_BITS (this->options_, Options::VERBOSE); break; case 'w': // Time performance for a designated amount of time. this->performance_window_ = ACE_OS::atoi (get_opt.opt_arg ()); // Use blocking connection semantics so that we get accurate // timings (since all connections start at once). this->blocking_semantics_ = 0; break; default: this->print_usage(); // It's nice to have a usage prompt. break; } } return 0; } ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/Options.h0000644000175000017500000001306415027201773020744 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Options.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef OPTIONS_H #define OPTIONS_H #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/svc_export.h" #include "ace/Thread_Mutex.h" #include "ace/Lock_Adapter_T.h" #include "ace/Synch_Traits.h" /** * @class Options * * @brief Singleton that consolidates all Options for a gatewayd. */ class ACE_Svc_Export Options { public: // = Options that can be enabled/disabled. enum { // = The types of threading strategies. REACTIVE = 0, OUTPUT_MT = 1, INPUT_MT = 2, VERBOSE = 01, DEBUGGING = 02, SUPPLIER_ACCEPTOR = 04, CONSUMER_ACCEPTOR = 010, SUPPLIER_CONNECTOR = 020, CONSUMER_CONNECTOR = 040 }; /// Return Singleton. static Options *instance (); /// Termination. ~Options (); /// Parse the arguments and set the options. int parse_args (int argc, ACE_TCHAR *argv[]); /** * Print the gateway supported parameters. * = Accessor methods. * Determine if an option is enabled. */ void print_usage(); int enabled (int option) const; /** * Gets the locking strategy used for serializing access to the * reference count in . If it's 0, then there's * no locking strategy and we're using a REACTIVE concurrency * strategy. */ ACE_Lock_Adapter *locking_strategy () const; /// Set the locking strategy used for serializing access to the /// reference count in . void locking_strategy (ACE_Lock_Adapter *); /// Number of seconds after connection establishment to report /// throughput. long performance_window () const; /// 0 == blocking connects, ACE_NONBLOCK == non-blocking connects. int blocking_semantics () const; /// Size of the socket queue (0 means "use default"). int socket_queue_size () const; /// i.e., REACTIVE, OUTPUT_MT, and/or INPUT_MT. u_long threading_strategy () const; /** * Our acceptor port number, i.e., the one that we passively listen * on for connections to arrive from a gatewayd and create a * Supplier. */ u_short supplier_acceptor_port () const; /** * Our acceptor port number, i.e., the one that we passively listen * on for connections to arrive from a gatewayd and create a * Consumer. */ u_short consumer_acceptor_port () const; /// The connector port number, i.e., the one that we use to actively /// establish connections with a gatewayd and create a Supplier. u_short supplier_connector_port () const; /// The connector port number, i.e., the one that we use to actively /// establish connections with a gatewayd and create a Consumer. u_short consumer_connector_port () const; /// Name of the connection configuration file. const ACE_TCHAR *connection_config_file () const; /// Name of the consumer map configuration file. const ACE_TCHAR *consumer_config_file () const; /// The maximum retry timeout delay. long max_timeout () const; /// The maximum size of the queue. long max_queue_size () const; /// Returns a reference to the next available connection id; CONNECTION_ID &connection_id (); private: enum { MAX_QUEUE_SIZE = 1024 * 1024 * 16, // We'll allow up to 16 megabytes to be queued per-output proxy. MAX_TIMEOUT = 32 // The maximum timeout for trying to re-establish connections. }; /// Initialization. Options (); /// Options Singleton instance. static Options *instance_; /** * Points to the locking strategy used for serializing access to the * reference count in . If it's 0, then there's * no locking strategy and we're using a REACTIVE concurrency * strategy. */ ACE_Lock_Adapter *locking_strategy_; /// Number of seconds after connection establishment to report /// throughput. long performance_window_; /// 0 == blocking connects, ACE_NONBLOCK == non-blocking connects. int blocking_semantics_; /// Size of the socket queue (0 means "use default"). int socket_queue_size_; /// i.e., REACTIVE, OUTPUT_MT, and/or INPUT_MT. u_long threading_strategy_; /// Flag to indicate if we want verbose diagnostics. u_long options_; /** * The acceptor port number, i.e., the one that we passively listen * on for connections to arrive from a gatewayd and create a * Supplier. */ u_short supplier_acceptor_port_; /** * The acceptor port number, i.e., the one that we passively listen * on for connections to arrive from a gatewayd and create a * Consumer. */ u_short consumer_acceptor_port_; /// The connector port number, i.e., the one that we use to actively /// establish connections with a gatewayd and create a Supplier. u_short supplier_connector_port_; /// The connector port number, i.e., the one that we use to actively /// establish connections with a gatewayd and create a Consumer. u_short consumer_connector_port_; /// The maximum retry timeout delay. long max_timeout_; /// The maximum size of the queue. long max_queue_size_; /// The next available connection id. CONNECTION_ID connection_id_; /// Name of the connection configuration file. ACE_TCHAR connection_config_file_[MAXPATHLEN + 1]; /// Name of the consumer map configuration file. ACE_TCHAR consumer_config_file_[MAXPATHLEN + 1]; }; #endif /* OPTIONS_H */ ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/Connection_Handler_Acceptor.cpp0000644000175000017500000000307215027201773025216 0ustar sudipsudip#define ACE_BUILD_SVC_DLL #include "Event_Channel.h" #include "Connection_Handler_Acceptor.h" int Connection_Handler_Acceptor::make_svc_handler (Connection_Handler *&ch) { ACE_ALLOCATOR_RETURN (ch, this->connection_handler_factory_.make_connection_handler (this->connection_config_info_), -1); return 0; } int Connection_Handler_Acceptor::accept_svc_handler (Connection_Handler *ch) { if (this->inherited::accept_svc_handler (ch) == -1) return -1; else { ch->connection_id (Options::instance ()->connection_id ()); ACE_INET_Addr remote_addr; if (ch->peer ().get_remote_addr (remote_addr) == -1) return -1; // Set the remote address of our connected Peer. ch->remote_addr (remote_addr); // Set the Event_Channel pointer. ch->event_channel (&this->event_channel_); // Increment the connection ID by one. Options::instance ()->connection_id ()++; return 0; } } Connection_Handler_Acceptor::Connection_Handler_Acceptor (Event_Channel &ec, char connection_role) : event_channel_ (ec) { this->connection_config_info_.connection_id_ = 0; this->connection_config_info_.host_[0] = '\0'; this->connection_config_info_.remote_port_ = 0; this->connection_config_info_.connection_role_ = connection_role; this->connection_config_info_.max_retry_timeout_ = Options::instance ()->max_timeout (); this->connection_config_info_.local_port_ = 0; this->connection_config_info_.priority_ = 1; } ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/Event_Channel.h0000644000175000017500000001031615027201773022017 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Event_Channel.h * * @author Doug Schmidt */ //============================================================================= #ifndef ACE_EVENT_CHANNEL #define ACE_EVENT_CHANNEL #include "Connection_Handler_Connector.h" #include "Connection_Handler_Acceptor.h" #include "Consumer_Dispatch_Set.h" #include "Event_Forwarding_Discriminator.h" #include "ace/svc_export.h" typedef ACE_Null_Mutex MAP_MUTEX; /** * @class Event_Channel * * @brief Define a generic Event_Channel. * * The inspiration for this class is derived from the CORBA COS * Event Channel, though the design is simplified. * We inherit from so that we can be * registered with an to handle timeouts. */ class ACE_Svc_Export Event_Channel : public ACE_Event_Handler { public: Event_Channel (); ~Event_Channel (); /// Open the channel. virtual int open (void * = 0); /// Close down the Channel. virtual int close (u_long = 0); // = Proxy management methods. /** * Initiate the connection of the to its peer. * Second paratemer is used for thread connection-handler which will * block the connecting procedure directly, need not care * Options::blocking_semantics(). */ int initiate_connection_connection (Connection_Handler *, int sync_directly = 0); /// Complete the initialization of the once it's /// connected to its Peer. int complete_connection_connection (Connection_Handler *); /// Reinitiate a connection asynchronously when the Peer fails. /// Cancel a asynchronous connection. int reinitiate_connection_connection (Connection_Handler *); int cancel_connection_connection (Connection_Handler *); /// Bind the to the . int bind_proxy (Connection_Handler *); /// Locate the with . int find_proxy (ACE_INT32 connection_id, Connection_Handler *&); /// Subscribe the to receive events that /// match . int subscribe (const Event_Key &event_addr, Consumer_Dispatch_Set *cds); // = Event processing entry point. /// Pass to the Event Channel so it can forward it to Consumers. virtual int put (ACE_Message_Block *mb, ACE_Time_Value * = 0); /// Actively initiate connections to the Peers. void initiate_connector (); /// Passively initiate the s for Consumer and /// Suppliers. int initiate_acceptors (); private: /// Parse the command-line arguments. int parse_args (int argc, ACE_TCHAR *argv[]); // = Methods for handling events. /// Forwards the to Consumer that have registered to receive /// it, based on addressing information in the . void routing_event (Event_Key *event_key, ACE_Message_Block *data); /// Add a Consumer subscription. void subscription_event (ACE_Message_Block *data); /// Perform timer-based performance profiling. int compute_performance_statistics (); /// Periodically callback to perform timer-based performance /// profiling. virtual int handle_timeout (const ACE_Time_Value &, const void *arg); /// Used to establish the connections actively. Connection_Handler_Connector connector_; /// Used to establish connections passively and create Suppliers. Connection_Handler_Acceptor supplier_acceptor_; /// Used to establish connections passively and create Consumers. Connection_Handler_Acceptor consumer_acceptor_; // = Make life easier by defining typedefs. typedef ACE_Map_Manager CONNECTION_MAP; typedef ACE_Map_Iterator CONNECTION_MAP_ITERATOR; typedef ACE_Map_Entry CONNECTION_MAP_ENTRY; /// Table that maps s to *'s. CONNECTION_MAP connection_map_; /// Map that associates an event to a set of *'s. Event_Forwarding_Discriminator efd_; }; #endif /* ACE_EVENT_CHANNEL */ ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/Event_Forwarding_Discriminator.cpp0000644000175000017500000000241715027201773025776 0ustar sudipsudip#if !defined (_CONSUMER_MAP_C) #define _CONSUMER_MAP_C #include "Event_Forwarding_Discriminator.h" // Bind the Event_Key to the INT_ID. int Event_Forwarding_Discriminator::bind (Event_Key event_addr, Consumer_Dispatch_Set *cds) { return this->map_.bind (event_addr, cds); } // Find the Consumer_Dispatch_Set corresponding to the Event_Key. int Event_Forwarding_Discriminator::find (Event_Key event_addr, Consumer_Dispatch_Set *&cds) { return this->map_.find (event_addr, cds); } // Unbind (remove) the Event_Key from the map. int Event_Forwarding_Discriminator::unbind (Event_Key event_addr) { Consumer_Dispatch_Set *cds = 0; int result = this->map_.unbind (event_addr, cds); delete cds; return result; } Event_Forwarding_Discriminator_Iterator::Event_Forwarding_Discriminator_Iterator (Event_Forwarding_Discriminator &rt) : map_iter_ (rt.map_) { } int Event_Forwarding_Discriminator_Iterator::next (Consumer_Dispatch_Set *&cds) { ACE_Map_Entry *temp; if (this->map_iter_.next (temp) == 0) return 0; else { cds = temp->int_id_; return 1; } } int Event_Forwarding_Discriminator_Iterator::advance () { return this->map_iter_.advance (); } #endif /* _CONSUMER_MAP_C */ ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/Event.h0000644000175000017500000001325215027201773020371 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Event.h * * @author Doug Schmidt */ //============================================================================= #ifndef EVENT_H #define EVENT_H #include "ace/os_include/arpa/os_inet.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Basic_Types.h" // = The following #defines should really be in a separate include // file that is shared with the ../Peer/ directory. For now, we'll // keep them here to simplify the sharing between the two directories. // BTW, this is also the reason why all the methods are inlined... // Used by Peers to create Consumers in a Gateway. #if !defined (DEFAULT_GATEWAY_CONSUMER_PORT) #define DEFAULT_GATEWAY_CONSUMER_PORT 10009 #endif /* DEFAULT_GATEWAY_CONSUMER_PORT */ // Used by Peers create Suppliers in a Gateway. #if !defined (DEFAULT_GATEWAY_SUPPLIER_PORT) #define DEFAULT_GATEWAY_SUPPLIER_PORT 10010 #endif /* DEFAULT_GATEWAY_SUPPLIER_PORT */ // Used by a Gateway to create Consumers in a Peer. #if !defined (DEFAULT_PEER_CONSUMER_PORT) #define DEFAULT_PEER_CONSUMER_PORT 10011 #endif /* DEFAULT_PEER_CONSUMER_PORT */ // Used by a Gateway to create Suppliers in a Peer. #if !defined (DEFAULT_PEER_SUPPLIER_PORT) #define DEFAULT_PEER_SUPPLIER_PORT 10012 #endif /* DEFAULT_PEER_SUPPLIER_PORT */ #if !defined (MAX_CONSUMERS) #define MAX_CONSUMERS 1000 #endif /* MAX_CONSUMERS */ // This is the unique supplier identifier that denotes a particular // in the Gateway. typedef ACE_INT32 CONNECTION_ID; enum { // = These are the types of events generated by the and // handled by the . ROUTING_EVENT = 0, // A normal event, which is forwarded to the . SUBSCRIPTION_EVENT = 1 // A subscription to managed by the . }; /** * @class Event_Key * * @brief Address used to identify the source/destination of an event. * * This is really a "processing descriptor" that is used to * decouple the processing, filtering, and forwarding logic of * the Event Channel from the format of the data. The * and fields are copied from the * class below. */ class Event_Key { public: Event_Key (CONNECTION_ID cid = -1, ACE_INT32 type = 0, ACE_INT32 priority = 0) : connection_id_ (cid), type_ (type), priority_ (priority) { } bool operator== (const Event_Key &event_addr) const { return this->connection_id_ == event_addr.connection_id_ && this->type_ == event_addr.type_; } /// Unique connection identifier that denotes a particular /// Connection_Handler. CONNECTION_ID connection_id_; /// Event type, e.g., or . ACE_INT32 type_; /// Event priority. ACE_INT32 priority_; }; /** * @class Event_Header * * @brief Fixed sized header. * * This is designed to have a sizeof (16) to avoid alignment * problems on most platforms. */ class Event_Header { public: enum { INVALID_ID = -1 // No peer can validly use this number. }; Event_Header (ACE_INT32 len, CONNECTION_ID connection_id, ACE_INT32 type, ACE_INT32 priority) : len_ (len), connection_id_ (connection_id), type_ (type), priority_ (priority) { } void decode () { this->len_ = ntohl (this->len_); this->connection_id_ = ntohl (this->connection_id_); this->type_ = ntohl (this->type_); this->priority_ = ntohl (this->priority_); } // Decode from network byte order to host byte order. void encode () { this->len_ = htonl (this->len_); this->connection_id_ = htonl (this->connection_id_); this->type_ = htonl (this->type_); this->priority_ = htonl (this->priority_); } // Encode from host byte order to network byte order. /// Length of the data_ payload, in bytes. ACE_INT32 len_; /// Unique connection identifier that denotes a particular /// Connection_Handler. CONNECTION_ID connection_id_; /// Event type, e.g., or . ACE_INT32 type_; /// Event priority. ACE_INT32 priority_; }; /** * @class Event * * @brief Variable-sized event (data_ may be variable-sized between * 0 and MAX_PAYLOAD_SIZE). */ class Event { public: /// The maximum size of an Event. enum { MAX_PAYLOAD_SIZE = 1024 }; Event () : header_ (0, -1, 0, 0) {}; /// Event header. Event_Header header_; /// Event data. char data_[MAX_PAYLOAD_SIZE]; }; /** * @class Subscription * * @brief Allows Consumers to subscribe to be routed information * arriving from a particular Supplier connection id. */ class Subscription { public: void decode () { this->connection_id_ = ntohl (this->connection_id_); for (ACE_INT32 i = 0; i < this->total_consumers_; i++) this->consumers_[i] = ntohl (this->consumers_[i]); this->total_consumers_ = ntohl (this->total_consumers_); } // Decode from network byte order to host byte order. void encode () { this->connection_id_ = htonl (this->connection_id_); for (ACE_INT32 i = 0; i < this->total_consumers_; i++) this->consumers_[i] = htonl (this->consumers_[i]); this->total_consumers_ = htonl (this->total_consumers_); } // Encode from host byte order to network byte order. /// Connection id. ACE_INT32 connection_id_; /// Connection ids for consumers that will be routed information /// containing this ACE_INT32 consumers_[MAX_CONSUMERS]; /// Total number of these consumers. ACE_INT32 total_consumers_; }; #endif /* EVENT_H */ ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/Concrete_Connection_Handlers.h0000644000175000017500000001067315027201773025055 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Concrete_Connection_Handlers.h * * These are all the subclasses of Connection_Handler that define the * appropriate threaded/reactive Consumer/Supplier behavior. * * @author Doug Schmidt */ //============================================================================= #ifndef CONCRETE_CONNECTION_HANDLER #define CONCRETE_CONNECTION_HANDLER #include "Connection_Handler.h" /** * @class Supplier_Handler * * @brief Handles reception of Events from Suppliers. * * Performs framing and error checking on Events. Intended to * run reactively, i.e., in one thread of control using a * Reactor for demuxing and dispatching. */ class Supplier_Handler : public Connection_Handler { public: Supplier_Handler (const Connection_Config_Info &); protected: // = All the following methods are upcalls, so they can be protected. /// Receive and process peer events. virtual int handle_input (ACE_HANDLE = ACE_INVALID_HANDLE); /// Receive an event from a Supplier. virtual int recv (ACE_Message_Block *&); /** * This delegates to the to do the actual * processing. Typically, it forwards the to its * appropriate Consumer. */ int process (ACE_Message_Block *event); /// Keep track of event fragment to handle non-blocking recv's from /// Suppliers. ACE_Message_Block *msg_frag_; }; /** * @class Consumer_Handler * * @brief Handles transmission of events to Consumers. * * Performs queueing and error checking. Intended to run * reactively, i.e., in one thread of control using a Reactor * for demuxing and dispatching. Also uses a Reactor to handle * flow controlled output connections. */ class Consumer_Handler : public Connection_Handler { public: Consumer_Handler (const Connection_Config_Info &); /// Send an event to a Consumer (may be queued if necessary). virtual int put (ACE_Message_Block *event, ACE_Time_Value * = 0); protected: /// Finish sending event when flow control conditions abate. virtual int handle_output (ACE_HANDLE); /// Perform a non-blocking put(). int nonblk_put (ACE_Message_Block *mb); /// Send an event to a Consumer. virtual ssize_t send (ACE_Message_Block *); /// Receive and process shutdowns from a Consumer. virtual int handle_input (ACE_HANDLE); }; /** * @class Thr_Consumer_Handler * * @brief Runs each in a separate thread. */ class Thr_Consumer_Handler : public Consumer_Handler { public: Thr_Consumer_Handler (const Connection_Config_Info &); /// Initialize the threaded Consumer_Handler object and spawn a new /// thread. virtual int open (void *); /// Send a message to a peer. virtual int put (ACE_Message_Block *, ACE_Time_Value * = 0); protected: /// Called when Peer shutdown unexpectedly. virtual int handle_input (ACE_HANDLE); /// Transmit peer messages. virtual int svc (); /** * When thread started, connection become blocked, so no need to use * handle_close to reinitiate the connection_handler, so should * override this function to justify if controlling is in thread or * not. If yes, handle_close do nothing, otherwise, it call parent * handle_close(). */ virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); private: /// If the controlling is in thread's svc() or not. int in_thread_; }; /** * @class Thr_Supplier_Handler * * @brief Runs each in a separate thread. */ class Thr_Supplier_Handler : public Supplier_Handler { public: Thr_Supplier_Handler (const Connection_Config_Info &pci); /// Initialize the object and spawn a new thread. virtual int open (void *); protected: /** * When thread started, connection become blocked, so no need to use * handle_close to reinitiate the connection_handler, so should * override this function to justify if controlling is in thread or * not. If yes, handle_close do nothing, otherwise, it call parent * handle_close(). */ virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); /// Transmit peer messages. virtual int svc (); private: /// If the controlling is in thread's svc() or not. int in_thread_; }; #endif /* CONCRETE_CONNECTION_HANDLER */ ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/consumer_config0000644000175000017500000000312215027201773022235 0ustar sudipsudip# Configuration file that the gatewayd process uses to determine which # Consumers will receive events from which Suppliers. For now, the # Gateway only allows Consumers to "subscribe" to receive events from # particular Suppliers. A more flexible implementation will allow # Consumers to subscribe to particular types of events, as well. # # The following provides an explanation for the fields in this file, # and how they relate to fields in the corresponding "connection_config" # file. # # 1. Connection ID -- Each Connection Handler is given a unique ID # that is used in the "consumer_config" file to specify to which # Consumers the Event Channel will forward incoming events from # Suppliers. The Connection ID field is the "key" that is used to # match up Consumer subscription requests in this file with # connections in the "connection_config" file. # # 2. Event Type -- Indicates the type of the event. Consumers # can use this to only subscribe to certain types of events. # This feature is currently not implemented. # # 3. Consumers -- Indicates which Consumers will receive events sent # from this Proxy/Supplier ID, i.e., Consumers can subscribe to # receive events from particular Suppliers. Note that more than # one Consumer can subscribe to the same Supplier event, i.e., # we support logical "multicast" (which is currently implemented # using multi-point unicast via TCP/IP). # # Connection Event Consumers # ID Type # ---------- ---- --------- 1 0 2 # 2 0 3,4 # 3 0 4 # 4 0 5 ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/File_Parser.h0000644000175000017500000000367315027201773021511 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file File_Parser.h * * @author Doug Schmidt */ //============================================================================= #ifndef _FILE_PARSER #define _FILE_PARSER #include "ace/Basic_Types.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ /** * @class FPRT * * @brief This class serves as a namespace for the . */ class FPRT { public: enum Return_Type { RT_EOLINE, RT_EOFILE, RT_SUCCESS, RT_COMMENT, RT_DEFAULT, RT_PARSE_ERROR }; }; /** * @class File_Parser * * @brief Class used to parse the configuration file for the * . */ template class File_Parser { public: /// Destructor. virtual ~File_Parser (); // = Open and Close the file specified int open (const ACE_TCHAR filename[]); int close (); virtual FPRT::Return_Type read_entry (ENTRY &entry, int &line_number) = 0; // Pure virtual hook that subclasses override and use the protected // methods to fill in the . protected: /// Read the next ASCII word. FPRT::Return_Type getword (char buf[]); /// Read the next integer. FPRT::Return_Type getint (ACE_INT32 &value); /** * Read the next "word," which is demarcated by s. * * @@ This function is inherently flawed since it doesn't take a * count of the size of ... */ FPRT::Return_Type readword (char buf[]); /// Returns true if is a delimiter, i.e., ' ', ',', or '\t'. int delimiter (char ch); /// Returns true if is the comment character, i.e., '#'. int comments (char ch); /// Skips to the remainder of a line, e.g., when we find a comment /// character. int skipline (); /// Pointer to the file we're reading. FILE *infile_; }; #include "File_Parser.cpp" #endif /* _FILE_PARSER */ ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/Connection_Handler.h0000644000175000017500000001042015027201773023036 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Connection_Handler.h * * @author Doug Schmidt */ //============================================================================= #ifndef _CONNECTION_HANDLER #define _CONNECTION_HANDLER #include "ace/Service_Config.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/SOCK_Connector.h" #include "ace/Svc_Handler.h" #include "Config_Files.h" #include "Options.h" #include "Event.h" // Forward declaration. class Event_Channel; /** * @class Connection_Handler * * @brief contains info about connection state and * addressing. * * The classes process events sent to the * Event Channel from Suppliers and forward them to Consumers. */ class Connection_Handler : public ACE_Svc_Handler { public: /// Default constructor (needed to make happy). Connection_Handler (); /// Real constructor. Connection_Handler (const Connection_Config_Info &); /// Initialize and activate a single-threaded /// (called by ). virtual int open (void * = 0); // = The current state of the Connection_Handler. enum State { IDLE = 1, // Prior to initialization. CONNECTING, // During connection establishment. ESTABLISHED, // Connection_Handler is established and active. DISCONNECTING, // Connection_Handler is in the process of connecting. FAILED // Connection_Handler has failed. }; // = Set/get the current state. void state (State); State state () const; // = Set/get remote INET addr. void remote_addr (ACE_INET_Addr &); const ACE_INET_Addr &remote_addr () const; // = Set/get local INET addr. void local_addr (ACE_INET_Addr &); const ACE_INET_Addr &local_addr () const; // = Set/get connection id. void connection_id (CONNECTION_ID); CONNECTION_ID connection_id () const; // = Set/get the current retry timeout delay. void timeout (long); long timeout (); // = Set/get the maximum retry timeout delay. void max_timeout (long); long max_timeout () const; // = Set/get proxy role (i.e., 'S' for Supplier and 'C' for Consumer // (necessary for error checking). void connection_role (char); char connection_role () const; // = Set/get the *. void event_channel (Event_Channel *); Event_Channel *event_channel () const; // = The total number of bytes sent/received on this proxy. /// Increment count by . /// Return the current byte count. void total_bytes (size_t bytes); size_t total_bytes () const; /// Perform timer-based Connection_Handler reconnection. virtual int handle_timeout (const ACE_Time_Value &, const void *arg); /// Perform Connection_Handler termination. virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); protected: /// Address of peer. ACE_INET_Addr remote_addr_; /// Address of us. ACE_INET_Addr local_addr_; /// The assigned connection ID of this entry. CONNECTION_ID connection_id_; /// The total number of bytes sent/received on this proxy. size_t total_bytes_; /// The current state of the proxy. State state_; /// Amount of time to wait between reconnection attempts. long timeout_; /// Maximum amount of time to wait between reconnection attempts. long max_timeout_; /// Indicates which role the proxy plays ('S' == Supplier and 'C' == /// Consumer). char connection_role_; /// Reference to the that we use to forward all /// the events from Consumers and Suppliers. Event_Channel *event_channel_; }; /** * @class Connection_Handler_Factory * * @brief Creates the appropriate type of . * * s can include , * , , or * ). */ class Connection_Handler_Factory { public: /// Make the appropriate type of , based on the /// parameter. Connection_Handler *make_connection_handler (const Connection_Config_Info &); }; #endif /* _CONNECTION_HANDLER */ ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/Connection_Handler.cpp0000644000175000017500000001447215027201773023404 0ustar sudipsudip#define ACE_BUILD_SVC_DLL #include "ace/OS_NS_string.h" #include "Event_Channel.h" #include "Concrete_Connection_Handlers.h" Event_Channel * Connection_Handler::event_channel () const { return this->event_channel_; } void Connection_Handler::event_channel (Event_Channel *ec) { this->event_channel_ = ec; } void Connection_Handler::connection_id (CONNECTION_ID id) { this->connection_id_ = id; } CONNECTION_ID Connection_Handler::connection_id () const { return this->connection_id_; } // The total number of bytes sent/received on this Proxy. size_t Connection_Handler::total_bytes () const { return this->total_bytes_; } void Connection_Handler::total_bytes (size_t bytes) { this->total_bytes_ += bytes; } Connection_Handler::Connection_Handler () { } Connection_Handler::Connection_Handler (const Connection_Config_Info &pci) : local_addr_ (pci.local_port_), connection_id_ (pci.connection_id_), total_bytes_ (0), state_ (Connection_Handler::IDLE), timeout_ (1), max_timeout_ (pci.max_retry_timeout_), event_channel_ (pci.event_channel_) { if (ACE_OS::strlen (pci.host_) > 0) this->remote_addr_.set (pci.remote_port_, pci.host_); else this->remote_addr_.set (pci.remote_port_, ACE_DEFAULT_SERVER_HOST); // Set the priority of the Proxy. this->priority (int (pci.priority_)); } // Set the connection_role. void Connection_Handler::connection_role (char d) { this->connection_role_ = d; } // Get the connection_role. char Connection_Handler::connection_role () const { return this->connection_role_; } // Sets the timeout delay. void Connection_Handler::timeout (long to) { if (to > this->max_timeout_) to = this->max_timeout_; this->timeout_ = to; } // Re-calculate the current retry timeout delay using exponential // backoff. Returns the original timeout (i.e., before the // re-calculation). long Connection_Handler::timeout () { long old_timeout = this->timeout_; this->timeout_ *= 2; if (this->timeout_ > this->max_timeout_) this->timeout_ = this->max_timeout_; return old_timeout; } // Sets the max timeout delay. void Connection_Handler::max_timeout (long mto) { this->max_timeout_ = mto; } // Gets the max timeout delay. long Connection_Handler::max_timeout () const { return this->max_timeout_; } // Restart connection asynchronously when timeout occurs. int Connection_Handler::handle_timeout (const ACE_Time_Value &, const void *) { ACE_DEBUG ((LM_DEBUG, "(%t) attempting to reconnect Connection_Handler %d with timeout = %d\n", this->connection_id (), this->timeout_)); // Delegate the re-connection attempt to the Event Channel. this->event_channel_->initiate_connection_connection (this); return 0; } // Handle shutdown of the Connection_Handler object. int Connection_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask) { ACE_DEBUG ((LM_DEBUG, "(%t) shutting down %s Connection_Handler %d on handle %d\n", this->connection_role () == 'C' ? "Consumer" : "Supplier", this->connection_id (), this->get_handle ())); // Restart the connection, if possible. return this->event_channel_->reinitiate_connection_connection (this); } // Set the state of the Proxy. void Connection_Handler::state (Connection_Handler::State s) { this->state_ = s; } // Return the current state of the Proxy. Connection_Handler::State Connection_Handler::state () const { return this->state_; } // Upcall from the or that delegates // control to our Connection_Handler. int Connection_Handler::open (void *) { ACE_DEBUG ((LM_DEBUG, "(%t) %s Connection_Handler's handle = %d\n", this->connection_role () == 'C' ? "Consumer" : "Supplier", this->peer ().get_handle ())); // Call back to the to complete our initialization. if (this->event_channel_->complete_connection_connection (this) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "complete_connection_connection"), -1); // Turn on non-blocking I/O. else if (this->peer ().enable (ACE_NONBLOCK) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "enable"), -1); // Register ourselves to receive input events. else if (ACE_Reactor::instance ()->register_handler (this, ACE_Event_Handler::READ_MASK) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "register_handler"), -1); else return 0; } const ACE_INET_Addr & Connection_Handler::remote_addr () const { return this->remote_addr_; } void Connection_Handler::remote_addr (ACE_INET_Addr &ra) { this->remote_addr_ = ra; } const ACE_INET_Addr & Connection_Handler::local_addr () const { return this->local_addr_; } void Connection_Handler::local_addr (ACE_INET_Addr &la) { this->local_addr_ = la; } // Make the appropriate type of (i.e., // , , , or // ). Connection_Handler * Connection_Handler_Factory::make_connection_handler (const Connection_Config_Info &pci) { Connection_Handler *connection_handler = 0; // The next few lines of code are dependent on whether we are making // a threaded/reactive Supplier_Handler/Consumer_Handler. if (pci.connection_role_ == 'C') // Configure a Consumer_Handler. { // Create a threaded Consumer_Handler. if (ACE_BIT_ENABLED (Options::instance ()->threading_strategy (), Options::OUTPUT_MT)) ACE_NEW_RETURN (connection_handler, Thr_Consumer_Handler (pci), 0); // Create a reactive Consumer_Handler. else ACE_NEW_RETURN (connection_handler, Consumer_Handler (pci), 0); } else // connection_role == 'S', so configure a Supplier_Handler. { // Create a threaded Supplier_Handler. if (ACE_BIT_ENABLED (Options::instance ()->threading_strategy (), Options::INPUT_MT)) ACE_NEW_RETURN (connection_handler, Thr_Supplier_Handler (pci), 0); // Create a reactive Supplier_Handler. else ACE_NEW_RETURN (connection_handler, Supplier_Handler (pci), 0); } return connection_handler; } ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/Connection_Handler_Connector.h0000644000175000017500000000206215027201773025053 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Connection_Handler_Connector.h * * @author Doug Schmidt */ //============================================================================= #ifndef _IO_HANDLER_CONNECTOR #define _IO_HANDLER_CONNECTOR #include "ace/Connector.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/SOCK_Connector.h" #include "Connection_Handler.h" /** * @class Connection_Handler_Connector * * @brief A concrete factory class that setups connections to peerds * and produces a new Connection_Handler object to do the dirty * work... */ class Connection_Handler_Connector : public ACE_Connector { public: Connection_Handler_Connector (); // Initiate (or reinitiate) a connection on the Connection_Handler. int initiate_connection (Connection_Handler *, ACE_Synch_Options & = ACE_Synch_Options::synch); }; #endif /* _IO_HANDLER_CONNECTOR */ ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/Gateway.cpp0000644000175000017500000002475015027201773021251 0ustar sudipsudip#define ACE_BUILD_SVC_DLL #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #include "ace/Service_Config.h" #include "ace/Signal.h" #include "ace/Truncate.h" #include "Config_Files.h" #include "Event_Channel.h" #include "Gateway.h" // Integrates the whole Gateway application. // // This implementation uses the as the basis // for the routing. class ACE_Svc_Export Gateway : public ACE_Service_Object { protected: // = Service configurator hooks. // Perform initialization. virtual int init (int argc, ACE_TCHAR *argv[]); // Perform termination when unlinked dynamically. virtual int fini (); // Return info about this service. virtual int info (ACE_TCHAR **, size_t) const; // = Configuration methods. // Parse the proxy configuration file. int parse_connection_config_file (); // Parse the consumer configuration file. int parse_consumer_config_file (); // = Lifecycle management methods. // Shut down the Gateway when input comes in from the controlling // console. int handle_input (ACE_HANDLE); // Shut down the Gateway when a signal arrives. int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); // The Event Channel routes events from Supplier(s) to Consumer(s) // using and objects. Event_Channel event_channel_; // Creates the appropriate type of . Connection_Handler_Factory connection_handler_factory_; }; int Gateway::handle_signal (int, siginfo_t *, ucontext_t *) { // Shut down the main event loop. ACE_Reactor::end_event_loop (); return 0; } int Gateway::handle_input (ACE_HANDLE h) { char buf[BUFSIZ]; // Consume the input... ACE_OS::read (h, buf, sizeof (buf)); // Shut us down. return this->handle_signal (ACE_Utils::truncate_cast ((intptr_t)h)); } int Gateway::init (int argc, ACE_TCHAR *argv[]) { // Parse the "command-line" arguments. Options::instance ()->parse_args (argc, argv); ACE_Sig_Set sig_set; sig_set.sig_add (SIGINT); sig_set.sig_add (SIGQUIT); // Register ourselves to receive signals so we can shut down // gracefully. if (ACE_Reactor::instance ()->register_handler (sig_set, this) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("register_handler")), -1); // Register this handler to receive events on stdin. We use this to // shutdown the Gateway gracefully. if (ACE_Event_Handler::register_stdin_handler (this, ACE_Reactor::instance (), ACE_Thread_Manager::instance ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("register_stdin_handler")), -1); // If this->performance_window_ > 0 start a timer. if (Options::instance ()->performance_window () > 0) { ACE_Time_Value const performance_time (Options::instance ()->performance_window ()); if (ACE_Reactor::instance ()->schedule_timer (&this->event_channel_, 0, performance_time) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("schedule_timer"))); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("starting timer for %d seconds...\n"), Options::instance ()->performance_window ())); } // Are we running as a connector? if (Options::instance ()->enabled (Options::CONSUMER_CONNECTOR | Options::SUPPLIER_CONNECTOR)) { // Parse the proxy configuration file. this->parse_connection_config_file (); // Parse the consumer config file and build the event forwarding // discriminator. this->parse_consumer_config_file (); } // Initialize the Event_Channel. return this->event_channel_.open (); } // This method is automatically called when the Gateway is shutdown. int Gateway::fini () { // Remove the handler that receive events on stdin. Otherwise, we // will crash on shutdown. ACE_Event_Handler::remove_stdin_handler (ACE_Reactor::instance (), ACE_Thread_Manager::instance ()); // Close down the event channel. this->event_channel_.close (); // Need to make sure we cleanup this Singleton. delete Options::instance (); return 0; } // Returns information on the currently active service. int Gateway::info (ACE_TCHAR **strp, size_t length) const { ACE_TCHAR buf[BUFSIZ]; ACE_OS::strcpy (buf, ACE_TEXT ("Gateway daemon\t # Application-level gateway\n")); if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0) return -1; else ACE_OS::strncpy (*strp, buf, length); return ACE_OS::strlen (buf); } // Parse and build the proxy table. int Gateway::parse_connection_config_file () { // File that contains the proxy configuration information. Connection_Config_File_Parser connection_file; int file_empty = 1; int line_number = 0; if (connection_file.open (Options::instance ()->connection_config_file ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), Options::instance ()->connection_config_file ()), -1); // Keep track of the previous connection id to make sure the // connection config file isn't corrupted. int previous_connection_id = 0; // Read config file one line at a time. for (Connection_Config_Info pci; connection_file.read_entry (pci, line_number) != FPRT::RT_EOFILE; ) { file_empty = 0; // First time in check. if (previous_connection_id == 0) { previous_connection_id = 1; if (pci.connection_id_ != 1) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) warning, the first connection id should be 1 not %d\n"), pci.connection_id_)); } else if (previous_connection_id + 1 != pci.connection_id_) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) warning, connection ids should keep increasing by 1 and %d + 1 != %d\n"), previous_connection_id, pci.connection_id_)); // Update the last connection id to ensure that we monotonically // increase by 1. previous_connection_id = pci.connection_id_; if (Options::instance ()->enabled (Options::DEBUGGING)) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) conn id = %d, ") ACE_TEXT ("host = %s, ") ACE_TEXT ("remote port = %d, ") ACE_TEXT ("proxy role = %c, ") ACE_TEXT ("max retry timeout = %d, ") ACE_TEXT ("local port = %d, ") ACE_TEXT ("priority = %d\n"), pci.connection_id_, pci.host_, pci.remote_port_, pci.connection_role_, pci.max_retry_timeout_, pci.local_port_, pci.priority_)); pci.event_channel_ = &this->event_channel_; // Create the appropriate type of Proxy. Connection_Handler *connection_handler; ACE_ALLOCATOR_RETURN (connection_handler, this->connection_handler_factory_.make_connection_handler (pci), -1); // Bind the new Connection_Handler to the connection ID. this->event_channel_.bind_proxy (connection_handler); } // Keep track of the next available connection id, which is // necessary for Peers that connect with us, rather than vice versa. Options::instance ()->connection_id () = previous_connection_id + 1; if (file_empty) ACE_ERROR ((LM_WARNING, ACE_TEXT ("warning: connection connection_handler configuration file was empty\n"))); return 0; } int Gateway::parse_consumer_config_file () { // File that contains the consumer event forwarding information. Consumer_Config_File_Parser consumer_file; int file_empty = 1; int line_number = 0; if (consumer_file.open (Options::instance ()->consumer_config_file ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), Options::instance ()->consumer_config_file ()), -1); // Read config file line at a time. for (Consumer_Config_Info cci_entry; consumer_file.read_entry (cci_entry, line_number) != FPRT::RT_EOFILE; ) { file_empty = 0; if (Options::instance ()->enabled (Options::DEBUGGING)) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) connection id = %d, payload = %d, ") ACE_TEXT ("number of consumers = %d\n"), cci_entry.connection_id_, cci_entry.type_, cci_entry.total_consumers_)); for (int i = 0; i < cci_entry.total_consumers_; i++) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) destination[%d] = %d\n"), i, cci_entry.consumers_[i])); } Consumer_Dispatch_Set *dispatch_set; ACE_NEW_RETURN (dispatch_set, Consumer_Dispatch_Set, -1); Event_Key event_addr (cci_entry.connection_id_, cci_entry.type_); // Add the Consumers to the Dispatch_Set. for (int i = 0; i < cci_entry.total_consumers_; i++) { Connection_Handler *connection_handler = 0; // Lookup destination and add to Consumer_Dispatch_Set set // if found. if (this->event_channel_.find_proxy (cci_entry.consumers_[i], connection_handler) != -1) dispatch_set->insert (connection_handler); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%t) not found: destination[%d] = %d\n"), i, cci_entry.consumers_[i])); } this->event_channel_.subscribe (event_addr, dispatch_set); } if (file_empty) ACE_ERROR ((LM_WARNING, ACE_TEXT ("warning: consumer map configuration file was empty\n"))); return 0; } // The following is a "Factory" used by the ACE_Service_Config and // svc.conf file to dynamically initialize the state of the Gateway. ACE_SVC_FACTORY_DEFINE (Gateway) ace-8.0.4+dfsg.orig/apps/Gateway/Gateway/Event_Forwarding_Discriminator.h0000644000175000017500000000324215027201773025440 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Event_Forwarding_Discriminator.h * * @author Doug Schmidt */ //============================================================================= #ifndef _CONSUMER_MAP_H #define _CONSUMER_MAP_H #include "ace/Map_Manager.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Null_Mutex.h" #include "Event.h" #include "Consumer_Dispatch_Set.h" /** * @class Event_Forwarding_Discriminator * * @brief Map events to the set of Consumer_Proxies that have subscribed * to receive the event. */ class Event_Forwarding_Discriminator { public: /// Associate Event with the Consumer_Dispatch_Set. int bind (Event_Key event, Consumer_Dispatch_Set *cds); /// Locate EXID and pass out parameter via INID. If found, /// return 0, else -1. int unbind (Event_Key event); /// Break any association of EXID. int find (Event_Key event, Consumer_Dispatch_Set *&cds); public: /// Map that associates s (external ids) with /// *'s . ACE_Map_Manager map_; }; /** * @class Event_Forwarding_Discriminator_Iterator * * @brief Define an iterator for the Consumer Map. */ class Event_Forwarding_Discriminator_Iterator { public: Event_Forwarding_Discriminator_Iterator (Event_Forwarding_Discriminator &mm); int next (Consumer_Dispatch_Set *&); int advance (); private: /// Map we are iterating over. ACE_Map_Iterator map_iter_; }; #endif /* _CONSUMER_MAP_H */ ace-8.0.4+dfsg.orig/apps/Gateway/Peer/0000755000175000017500000000000015046037655016435 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/Gateway/Peer/svc.conf0000644000175000017500000000016215027201773020067 0ustar sudipsudip #static Svc_Manager "-d -p 291" dynamic Peer1 Service_Object * Gateway_Peer:_make_Peer_Factory() active "-a C|S" ace-8.0.4+dfsg.orig/apps/Gateway/Peer/Peer.h0000644000175000017500000002017415027201773017476 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Peer.h * * These classes process Supplier/Consumer events sent from the * gateway (gatewayd) to its various peers (peerd). The general * collaboration works as follows: * * 1. creates a listener endpoint and waits * passively for gatewayd to connect with it. * * 2. When a gatewayd connects, creates an * object that sends/receives events from * gatewayd on that connection. * * 3. The waits for gatewayd to inform it of its * connection ID, which is prepended to all subsequent outgoing * events sent from peerd. * * 4. Once the connection ID is set, peerd periodically sends events * to gatewayd. Peerd also receives and "processes" events * forwarded to it from gatewayd. In this program, peerd * "processes" the events sent to it by writing them to stdout. * * Note that in the current peerd implementation, one Peer process * cannot serve as both a Consumer and Supplier of Events. This is * because the gatewayd establishes a separate connection for * Suppliers and Consumers and the peerd only maintains a single * object to handle this one connection. Enhancing * this implementation to be both a Consumer and Supplier * simultaneously is straightforward, however. In addition, * multiple peerd processes can already work together to play these * different roles. * * @author Douglas C. Schmidt */ //============================================================================= #ifndef PEER_H #define PEER_H #include "ace/Service_Config.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Acceptor.h" #include "ace/SOCK_Acceptor.h" #include "ace/SOCK_Connector.h" #include "ace/Svc_Handler.h" #include "ace/Connector.h" #include "ace/Null_Condition.h" #include "ace/Null_Mutex.h" #include "Options.h" ACE_SVC_FACTORY_DECLARE (Peer_Factory) #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT template class ACE_Svc_Export ACE_Svc_Handler; #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ /** * @class Peer_Handler * * @brief Handle Peer events arriving from a Gateway. */ class ACE_Svc_Export Peer_Handler : public ACE_Svc_Handler { public: /// Initialize the peer. Peer_Handler (); /// Shutdown the Peer. ~Peer_Handler (); /// Initialize the handler when called by /// . virtual int open (void * = 0); /// Receive and process peer events. virtual int handle_input (ACE_HANDLE); /// Send a event to a gateway (may be queued if necessary due to flow /// control). virtual int put (ACE_Message_Block *, ACE_Time_Value *tv = 0); /// Finish sending a event when flow control conditions abate. virtual int handle_output (ACE_HANDLE); /// Periodically send events via timer mechanism. virtual int handle_timeout (const ACE_Time_Value &, const void *arg); /// Perform object termination. virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); protected: typedef ACE_Svc_Handler inherited; /// Transmit to the gatewayd. int transmit (ACE_Message_Block *mb, size_t n, int event_type); /// Receive an Peer event from gatewayd. virtual int recv (ACE_Message_Block *&mb); /// Send an Peer event to gatewayd, using . virtual int send (ACE_Message_Block *mb); /// Perform a non-blocking , which tries to send an event to the /// gatewayd, but only if it isn't flow controlled. virtual int nonblk_put (ACE_Message_Block *mb); /// Register Consumer subscriptions with the gateway. int subscribe (); // = Event/state/action handlers. /// Receive a event from stdin and send it to the gateway. int transmit_stdin (); /// Action that receives the route id. int await_connection_id (); /// Action that receives events. int await_events (); /// Pointer-to-member-function for the current action to run in this /// state. This points to one of the preceding 3 methods. int (Peer_Handler::*do_action_)(); /// Connection ID of the peer, which is obtained from the gatewayd. CONNECTION_ID connection_id_; /// Keep track of event fragments that arrive in non-blocking recv's /// from the gatewayd. ACE_Message_Block *msg_frag_; /// The total number of bytes sent/received to the gatewayd thus far. size_t total_bytes_; /// Used to call register_stdin_handle only once. Otherwise, thread /// leak will occur on Win32. int first_time_; }; #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT template class ACE_Svc_Export ACE_Acceptor; #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ /** * @class Peer_Acceptor * * @brief Passively accept connections from gatewayd and dynamically * create a new object to communicate with the * gatewayd. */ class ACE_Svc_Export Peer_Acceptor : public ACE_Acceptor { public: /// Default initialization. Peer_Acceptor (); /// the . int start (u_short); /// Terminate the . int close (); /// Factory method that creates a just once. virtual int make_svc_handler (Peer_Handler *&); private: /// Factor out common code for initializing the . int open_acceptor (u_short port); /// Pointer to allocated just once. Peer_Handler *peer_handler_; /// Our acceptor addr. ACE_INET_Addr addr_; typedef ACE_Acceptor inherited; }; #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT template class ACE_Svc_Export ACE_Connector; #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ /** * @class Peer_Connector * * @brief Actively establish connections with gatewayd and dynamically * create a new object to communicate with the * gatewayd. */ class ACE_Svc_Export Peer_Connector : public ACE_Connector { public: /** * Initialize the . NOTE: the arguments are * ignored. They are only provided to avoid a compiler warning * about hiding the virtual function ACE_Connector::open(ACE_Reactor*, int). */ int open (ACE_Reactor * = 0, int = 0); private: /// Factor out common code for initializing the . int open_connector (Peer_Handler *&ph, u_short port); /// Consumer that is connected to a gatewayd. Peer_Handler *consumer_peer_handler_; /// Supplier that is connected to a gatewayd. Peer_Handler *supplier_peer_handler_; }; /** * @class Peer_Factory * * @brief A factory class that actively and/or passively establishes * connections with the gatewayd. */ class ACE_Svc_Export Peer_Factory : public ACE_Service_Object { public: // = Dynamic initialization and termination hooks from . /// Initialize the acceptor and connector. virtual int init (int argc, ACE_TCHAR *argv[]); /// Perform termination activities. virtual int fini (); /// Return info about this service. virtual int info (ACE_TCHAR **, size_t) const; /// Handle various signals (e.g., SIGPIPE, SIGINT, and SIGQUIT). virtual int handle_signal (int signum, siginfo_t *, ucontext_t *); private: /// Pointer to an instance of our that's used to /// accept connections and create Consumers. Peer_Acceptor consumer_acceptor_; /// Pointer to an instance of our that's used to /// accept connections and create Suppliers. Peer_Acceptor supplier_acceptor_; /** * An instance of our . Note that one * is used to establish s for both * Consumers and Suppliers. */ Peer_Connector connector_; }; #endif /* PEER_H */ ace-8.0.4+dfsg.orig/apps/Gateway/Peer/Options.cpp0000644000175000017500000001240515027201773020567 0ustar sudipsudip#define ACE_BUILD_SVC_DLL #include "ace/Get_Opt.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_stdlib.h" #include "ace/OS_NS_strings.h" #include "ace/OS_NS_string.h" #include "ace/OS_Memory.h" #include "Options.h" // Static initialization. Options *Options::instance_ = 0; void Options::print_usage_and_die () { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%n [-a {C|S}:acceptor-port] [-c {C|S}:connector-port] [-C connection-id] [-h gateway-host] [-q max-queue-size] [-t timeout] [-v]\n"))); ACE_OS::exit (1); } Options::Options () : options_ (0), supplier_acceptor_port_ (DEFAULT_PEER_SUPPLIER_PORT), consumer_acceptor_port_ (DEFAULT_PEER_CONSUMER_PORT), supplier_connector_port_ (DEFAULT_GATEWAY_SUPPLIER_PORT), consumer_connector_port_ (DEFAULT_GATEWAY_CONSUMER_PORT), connector_host_ (ACE_DEFAULT_SERVER_HOST), timeout_ (0), max_queue_size_ (MAX_QUEUE_SIZE), connection_id_ (0) { char *timeout = ACE_OS::getenv ("TIMEOUT"); if (timeout == 0) this->timeout_ = Options::DEFAULT_TIMEOUT; else this->timeout_ = ACE_OS::atoi (timeout); } Options * Options::instance () { if (Options::instance_ == 0) ACE_NEW_RETURN (Options::instance_, Options, 0); return Options::instance_; } long Options::timeout () const { return this->timeout_; } CONNECTION_ID & Options::connection_id () { return this->connection_id_; } long Options::max_queue_size () const { return this->max_queue_size_; } u_short Options::consumer_acceptor_port () const { return this->consumer_acceptor_port_; } u_short Options::supplier_acceptor_port () const { return this->supplier_acceptor_port_; } u_short Options::consumer_connector_port () const { return this->consumer_connector_port_; } u_short Options::supplier_connector_port () const { return this->supplier_connector_port_; } const ACE_TCHAR * Options::connector_host () const { return this->connector_host_; } int Options::enabled (int option) const { return ACE_BIT_ENABLED (this->options_, option); } void Options::parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("a:c:C:h:m:t:v"), 0); for (int c; (c = get_opt ()) != -1; ) { switch (c) { case 'a': { // Become an Acceptor. for (ACE_TCHAR *flag = ACE_OS::strtok (get_opt.opt_arg (), ACE_TEXT ("|")); flag != 0; flag = ACE_OS::strtok (0, ACE_TEXT ("|"))) if (ACE_OS::strncasecmp (flag, ACE_TEXT ("C"), 1) == 0) { ACE_SET_BITS (this->options_, Options::CONSUMER_ACCEPTOR); if (ACE_OS::strlen (flag) > 1) // Set the Consumer Acceptor port number. this->consumer_acceptor_port_ = ACE_OS::atoi (flag + 2); } else if (ACE_OS::strncasecmp (flag, ACE_TEXT ("S"), 1) == 0) { ACE_SET_BITS (this->options_, Options::SUPPLIER_ACCEPTOR); if (ACE_OS::strlen (flag) > 1) // Set the Supplier Acceptor port number. this->supplier_acceptor_port_ = ACE_OS::atoi (flag + 2); } } break; /* NOTREACHED */ case 'c': { // Become a Connector. for (ACE_TCHAR *flag = ACE_OS::strtok (get_opt.opt_arg (), ACE_TEXT ("|")); flag != 0; flag = ACE_OS::strtok (0, ACE_TEXT ("|"))) if (ACE_OS::strncasecmp (flag, ACE_TEXT ("C"), 1) == 0) { ACE_SET_BITS (this->options_, Options::CONSUMER_CONNECTOR); if (ACE_OS::strlen (flag) > 1) // Set the Consumer Connector port number. this->consumer_connector_port_ = ACE_OS::atoi (flag + 2); } else if (ACE_OS::strncasecmp (flag, ACE_TEXT ("S"), 1) == 0) { ACE_SET_BITS (this->options_, Options::SUPPLIER_CONNECTOR); if (ACE_OS::strlen (flag) > 1) // Set the Supplier Connector port number. this->supplier_connector_port_ = ACE_OS::atoi (flag + 2); } } break; /* NOTREACHED */ case 'C': this->connection_id_ = ACE_OS::atoi (get_opt.opt_arg ()); break; /* NOTREACHED */ case 'h': // connector host this->connector_host_ = get_opt.opt_arg (); break; /* NOTREACHED */ case 'm': // max queue size. this->max_queue_size_ = ACE_OS::atoi (get_opt.opt_arg ()); break; /* NOTREACHED */ case 't': // Timeout this->timeout_ = ACE_OS::atoi (get_opt.opt_arg ()); break; /* NOTREACHED */ case 'v': // Verbose mode. ACE_SET_BITS (this->options_, Options::VERBOSE); break; /* NOTREACHED */ default: this->print_usage_and_die (); /* NOTREACHED */ } } } ace-8.0.4+dfsg.orig/apps/Gateway/Peer/Options.h0000644000175000017500000000707215027201773020240 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Options.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef OPTIONS_H #define OPTIONS_H #include "../Gateway/Event.h" #include "ace/svc_export.h" /** * @class Options * * @brief Singleton that consolidates all Options for a peerd. */ class ACE_Svc_Export Options { public: // = Options that can be enabled/disabled. enum { VERBOSE = 01, SUPPLIER_ACCEPTOR = 02, CONSUMER_ACCEPTOR = 04, SUPPLIER_CONNECTOR = 010, CONSUMER_CONNECTOR = 020 }; /// Return Singleton. static Options *instance (); /// Parse the arguments and set the options. void parse_args (int argc, ACE_TCHAR *argv[]); // = Accessor methods. /// Determine if an option is enabled. int enabled (int option) const; /** * Our acceptor port number, i.e., the one that we passively listen * on for connections to arrive from a gatewayd and create a * Supplier. */ u_short supplier_acceptor_port () const; /** * Our acceptor port number, i.e., the one that we passively listen * on for connections to arrive from a gatewayd and create a * Consumer. */ u_short consumer_acceptor_port () const; /// The connector port number, i.e., the one that we use to actively /// establish connections with a gatewayd and create a Supplier. u_short supplier_connector_port () const; /// The connector port number, i.e., the one that we use to actively /// establish connections with a gatewayd and create a Consumer. u_short consumer_connector_port () const; /// Our connector port host, i.e., the host running the gatewayd /// process. const ACE_TCHAR *connector_host () const; /// Duration between disconnects. long timeout () const; /// The maximum size of the queue. long max_queue_size () const; /// Returns a reference to the connection id. CONNECTION_ID &connection_id (); private: enum { MAX_QUEUE_SIZE = 1024 * 1024 * 16, // We'll allow up to 16 megabytes to be queued per-output // channel!!!! This is clearly a policy in search of // refinement... DEFAULT_TIMEOUT = 60 // By default, disconnect the peer every minute. }; /// Ensure Singleton. Options (); /// Explain usage and exit. void print_usage_and_die (); /// Singleton. static Options *instance_; /// Flag to indicate if we want verbose diagnostics. u_long options_; /** * The acceptor port number, i.e., the one that we passively listen * on for connections to arrive from a gatewayd and create a * Supplier. */ u_short supplier_acceptor_port_; /** * The acceptor port number, i.e., the one that we passively listen * on for connections to arrive from a gatewayd and create a * Consumer. */ u_short consumer_acceptor_port_; /// The connector port number, i.e., the one that we use to actively /// establish connections with a gatewayd and create a Supplier. u_short supplier_connector_port_; /// The connector port number, i.e., the one that we use to actively /// establish connections with a gatewayd and create a Consumer. u_short consumer_connector_port_; /// Our connector host, i.e., where the gatewayd process is running. const ACE_TCHAR *connector_host_; /// The amount of time to wait before disconnecting from the Peerd. long timeout_; /// The maximum size that the queue can grow to. long max_queue_size_; /// The connection id. CONNECTION_ID connection_id_; }; #endif /* OPTIONS_H */ ace-8.0.4+dfsg.orig/apps/Gateway/Peer/peer.mpc0000644000175000017500000000042615027201773020064 0ustar sudipsudip// -*- MPC -*- project(Gateway_Peer) : ace_output, acelib { sharedname = Gateway_Peer Source_Files { Options.cpp Peer.cpp } } project(gateway_peerd) : aceexe { exename = peerd after += Gateway_Peer libs += Gateway_Peer Source_Files { peerd.cpp } }ace-8.0.4+dfsg.orig/apps/Gateway/Peer/peerd.cpp0000644000175000017500000000304215027201773020230 0ustar sudipsudip //============================================================================= /** * @file peerd.cpp * * Driver for the peer daemon (peerd). Note that this is * completely generic code due to the Service Configurator * framework! * * @author Douglas C. Schmidt */ //============================================================================= #include "ace/OS_NS_unistd.h" #include "Peer.h" int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { if (ACE_OS::access (ACE_DEFAULT_SVC_CONF, F_OK) != 0) { // Use static linking. ACE_Service_Object_Ptr sp = ACE_SVC_INVOKE (Peer_Factory); if (sp->init (argc - 1, argv + 1) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("init")), 1); // Run forever, performing the configured services until we are // shut down by a SIGINT/SIGQUIT signal. ACE_Reactor::instance ()->run_reactor_event_loop (); // Destructor of automagically call // . } else { if (ACE_Service_Config::open (argc, argv) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), 1); else // Use dynamic linking. // Run forever, performing the configured services until we // are shut down by a signal (e.g., SIGINT or SIGQUIT). ACE_Reactor::instance ()->run_reactor_event_loop (); } return 0; } ace-8.0.4+dfsg.orig/apps/Gateway/Peer/Peer.cpp0000644000175000017500000006467415027201773020046 0ustar sudipsudip#define ACE_BUILD_SVC_DLL #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #include "ace/Signal.h" #include "Peer.h" Peer_Handler::Peer_Handler () : connection_id_ (-1), // Maybe it's better than 0. msg_frag_ (0), total_bytes_ (0) { // Set the high water mark of the . This is used // to exert flow control. this->msg_queue ()->high_water_mark (Options::instance ()->max_queue_size ()); first_time_ = 1; // It will be first time to open Peer_Handler. } // Upcall from the that turns control // over to our application-specific Gateway handler. int Peer_Handler::open (void *a) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("handle = %d\n"), this->peer ().get_handle ())); // Call down to the base class to activate and register this handler // with an . if (this->inherited::open (a) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), -1); if (this->peer ().enable (ACE_NONBLOCK) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("enable")), -1); ACE_Time_Value timeout (Options::instance ()->timeout ()); // Schedule the time between disconnects. This should really be a // "tunable" parameter. if (ACE_Reactor::instance ()->schedule_timer (this, 0, timeout) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("schedule_timer"))); // If there are events left in the queue, make sure we enable the // appropriately to get them sent out. if (this->msg_queue ()->is_empty () == 0 && ACE_Reactor::instance ()->schedule_wakeup (this, ACE_Event_Handler::WRITE_MASK) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("schedule_wakeup")), -1); // First action is to wait to be notified of our connection id. this->do_action_ = &Peer_Handler::await_connection_id; return 0; } int Peer_Handler::transmit (ACE_Message_Block *mb, size_t n, int event_type) { Event *event = (Event *) mb->rd_ptr (); // Initialize the header. new (&event->header_) Event_Header (n, this->connection_id_, event_type, 0); // Convert all the fields into network byte order. event->header_.encode (); // Move the write pointer to the end of the event. mb->wr_ptr (sizeof (Event_Header) + n); if (this->put (mb) == -1) { if (errno == EWOULDBLOCK) // The queue has filled up! ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("gateway is flow controlled, so we're dropping events"))); else ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("transmission failure in transmit()"))); // Function name fixed. // Caller is responsible for freeing a ACE_Message_Block // if failures occur. mb->release (); return -1; } return 0; } // Read events from stdin and send them to the gatewayd. int Peer_Handler::transmit_stdin () { // If return value is -1, then first_time_ must be reset to 1. int result = 0; if (this->connection_id_ != -1) { ACE_Message_Block *mb = 0; ACE_NEW_RETURN (mb, ACE_Message_Block (sizeof (Event)), -1); // Cast the message block payload into an pointer. Event *event = (Event *) mb->rd_ptr (); ssize_t n = ACE_OS::read (ACE_STDIN, event->data_, sizeof event->data_); switch (n) { case 0: ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("stdin closing down\n"))); // Take stdin out of the ACE_Reactor so we stop trying to // send events. ACE_Reactor::instance ()->remove_handler (ACE_STDIN, ACE_Event_Handler::DONT_CALL | ACE_Event_Handler::READ_MASK); mb->release (); result = 0; // break; /* NOTREACHED */ case -1: mb->release (); ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("read"))); result = 0; // break; /* NOTREACHED */ default: // Do not return directly, save the return value. result = this->transmit (mb, n, ROUTING_EVENT); break; /* NOTREACHED */ } // Do not return at here, but at exit of function. /*return 0;*/ } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Must transmit over an opened channel.\n"))); result = -1; // Save return value at here, return at exit of function. } // If transmit error, the stdin-thread will be cancelled, so should // reset first_time_ to 1, which will register_stdin_handler again. if (result == -1) first_time_ = 1; return result; } // Perform a non-blocking of event MB. If we are unable to send // the entire event the remainder is re-queue'd at the *front* of the // Message_Queue. int Peer_Handler::nonblk_put (ACE_Message_Block *mb) { // Try to send the event. If we don't send it all (e.g., due to // flow control), then re-queue the remainder at the head of the // and ask the to inform us (via // ) when it is possible to try again. ssize_t n = this->send (mb); if (n == -1) // -1 is returned only when things have really gone wrong (i.e., // not when flow control occurs). return -1; else if (errno == EWOULDBLOCK) { // We didn't manage to send everything, so requeue. ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("queueing activated on handle %d to connection id %d\n"), this->get_handle (), this->connection_id_)); // Re-queue in *front* of the list to preserve order. if (this->msg_queue ()->enqueue_head (mb, (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("enqueue_head")), -1); // Tell ACE_Reactor to call us back when we can send again. if (ACE_Reactor::instance ()->schedule_wakeup (this, ACE_Event_Handler::WRITE_MASK) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("schedule_wakeup")), -1); return 0; } else return n; } // Finish sending a event when flow control conditions abate. This // method is automatically called by the ACE_Reactor. int Peer_Handler::handle_output (ACE_HANDLE) { ACE_Message_Block *mb = 0; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("in handle_output\n"))); if (this->msg_queue ()->dequeue_head (mb, (ACE_Time_Value *) &ACE_Time_Value::zero) != -1) { switch (this->nonblk_put (mb)) { case 0: // Partial send. ACE_ASSERT (errno == EWOULDBLOCK); // Didn't write everything this time, come back later... break; /* NOTREACHED */ case -1: // Caller is responsible for freeing a ACE_Message_Block if // failures occur. mb->release (); ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("transmission failure in handle_output"))); ACE_FALLTHROUGH; default: // Sent the whole thing. // If we succeed in writing the entire event (or we did not // fail due to EWOULDBLOCK) then check if there are more // events on the . If there aren't, tell // the not to notify us anymore (at least // until there are new events queued up). if (this->msg_queue ()->is_empty ()) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("queue now empty on handle %d to connection id %d\n"), this->get_handle (), this->connection_id_)); if (ACE_Reactor::instance ()->cancel_wakeup (this, ACE_Event_Handler::WRITE_MASK) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("cancel_wakeup"))); } } return 0; } else // If the list is empty there's a bug! ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("dequeue_head")), 0); } // Send an event to a peer (may block if necessary). int Peer_Handler::put (ACE_Message_Block *mb, ACE_Time_Value *) { if (this->msg_queue ()->is_empty ()) // Try to send the event *without* blocking! return this->nonblk_put (mb); else // If we have queued up events due to flow control then just // enqueue and return. return this->msg_queue ()->enqueue_tail (mb, (ACE_Time_Value *) &ACE_Time_Value::zero); } // Send an Peer event to gatewayd. int Peer_Handler::send (ACE_Message_Block *mb) { size_t len = mb->length (); ssize_t n = this->peer ().send (mb->rd_ptr (), len); if (n <= 0) return errno == EWOULDBLOCK ? 0 : n; else if (n < (ssize_t) len) { // Re-adjust pointer to skip over the part we did send. mb->rd_ptr (n); this->total_bytes_ += n; } else // if (n == length). { // The whole event is sent, we can now safely deallocate the // buffer. Note that this should decrement a reference count... this->total_bytes_ += n; mb->release (); errno = 0; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("sent %d bytes, total bytes sent = %d\n"), n, this->total_bytes_)); return n; } // Receive an Event from gatewayd. Handles fragmentation. int Peer_Handler::recv (ACE_Message_Block *&mb) { if (this->msg_frag_ == 0) // No existing fragment... ACE_NEW_RETURN (this->msg_frag_, ACE_Message_Block (sizeof (Event)), -1); Event *event = (Event *) this->msg_frag_->rd_ptr (); ssize_t header_received = 0; const size_t HEADER_SIZE = sizeof (Event_Header); ssize_t header_bytes_left_to_read = HEADER_SIZE - this->msg_frag_->length (); if (header_bytes_left_to_read > 0) { header_received = this->peer ().recv (this->msg_frag_->wr_ptr (), header_bytes_left_to_read); if (header_received == -1 /* error */ || header_received == 0 /* EOF */) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Recv error during header read"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("attempted to read %d bytes\n"), header_bytes_left_to_read)); this->msg_frag_ = this->msg_frag_->release (); return header_received; } // Bump the write pointer by the amount read. this->msg_frag_->wr_ptr (header_received); // At this point we may or may not have the ENTIRE header. if (this->msg_frag_->length () < HEADER_SIZE) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Partial header received: only %d bytes\n"), this->msg_frag_->length ())); // Notify the caller that we didn't get an entire event. errno = EWOULDBLOCK; return -1; } // Convert the header into host byte order so that we can access // it directly without having to repeatedly muck with it... event->header_.decode (); if (event->header_.len_ > ACE_INT32 (sizeof event->data_)) { // This data_ payload is too big! errno = EINVAL; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Data payload is too big (%d bytes)\n"), event->header_.len_)); return -1; } } // At this point there is a complete, valid header in Event. Now we // need to get the event payload. Due to incomplete reads this may // not be the first time we've read in a fragment for this message. // We account for this here. Note that the first time in here // wr_ptr> will point to data_>. Every time we // do a successful fragment read, we advance . Therefore, // by subtracting how much we've already read from the // header_.len_> we complete the // ... ssize_t data_bytes_left_to_read = ssize_t (event->header_.len_ - (msg_frag_->wr_ptr () - event->data_)); // peer().recv() should not be called when data_bytes_left_to_read is 0. ssize_t data_received = !data_bytes_left_to_read ? 0 : this->peer ().recv (this->msg_frag_->wr_ptr (), data_bytes_left_to_read); // Try to receive the remainder of the event. switch (data_received) { case -1: if (errno == EWOULDBLOCK) // This might happen if only the header came through. return -1; ACE_FALLTHROUGH; case 0: // Premature EOF. if (data_bytes_left_to_read) { this->msg_frag_ = this->msg_frag_->release (); return 0; } ACE_FALLTHROUGH; default: // Set the write pointer at 1 past the end of the event. this->msg_frag_->wr_ptr (data_received); if (data_received != data_bytes_left_to_read) { errno = EWOULDBLOCK; // Inform caller that we didn't get the whole event. return -1; } else { // Set the read pointer to the beginning of the event. this->msg_frag_->rd_ptr (this->msg_frag_->base ()); mb = this->msg_frag_; // Reset the pointer to indicate we've got an entire event. this->msg_frag_ = 0; } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) connection id = %d, cur len = %d, total bytes read = %d\n"), event->header_.connection_id_, event->header_.len_, data_received + header_received)); if (Options::instance ()->enabled (Options::VERBOSE)) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("data_ = %*s\n"), event->header_.len_ - 2, event->data_)); return data_received + header_received; } } // Receive various types of input (e.g., Peer event from the gatewayd, // as well as stdio). int Peer_Handler::handle_input (ACE_HANDLE sd) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("in handle_input, sd = %d\n"), sd)); if (sd == ACE_STDIN) // Handle event from stdin. return this->transmit_stdin (); else // Perform the appropriate action depending on the state we are // in. return (this->*do_action_) (); } // Action that receives our connection id from the Gateway. int Peer_Handler::await_connection_id () { ssize_t n = this->peer ().recv (&this->connection_id_, sizeof this->connection_id_); if (n != (ssize_t) sizeof this->connection_id_) { if (n == 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("gatewayd has closed down unexpectedly\n")), -1); else ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p, bytes received on handle %d = %d\n"), ACE_TEXT ("recv"), this->get_handle (), n), -1); } else { this->connection_id_ = ntohl (this->connection_id_); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("assigned connection id %d\n"), this->connection_id_)); } // Subscribe for events if we're a Consumer. if (Options::instance ()->enabled (Options::CONSUMER_CONNECTOR)) this->subscribe (); // No need to disconnect by timeout. ACE_Reactor::instance ()->cancel_timer(this); // Transition to the action that waits for Peer events. this->do_action_ = &Peer_Handler::await_events; // Reset standard input. ACE_OS::rewind (stdin); // Call register_stdin_handler only once, until the stdin-thread // closed which caused by transmit_stdin error. if (first_time_) { // Register this handler to receive test events on stdin. if (ACE_Event_Handler::register_stdin_handler (this, ACE_Reactor::instance (), ACE_Thread_Manager::instance ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%t) %p\n"), ACE_TEXT ("register_stdin_handler")), -1); // Next time in await_connection_id(), I'll don't call // register_stdin_handler(). first_time_ = 0; } return 0; } int Peer_Handler::subscribe () { ACE_Message_Block *mb = 0; ACE_NEW_RETURN (mb, ACE_Message_Block (sizeof (Event)), -1); Subscription *subscription = (Subscription *) ((Event *) mb->rd_ptr ())->data_; subscription->connection_id_ = Options::instance ()->connection_id (); return this->transmit (mb, sizeof *subscription, SUBSCRIPTION_EVENT); } // Action that receives events from the Gateway. int Peer_Handler::await_events () { ACE_Message_Block *mb = 0; ssize_t n = this->recv (mb); switch (n) { case 0: ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("gatewayd has closed down\n")), -1); /* NOTREACHED */ case -1: if (errno == EWOULDBLOCK) // A short-read, we'll come back and finish it up later on! return 0; else ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("recv")), -1); /* NOTREACHED */ default: { // We got a valid event, so let's process it now! At the // moment, we just print out the event contents... Event *event = (Event *) mb->rd_ptr (); this->total_bytes_ += mb->length (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("route id = %d, cur len = %d, total len = %d\n"), event->header_.connection_id_, event->header_.len_, this->total_bytes_)); if (Options::instance ()->enabled (Options::VERBOSE)) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("data_ = %*s\n"), event->header_.len_ - 2, event->data_)); mb->release (); return 0; } } } // Periodically send events via ACE_Reactor timer mechanism. int Peer_Handler::handle_timeout (const ACE_Time_Value &, const void *) { // Shut down the handler. return this->handle_close (); } Peer_Handler::~Peer_Handler () { // Shut down the handler. this->handle_close (); } // Handle shutdown of the Peer object. int Peer_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask) { if (this->get_handle () != ACE_INVALID_HANDLE) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("shutting down Peer on handle %d\n"), this->get_handle ())); ACE_Reactor_Mask mask = ACE_Event_Handler::DONT_CALL | ACE_Event_Handler::READ_MASK; // Explicitly remove ourselves for ACE_STDIN (the // removes the HANDLE. Note that // instructs the ACE_Reactor *not* to call , which // would otherwise lead to infinite recursion!). ACE_Reactor::instance ()->remove_handler (ACE_STDIN, mask); // Deregister this handler with the ACE_Reactor. if (ACE_Reactor::instance ()->remove_handler (this, mask) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("handle = %d: %p\n"), this->get_handle (), ACE_TEXT ("remove_handler")), -1); // Close down the peer. this->peer ().close (); } return 0; } int Peer_Acceptor::start (u_short port) { // This object only gets allocated once and is just recycled // forever. ACE_NEW_RETURN (peer_handler_, Peer_Handler, -1); this->addr_.set (port); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("opening acceptor at port %d\n"), port)); // Call down to the method. if (this->inherited::open (this->addr_) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("open")), -1); else if (this->acceptor ().get_local_addr (this->addr_) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("get_local_addr")), -1); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("accepting at port %d\n"), this->addr_.get_port_number ())); return 0; } Peer_Acceptor::Peer_Acceptor () : peer_handler_ (0) { } int Peer_Acceptor::close () { // Will trigger a delete. if (this->peer_handler_ != 0) this->peer_handler_->destroy (); // Close down the base class. return this->inherited::close (); } // Note how this method just passes back the pre-allocated // instead of having the allocate a new // one each time! int Peer_Acceptor::make_svc_handler (Peer_Handler *&sh) { sh = this->peer_handler_; return 0; } int Peer_Connector::open_connector (Peer_Handler *&peer_handler, u_short port) { // This object only gets allocated once and is just recycled // forever. ACE_NEW_RETURN (peer_handler, Peer_Handler, -1); ACE_INET_Addr addr (port, Options::instance ()->connector_host ()); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("connecting to %s:%d\n"), addr.get_host_name (), addr.get_port_number ())); if (this->connect (peer_handler, addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("connect")), -1); else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("connected to %C:%d\n"), addr.get_host_name (), addr.get_port_number ())); return 0; } int Peer_Connector::open (ACE_Reactor *, int) { this->supplier_peer_handler_ = 0; this->consumer_peer_handler_ = 0; if (Options::instance ()->enabled (Options::SUPPLIER_CONNECTOR) && this->open_connector (this->supplier_peer_handler_, Options::instance ()->supplier_connector_port ()) == -1) return -1; if (Options::instance ()->enabled (Options::CONSUMER_CONNECTOR) && this->open_connector (this->consumer_peer_handler_, Options::instance ()->consumer_connector_port ()) == -1) return -1; return 0; } int Peer_Factory::handle_signal (int signum, siginfo_t *, ucontext_t *) { if (signum != SIGPIPE) { // Shut down the main event loop. ACE_DEBUG((LM_NOTICE, ACE_TEXT ("Exit case signal\n"))); // Why do I exit? ACE_Reactor::instance ()->end_reactor_event_loop(); } return 0; } // Returns information on the currently active service. int Peer_Factory::info (ACE_TCHAR **strp, size_t length) const { ACE_TCHAR buf[BUFSIZ]; ACE_TCHAR consumer_addr_str[BUFSIZ]; ACE_TCHAR supplier_addr_str[BUFSIZ]; ACE_INET_Addr addr; if (this->consumer_acceptor_.acceptor ().get_local_addr (addr) == -1) return -1; else if (addr.addr_to_string (consumer_addr_str, sizeof addr) == -1) return -1; else if (this->supplier_acceptor_.acceptor ().get_local_addr (addr) == -1) return -1; else if (addr.addr_to_string (supplier_addr_str, sizeof addr) == -1) return -1; ACE_OS::strcpy (buf, ACE_TEXT ("peerd\t C:")); ACE_OS::strcat (buf, consumer_addr_str); ACE_OS::strcat (buf, ACE_TEXT ("|S:")); ACE_OS::strcat (buf, supplier_addr_str); ACE_OS::strcat (buf, ACE_TEXT ("/tcp # Gateway traffic generator and data sink\n")); if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0) return -1; else ACE_OS::strncpy (*strp, buf, length); return ACE_OS::strlen (buf); } // Hook called by the explicit dynamic linking facility to terminate // the peer. int Peer_Factory::fini () { this->consumer_acceptor_.close (); this->supplier_acceptor_.close (); return 0; } // Hook called by the explicit dynamic linking facility to initialize // the peer. int Peer_Factory::init (int argc, ACE_TCHAR *argv[]) { Options::instance ()->parse_args (argc, argv); ACE_Sig_Set sig_set; sig_set.sig_add (SIGINT); sig_set.sig_add (SIGQUIT); sig_set.sig_add (SIGPIPE); // Register ourselves to receive signals so we can shut down // gracefully. if (ACE_Reactor::instance ()->register_handler (sig_set, this) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("register_handler")), -1); if (Options::instance ()->enabled (Options::SUPPLIER_ACCEPTOR) && this->supplier_acceptor_.start (Options::instance ()->supplier_acceptor_port ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Acceptor::open")), -1); else if (Options::instance ()->enabled (Options::CONSUMER_ACCEPTOR) && this->consumer_acceptor_.start (Options::instance ()->consumer_acceptor_port ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Acceptor::open")), -1); else if (this->connector_.open () == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("Connector::open")), -1); return 0; } // The following is a "Factory" used by the and // svc.conf file to dynamically initialize the and // . ACE_SVC_FACTORY_DEFINE (Peer_Factory) ace-8.0.4+dfsg.orig/apps/Gateway/README0000644000175000017500000001273415027201773016422 0ustar sudipsudip OVERVIEW This directory contains source code for an application-level Communication Gateway implemented with ACE. This prototype was developed in my cs422 OS class at Washington University in 1994. The Gateway has recently been updated to illustrate the use of Event Channels, which forward events from Suppliers to Consumers in a distributed system. You can get a paper that explains the patterns used in this implementation at the following WWW URL: http://www.dre.vanderbilt.edu/~schmidt/PDF/TAPOS-00.pdf ---------------------------------------- DIRECTORY STRUCTURE There are 2 directories: 1. Gateway This directory contains the source code for the application-level Gateway process, gatewayd. The gatewayd routes event messages between Peers. By default, the gatewayd plays the Connector role and initializes itself by reading the connection_config and consumer_config files: 1. The connection_config file establishes the "physical configuration" of the Consumer and Supplier proxies. This file tells the Gateway what connections to establish with particular hosts using particular ports. 2. The consumer_config file establishes the "logical configuration." This file tells the Gateway how to forward data coming from Suppliers to the appropriate Consumers. The application Gateway generally should be started after all the Peers described below, though the process should work correctly even if it starts first. 2. Peer This directory contains the source code for the Peer process, peerd. There are typically many Peers, which act as suppliers and consumers of event messages that are routed through the gatewayd. To do anything interesting you'll need at least two Peers: one to supply events and one to consume events. In the configuration files, these two types of Peers are designated as follows: 1. Supplier Peers (designated by an 'S' in the Gateway's connection_config configuration file). These Peers are "suppliers" of events to the Gateway. 2. Consumer Peers (designated by an 'C' in the Gateway's connection_config file). These Peers are "consumers" of events forwarded by the Gateway. Forwarding is based on the settings in the consumer_config configuration file. ---------------------------------------- HOW TO RUN THE TESTS To run the tests do the following: 1. Compile everything (i.e., first compile the ACE libraries, then compile the Gateway and Peer directories). 2. Edit the consumer_config and connection_config files as discussed above to indicate the desired physical and logical mappings for Consumers and Suppliers. 3. Start up the Peers (peerd). You can start up as many as you like, as per the connection_config file, but you'll need at least two (i.e., one Supplier and Consumer). I typically start up each Peer in a different window on a different machine, but you can run them on the same machine as long as you pick different port numbers. The Peers will print out some diagnostic info and then block awaiting connections from the Gateway. If you want to set the port numbers of the Peers from the command-line do the following: a. Change the svc.conf file in the ./Peer/ directory to another name (e.g., foo.conf). This will keep the program from starting up with the svc.conf file (which dynamically links in the Peers and uses the -a option to set the port). b. Then run the peers in different windows as # Window 1 (Supplier) % peerd -a S:10011 # Window 2 (Consumer) % peerd -a C:10012 etc. Naturally, you can also edit the svc.conf file, but that may be more of a pain if you've got a network filesystem and all your hosts share the same svc.conf file. 4. Start up the Gateway (gatewayd). This will print out a bunch of messages as it reads the config files and connects to all the Peers. By default, the Gateway is purely reactive, i.e., it handles Consumers and Suppliers in the same thread of control. However, if you give the '-t OUTPUT_MT' option the Gateway will handle all Consumers in separate threads. If you give the '-t INPUT_MT' option the Gateway will handle all Suppliers in separate threads. If you give the '-t INPUT_MT|OUTPUT_MT' option both Consumers and Suppliers will be handled in the separate threads. Assuming everything works, then all the Peers will be connected. If some of the Peers aren't set up correctly, or if they aren't started first, then the Gateway will use an exponential backoff algorithm to attempt to reestablish those connections. 5. Once the Gateway has connected with all the Peers you can send events from Supplier Peers by typing commands in the Peer window. This Supplier will be sent to the Gateway, which will forward the event to all Consumer Peers that have "subscribed" to receive these events. Note that if you type ^C in a Peer window the Peer will shutdown its handlers and exit. The Gateway will detect this and will start trying to reestablish the connection using the same exponential backoff algorithm it used for the initial connection establishment. 7. When you want to terminate a Gateway, just type ^C or type any characters in the ./gatewayd window and the process will shut down gracefully. ace-8.0.4+dfsg.orig/apps/drwho/0000755000175000017500000000000015046037655015264 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/drwho/PM_Client.cpp0000644000175000017500000000771515027201773017605 0ustar sudipsudip#include "Options.h" #include "PM_Server.h" #include "PM_Client.h" #include "ace/ACE.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_stdlib.h" // This function is used to merge the LOGIN_NAME from server HOST_NAME // into the userids kept on the client's side. Note that we must // allocate memory for HOST_NAME... Protocol_Record * PM_Client::insert_protocol_info (Protocol_Record &protocol_record) { Protocol_Record *prp = this->ss->insert (protocol_record.get_login ()); Drwho_Node *current_node = protocol_record.get_drwho_list (); Drwho_Node *np = this->get_drwho_node (ACE::strnew (current_node->get_host_name ()), prp->drwho_list_); // Update the active and inactive counts. if (np->get_active_count () < current_node->get_active_count ()) { np->set_active_count (current_node->get_active_count ()); prp->is_active_ = 1; } if (np->get_inactive_count () < current_node->get_inactive_count()) np->set_inactive_count (current_node->get_inactive_count ()); return prp; } // This routine does all the dirty work, and actually prints out the // friends info in a nicely formatted manner. void PM_Client::process () { const char *(Protocol_Record::*get_name)(); if (Options::get_opt (Options::PRINT_LOGIN_NAME)) get_name = &Protocol_Record::get_login; else get_name = &Protocol_Record::get_real; int active_friends = 0; int users = this->Protocol_Manager::get_total_users (); ACE_DEBUG ((LM_DEBUG, "------------------------\n")); if (Options::get_opt (Options::PRINT_LOGIN_NAME)) this->max_key_length = MAXUSERIDNAMELEN; // Goes through the queue of all the logged in friends and prints // out the associated information. for (Protocol_Record *prp = this->Protocol_Manager::get_each_friend (); prp != 0; prp = this->Protocol_Manager::get_each_friend ()) { ACE_DEBUG ((LM_DEBUG, "%c%-*s [", (prp->is_active_ != 0 ? '*' : ' '), this->max_key_length, (prp->*get_name) ())); for (Drwho_Node *np = prp->get_drwho_list (); ;) { ACE_DEBUG ((LM_DEBUG, np->get_host_name (), stdout)); active_friends += np->get_active_count (); if (np->get_inactive_count () != 0) { if (np->get_active_count () != 0) ACE_DEBUG ((LM_DEBUG, "*(%d)", np->get_active_count ())); } else if (np->get_active_count () > 1) ACE_DEBUG ((LM_DEBUG, "*(%d)", np->get_active_count ())); else if (np->get_active_count () == 1) ACE_DEBUG ((LM_DEBUG, "*")); np = np->next_; if (np == 0) break; else ACE_DEBUG ((LM_DEBUG, " ")); } ACE_DEBUG ((LM_DEBUG, "]\n")); } ACE_DEBUG ((LM_DEBUG, "------------------------\n")); ACE_DEBUG ((LM_DEBUG, "friends: %d\tusers: %d\n", active_friends, users)); } char * PM_Client::handle_protocol_entries (const char *cp, const char *login_name, const char *real_name) { static Protocol_Record protocol_record (1); Drwho_Node *current_node = protocol_record.get_drwho_list (); protocol_record.set_login (login_name); protocol_record.set_real (real_name); current_node->set_inactive_count (ACE_OS::atoi (cp)); current_node->set_active_count (ACE_OS::atoi (cp = ACE_OS::strchr (cp, ' ') + 1)); current_node->set_host_name (cp = ACE_OS::strchr (cp, ' ') + 1); this->insert_protocol_info (protocol_record); return (char *) ACE::strend (cp); } PM_Client::PM_Client () : max_key_length (0) { } PM_Client::~PM_Client () { } ace-8.0.4+dfsg.orig/apps/drwho/PM_Server.cpp0000644000175000017500000000377015027201773017632 0ustar sudipsudip#include "Options.h" #include "Rwho_DB_Manager.h" #include "PM_Server.h" #include "ace/ACE.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_stdio.h" // This is the main method for the server side of things. It reads // the RWHO file on the local machine and inserts HOST_NAME // information for each LOGIN_NAME that is a friend into the // DRWHO_LIST. This function is also responsible for determining // whether a given LOGIN_NAME is currently idle or not. int PM_Server::process () { RWho_DB_Manager ru; Protocol_Record protocol_record (1); while (ru.get_next_user (protocol_record) > 0) this->insert_protocol_info (protocol_record); return 1; } // Insert the HOST_NAME into the server's lookup table on behalf of // user LOGIN_NAME. Note that we need to allocate memory for // HOST_NAME... Protocol_Record * PM_Server::insert_protocol_info (Protocol_Record &protocol_record) { Protocol_Record *prp = this->ss->insert (protocol_record.get_login ()); Drwho_Node *current_node = protocol_record.get_drwho_list (); if (current_node->get_idle_time () < MAX_USER_TIMEOUT) this->increment_total_users (); if (prp) { Drwho_Node *np = this->get_drwho_node (ACE::strnew (current_node->get_host_name ()), prp->drwho_list_); if (current_node->get_idle_time () >= MAX_USER_TIMEOUT) np->inactive_count_++; else np->active_count_++; } return prp; } // Put the inactive and active counts, plus the hostname into the // packet. char * PM_Server::handle_protocol_entries (char *buf_ptr, Drwho_Node *np) { for (; np != 0; np = np->next_) { ACE_OS::sprintf (buf_ptr, "%d %d %s", np->get_inactive_count (), np->get_active_count (), np->get_host_name ()); buf_ptr += ACE_OS::strlen (buf_ptr) + 1; } return buf_ptr; } PM_Server::PM_Server () { } PM_Server::~PM_Server () { } ace-8.0.4+dfsg.orig/apps/drwho/HT_Server.cpp0000644000175000017500000000214615027201773017625 0ustar sudipsudip#include "HT_Server.h" #include "ace/ACE.h" #include "ace/OS_NS_string.h" #include "ace/OS_Memory.h" // Insert a KEY_NAME into the hash table, if it doesn't already exist // there. What gets returned is a pointer to the node inserted. Note // that we do our own memory allocation here... Protocol_Record * HT_Server::insert (const char *key_name, int max_len) { Protocol_Record **prpp = 0; // This is tricky... for (prpp = &this->hash_table[ACE::hash_pjw (key_name) % this->hash_table_size]; *prpp != 0 && ACE_OS::strncmp ((*prpp)->get_login (), key_name, max_len) != 0; prpp = &(*prpp)->next_) continue; if (*prpp == 0) { // Remember, the server must be very careful about stuff it // receives from the rwho manager, since it may not be // NUL-terminated. That's why we use ACE::strnnew ()... ACE_NEW_RETURN (*prpp, Protocol_Record (ACE::strnnew (key_name, max_len), *prpp), 0); this->count_++; } return *prpp; } ace-8.0.4+dfsg.orig/apps/drwho/CM_Client.h0000644000175000017500000000177015027201773017230 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file CM_Client.h * * Provides a virtual communcations layer for the client in the * drwho program. * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _CM_CLIENT_H #define _CM_CLIENT_H #include "Comm_Manager.h" #include "ace/Time_Value.h" /** * @class CM_Client * * @brief Provides a virtual communcations layer for the client in the * drwho program. */ class CM_Client : public Comm_Manager { public: /// Constructor. CM_Client (); /// Destructor. virtual ~CM_Client (); virtual int mux (char *packet, int &packet_length) = 0; virtual int demux (char *packet, int &packet_length) = 0; virtual int open (short port_number); virtual int receive (int timeout = 0); virtual int send (); private: fd_set read_fd_; ACE_Time_Value time_out_; ACE_Time_Value *top_; }; #endif /* _CM_CLIENT_H */ ace-8.0.4+dfsg.orig/apps/drwho/PMS_Flo.cpp0000644000175000017500000000404615027201773017224 0ustar sudipsudip#include "Options.h" #include "BS_Server.h" #include "PMS_Flo.h" #include "ace/ACE.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_Memory.h" // This function packs the located friends userids, plus the machines // they are logged into (along with the inactive and active counts on // each machine) into a buffer that is subsequently transmitted back // to the client across the network. int PMS_Flo::encode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUGGING) != 0) ACE_DEBUG ((LM_DEBUG, "in PMS_Flo::encode")); Protocol_Record *prp; char *buf_ptr = packet; ACE_OS::sprintf (buf_ptr, "Users %d", this->get_total_users ()); buf_ptr += ACE_OS::strlen (buf_ptr) + 1; // We only send back info on friends that we actually see logged in. for (; (prp = this->get_next_friend ()) != 0; *buf_ptr++ = '\t') buf_ptr = this->handle_protocol_entries (ACE_OS::strecpy (buf_ptr, prp->get_login ()), prp->get_drwho_list ()); *buf_ptr++ = '\n'; packet_length = buf_ptr - packet; if (Options::get_opt (Options::DEBUGGING) != 0) { ACE_DEBUG ((LM_DEBUG, "packet_length = %d\n", packet_length)); ACE_OS::write (ACE_STDERR, packet, packet_length); ACE_DEBUG ((LM_DEBUG, "\n")); } return 1; } // This function takes a packet received from the client and calls the // appropriate Protocol_Manager routine to build the local table of // friends. int PMS_Flo::decode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUGGING) != 0) ACE_DEBUG ((LM_DEBUG, "in PMS_Flo::decode, packet_length = %d\n", packet_length)); ACE_NEW_RETURN (this->ss, BS_Server (packet), -1); return 1; } PMS_Flo::PMS_Flo () { } ace-8.0.4+dfsg.orig/apps/drwho/HT_Client.cpp0000644000175000017500000000161615027201773017576 0ustar sudipsudip#include "HT_Client.h" #include "ace/ACE.h" #include "ace/OS_NS_string.h" #include "ace/OS_Memory.h" // Insert a KEY_NAME into the hash table, if it doesn't already exist // there. What gets returned is a pointer to the node inserted. Note // that we do our own memory allocation here... Protocol_Record * HT_Client::insert (const char *key_name, int max_len) { Protocol_Record **prpp = 0; // This is tricky... for (prpp = &this->hash_table[ACE::hash_pjw (key_name) % this->hash_table_size]; *prpp != 0 && ACE_OS::strncmp ((*prpp)->get_login (), key_name, max_len) != 0; prpp = &(*prpp)->next_) continue; if (*prpp == 0) { ACE_NEW_RETURN (*prpp, Protocol_Record (ACE::strnew (key_name), *prpp), 0); this->count_++; } return *prpp; } ace-8.0.4+dfsg.orig/apps/drwho/Comm_Manager.h0000644000175000017500000000157615027201773017764 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Comm_Manager.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _COMM_MANAGER_H #define _COMM_MANAGER_H #include "global.h" #include "ace/os_include/netinet/os_in.h" class Comm_Manager { public: virtual ~Comm_Manager (); // = TITLE // Provides a virtual communcations layer for the drwho program. protected: char recv_packet_[UDP_PACKET_SIZE]; char send_packet_[UDP_PACKET_SIZE]; sockaddr_in sin_; int sokfd_; virtual int mux (char *packet, int &packet_length) = 0; virtual int demux (char *packet, int &packet_length) = 0; virtual int open (short port_number) = 0; virtual int receive (int timeout = 0) = 0; virtual int send () = 0; }; #endif /* _COMM_MANAGER_H */ ace-8.0.4+dfsg.orig/apps/drwho/PMC_Ruser.cpp0000644000175000017500000001171415027201773017564 0ustar sudipsudip#include "global.h" #include "Options.h" #include "HT_Client.h" #include "PMC_Ruser.h" #include "ace/ACE.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_stdlib.h" #include "ace/OS_Memory.h" #include "ace/os_include/os_netdb.h" // This function is pretty much a no-op that just sets up the // appropriate lookup function to use. int PMC_Ruser::encode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUGGING) != 0) ACE_DEBUG ((LM_DEBUG, "in PMC_Ruser::encode\n")); ACE_NEW_RETURN (this->ss, HT_Client, -1); SET_PACKET_TYPE (packet, Options::PROTO_RUSER); char *buf_ptr = SKIP_PACKET_TYPE (packet); *buf_ptr++ = char (Options::get_opt (Options::PRINT_LOGIN_NAME)); packet_length = buf_ptr - packet; return 1; } // This method is responsible for transforming the msg from the server // back into a form usable by the client. Note that it reads the // REAL_NAME from the packet (since the server placed it there)... int PMC_Ruser::decode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUGGING) != 0) { ACE_DEBUG ((LM_DEBUG, "in PMC_Ruser::decode, packet_length = %d\n", packet_length)); ACE_OS::write (ACE_STDERR, packet, packet_length); ACE_DEBUG ((LM_DEBUG, "\n")); } char *cp = packet; int remote_users = 0; sscanf (cp, "Users %d", &remote_users); this->increment_total_users (remote_users); for (cp = (char *) ACE::strend (cp); *cp != '\n'; cp++) { char *host_name = cp; for (cp = (char *) ACE::strend (cp); *(cp = this->handle_protocol_entries (cp, host_name)) != '\t'; ) continue; } return 1; } Protocol_Record * PMC_Ruser::insert_protocol_info (Protocol_Record &protocol_record) { Protocol_Record *prp = this->ss->insert (protocol_record.get_host (), MAXHOSTNAMELEN); Drwho_Node *current_node = protocol_record.get_drwho_list (); Drwho_Node *np = this->get_drwho_node (ACE::strnnew (current_node->get_login_name (), MAXUSERIDNAMELEN), prp->drwho_list_); int length = ACE_OS::strlen (prp->get_host ()); np->set_real_name (ACE::strnew (current_node->get_real_name ())); if (np->get_active_count () < current_node->get_active_count ()) np->set_active_count (current_node->get_active_count ()); if (np->get_inactive_count () < current_node->get_inactive_count()) np->set_inactive_count (current_node->get_inactive_count ()); if (length > this->max_key_length) this->max_key_length = length; return prp; } char * PMC_Ruser::handle_protocol_entries (const char *cp, const char *host_name, const char *) { static Protocol_Record protocol_record (1); Drwho_Node *current_node = protocol_record.get_drwho_list (); protocol_record.set_host (host_name); current_node->set_inactive_count (ACE_OS::atoi (cp)); current_node->set_active_count (ACE_OS::atoi (cp = ACE_OS::strchr (cp, ' ') + 1)); current_node->set_login_name (cp = ACE_OS::strchr (cp, ' ') + 1); current_node->set_real_name (cp = ACE_OS::strchr (cp, '\0') + 1); this->insert_protocol_info (protocol_record); return (char *) ACE::strend (cp); } void PMC_Ruser::process () { const char *(Drwho_Node::*get_name)(); if (Options::get_opt (Options::PRINT_LOGIN_NAME)) get_name = &Drwho_Node::get_login_name; else get_name = &Drwho_Node::get_real_name; for (Protocol_Record *prp; (prp = this->Protocol_Manager::get_each_friend ()) != 0; ) { ACE_DEBUG ((LM_DEBUG, "%-*s ", this->max_key_length, prp->get_host ())); for (Drwho_Node *np = prp->get_drwho_list (); ;) { ACE_DEBUG ((LM_DEBUG, "%s", (np->*get_name) ())); if (np->get_inactive_count () != 0) { if (np->get_active_count () != 0) ACE_DEBUG ((LM_DEBUG, "*(%d)", np->get_active_count ())); } else if (np->get_active_count () > 1) ACE_DEBUG ((LM_DEBUG, "*(%d)", np->get_active_count ())); else if (np->get_active_count () == 1) ACE_DEBUG ((LM_DEBUG, "*")); np = np->next_; if (np == 0) break; else if (Options::get_opt (Options::PRINT_LOGIN_NAME)) ACE_DEBUG ((LM_DEBUG, " ")); else ACE_DEBUG ((LM_DEBUG, ", ")); } ACE_DEBUG ((LM_DEBUG, "\n")); } } PMC_Ruser::PMC_Ruser () { } ace-8.0.4+dfsg.orig/apps/drwho/Comm_Manager.cpp0000644000175000017500000000007615027201773020311 0ustar sudipsudip#include "Comm_Manager.h" Comm_Manager::~Comm_Manager () { } ace-8.0.4+dfsg.orig/apps/drwho/BS_Server.cpp0000644000175000017500000000640515027201773017620 0ustar sudipsudip#include "BS_Server.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_stdlib.h" #include "ace/OS_Memory.h" #include "ace/os_include/os_netdb.h" // This constructor takes a message of sorted login names and loads up // the symbol table on the server's side. It assumes that the number // of friends is stored in the first MAXUSERIDNAMELEN bytes of the // packet. Note that we assume that the client sends the login names // in sorted order, so we don't bother sorting them! BS_Server::BS_Server (const char *packet) { const char *buf_ptr = packet + MAXUSERIDNAMELEN; this->count_ = ACE_OS::atoi (packet); this->buffer_ = buf_ptr; ACE_NEW (this->protocol_record_, Protocol_Record[this->count_]); ACE_NEW (this->sorted_record_, Protocol_Record *[this->count_]); for (int i = 0; i < this->count_; i++) { Protocol_Record *rec_ptr = &this->protocol_record_[i]; this->sorted_record_[i] = rec_ptr; rec_ptr->key_name1_ = buf_ptr; // Skip forward to the start of the next login name. while (*buf_ptr++ != '\0') continue; } } // Insert the HOST_NAME into the appropriate DRWHO_LIST slot if the // KEY_NAME happens to be one of our friends. Binary search is used // because the Protocol_Manager keeps a sorted representation of the // friend names. // // Note that this binary search is tuned for unsuccessful searches, // since most of the time we the KEY_NAME is *not* a friend (unless // you've got *lots* of friends)! // // Note finally that we keep a cache of the last KEY_NAME that is // looked up, as well as the result of the lookup. This speeds things // up because the whod files tend to cluster userids together. */ Protocol_Record * BS_Server::insert (const char *key_name, int max_len) { static char last_lookup[MAXHOSTNAMELEN]; static int mid = 0; static int result = 0; Protocol_Record **buffer = this->sorted_record_; // First check the cache... if (ACE_OS::strncmp (last_lookup, key_name, max_len) == 0) { if (result == 0) return 0; } else { // Store this away in the cache for the next iteration. ACE_OS::strncpy (last_lookup, key_name, max_len); int hi = this->count_ - 1; int lo = 0; int cmp = 0; while (lo < hi) { mid = (hi + lo + 1) / 2; cmp = ACE_OS::strncmp (key_name, buffer[mid]->get_login (), max_len); if (cmp < 0) hi = mid - 1; else lo = mid; } // This line is very subtle... ;-) if (!(cmp == 0 || ACE_OS::strncmp (key_name, buffer[--mid]->get_login (), max_len) == 0)) { result = 0; return 0; } } // If we get here we've located a friend. result = 1; return buffer[mid]; } // Returns the next friend in the sequence of sorted friends. Skips // over the entries that don't have any hosts associated with them // (because these entries weren't on the server machine. */ Protocol_Record * BS_Server::get_next_entry () { for (Protocol_Record *prp = Binary_Search::get_next_entry (); prp != 0; prp = Binary_Search::get_next_entry ()) if (prp->get_drwho_list () != 0) return prp; return 0; } ace-8.0.4+dfsg.orig/apps/drwho/SM_Client.h0000644000175000017500000000124515027201773017245 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file SM_Client.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _SM_CLIENT_H #define _SM_CLIENT_H #include "PM_Client.h" #include "CM_Client.h" #include "Select_Manager.h" class SM_Client : public Select_Manager, public CM_Client { public: SM_Client (); virtual ~SM_Client (); virtual int mux (char *packet, int &packet_length); virtual int demux (char *packet, int &packet_length); virtual void process (); private: PM_Client *pm_client; }; #endif /* _SM_CLIENT_H */ ace-8.0.4+dfsg.orig/apps/drwho/Select_Manager.h0000644000175000017500000000106315027201773020277 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Select_Manager.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _SELECT_MANAGER_H #define _SELECT_MANAGER_H class Select_Manager { public: virtual ~Select_Manager (); virtual int mux (char *packet, int &packet_length) = 0 ; virtual int demux (char *packet, int &packet_length) = 0; }; #endif /* _SELECT_MANAGER_H */ ace-8.0.4+dfsg.orig/apps/drwho/PMS_Ruser.h0000644000175000017500000000142515027201773017247 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file PMS_Ruser.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _PMS_RUSER_H #define _PMS_RUSER_H #include "PM_Server.h" /** * @class PMS_Ruser * * @brief Provides the server's lookup table abstraction for `ruser' users... */ class PMS_Ruser : public PM_Server { public: PMS_Ruser (); protected: virtual char *handle_protocol_entries (char *bp, Drwho_Node *hp); virtual Protocol_Record *insert_protocol_info (Protocol_Record &protocol_record); virtual int encode (char *packet, int &total_bytes); virtual int decode (char *packet, int &total_bytes); }; #endif /* _PMS_RUSER_H */ ace-8.0.4+dfsg.orig/apps/drwho/Search_Struct.cpp0000644000175000017500000000052315027201773020532 0ustar sudipsudip#include "Options.h" #include "Search_Struct.h" #include "ace/Log_Msg.h" Search_Struct::~Search_Struct () { if (Options::get_opt (Options::DEBUGGING)) ACE_DEBUG ((LM_DEBUG, "disposing Search_Struct\n")); } Search_Struct::Search_Struct () : count_ (0) {} int Search_Struct::n_elems () { return this->count_; } ace-8.0.4+dfsg.orig/apps/drwho/PM_Server.h0000644000175000017500000000156215027201773017274 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file PM_Server.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _PM_SERVER_H #define _PM_SERVER_H #include "Protocol_Manager.h" /** * @class PM_Server * * @brief Handle the server's lookup table abstraction. */ class PM_Server : public Protocol_Manager { public: PM_Server (); virtual ~PM_Server (); virtual int encode (char *packet, int &total_bytes) = 0; virtual int decode (char *packet, int &total_bytes) = 0; virtual int process (); protected: virtual char *handle_protocol_entries (char *bp, Drwho_Node *hp); virtual Protocol_Record *insert_protocol_info (Protocol_Record &protocol_record); }; #endif /* _PM_SERVER_H */ ace-8.0.4+dfsg.orig/apps/drwho/Drwho_Node.h0000644000175000017500000000214415027201773017457 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Drwho_Node.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _DRWHO_NODE_H #define _DRWHO_NODE_H #include "global.h" /** * @class Drwho_Node * * @brief Stores information about a host for a specific friend. */ class Drwho_Node { public: Drwho_Node (const char *host, Drwho_Node *next); Drwho_Node (); int get_active_count (); int get_inactive_count (); int set_active_count (int count); int set_inactive_count (int count); int set_idle_time (int idle_time); int get_idle_time (); const char *get_host_name (); const char *set_host_name (const char *str); const char *get_login_name (); const char *set_login_name (const char *); const char *get_real_name (); const char *set_real_name (const char *); const char *key_name1_; const char *key_name2_; const char *tty_name_; int idle_time_; int active_count_; int inactive_count_; Drwho_Node *next_; }; #endif /* _DRWHO_NODE_H */ ace-8.0.4+dfsg.orig/apps/drwho/PMC_All.cpp0000644000175000017500000000441315027201773017172 0ustar sudipsudip#include "global.h" #include "Options.h" #include "HT_Client.h" #include "PMC_All.h" #include "ace/ACE.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_Memory.h" // This function is pretty much a no-op that just sets up the // appropriate lookup function to use. int PMC_All::encode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUGGING) != 0) ACE_DEBUG ((LM_DEBUG, "in PMC_All::encode\n")); ACE_NEW_RETURN (this->ss, HT_Client, -1); SET_PACKET_TYPE (packet, Options::PROTO_ALL); char *buf_ptr = SKIP_PACKET_TYPE (packet); packet_length = buf_ptr - packet; return 1; } // This method is responsible for transforming the msg from the server // back into a form usable by the client. Note that it reads the // REAL_NAME from the packet (since the server placed it there)... int PMC_All::decode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUGGING) != 0) { ACE_DEBUG ((LM_DEBUG, "in PMC_All::decode, packet_length = %d\n", packet_length)); ACE_OS::write (ACE_STDERR, packet, packet_length); ACE_DEBUG ((LM_DEBUG, "\n")); } char *cp = packet; int remote_users = 0; sscanf (cp, "Users %d", &remote_users); this->increment_total_users (remote_users); for (cp = (char *) ACE::strend (cp); *cp != '\n'; cp++) { // Skip over the LOGIN_NAME. char *login_name = cp; char *real_name = cp = (char *) ACE::strend (cp); for (cp = (char *) ACE::strend (cp); *(cp = this->handle_protocol_entries (cp, login_name, real_name)) != '\t'; ) continue; } return 1; } Protocol_Record * PMC_All::insert_protocol_info (Protocol_Record &protocol_record) { Protocol_Record *prp = PM_Client::insert_protocol_info (protocol_record); int length = ACE_OS::strlen (prp->set_real (ACE::strnew (protocol_record.get_real ()))); if (length > this->max_key_length) this->max_key_length = length; return prp; } void PMC_All::process () { ACE_DEBUG ((LM_DEBUG, "remote users logged on\n")); PM_Client::process (); } PMC_All::PMC_All () { } ace-8.0.4+dfsg.orig/apps/drwho/HT_Server.h0000644000175000017500000000113415027201773017266 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file HT_Server.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _HT_SERVER_H #define _HT_SERVER_H #include "Hash_Table.h" /** * @class HT_Server * * @brief Provides the server's hash table abstraction. */ class HT_Server : public Hash_Table { public: virtual Protocol_Record *insert (const char *key_name, int max_len = MAXUSERIDNAMELEN); }; #endif /* _HT_SERVER_H */ ace-8.0.4+dfsg.orig/apps/drwho/BS_Server.h0000644000175000017500000000234515027201773017264 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file BS_Server.h * * Provides the server's binary search lookup table abstraction. * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _BS_SERVER_H #define _BS_SERVER_H #include "Binary_Search.h" /** * @class BS_Server * * @brief Provides the server's binary search lookup table abstraction. */ class BS_Server : public Binary_Search { public: // = Initialization. BS_Server (const char *packet); /** * This function is used to merge the from server * into the sorted list of userids kept on the client's * side. */ virtual Protocol_Record *insert (const char *key_name, int max_len = MAXUSERIDNAMELEN); /** * An iterator, similar to Binary_Search::get_next_friend, though in * this case the friend records are returned in the order they * appeared in the friend file, rather than in sorted order. Also, * we skip over entries that don't have any hosts associated with * them. */ virtual Protocol_Record *get_next_entry (); }; #endif /* _BS_SERVER_H */ ace-8.0.4+dfsg.orig/apps/drwho/Protocol_Manager.cpp0000644000175000017500000000341515027201773021217 0ustar sudipsudip#include "ace/config-all.h" #include "ace/Log_Msg.h" #include "ace/OS_Memory.h" #include "ace/OS_NS_string.h" #include "Options.h" #include "Protocol_Manager.h" // Returns a pointer to the Drwho_Node associated with HOST_NAME (if // it exists, otherwise a new node is created. Note that if a // Drwho_Node is found it is moved to the front of the list so that // subsequent finds are faster (i.e., self-organizing!) Drwho_Node * Protocol_Manager::get_drwho_node (char *key_name, Drwho_Node *&head) { Drwho_Node **temp = &head; for (; *temp != 0; temp = &(*temp)->next_) if (ACE_OS::strcmp (key_name, (*temp)->get_login_name ()) == 0) break; if (*temp == 0) ACE_NEW_RETURN (head, Drwho_Node (key_name, head), 0); else { Drwho_Node *t = *temp; *temp = (*temp)->next_; t->next_ = head; head = t; } return head; } Protocol_Manager::Protocol_Manager () : total_users (0) { } Protocol_Manager::~Protocol_Manager () { if (Options::get_opt (Options::DEBUGGING)) ACE_DEBUG ((LM_DEBUG, "disposing Protocol_Manager\n")); } // Returns the next friend in the sequence of sorted friends. Protocol_Record * Protocol_Manager::get_next_friend () { return this->ss->get_next_entry (); } Protocol_Record * Protocol_Manager::get_each_friend () { return this->ss->get_each_entry (); } // Returns the number of friends. int Protocol_Manager::friend_count () { return this->ss->n_elems (); } // Returns total number of users logged in throughout the system. int Protocol_Manager::get_total_users () { return Protocol_Manager::total_users; } void Protocol_Manager::increment_total_users (int remote_users) { Protocol_Manager::total_users += remote_users; } ace-8.0.4+dfsg.orig/apps/drwho/SM_Client.cpp0000644000175000017500000000277215027201773017606 0ustar sudipsudip#include "Options.h" #include "PMC_All.h" #include "PMC_Flo.h" #include "PMC_Usr.h" #include "PMC_Ruser.h" #include "SM_Client.h" #include "ace/Log_Msg.h" #include "ace/OS_Memory.h" // Call-back function that invokes the appropriate decode function. int SM_Client::demux (char *packet, int &packet_length) { if (this->pm_client->decode (packet, packet_length) < 0) return -1; else return 1; } // Call-back function that invokes the appropriate encode function. int SM_Client::mux (char *packet, int &packet_length) { switch (Options::protocol_type) { case Options::PROTO_USR: ACE_NEW_RETURN (this->pm_client, PMC_Usr (Options::user_name), -1); break; case Options::PROTO_ALL: ACE_NEW_RETURN (this->pm_client, PMC_All, -1); break; case Options::PROTO_FLO: ACE_NEW_RETURN (this->pm_client, PMC_Flo, -1); break; case Options::PROTO_RUSER: ACE_NEW_RETURN (this->pm_client, PMC_Ruser, -1); break; default: ACE_DEBUG ((LM_DEBUG, "%s: bad protocol\n", Options::program_name)); return -1; } if (this->pm_client->encode (packet, packet_length) < 0) return -1; return 1; } SM_Client::SM_Client () { } SM_Client::~SM_Client () { } void SM_Client::process () { this->pm_client->process (); } ace-8.0.4+dfsg.orig/apps/drwho/PMS_All.cpp0000644000175000017500000000570415027201773017216 0ustar sudipsudip#include "Options.h" #include "HT_Server.h" #include "PMS_All.h" #include "ace/ACE.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_pwd.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_Memory.h" // This function packs the located friends userids, plus the machines // they are logged into (along with the inactive and active counts on // each machine) into a buffer that is subsequently transmitted back // to the client across the network. Note that this function encodes // the REAL_NAME of the user in the packet. int PMS_All::encode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUGGING) != 0) ACE_DEBUG ((LM_DEBUG, "in PMS_All::encode")); Protocol_Record *prp; char *buf_ptr = packet; ACE_OS::sprintf (buf_ptr, "Users %d", this->get_total_users ()); buf_ptr += ACE_OS::strlen (buf_ptr) + 1; // We only send back info on friends that we actually see logged in. for (; (prp = this->get_next_friend ()) != 0; *buf_ptr++ = '\t') buf_ptr = this->handle_protocol_entries (ACE_OS::strecpy (ACE_OS::strecpy (buf_ptr, prp->get_login ()), prp->get_real ()), prp->get_drwho_list ()); *buf_ptr++ = '\n'; packet_length = buf_ptr - packet; if (Options::get_opt (Options::DEBUGGING) != 0) { ACE_DEBUG ((LM_DEBUG, "packet_length = %d\n", packet_length)); ACE_OS::write (ACE_STDERR, packet, packet_length); ACE_DEBUG ((LM_DEBUG, "\n")); } return 1; } // This function takes a packet received from the client and calls the // appropriate Protocol_Manager routine to build the local table of // friends. int PMS_All::decode (char *, int &packet_length) { if (Options::get_opt (Options::DEBUGGING) != 0) ACE_DEBUG ((LM_DEBUG, "in PMS_All::decode, packet_length = %d\n", packet_length)); ACE_NEW_RETURN (this->ss, HT_Server, -1); return 1; } // We only want the user's real name, not the gecos junk after the // first leading ','. However, if the real-name is not in the // password file, just return the login name instead. Protocol_Record * PMS_All::insert_protocol_info (Protocol_Record &protocol_record) { Protocol_Record *prp = PM_Server::insert_protocol_info (protocol_record); passwd *pwent = ACE_OS::getpwnam (prp->get_login ()); char *cp = (char *) ACE_OS::strchr (prp->set_real (pwent == 0 ? prp->get_login () : ACE::strnew (pwent->pw_gecos)), ','); if (cp != 0) *cp = '\0'; return prp; } PMS_All::PMS_All () { } ace-8.0.4+dfsg.orig/apps/drwho/File_Manager.cpp0000644000175000017500000000725515027201773020303 0ustar sudipsudip#include "ace/OS_NS_stdio.h" #include "ace/OS_NS_pwd.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_ctype.h" #include "File_Manager.h" File_Manager::File_Manager () : number_of_friends (0), max_key_length (0), buffer_ptr (0), current_ptr (0), buffer_size (0) { } // Either opens the friends file (if FILENAME is not a NULL pointer) // or opens up the password file. In either case, the number of // entries in the file are returned, i.e., number of friends... int File_Manager::open_file (const char *filename) { return filename == 0 ? this->open_passwd_file () : this->open_friends_file (filename); } // Returns the next LOGIN_NAME and REAL_NAME from the file. void File_Manager::get_login_and_real_name (const char *&login_name, const char *&real_name) { char *buf_ptr = this->current_ptr; login_name = buf_ptr; // Skip to the end of the login name. while (ACE_OS::ace_isalnum (*buf_ptr)) buf_ptr++; *buf_ptr++ = '\0'; // Now skip over white space to *start* of real name! while (ACE_OS::ace_isspace (*buf_ptr) || *buf_ptr == '\0') buf_ptr++; real_name = buf_ptr; while (*buf_ptr++ != '\n') continue; // Clear the trailing blanks and junk. for (char *tmp_ptr = buf_ptr - 1; ACE_OS::ace_isspace (*tmp_ptr); tmp_ptr--) *tmp_ptr = '\0'; // Skip over consecutive blank lines. while (*buf_ptr == '\n') buf_ptr++; this->current_ptr = buf_ptr; } // Open up the yp passwd file and slurp all the users in! int File_Manager::open_passwd_file () { char *filename = const_cast ("passwd-XXXXXX"); ACE_HANDLE f = ACE_OS::mkstemp (filename); FILE *fp = ACE_OS::fdopen (f, "w"); if (fp == 0) return -1; passwd *pwent; for (ACE_OS::setpwent (); (pwent = ACE_OS::getpwent ()) != 0; ) if (*pwent->pw_gecos != '\0') { char *cp = ACE_OS::strchr (pwent->pw_gecos, ','); if (cp != 0) *cp = '\0'; ACE_OS::fprintf (fp, "%-8.8s %s\n", pwent->pw_name, pwent->pw_gecos); this->number_of_friends++; } ACE_OS::endpwent (); ACE_OS::fclose (fp); if (this->mmap_.map (filename) == -1) return -1; this->buffer_ptr = (char *) this->mmap_.addr (); this->buffer_size = this->mmap_.size (); this->current_ptr = this->buffer_ptr; return this->number_of_friends; } // This function opens up FILENAME and memory maps it in our address // space. int File_Manager::open_friends_file (const char *filename) { char directory[MAXPATHLEN]; const char *pathname = directory; // See if we've got a filename or a pathname (i.e., directory/filename). if (ACE_OS::strrchr (filename, '/') != 0) // We've got a complete pathname. pathname = filename; else { directory[0] = '\0'; const char *home = ACE_OS::getenv ("HOME"); if (home != 0) { ACE_OS::strcat (directory, home); ACE_OS::strcat (directory, "/"); } ACE_OS::strcat (directory, filename); } // Do the mmap'ing. if (this->mmap_.map (pathname) == -1) return -1; this->buffer_ptr = (char *) this->mmap_.addr (); this->buffer_size = this->mmap_.size (); this->current_ptr = this->buffer_ptr; // Determine how many friends there are by counting the newlines. for (char *cp = this->buffer_ptr + this->buffer_size; cp > this->buffer_ptr ;) if (*--cp == '\n') { this->number_of_friends++; // Skip consecutive newlines. while (cp[-1] == '\n') --cp; } return this->number_of_friends; } ACE_SINGLETON_TEMPLATE_INSTANTIATE(ACE_Singleton, File_Manager, ACE_Null_Mutex); ace-8.0.4+dfsg.orig/apps/drwho/HT_Client.h0000644000175000017500000000113415027201773017236 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file HT_Client.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _HT_CLIENT_H #define _HT_CLIENT_H #include "Hash_Table.h" /** * @class HT_Client * * @brief Provides the client's hash table abstraction. */ class HT_Client : public Hash_Table { public: virtual Protocol_Record *insert (const char *key_name, int max_len = MAXUSERIDNAMELEN); }; #endif /* _HT_CLIENT_H */ ace-8.0.4+dfsg.orig/apps/drwho/Single_Lookup.h0000644000175000017500000000154015027201773020200 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Single_Lookup.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _SINGLE_LOOKUP_H #define _SINGLE_LOOKUP_H #include "Options.h" #include "Search_Struct.h" /** * @class Single_Lookup * * Provides the client's single user lookup table abstraction. */ class Single_Lookup : public Search_Struct { public: Single_Lookup (const char *usr_name); virtual ~Single_Lookup (); virtual Protocol_Record *insert (const char *key_name, int max_len = MAXUSERIDNAMELEN) = 0; virtual Protocol_Record *get_next_entry (); virtual Protocol_Record *get_each_entry (); protected: Protocol_Record *prp_; }; #endif /* _SINGLE_LOOKUP_H */ ace-8.0.4+dfsg.orig/apps/drwho/Single_Lookup.cpp0000644000175000017500000000110215027201773020525 0ustar sudipsudip#include "Options.h" #include "Single_Lookup.h" #include "ace/ACE.h" #include "ace/Log_Msg.h" #include "ace/OS_Memory.h" Single_Lookup::Single_Lookup (const char *usr_name) { ACE_NEW (this->prp_, Protocol_Record (ACE::strnew (usr_name))); } Single_Lookup::~Single_Lookup () { if (Options::get_opt (Options::DEBUGGING)) ACE_DEBUG ((LM_DEBUG, "disposing Single_Lookup\n")); } Protocol_Record * Single_Lookup::get_each_entry () { return this->prp_; } Protocol_Record * Single_Lookup::get_next_entry () { return this->get_each_entry (); } ace-8.0.4+dfsg.orig/apps/drwho/Multicast_Manager.h0000644000175000017500000000247115027201773021031 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Multicast_Manager.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _MULTICAST_MANAGER_H #define _MULTICAST_MANAGER_H #include "global.h" #include "ace/os_include/netinet/os_in.h" #include "ace/os_include/os_netdb.h" class Host_Elem { public: const char *host_name; in_addr host_addr; int checked_off; Host_Elem *next; Host_Elem (const char *h_name, Host_Elem *n); }; /** * @class Multicast_Manager * * @brief This file handles all the operations upon host machines names * and addresses. */ class Multicast_Manager { public: static void add_host (const char *host_name); static void checkoff_host (in_addr host_addr); static int get_next_host_addr (in_addr &host_addr); static int outstanding_hosts_remain (); static int get_next_non_responding_host (const char *&host_name); static int insert_hosts_from_file (const char *filename); static void insert_default_hosts (); private: static hostent *get_host_entry (const char *host); static int received_host_count; static const char *host_names[]; static Host_Elem *drwho_list; static Host_Elem *current_ptr; }; #endif /* _MULTICAST_MANAGER_H */ ace-8.0.4+dfsg.orig/apps/drwho/PMS_Ruser.cpp0000644000175000017500000000762515027201773017612 0ustar sudipsudip#include "Options.h" #include "HT_Server.h" #include "PMS_Ruser.h" #include "ace/ACE.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_pwd.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_Memory.h" #include "ace/os_include/os_netdb.h" // This function packs the located friends userids, plus the machines // they are logged into (along with the inactive and active counts on // each machine) into a buffer that is subsequently transmitted back // to the client across the network. Note that this function encodes // the REAL_NAME of the user in the packet. int PMS_Ruser::encode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUGGING) != 0) ACE_DEBUG ((LM_DEBUG, "in PMS_Ruser::encode")); Protocol_Record *prp; char *buf_ptr = packet; ACE_OS::sprintf (buf_ptr, "Users %d", this->get_total_users ()); buf_ptr += ACE_OS::strlen (buf_ptr) + 1; // We only send back info on hosts that we actually see. for (; (prp = this->get_next_friend ()) != 0; *buf_ptr++ = '\t') buf_ptr = this->handle_protocol_entries (ACE_OS::strecpy (buf_ptr, prp->get_host ()), prp->get_drwho_list ()); *buf_ptr++ = '\n'; packet_length = buf_ptr - packet; if (Options::get_opt (Options::DEBUGGING) != 0) { ACE_DEBUG ((LM_DEBUG, "packet_length = %d\n", packet_length)); ACE_OS::write (ACE_STDERR, packet, packet_length); ACE_DEBUG ((LM_DEBUG, "\n")); } return 1; } // This function takes a packet received from the client and crusers // the appropriate Protocol_Manager routine to build the local table // of friends. int PMS_Ruser::decode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUGGING) != 0) ACE_DEBUG ((LM_DEBUG, "in PMS_Ruser::decode, packet_length = %d\n", packet_length)); if (*packet) Options::set_opt (Options::PRINT_LOGIN_NAME); ACE_NEW_RETURN (this->ss, HT_Server, -1); return 1; } Protocol_Record * PMS_Ruser::insert_protocol_info (Protocol_Record &protocol_record) { Drwho_Node *current_node = protocol_record.get_drwho_list (); Protocol_Record *prp = this->ss->insert (current_node->get_host_name (), MAXHOSTNAMELEN); Drwho_Node *np = this->get_drwho_node (ACE::strnnew (protocol_record.get_login (), MAXUSERIDNAMELEN), prp->drwho_list_); if (Options::get_opt (Options::PRINT_LOGIN_NAME)) np->set_real_name (""); else { passwd *pwent = ACE_OS::getpwnam (np->get_login_name ()); char *cp = (char *) ACE_OS::strchr (np->set_real_name (pwent == 0 ? np->get_login_name () : ACE::strnew (pwent->pw_gecos)), ','); if (cp != 0) *cp = '\0'; } if (current_node->get_idle_time () >= MAX_USER_TIMEOUT) np->inactive_count_++; else np->active_count_++; return prp; } char * PMS_Ruser::handle_protocol_entries (char *buf_ptr, Drwho_Node *np) { for (; np != 0; np = np->next_) { ACE_OS::sprintf (buf_ptr, "%d %d ", np->get_inactive_count (), np->get_active_count ()); buf_ptr += ACE_OS::strlen (buf_ptr); buf_ptr = ACE_OS::strecpy (ACE_OS::strecpy (buf_ptr, np->get_login_name ()), np->get_real_name ()); } return buf_ptr; } PMS_Ruser::PMS_Ruser () { } ace-8.0.4+dfsg.orig/apps/drwho/PMS_Flo.h0000644000175000017500000000115515027201773016667 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file PMS_Flo.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _PMS_FLO_H #define _PMS_FLO_H #include "PM_Server.h" /** * @class PMS_Flo * * @brief Provides the server's lookup table abstraction for `flo' users... */ class PMS_Flo : public PM_Server { public: PMS_Flo (); protected: virtual int encode (char *packet, int &total_bytes); virtual int decode (char *packet, int &total_bytes); }; #endif /* _PMS_FLO_H */ ace-8.0.4+dfsg.orig/apps/drwho/PMC_Usr.h0000644000175000017500000000126215027201773016677 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file PMC_Usr.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _PMC_USR_H #define _PMC_USR_H #include "PM_Client.h" /** * @class PMC_Usr * * @brief Provides the client's lookup table abstraction for `Usr' users... */ class PMC_Usr : public PM_Client { public: PMC_Usr (char *usr_name); virtual void process (); protected: virtual int encode (char *packet, int &total_bytes); virtual int decode (char *packet, int &total_bytes); private: char *usr_name; }; #endif /* _PMC_USR_H */ ace-8.0.4+dfsg.orig/apps/drwho/PMS_Usr.h0000644000175000017500000000115515027201773016720 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file PMS_Usr.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _PMS_USR_H #define _PMS_USR_H #include "PM_Server.h" /** * @class PMS_Usr * * @brief Provides the client's lookup table abstraction for `Usr' users... */ class PMS_Usr : public PM_Server { public: PMS_Usr (); protected: virtual int encode (char *packet, int &total_bytes); virtual int decode (char *packet, int &total_bytes); }; #endif /* _PMS_USR_H */ ace-8.0.4+dfsg.orig/apps/drwho/SM_Server.cpp0000644000175000017500000000260215027201773017626 0ustar sudipsudip#include "Options.h" #include "PMS_All.h" #include "PMS_Flo.h" #include "PMS_Usr.h" #include "PMS_Ruser.h" #include "SM_Server.h" #include "ace/Log_Msg.h" #include "ace/OS_Memory.h" int SM_Server::demux (char *packet, int &packet_length) { switch (GET_PACKET_TYPE (packet)) { case Options::PROTO_USR: ACE_NEW_RETURN (this->pm_server, PMS_Usr, -1); break; case Options::PROTO_ALL: ACE_NEW_RETURN (this->pm_server, PMS_All, -1); break; case Options::PROTO_FLO: ACE_NEW_RETURN (this->pm_server, PMS_Flo, -1); break; case Options::PROTO_RUSER: ACE_NEW_RETURN (this->pm_server, PMS_Ruser, -1); break; default: ACE_DEBUG ((LM_DEBUG, "%s: bad protocol\n", Options::program_name)); return -1; } packet_length = SUBTRACT_PACKET_TYPE (packet_length); if (pm_server->decode (SKIP_PACKET_TYPE (packet), packet_length) < 0) return -1; if (pm_server->process () < 0) return -1; return 1; } int SM_Server::mux (char *packet, int &packet_length) { return pm_server->encode (packet, packet_length); } SM_Server::SM_Server () { } SM_Server::~SM_Server () { } ace-8.0.4+dfsg.orig/apps/drwho/Binary_Search.h0000644000175000017500000000363515027201773020146 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Binary_Search.h * * Defines a binary search abstraction for friend records. * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _BINARY_SEARCH_H #define _BINARY_SEARCH_H #include "Search_Struct.h" /** * @class Binary_Search * * @brief Defines a binary search abstraction for friend records. */ class Binary_Search : public Search_Struct { public: /// Initialize the values for the iterators... Binary_Search (); /// Destructor. virtual ~Binary_Search (); /** * Returns the next friend in the sequence of sorted friends. Note * that this function would be simplified if we expanded the * iterator interface to include an "initialize" and "next" * function! */ virtual Protocol_Record *get_next_entry (); /** * An iterator, similar to Binary_Search::get_next_friend, though in * this case the friend records are returned in the order they * appeared in the friend file, rather than in sorted order. Also, * we skip over entries that don't have any hosts associated with * them. */ virtual Protocol_Record *get_each_entry (); /** * This function is used to merge the from server * into the sorted list of userids kept on the client's * side. */ virtual Protocol_Record *insert (const char *key_name, int max_len = MAXUSERIDNAMELEN) = 0; /// This function is passed to qsort to perform the comparison /// between login names for two friends. static int name_compare (const void *, const void *); protected: Protocol_Record **current_ptr_; int current_index_; Protocol_Record *protocol_record_; Protocol_Record **sorted_record_; const char *buffer_; int buffer_size_; }; #endif /* _BINARY_SEARCH_H */ ace-8.0.4+dfsg.orig/apps/drwho/Search_Struct.h0000644000175000017500000000155715027201773020207 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Search_Struct.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _SEARCH_STRUCT_H #define _SEARCH_STRUCT_H #include "Protocol_Record.h" /** * @class Search_Struct * * @brief Provides an "Abstract Base Class" lookup table abstraction that * stores and manipulates friend records. */ class Search_Struct { public: Search_Struct (); virtual ~Search_Struct (); virtual int n_elems (); virtual Protocol_Record *insert (const char *key_name, int max_len = MAXUSERIDNAMELEN) = 0; virtual Protocol_Record *get_next_entry () = 0; virtual Protocol_Record *get_each_entry () = 0; protected: int count_; }; #endif /* _SEARCH_STRUCT_H */ ace-8.0.4+dfsg.orig/apps/drwho/SML_Server.h0000644000175000017500000000066615027201773017417 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file SML_Server.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _SML_SERVER_H #define _SML_SERVER_H #include "SM_Server.h" class SML_Server : public SM_Server { public: SML_Server (); virtual ~SML_Server (); }; #endif /* _SML_SERVER_H */ ace-8.0.4+dfsg.orig/apps/drwho/PMS_Usr.cpp0000644000175000017500000000425215027201773017254 0ustar sudipsudip#include "Options.h" #include "SL_Server.h" #include "PMS_Usr.h" #include "ace/ACE.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_Memory.h" // This function "encodes" a list of friends by putting the userid's in // a contiguous block. This block can then be transmitted over to the // network to servers on other subnets. Several things are added to // make decoding easier on the other end: // // * A count of the number of friends is prepended (assumption: there // are no more than 9999999 friends... ;-)) // * The login userids are separated by a single space. */ int PMS_Usr::encode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUGGING) != 0) ACE_DEBUG ((LM_DEBUG, "in PMS_Usr::encode")); char *buf_ptr = packet; // We only send back info on friend that is actually logged in. Protocol_Record *prp = this->get_next_friend (); if (prp) { buf_ptr = this->handle_protocol_entries (ACE_OS::strecpy (buf_ptr, prp->get_login ()), prp->get_drwho_list ()); *buf_ptr++ = '\t'; } *buf_ptr++ = '\n'; packet_length = buf_ptr - packet; if (Options::get_opt (Options::DEBUGGING) != 0) { ACE_DEBUG ((LM_DEBUG, "packet_length = %d\n", packet_length)); ACE_OS::write (ACE_STDERR, packet, packet_length); ACE_DEBUG ((LM_DEBUG, "\n")); } return 1; } // This function takes a packet received from the client and calls the // appropriate Protocol_Manager routine to build the local table of // friends. int PMS_Usr::decode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUGGING) != 0) { ACE_DEBUG ((LM_DEBUG, "in PMS_Usr::decode, packet_length = %d\n", packet_length)); ACE_OS::write (ACE_STDERR, packet, packet_length); ACE_DEBUG ((LM_DEBUG, "\n")); } ACE_NEW_RETURN (this->ss, SL_Server (packet), -1); return 1; } PMS_Usr::PMS_Usr () { } ace-8.0.4+dfsg.orig/apps/drwho/PMC_Flo.cpp0000644000175000017500000000577615027201773017217 0ustar sudipsudip#include "Options.h" #include "BS_Client.h" #include "PMC_Flo.h" #include "ace/ACE.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_Memory.h" // This function "encodes" a list of friends by putting the userid's // in a contiguous block. This block can then be transmitted over to // the network to servers on other subnets. Several things are added // to make decoding easier on the other end: // // * A count of the number of friends is prepended (assumption: there // are no more than 9999999 friends... ;-)) // * The login userids are separated by a single space. */ int PMC_Flo::encode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUGGING) != 0) ACE_DEBUG ((LM_DEBUG, "in PMC_Flo::encode")); ACE_NEW_RETURN (this->ss, BS_Client, -1); SET_PACKET_TYPE (packet, Options::PROTO_FLO); char *buf_ptr = SKIP_PACKET_TYPE (packet); ACE_OS::sprintf (buf_ptr, "%d", this->friend_count ()); buf_ptr += MAXUSERIDNAMELEN; // Iterate through all the friends, copying them into the packet // buffer. for (Protocol_Record *prp; (prp = this->get_next_friend ()) != 0; ) buf_ptr = ACE_OS::strecpy (buf_ptr, prp->get_login ()); packet_length = buf_ptr - packet; if (Options::get_opt (Options::DEBUGGING) != 0) { ACE_DEBUG ((LM_DEBUG, "packet_length = %d\n", packet_length)); ACE_OS::write (ACE_STDERR, packet, packet_length); ACE_DEBUG ((LM_DEBUG, "\n")); } return 1; } // This method is responsible for transforming the msg from the server // back into a form usable by the client. int PMC_Flo::decode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUGGING) != 0) { ACE_DEBUG ((LM_DEBUG, "in PMC_Flo::decode, packet_length = %d\n", packet_length)); ACE_OS::write (ACE_STDERR, packet, packet_length); ACE_DEBUG ((LM_DEBUG, "\n")); } char *cp = packet; int remote_users = 0; sscanf (cp, "Users %d", &remote_users); this->increment_total_users (remote_users); for (cp = (char *) ACE::strend (cp); *cp != '\n'; cp++) { char *login_name = cp; for (cp = (char *) ACE::strend (cp); *(cp = this->handle_protocol_entries (cp, login_name)) != '\t'; ) continue; } return 1; } Protocol_Record * PMC_Flo::insert_protocol_info (Protocol_Record &protocol_record) { Protocol_Record *prp = PM_Client::insert_protocol_info (protocol_record); int length = ACE_OS::strlen (prp->get_real ()); if (length > this->max_key_length) this->max_key_length = length; return prp; } void PMC_Flo::process () { ACE_DEBUG ((LM_DEBUG, "remote friends logged on\n")); PM_Client::process (); } PMC_Flo::PMC_Flo () { } ace-8.0.4+dfsg.orig/apps/drwho/Options.cpp0000644000175000017500000001150215027201773017413 0ustar sudipsudip#include "ace/OS_NS_stdlib.h" #include "ace/Get_Opt.h" #include "ace/Log_Msg.h" #include "Options.h" #include "Multicast_Manager.h" // Initialize all the static variables. // Contains bit-mask for options. u_int Options::option_word = 0; // Which protocol are we using? Options::Protocol_Types Options::protocol_type = Options::PROTO_FLO; // User name for quick lookups. char *Options::user_name = 0; // Port number for client/server. short Options::port_number = PORT_NUMBER; // Maximum time the client waits for servers to timeout. int Options::max_server_timeout = 5; // Name of the program. char *Options::program_name; // Default name of file that stores friend info. const char *Options::friend_file = FRIEND_FILE; void Options::print_usage_and_die (int long_msg) { ACE_DEBUG ((LM_DEBUG, "usage: %s %s", program_name, long_msg ? "\n" "-?\tprints a short usage message\n" "-A\tappend the following hostname to the list of predefined hostnames.\n" "-a\treturn information on *all* users remotely logged in (uses yp passwd).\n" "-b\trun the server in the background (i.e., as a daemon).\n" "-d\tturn on debugging.\n" "-F\tuse the following file contents to initialize the host list.\n" "-f\tuse the following file contents to initialize the friends database.\n" "-H\tuse the following hostname as part of the new list of hostnames.\n" "\t(this option overwrites the existing default names).\n" "-h\tprint a long usage message.\n" "-L\tprint the login name rather than the real name (which is the default).\n" "-l\tprint information in long format (works for all protocols).\n" "-p\tset the port number (server must correspond).\n" "-r\tdo the remote lookups (i.e., local operations are the default).\n" "-R\tprint info using the rusers format.\n" "-s\tsort the output by login name.\n" "-S\tsort the output by real name.\n" "-t\tset the amount of time we wait for servers to timeout.\n" "-w\treturn information on just one user.\n" : "[-?haAbdfFHhLlpRrtw]\n")); ACE_OS::exit (1); } void Options::set_opt (Option_Types opt) { Options::option_word |= opt; } int Options::get_opt (Option_Types opt) { return (Options::option_word & opt) != 0; } void Options::set_options (int argc, char *argv[]) { int c; int add_default_hosts = 1; Options::program_name = argv[0]; //FUZZ: disable check_for_lack_ACE_OS ACE_Get_Opt getopt (argc, argv, ACE_TEXT("?aA:bdF:f:hH:Llp:rRsSt:w:")); while ((c = getopt ()) != -1) { //FUZZ: endable check_for_lack_ACE_OS switch (c) { case '?': Options::print_usage_and_die (0); /* NOTREACHED */ case 'A': Multicast_Manager::add_host (getopt.opt_arg ()); break; case 'a': Options::protocol_type = PROTO_ALL; break; case 'b': Options::set_opt (Options::BE_A_DAEMON); break; case 'd': Options::set_opt (Options::DEBUGGING); break; case 'f': Options::friend_file = getopt.opt_arg (); break; case 'F': if (Multicast_Manager::insert_hosts_from_file (getopt.opt_arg ()) < 0) ACE_DEBUG ((LM_DEBUG, "%p%a\n", Options::program_name, 1)); add_default_hosts = 0; break; case 'H': Multicast_Manager::add_host (getopt.opt_arg ()); add_default_hosts = 0; break; case 'h': Options::print_usage_and_die (1); /* NOTREACHED */ case 'L': Options::set_opt (Options::PRINT_LOGIN_NAME); break; case 'l': Options::set_opt (Options::USE_VERBOSE_FORMAT); break; case 'p': Options::port_number = ACE_OS::atoi (getopt.opt_arg ()); break; case 'R': Options::protocol_type = PROTO_RUSER; break; case 'r': Options::set_opt (Options::REMOTE_USAGE); break; case 's': Options::set_opt (Options::SORT_BY_LOGIN_NAME); break; case 'S': Options::set_opt (Options::SORT_BY_REAL_NAME); break; case 't': Options::max_server_timeout = ACE_OS::atoi (getopt.opt_arg ()); break; case 'w': Options::user_name = getopt.opt_arg (); Options::protocol_type = PROTO_USR; break; default: break; } } if (Options::get_opt (Options::REMOTE_USAGE) && add_default_hosts) Multicast_Manager::insert_default_hosts (); } ace-8.0.4+dfsg.orig/apps/drwho/Options.h0000644000175000017500000000312015027201773017055 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Options.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _OPTIONS_H #define _OPTIONS_H #include "global.h" /** * @class Options * * @brief This file is used to provide a consolidated Options handling facility. */ class Options { public: enum Option_Types { REMOTE_USAGE = 01, PRINT_LOGIN_NAME = 02, DEBUGGING = 04, STAND_ALONE_SERVER = 010, SORT_BY_LOGIN_NAME = 020, SORT_BY_REAL_NAME = 040, USE_VERBOSE_FORMAT = 0100, BE_A_DAEMON = 0200 }; // Different types of messages. enum Protocol_Types { PROTO_USR = 1, // Only return info on one user. PROTO_ALL = 2, // Return info on all users logged in around the system. PROTO_FLO = 3, // Return info on friends logged in. PROTO_RUSER = 4, // Return info in ruser format! PROTO_RWHO = 5, // Return info in rwho format. PROTO_WHO = 6, // Return info in who format. PROTO_RUPTIME = 7 // Return info in ruptime format. }; static void set_options (int argc, char *argv[]); static void set_opt (Option_Types opt); static int get_opt (Option_Types opt); static short port_number; static Protocol_Types protocol_type; static int max_server_timeout; static char *program_name; static const char *friend_file; static char *user_name; static void print_usage_and_die [[noreturn]] (int long_msg); static unsigned int option_word; }; #endif /* _OPTIONS_H */ ace-8.0.4+dfsg.orig/apps/drwho/SMR_Server.cpp0000644000175000017500000000045715027201773017756 0ustar sudipsudip#include "Options.h" #include "SMR_Server.h" #include "ace/Log_Msg.h" SMR_Server::SMR_Server (short port_number) { if (CM_Server::open (port_number) < 0) ACE_ERROR ((LM_ERROR, "%p\n%a", Options::program_name, 1)); } SMR_Server::~SMR_Server () { } ace-8.0.4+dfsg.orig/apps/drwho/Hash_Table.h0000644000175000017500000000164715027201773017430 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Hash_Table.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _HASH_TABLE_H #define _HASH_TABLE_H #include "Search_Struct.h" /** * @class Hash_Table * * @brief Provides a hash function lookup abstraction for friend records. */ class Hash_Table : public Search_Struct { public: Hash_Table (); virtual ~Hash_Table (); virtual Protocol_Record *insert (const char *key_name, int max_len = MAXUSERIDNAMELEN) = 0; virtual Protocol_Record *get_next_entry (); virtual Protocol_Record *get_each_entry (); protected: enum { HASH_TABLE_SIZE = 500 }; Protocol_Record **hash_table; Protocol_Record *current_ptr; int current_index; int hash_table_size; }; #endif /* _HASH_TABLE_H */ ace-8.0.4+dfsg.orig/apps/drwho/drwho.mpc0000644000175000017500000000332615027201773017105 0ustar sudipsudip// -*- MPC -*- project(*-client) : aceexe { requires += rwho avoids += uses_wchar ace_for_tao exename = client Source_Files { Comm_Manager.cpp Select_Manager.cpp Protocol_Manager.cpp Drwho_Node.cpp Rwho_DB_Manager.cpp Multicast_Manager.cpp Protocol_Record.cpp Options.cpp File_Manager.cpp Hash_Table.cpp Binary_Search.cpp Search_Struct.cpp Single_Lookup.cpp SML_Server.cpp SM_Server.cpp PMS_Usr.cpp SL_Server.cpp PMS_Flo.cpp PM_Server.cpp HT_Server.cpp BS_Server.cpp PMS_All.cpp PMS_Ruser.cpp SMR_Server.cpp CM_Client.cpp SM_Client.cpp SMR_Client.cpp PM_Client.cpp HT_Client.cpp BS_Client.cpp PMC_All.cpp PMC_Flo.cpp PMC_Usr.cpp SL_Client.cpp PMC_Ruser.cpp SMR_Client.cpp SML_Client.cpp CM_Server.cpp client.cpp } } project(*-server) : aceexe { requires += rwho avoids += uses_wchar ace_for_tao exename = server Source_Files { Comm_Manager.cpp Select_Manager.cpp Protocol_Manager.cpp Drwho_Node.cpp Rwho_DB_Manager.cpp Multicast_Manager.cpp Protocol_Record.cpp Options.cpp File_Manager.cpp Hash_Table.cpp Binary_Search.cpp Search_Struct.cpp Single_Lookup.cpp SML_Server.cpp SM_Server.cpp PMS_Usr.cpp SL_Server.cpp PMS_Flo.cpp PM_Server.cpp HT_Server.cpp BS_Server.cpp PMS_All.cpp PMS_Ruser.cpp SMR_Server.cpp CM_Client.cpp SM_Client.cpp SMR_Client.cpp PM_Client.cpp HT_Client.cpp BS_Client.cpp PMC_All.cpp PMC_Flo.cpp PMC_Usr.cpp SL_Client.cpp PMC_Ruser.cpp SMR_Client.cpp SML_Client.cpp CM_Server.cpp server.cpp } } ace-8.0.4+dfsg.orig/apps/drwho/Binary_Search.cpp0000644000175000017500000000420515027201773020473 0ustar sudipsudip#include "Options.h" #include "Binary_Search.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_string.h" // This function is passed to qsort to perform the comparison between // login names for two friends. int Binary_Search::name_compare (const void *s1, const void *s2) { return ACE_OS::strcmp ((*(Protocol_Record **) s1)->key_name1_, (*(Protocol_Record **) s2)->key_name1_); } // Returns the next friend in the sequence of sorted friends. Note // that this function would be simplified if we expanded the iterator // interface to include an "initialize" and "next" function! Protocol_Record * Binary_Search::get_next_entry () { // Reset the iterator if we are starting from the beginning. if (this->current_ptr_ == 0) this->current_ptr_ = this->sorted_record_; // Now check to see if we've hit the end, in which case we set // things up for the next round! if (this->current_ptr_ < this->sorted_record_ + this->count_) return *this->current_ptr_++; else { this->current_ptr_ = 0; return 0; } } // An iterator, similar to Binary_Search::get_next_friend, though in // this case the friend records are returned in the order they // appeared in the friend file, rather than in sorted order. Also, we // skip over entries that don't have any hosts associated with them. Protocol_Record * Binary_Search::get_each_entry () { // Reset the iterator if we are starting from the beginning. if (this->current_index_ == -1) this->current_index_ = 0; // Now check to see if we've hit the end, in which case we set // things up for the next round! for (; this->current_index_ < this->count_; this->current_index_++) if (this->protocol_record_[this->current_index_].drwho_list_ != 0) return &this->protocol_record_[this->current_index_++]; this->current_index_ = -1; return 0; } Binary_Search::~Binary_Search () { if (Options::get_opt (Options::DEBUGGING)) ACE_DEBUG ((LM_DEBUG, "disposing Binary_Search\n")); } // Used to initialize the values for the iterators... Binary_Search::Binary_Search () : current_ptr_ (0), current_index_ (0) { } ace-8.0.4+dfsg.orig/apps/drwho/client.cpp0000644000175000017500000000240115027201773017234 0ustar sudipsudip //============================================================================= /** * @file client.cpp * * Client driver program for drwho. * * @author Douglas C. Schmidt */ //============================================================================= #include "ace/Log_Msg.h" #include "Options.h" #include "SML_Client.h" #include "SMR_Client.h" #include "ace/OS_Memory.h" // Factory function. static SM_Client * make_client () { SM_Client *client = 0; if (Options::get_opt (Options::REMOTE_USAGE) == 0) ACE_NEW_RETURN (client, SML_Client, 0); else ACE_NEW_RETURN (client, SMR_Client (Options::port_number), 0); return client; } int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { Options::set_options (argc, argv); SM_Client *sm_client = make_client (); if (sm_client->send () < 0) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", Options::program_name), -1); if (sm_client->receive (Options::max_server_timeout) < 0) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", Options::program_name), -1); sm_client->process (); return 0; } ace-8.0.4+dfsg.orig/apps/drwho/CM_Client.cpp0000644000175000017500000000755615027201773017573 0ustar sudipsudip#include "Options.h" #include "Multicast_Manager.h" #include "CM_Client.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_sys_socket.h" #include "ace/OS_NS_sys_select.h" #include "ace/OS_NS_netdb.h" #include "ace/OS_NS_arpa_inet.h" #include "ace/os_include/os_string.h" // Creates and binds a UDP socket... int CM_Client::open (short port_number) { Comm_Manager::sokfd_ = ACE_OS::socket (PF_INET, SOCK_DGRAM, 0); if (Comm_Manager::sokfd_ == ACE_INVALID_HANDLE) return -1; ACE_OS::memset ((char *) &this->sin_, 0, sizeof this->sin_); this->sin_.sin_family = AF_INET; this->sin_.sin_port = htons (port_number); return 1; } int CM_Client::receive (int timeout) { FD_ZERO (&this->read_fd_); FD_SET (Comm_Manager::sokfd_, &this->read_fd_); if (timeout > 0) { this->time_out_.sec (timeout); this->time_out_.usec (0); this->top_ = &time_out_; } while (Multicast_Manager::outstanding_hosts_remain ()) { if (ACE_OS::select (Comm_Manager::sokfd_ + 1, &this->read_fd_, 0, 0, this->top_) <= 0) break; else { int sin_len = sizeof this->sin_; int n = ACE_OS::recvfrom ((int)Comm_Manager::sokfd_, this->recv_packet_, UDP_PACKET_SIZE, 0, reinterpret_cast (&this->sin_), &sin_len); if (n < 0) return -1; else { if (Options::get_opt (Options::DEBUGGING) != 0) { hostent *np = ACE_OS::gethostbyaddr ((char *) &this->sin_.sin_addr, sizeof this->sin_.sin_addr, AF_INET); ACE_DEBUG ((LM_DEBUG, "receiving from server host %s (%s)\n", np->h_name, ACE_OS::inet_ntoa (this->sin_.sin_addr))); } if (this->demux (this->recv_packet_, n) < 0) return -1; Multicast_Manager::checkoff_host (this->sin_.sin_addr); } } } for (const char *host_name; Multicast_Manager::get_next_non_responding_host (host_name); ) ACE_DEBUG ((LM_DEBUG, "%s did not respond\n", host_name)); return 1; } int CM_Client::send () { int packet_length = 0; if (this->mux (this->send_packet_, packet_length) < 0) return -1; // Ship off the info to all the hosts. while (Multicast_Manager::get_next_host_addr (this->sin_.sin_addr) != 0) { if (Options::get_opt (Options::DEBUGGING) != 0) { hostent *np = ACE_OS::gethostbyaddr ((char *) &this->sin_.sin_addr, sizeof this->sin_.sin_addr, AF_INET); ACE_DEBUG ((LM_DEBUG, "sending to server host %s (%s)\n", np->h_name, ACE_OS::inet_ntoa (this->sin_.sin_addr))); } if (ACE_OS::sendto (Comm_Manager::sokfd_, this->send_packet_, packet_length, 0, reinterpret_cast (&this->sin_), sizeof this->sin_) < 0) return -1; } return 1; } CM_Client::CM_Client () : top_ (0) { } CM_Client::~CM_Client () { if (Options::get_opt (Options::DEBUGGING)) ACE_DEBUG ((LM_DEBUG, "disposing CM_Client\n")); ACE_OS::closesocket ((int)Comm_Manager::sokfd_); } ace-8.0.4+dfsg.orig/apps/drwho/SL_Server.cpp0000644000175000017500000000102615027201773017624 0ustar sudipsudip#include "global.h" #include "SL_Server.h" #include "ace/OS_NS_string.h" SL_Server::SL_Server (const char *usr_name) : Single_Lookup (usr_name) { } Protocol_Record * SL_Server::get_each_entry () { Protocol_Record *prp = Single_Lookup::get_each_entry (); return prp->get_drwho_list () == 0 ? 0 : prp; } Protocol_Record * SL_Server::insert (const char *key_name, int max_len) { return ACE_OS::strncmp (key_name, this->prp_->get_login (), max_len) == 0 ? this->prp_ : 0; } ace-8.0.4+dfsg.orig/apps/drwho/Drwho_Node.cpp0000644000175000017500000000272015027201773020012 0ustar sudipsudip#include "Drwho_Node.h" Drwho_Node::Drwho_Node (const char *h_name, Drwho_Node *n) : key_name1_ (h_name), key_name2_ (0), tty_name_ (0), idle_time_ (0), active_count_ (0), inactive_count_ (0), next_ (n) {} Drwho_Node::Drwho_Node () : key_name1_ (0), key_name2_ (0), tty_name_ (0), idle_time_ (0), active_count_ (0), inactive_count_ (0), next_ (0) {} const char * Drwho_Node::get_login_name () { return this->key_name1_; } const char * Drwho_Node::set_login_name (const char *str) { this->key_name1_ = str; return str; } const char * Drwho_Node::get_real_name () { return this->key_name2_; } const char * Drwho_Node::set_real_name (const char *str) { this->key_name2_ = str; return str; } const char * Drwho_Node::get_host_name () { return this->key_name1_; } const char * Drwho_Node::set_host_name (const char *str) { this->key_name1_ = str; return str; } int Drwho_Node::get_active_count () { return this->active_count_; } int Drwho_Node::get_inactive_count () { return this->inactive_count_; } int Drwho_Node::set_active_count (int count) { this->active_count_ = count; return count; } int Drwho_Node::set_inactive_count (int count) { this->inactive_count_ = count; return count; } int Drwho_Node::set_idle_time (int idle_time) { this->idle_time_ = idle_time; return idle_time; } int Drwho_Node::get_idle_time () { return this->idle_time_; } ace-8.0.4+dfsg.orig/apps/drwho/PMC_All.h0000644000175000017500000000133415027201773016636 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file PMC_All.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _PMC_ALL_H #define _PMC_ALL_H #include "PM_Client.h" /** * @class PMC_All * * @brief Provides the client's lookup table abstraction for `all' users... */ class PMC_All : public PM_Client { protected: virtual Protocol_Record *insert_protocol_info (Protocol_Record &protocol_record); virtual int encode (char *packet, int &total_bytes); virtual int decode (char *packet, int &total_bytes); public: PMC_All (); virtual void process (); }; #endif /* _PMC_ALL_H */ ace-8.0.4+dfsg.orig/apps/drwho/SML_Client.h0000644000175000017500000000110615027201773017355 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file SML_Client.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _SML_CLIENT_H #define _SML_CLIENT_H #include "SM_Client.h" #include "SML_Server.h" class SML_Client : public SM_Client { public: SML_Client (); virtual ~SML_Client (); virtual int receive (int timeout = 0); virtual int send (); private: SML_Server sml_server; int packet_length; }; #endif /* _SML_CLIENT_H */ ace-8.0.4+dfsg.orig/apps/drwho/Hash_Table.cpp0000644000175000017500000000322615027201773017756 0ustar sudipsudip#include "Options.h" #include "Hash_Table.h" #include "ace/Log_Msg.h" #include "ace/OS_Memory.h" #include "ace/OS_NS_string.h" Hash_Table::Hash_Table () : current_ptr (0), current_index (0), hash_table_size (HASH_TABLE_SIZE) { ACE_NEW (this->hash_table, Protocol_Record *[this->hash_table_size]); ACE_OS::memset (this->hash_table, 0, this->hash_table_size * sizeof *this->hash_table); } // Iterate through the hash table returning one node at a time... Protocol_Record * Hash_Table::get_next_entry () { // Reset the iterator if we are starting from the beginning. if (this->current_index == -1) this->current_index = 0; if (this->current_ptr == 0) { for (; this->current_index < this->hash_table_size; this->current_index++) if (this->hash_table[this->current_index] != 0) { Protocol_Record *prp = this->hash_table[this->current_index++]; this->current_ptr = prp->next_; return prp; } this->current_index = -1; return 0; } else { Protocol_Record *prp = this->current_ptr; this->current_ptr = this->current_ptr->next_; return prp; } } Protocol_Record * Hash_Table::get_each_entry () { return this->get_next_entry (); } // Frees up all the dynamic memory in the hash table. Hash_Table::~Hash_Table () { if (Options::get_opt (Options::DEBUGGING)) ACE_DEBUG ((LM_DEBUG, "disposing Hash_Table\n")); for (int i = 0; i < this->hash_table_size; i++) for (Protocol_Record *prp = this->hash_table[i]; prp != 0; ) { prp = prp->next_; } } ace-8.0.4+dfsg.orig/apps/drwho/SL_Client.h0000644000175000017500000000122415027201773017241 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file SL_Client.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _SL_CLIENT_H #define _SL_CLIENT_H #include "Single_Lookup.h" /** * @class SL_Client * * @brief Provides the client's single user lookup table abstraction. */ class SL_Client : public Single_Lookup { public: SL_Client (const char *key_name); virtual Protocol_Record *insert (const char *key_name, int max_len = MAXUSERIDNAMELEN); }; #endif /* _SL_CLIENT_H */ ace-8.0.4+dfsg.orig/apps/drwho/BS_Client.cpp0000644000175000017500000000447215027201773017572 0ustar sudipsudip#include "Options.h" #include "File_Manager.h" #include "BS_Client.h" #include "ace/Log_Msg.h" #include "ace/Null_Mutex.h" #include "ace/OS_NS_string.h" BS_Client::BS_Client () { this->count_ = FILE_MANAGER::instance ()->open_file (Options::friend_file); if (this->count_ < 0) ACE_ERROR ((LM_ERROR, "%p\n", Options::program_name)); else { ACE_NEW (this->protocol_record_, Protocol_Record[this->count_]); ACE_NEW (this->sorted_record_, Protocol_Record *[this->count_]); for (int i = 0; i < this->count_; i++) { Protocol_Record *prp = &this->protocol_record_[i]; this->sorted_record_[i] = prp; FILE_MANAGER::instance ()->get_login_and_real_name (prp->key_name1_, prp->key_name2_); } ACE_OS::qsort (this->sorted_record_, this->count_, sizeof *this->sorted_record_, (ACE_COMPARE_FUNC)Binary_Search::name_compare); } } // This function is used to merge the KEY_NAME from server HOST_NAME // into the sorted list of userids kept on the client's side. Since // we *know* we are going to find the name we use the traditional // binary search. Protocol_Record * BS_Client::insert (const char *key_name, int) { #if 0 Protocol_Record *pr = (Protocol_Record *) ACE_OS::bsearch ((const void *) key_name, (const void *) this->sorted_record_, this->count_, sizeof ..., int (*compar)(const void *, const void *) ACE_OS::strcmp); return pr; #else int lo = 0; int hi = this->count_ - 1; Protocol_Record **sorted_buffer = this->sorted_record_; while (lo <= hi) { int mid = (lo + hi) / 2; Protocol_Record *prp = sorted_buffer[mid]; int cmp = ACE_OS::strcmp (key_name, prp->get_login ()); if (cmp == 0) return prp; else if (cmp < 0) hi = mid - 1; else lo = mid + 1; } return 0; #endif /* 0 */ } Protocol_Record * BS_Client::get_each_entry () { for (Protocol_Record *prp = Binary_Search::get_each_entry (); prp != 0; prp = Binary_Search::get_each_entry ()) if (prp->get_drwho_list () != 0) return prp; return 0; } ace-8.0.4+dfsg.orig/apps/drwho/Rwho_DB_Manager.cpp0000644000175000017500000000706215027201773020704 0ustar sudipsudip#include "global.h" #include "Options.h" #include "Rwho_DB_Manager.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_time.h" #include "ace/OS_NS_fcntl.h" // Change to the RWHO directory to speed up and simplify later // processing. This requires opening the directory for reading with // the directory iterator abstraction and then skipping the first two // files in the directory, which are assumed to be "." and ".." (this // function needs to be changed if this assumption does not hold!) RWho_DB_Manager::RWho_DB_Manager () : number_of_users (0), current_user (0), WHOD_HEADER_SIZE (sizeof host_data - sizeof host_data.wd_we), rwho_dir_name (RWHODIR) { if (ACE_OS::getcwd (this->original_pathname, MAXPATHLEN + 1) == 0) ACE_ERROR ((LM_ERROR, "%p\n%a", Options::program_name, 1)); if (ACE_OS::chdir (this->rwho_dir_name) < 0) ACE_ERROR ((LM_ERROR, "%p\n%a", this->rwho_dir_name, 1)); this->rwho_dir.open (this->rwho_dir_name); #if 0 // Skip "." and ".." this->rwho_dir.read (); this->rwho_dir.read (); #endif } // The destructor cleans up the RWHOD_DIR handle. RWho_DB_Manager::~RWho_DB_Manager () { if (ACE_OS::chdir (this->original_pathname) < 0) ACE_ERROR ((LM_ERROR, "%p\n%a", Options::program_name, 1)); if (Options::get_opt (Options::DEBUGGING)) ACE_DEBUG ((LM_DEBUG, "disposing the RWho_DB_Manager\n")); } // This procedure looks through the rwhod directory until it finds the next // valid user file. // // The requirements for user files are: // 1) The file is at least MIN_HOST_DATA_SIZE bytes long // 2) It was received within the last MAX_HOST_TIMEOUT seconds // Return: // Are there any more hosts? */ int RWho_DB_Manager::get_next_host () { time_t current_time; ACE_OS::time (¤t_time); // Go through each file in the directory looking for valid entries. for (dirent *dir_ptr = this->rwho_dir.read (); dir_ptr != 0; dir_ptr = this->rwho_dir.read ()) { ACE_HANDLE user_file = ACE_OS::open (dir_ptr->d_name, O_RDONLY); if (user_file < 0) return -1; int host_data_length = ACE_OS::read (user_file, (char *) &this->host_data, sizeof this->host_data); if (host_data_length > WHOD_HEADER_SIZE && current_time - this->host_data.wd_recvtime < MAX_HOST_TIMEOUT) { this->current_user = 0; this->number_of_users = (host_data_length - WHOD_HEADER_SIZE) / sizeof *this->host_data.wd_we; ACE_OS::close (user_file); return 1; // We found a good host, so return it. } else ACE_OS::close (user_file); } // There are no more hosts, so return False. return 0; } // Returns the next user's information. Note that for efficiency only // pointers are copied, i.e., this info must be used before we call // this function again. int RWho_DB_Manager::get_next_user (Protocol_Record &protocol_record) { // Get the next host file if necessary if (this->current_user >= this->number_of_users && this->get_next_host () == 0) return 0; protocol_record.set_login (this->host_data.wd_we[current_user].we_utmp.out_name); Drwho_Node *current_node = protocol_record.get_drwho_list (); current_node->set_host_name (this->host_data.wd_hostname); current_node->set_idle_time (this->host_data.wd_we[current_user].we_idle); this->current_user++; return 1; } ace-8.0.4+dfsg.orig/apps/drwho/SMR_Client.cpp0000644000175000017500000000060515027201773017721 0ustar sudipsudip#include "Options.h" #include "PMC_All.h" #include "PMC_Flo.h" #include "PMC_Usr.h" #include "PMC_Ruser.h" #include "SMR_Client.h" #include "ace/Log_Msg.h" SMR_Client::SMR_Client (short port_number) { if (CM_Client::open (port_number) < 0) ACE_ERROR ((LM_ERROR, "%p\n%a", Options::program_name, 1)); } SMR_Client::~SMR_Client () { } ace-8.0.4+dfsg.orig/apps/drwho/SL_Server.h0000644000175000017500000000130015027201773017264 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file SL_Server.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _SL_SERVER_H #define _SL_SERVER_H #include "Single_Lookup.h" /** * @class SL_Server * * @brief Provides the server's single user lookup table abstraction. */ class SL_Server : public Single_Lookup { public: SL_Server (const char *packet); virtual Protocol_Record *insert (const char *key_name, int max_len = MAXUSERIDNAMELEN); virtual Protocol_Record *get_each_entry (); }; #endif /* _SL_SERVER_H */ ace-8.0.4+dfsg.orig/apps/drwho/CM_Server.h0000644000175000017500000000145015027201773017253 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file CM_Server.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _CM_SERVER_H #define _CM_SERVER_H #include "Options.h" #include "global.h" #include "Comm_Manager.h" /** * @class CM_Server * * @brief Provides a virtual communcations layer for the server in drwho. */ class CM_Server : public Comm_Manager { public: CM_Server (); virtual ~CM_Server (); virtual int open (short port_number); virtual int receive (int timeout = 0); virtual int send (); virtual int mux (char *packet, int &packet_length) = 0; virtual int demux (char *packet, int &packet_length) = 0; }; #endif /* _CM_SERVER_H */ ace-8.0.4+dfsg.orig/apps/drwho/Protocol_Record.cpp0000644000175000017500000000305115027201773021057 0ustar sudipsudip#include "Options.h" #include "Protocol_Record.h" #include "ace/Log_Msg.h" // Static initialization. Drwho_Node Protocol_Record::drwho_node_; Protocol_Record::~Protocol_Record () { if (Options::get_opt (Options::DEBUGGING)) ACE_DEBUG ((LM_DEBUG, "disposing Protocol_Record\n")); for (Drwho_Node *np = this->get_drwho_list (); np != 0; ) { Drwho_Node *t = np; np = np->next_; delete t; } } Protocol_Record::Protocol_Record () : key_name1_ (0), key_name2_ (0), drwho_list_ (0), next_ (0), is_active_ (0) { } Protocol_Record::Protocol_Record (int) : key_name1_ (0), key_name2_ (0), drwho_list_ (&Protocol_Record::drwho_node_), next_ (0), is_active_ (0) { } Protocol_Record::Protocol_Record (const char *kn1, Protocol_Record *next) : key_name1_ (kn1), key_name2_ (0), drwho_list_ (0), next_ (next), is_active_ (0) { } const char * Protocol_Record::get_login () { return this->key_name1_; } const char * Protocol_Record::set_login (const char *str) { this->key_name1_ = str; return str; } const char * Protocol_Record::get_real () { return this->key_name2_; } const char * Protocol_Record::get_host () { return this->key_name1_; } const char * Protocol_Record::set_host (const char *str) { this->key_name1_ = str; return str; } const char * Protocol_Record::set_real (const char *str) { this->key_name2_ = str; return str; } Drwho_Node * Protocol_Record::get_drwho_list () { return this->drwho_list_; } ace-8.0.4+dfsg.orig/apps/drwho/server.cpp0000644000175000017500000000467115027201773017277 0ustar sudipsudip //============================================================================= /** * @file server.cpp * * Driver program for the server. Note that it is easy to reuse the * server for other distributed programs. Pretty much all that must * change are the functions registered with the communciations * manager. * * @author Douglas C. Schmidt */ //============================================================================= #include "Options.h" #include "SMR_Server.h" #include "ace/ACE.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_signal.h" #include "ace/OS_NS_time.h" #include "ace/OS_NS_stdlib.h" #include "ace/OS_NS_sys_socket.h" static char * time_stamp () { time_t time_now; char *temp; time_now = ACE_OS::time (0); temp = ACE_OS::asctime (ACE_OS::localtime (&time_now)); temp[12] = 0; return temp; } // Catch the obvious signals and die with dignity... static void exit_server (int sig) { ACE_DEBUG ((LM_DEBUG, "%s exiting on signal %S\n", time_stamp (), sig)); ACE_OS::exit (0); } // Returns TRUE if the program was started by INETD. static int started_by_inetd () { sockaddr_in sin; int size = sizeof sin; return ACE_OS::getsockname (0, reinterpret_cast (&sin), &size) == 0; } // Does the drwho service. static void do_drwho (SMR_Server &smr_server) { if (smr_server.receive () == -1) ACE_ERROR ((LM_ERROR, "%p\n", Options::program_name)); if (smr_server.send () == -1) ACE_ERROR ((LM_ERROR, "%p\n", Options::program_name)); } // If the server is started with any argument at all then it doesn't // fork off a child process to do the work. This is useful when // debugging! int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { ACE_OS::signal (SIGTERM, (ACE_SignalHandler)exit_server); ACE_OS::signal (SIGINT, (ACE_SignalHandler)exit_server); ACE_OS::signal (SIGQUIT, (ACE_SignalHandler)exit_server); Options::set_options (argc, argv); Options::set_opt (Options::STAND_ALONE_SERVER); int inetd_controlled = started_by_inetd (); if (!inetd_controlled && Options::get_opt (Options::BE_A_DAEMON)) ACE::daemonize (); SMR_Server smr_server (Options::port_number); if (inetd_controlled) do_drwho (smr_server); else { for (;;) do_drwho (smr_server); /* NOTREACHED */ } return 0; } ace-8.0.4+dfsg.orig/apps/drwho/Protocol_Manager.h0000644000175000017500000000241315027201773020661 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Protocol_Manager.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _PROTOCOL_MANAGER_H #define _PROTOCOL_MANAGER_H #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "Options.h" #include "Search_Struct.h" #include "Protocol_Record.h" /** * @class Protocol_Manager * * @brief A base class that consolidates friend management functionality * shared by both clients and servers. */ class Protocol_Manager { public: Protocol_Manager (); virtual ~Protocol_Manager (); virtual int encode (char *packet, int &total_bytes) = 0; virtual int decode (char *packet, int &total_bytes) = 0; protected: int total_users; Search_Struct *ss; int friend_count (); Drwho_Node *get_drwho_node (char *host_name, Drwho_Node *&head); int get_total_users (); void increment_total_users (int remote_users = 1); Protocol_Record *get_next_friend (); Protocol_Record *get_each_friend (); virtual Protocol_Record *insert_protocol_info (Protocol_Record &protocol_record) = 0; }; #endif /* _PROTOCOL_MANAGER_H */ ace-8.0.4+dfsg.orig/apps/drwho/PMC_Usr.cpp0000644000175000017500000000523215027201773017233 0ustar sudipsudip#include "Options.h" #include "SL_Client.h" #include "PMC_Usr.h" #include "ace/ACE.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_Memory.h" int PMC_Usr::encode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUGGING) != 0) ACE_DEBUG ((LM_DEBUG, "in PMC_Usr::encode")); ACE_NEW_RETURN (this->ss, SL_Client (this->usr_name), -1); SET_PACKET_TYPE (packet, Options::PROTO_USR); char *buf_ptr = SKIP_PACKET_TYPE (packet); buf_ptr = ACE_OS::strecpy (buf_ptr, this->get_next_friend ()->get_login ()); packet_length = buf_ptr - packet; if (Options::get_opt (Options::DEBUGGING) != 0) { ACE_DEBUG ((LM_DEBUG, "packet_length = %d\n", packet_length)); ACE_OS::write (ACE_STDERR, packet, packet_length); ACE_DEBUG ((LM_DEBUG, "\n")); } return 1; } // This method is responsible for transforming the msg from the server // back into a form usable by the client. int PMC_Usr::decode (char *packet, int &packet_length) { if (Options::get_opt (Options::DEBUGGING) != 0) { ACE_DEBUG ((LM_DEBUG, "in PMC_Usr::decode, packet_length = %d\n", packet_length)); ACE_OS::write (ACE_STDERR, packet, packet_length); ACE_DEBUG ((LM_DEBUG, "\n")); } char *cp = packet; if (*cp != '\n') { char *login_name = cp; for (cp = (char *) ACE::strend (cp); *(cp = this->handle_protocol_entries (cp, login_name)) != '\t'; ) continue; } return 1; } void PMC_Usr::process () { Protocol_Record *prp = this->get_each_friend (); Drwho_Node *np = prp->get_drwho_list (); if (np == 0) ACE_DEBUG ((LM_DEBUG, "")); else { // First try to get a login session that is active... for (; np != 0; np = np->next_) if (np->active_count_ > 0) { ACE_DEBUG ((LM_DEBUG, "%s ", np->get_host_name ())); if (Options::get_opt (Options::USE_VERBOSE_FORMAT) == 0) return; } for (np = prp->get_drwho_list (); np != 0; np = np->next_) if (np->active_count_ == 0) { ACE_DEBUG ((LM_DEBUG, "%s ", np->get_host_name ())); if (Options::get_opt (Options::USE_VERBOSE_FORMAT) == 0) return; } } } PMC_Usr::PMC_Usr (char *u_name) : usr_name (u_name) { } ace-8.0.4+dfsg.orig/apps/drwho/PMS_All.h0000644000175000017500000000130115027201773016650 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file PMS_All.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _PMS_ALL_H #define _PMS_ALL_H #include "PM_Server.h" /** * @class PMS_All * * @brief Provides the server's lookup table abstraction for `all' users... */ class PMS_All : public PM_Server { public: PMS_All (); protected: virtual Protocol_Record *insert_protocol_info (Protocol_Record &protocol_record); virtual int encode (char *packet, int &total_bytes); virtual int decode (char *packet, int &total_bytes); }; #endif /* _PMS_ALL_H */ ace-8.0.4+dfsg.orig/apps/drwho/SML_Client.cpp0000644000175000017500000000101615027201773017710 0ustar sudipsudip#include "Options.h" #include "SML_Client.h" int SML_Client::receive (int) { if (sml_server.mux (this->recv_packet_, this->packet_length) < 0) return -1; if (this->demux (this->recv_packet_, this->packet_length) < 0) return -1; return 1; } int SML_Client::send () { if (this->mux (this->send_packet_, this->packet_length) < 0) return -1; if (sml_server.demux (this->send_packet_, this->packet_length) < 0) return -1; return 1; } SML_Client::SML_Client () { } SML_Client::~SML_Client () { } ace-8.0.4+dfsg.orig/apps/drwho/Select_Manager.cpp0000644000175000017500000000010515027201773020626 0ustar sudipsudip#include "Select_Manager.h" Select_Manager::~Select_Manager () { } ace-8.0.4+dfsg.orig/apps/drwho/SMR_Client.h0000644000175000017500000000070715027201773017371 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file SMR_Client.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _SMR_CLIENT_H #define _SMR_CLIENT_H #include "SM_Client.h" class SMR_Client : public SM_Client { public: SMR_Client (short port_number); virtual ~SMR_Client (); }; #endif /* _SMR_CLIENT_H */ ace-8.0.4+dfsg.orig/apps/drwho/PMC_Ruser.h0000644000175000017500000000160115027201773017223 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file PMC_Ruser.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _PMC_RUSER_H #define _PMC_RUSER_H #include "PM_Client.h" /** * @class PMC_Ruser * * @brief Provides the client's lookup table abstraction for `ruser' users... */ class PMC_Ruser : public PM_Client { public: PMC_Ruser (); virtual void process (); protected: char *handle_protocol_entries (const char *cp, const char *host_name, const char * = 0); Protocol_Record *insert_protocol_info (Protocol_Record &protocol_record); virtual int encode (char *packet, int &total_bytes); virtual int decode (char *packet, int &total_bytes); }; #endif /* _PMC_RUSER_H */ ace-8.0.4+dfsg.orig/apps/drwho/SMR_Server.h0000644000175000017500000000067715027201773017427 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file SMR_Server.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _SMR_SERVER_H #define _SMR_SERVER_H #include "SM_Server.h" class SMR_Server : public SM_Server { public: SMR_Server (short port_number); ~SMR_Server (); }; #endif /* _SMR_SERVER_H */ ace-8.0.4+dfsg.orig/apps/drwho/CM_Server.cpp0000644000175000017500000000513115027201773017606 0ustar sudipsudip#include "global.h" #include "Options.h" #include "CM_Server.h" #include "ace/ACE.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_sys_socket.h" #include "ace/OS_NS_arpa_inet.h" // Creates and binds a UDP socket... int CM_Server::open (short port_number) { int max_packet_size = UDP_PACKET_SIZE; this->sokfd_ = ACE_OS::socket (PF_INET, SOCK_DGRAM, 0); if (this->sokfd_ < 0) return -1; ACE_OS::memset (&this->sin_, 0, sizeof this->sin_); this->sin_.sin_family = AF_INET; this->sin_.sin_port = htons (port_number); this->sin_.sin_addr.s_addr = INADDR_ANY; // This call fails if an rflo daemon is already running. if (ACE_OS::bind (this->sokfd_, reinterpret_cast (&this->sin_), sizeof this->sin_) < 0) return -1; if (ACE_OS::setsockopt (this->sokfd_, SOL_SOCKET, SO_SNDBUF, (char *) &max_packet_size, sizeof max_packet_size) < 0) return -1; return 1; } int CM_Server::receive (int) { int sin_len = sizeof this->sin_; if (Options::get_opt (Options::DEBUGGING) != 0) ACE_DEBUG ((LM_DEBUG, "waiting for client to send...\n")); int n = ACE_OS::recvfrom (this->sokfd_, this->recv_packet_, UDP_PACKET_SIZE, 0, reinterpret_cast (&this->sin_), (int *) &sin_len); if (n == -1) return -1; if (Options::get_opt (Options::DEBUGGING) != 0) ACE_DEBUG ((LM_DEBUG, "receiving from client host %s\n", ACE_OS::inet_ntoa (this->sin_.sin_addr))); if (this->demux (this->recv_packet_, n) < 0) return -1; return 1; } int CM_Server::send () { int packet_length = 0; if (this->mux (this->send_packet_, packet_length) < 0) return -1; if (Options::get_opt (Options::DEBUGGING) != 0) ACE_DEBUG ((LM_DEBUG, "sending to client host %s\n", ACE_OS::inet_ntoa (this->sin_.sin_addr))); if (ACE_OS::sendto (this->sokfd_, this->send_packet_, packet_length, 0, reinterpret_cast (&this->sin_), sizeof this->sin_) < 0) return -1; return 1; } CM_Server::CM_Server () { } CM_Server::~CM_Server () { if (Options::get_opt (Options::DEBUGGING)) ACE_DEBUG ((LM_DEBUG, "CM_Server\n")); ACE_OS::closesocket (this->sokfd_); } ace-8.0.4+dfsg.orig/apps/drwho/File_Manager.h0000644000175000017500000000217115027201773017740 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file File_Manager.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _FILE_MANAGER_H #define _FILE_MANAGER_H #include "global.h" #include "ace/Singleton.h" #include "ace/Null_Mutex.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Mem_Map.h" /** * @class File_Manager * * @brief This class provides a file ADT for our friends info. */ class File_Manager { public: /// Constructor. File_Manager (); int open_file (const char *filename); void get_login_and_real_name (const char *&login_name, const char *&real_name); private: int number_of_friends; int max_key_length; char *buffer_ptr; char *current_ptr; int buffer_size; int open_friends_file (const char *filename); int open_passwd_file (); ACE_Mem_Map mmap_; }; // Make a Singleton. typedef ACE_Singleton FILE_MANAGER; #endif /* _FILE_MANAGER_H */ ace-8.0.4+dfsg.orig/apps/drwho/SM_Server.h0000644000175000017500000000121115027201773017266 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file SM_Server.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _SM_SERVER_H #define _SM_SERVER_H #include "PM_Server.h" #include "CM_Server.h" #include "Select_Manager.h" class SM_Server : public Select_Manager, public CM_Server { public: SM_Server (); virtual ~SM_Server (); virtual int mux (char *packet, int &packet_length); virtual int demux (char *packet, int &packet_length); private: PM_Server *pm_server; }; #endif /* _SM_SERVER_H */ ace-8.0.4+dfsg.orig/apps/drwho/SL_Client.cpp0000644000175000017500000000031415027201773017573 0ustar sudipsudip#include "Options.h" #include "SL_Client.h" SL_Client::SL_Client (const char *usr_name) : Single_Lookup (usr_name) { } Protocol_Record * SL_Client::insert (const char *, int) { return this->prp_; } ace-8.0.4+dfsg.orig/apps/drwho/README0000644000175000017500000003012415027201773016135 0ustar sudipsudip This directory contains the "distributed rwho" (drwho) program. Drwho alleviates certain rwho(1) limitations. For instance it adds functionality that spans subnets. In addition, drwho prints a much more concise listing of who's logged in around a network. Below are some examples of how to use drwho. 0. Start by running the server in a window or as a daemon, e.g., run the following on a local machine, such as tango.cs.wustl.edu: % drwho-server Then, If you'd like to find out who's logged in, try the following commands: 1. Print out the command-line options. % drwho-client -h usage: ./drwho-client -? prints a short usage message -A append the following hostname to the list of predefined hostnames. -a return information on *all* users remotely logged in (uses yp passwd). -b run the server in the background (i.e., as a daemon). -d turn on debugging. -F use the following file contents to initialize the host list. -f use the following file contents to initialize the friends database. -H use the following hostname as part of the new list of hostnames. (this option overwrites the existing default names). -h print a long usage message. -L print the login name rather than the real name (which is the default). -l print information in long format (works for all protocols). -p set the port number (server must correspond). -r do the remote lookups (i.e., local operations are the default). -R print info using the rusers format. -s sort the output by login name. -S sort the output by real name. -t set the amount of time we wait for servers to timeout. -w return information on just one user. ---------------------------------------- 2. Find out which friends are logged in (* means currently active) % drwho-client -A tango.cs.wustl.edu -r -f ~schmidt/.friends.dta remote friends logged on ------------------------ *Doug O'las [tango*(3) mambo] Carlos O'Ryan [tango swarm.cs.wustl.edu macarena] Irfan Pyarali [merengue] Nanbor Wang [lambada] Marina Spivak [mambo] Chris Gill [tango] *Vishal [merengue*(2)] Kirthika [tango waltz] Naga [tango polka] Alex [lindy] Bala [cumbia] Pradeep [flamenco] Matt Braun [lambada] ------------------------ friends: 5 users: 168 You'll to write a friends.dta file in order for this feature to work. Here's one that I've got: schmidt Doug O'las coryan Carlos O'Ryan irfan Irfan Pyarali levine David Levine nanbor Nanbor Wang jp4 Jeff Parsons marina Marina Spivak cdgill Chris Gill vishal Vishal kirthika Kirthika naga Naga alex Alex bala Bala pradeep Pradeep brunsch Darrell Brunsch jxh James Hu yamuna Yamuna mjb2 Matt Braun gokhale Andy Gokhale fredk Fred Kuhns If you put this file in ~/.friends.dta drwho will automatically locate it. ---------------------------------------- 3. Find out where a particular person is logged in: % drwho-client -A tango.cs.wustl.edu -r -w schmidt tango This is useful for remote commands that require a hostname, e.g.: % talk schmidt@`drwho-client -A tango.cs.wustl.edu -r -w schmidt` or % rsh `drwho-client -w schmidt` ps PID TTY TIME CMD 1844 pts/9 0:01 tcsh_6.0 4821 ? 0:02 perfmete 77 pts/20 0:01 tcsh_6.0 4845 pts/2 0:00 tcsh_6.0 4766 ? 0:00 xmessage 4850 pts/3 0:06 tcsh_6.0 5057 pts/4 0:01 tcsh_6.0 4826 ? 18:07 netscape 4802 ? 0:07 mwm % foreach host (`drwho -r -l -w schmidt`) ? echo $host ? rsh $host w | grep -E schmidt ? end ---------------------------------------- 4. Find out everyone who is logged in everywhere! % drwho-client -A tango.cs.wustl.edu -r -a remote users logged on ------------------------ rlneblet [ascc] woody [fixer] Jyoti Parwatikar [hopscotch] Stephen D. Scott [occam] klkramer [ascc] dmorris [ascc] *pabacard [ascc*] sestasne [ascc] Sumedh Mungee [merengue lindy] Alexander Babu Arulanthu [lindy] Robert A. Rouse [siesta] asamarak [ascc] Tom Chaney [snoodles] Joe Hoffert [monkeybars] ircornel [ascc] Chris Cleeland [macarena] *Matthew Karl Lundberg [enz lcs*(2)] dmschult [ascc] sherlia [owen] *wmwhites [ascc*] Marius Mihai Tutunaru [siesta] Ken Wong [ackbar sarlacc] abstutts [ascc] Barry L. Kalman [sachel] Yunhong Zhou [siesta] Marina Igorevna Spivak [mambo] mschraed [ascc] tuck [ascc] Daniel Robert Dooly [cardinal] emlentz [ascc] Margaret Flucke [honker yoda brainmap] Jonathan S. Pollack [siesta] Gurudatta M. Parulkar [ackbar] Mike Richards [teebo] *Vishal Kachroo [merengue*(1)] The dump man [tapeworm] Uooyeol Yoon [siesta] jtlink [ascc] Dan Rosenstein [tubman] cdnorden [ascc] Jon Turner [spanky] Stan C. Kwasny [lambda] aymessin [ascc] Nanbor Wang [lambada] wolf [sarlacc] jgbers [ascc] Pradeep Gore [flamenco] Chris D. Gill [tango] sduseja [ascc] amgarcia [ascc] *Hongyin Quan [ackbar*(2)] firemen [helen] *lskafenb [ascc*] Sally Goldman [occam] Marcel Waldvogel [tiger] klforesm [ascc] Andy Fingerhut [yoda leia] root@tango [tango emperor siren flora helen boushi tapeworm siesta rainier taumsauk honker polka] Nagarajan Surendran [tango polka] ajeckste [ascc] Linda Suri [kavita] Sarah Elizabeth Burcham [helen] Salathiel Sawyer [helen] A. Maynard Engebretson [wicket] Theresa Manzara [siesta] aagrillo [ascc] ksviehen [ascc] Will Gillett [gel] Elaine M Ashton [helen] James C. Gray [siesta] Ian Flanigan [siesta] jacrank [ascc] Matthew J Braun [lambada] *pjhanrah [ascc*] Vadim Adamov [siesta] *rbherrin [ascc*] kslee [ascc] Balachandran Natarajan [cumbia] *Qianbo Huai [ecommerce*(2)] Scott Thomas Haug [bacon kato] Yuhua Chen [beru] blawrenc [ascc] dcoats [ascc] *sdsinger [ascc*] Katherine Skirving Larson [odysseus mas] rmcarbon [ascc] rer [luke honker leia] Ron Loui [ai siesta] Sergio Flores [tango siesta] maint [helen] mewedeha [ascc] Scott Simon [ackbar] weathert [anakin hobbie honker] Kirthika Parameswaran [waltz tango] Scott Douglas Powers [greedo buster] *vehays [ascc*] Multiagent Systems Research Group [siren] *Douglas C. Schmidt [tango*(3) mambo] sunyh [r2d2] *jbbrooks [ascc*] mweisema [ascc] *baruethe [ascc*] Yan Zhou [thunderball] *jennyc [ascc*] Karl Stiefvater [tamarin helen] John Roman [helen] slstraus [ascc] Subhash Suri [kavita] Sandeep Sikka [siesta] Dna Mutants [lcs] Irfan Pyarali [merengue] ajhingst [ascc] Tuomas Sandholm [siren] Carlos O'Ryan [tango swarm.cs.wustl.edu macarena] Tilman Wolf [siesta] ------------------------ friends: 20 users: 20 ---------------------------------------- 5. Print out all machines and who is logged into each one % drwho-client -A tango.cs.wustl.edu -R -l kavita Subhash Suri, Linda Suri lcs Matthew Karl Lundberg*(2), Dna Mutants leia Andy Fingerhut, rer rainier root@tango thunderball Yan Zhou lindy Sumedh Mungee, Alexander Babu Arulanthu flamenco Pradeep Gore ai Ron Loui wicket A. Maynard Engebretson occam Stephen D. Scott, Sally Goldman helen firemen, Sarah Elizabeth Burcham, Elaine M Ashton, root@tango, maint, John Roman, Karl Stiefvater, Salathiel Sawyer enz Matthew Karl Lundberg tamarin Karl Stiefvater tiger Marcel Waldvogel cumbia Balachandran Natarajan r2d2 sunyh fixer woody ecommerce Qianbo Huai*(2) lambda Stan C. Kwasny boushi root@tango mambo Douglas C. Schmidt, Marina Igorevna Spivak ascc slstraus, rmcarbon, aymessin, aagrillo, sdsinger*, dmschult, sestasne, dmorris, jgbers, jennyc*, sduseja, baruethe*, gzhou*, vehays*, pjhanrah*, dcoats, saduthie*, ksviehen, cdnorden, ajhingst*, mschraed, asamarak, pabacard*, mewedeha, ajeckste, jbbrooks, blawrenc, amgarcia, abstutts, klforesm, klkramer, pkshah*, jtlink, jacrank, wmwhites*, kslee, mweisema, emlentz, rlneblet, tuck beru Yuhua Chen emperor root@tango siren Tuomas Sandholm, root@tango, Multiagent Systems Research Group tubman Dan Rosenstein gel Will Gillett honker Margaret Flucke, root@tango, weathert, rer greedo Scott Douglas Powers swarm.cs.wustl.edu Carlos O'Ryan tapeworm root@tango, The dump man siesta Uooyeol Yoon, Marius Mihai Tutunaru, Vadim Adamov, Robert A. Rouse, Jonathan S. Pollack, James C. Gray, Sergio Flores, Sandeep Sikka, Ron Loui, Yunhong Zhou, Tilman Wolf, Theresa Manzara, Ian Flanigan, root@tango luke rer snoodles Tom Chaney ackbar Ken Wong, Scott Simon, Gurudatta M. Parulkar, Hongyin Quan*(1) buster Scott Douglas Powers tango Nagarajan Surendran, Sergio Flores, Chris D. Gill, Kirthika Parameswaran, Carlos O'Ryan, root@tango, Douglas C. Schmidt*(3) teebo Mike Richards cardinal Daniel Robert Dooly lambada Nanbor Wang, Matthew J Braun merengue Sumedh Mungee, Vishal Kachroo*(1), Irfan Pyarali macarena Chris Cleeland, Carlos O'Ryan sarlacc wolf, Ken Wong spanky Jon Turner brainmap Margaret Flucke polka Nagarajan Surendran, root@tango waltz Kirthika Parameswaran flora root@tango anakin weathert bacon Scott Thomas Haug hopscotch Jyoti Parwatikar mas Katherine Skirving Larson kato Scott Thomas Haug hobbie weathert odysseus Katherine Skirving Larson sachel Barry L. Kalman taumsauk root@tango yoda Margaret Flucke, Andy Fingerhut owen sherlia monkeybars Joe Hoffert ace-8.0.4+dfsg.orig/apps/drwho/PMC_Flo.h0000644000175000017500000000133415027201773016646 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file PMC_Flo.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _PMC_FLO_H #define _PMC_FLO_H #include "PM_Client.h" /** * @class PMC_Flo * * @brief Provides the client's lookup table abstraction for `flo' users... */ class PMC_Flo : public PM_Client { public: PMC_Flo (); virtual void process (); protected: virtual Protocol_Record *insert_protocol_info (Protocol_Record &protocol_record); virtual int encode (char *packet, int &total_bytes); virtual int decode (char *packet, int &total_bytes); }; #endif /* _PMC_FLO_H */ ace-8.0.4+dfsg.orig/apps/drwho/Protocol_Record.h0000644000175000017500000000205415027201773020526 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Protocol_Record.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _PROTOCOL_RECORD_H #define _PROTOCOL_RECORD_H #include "Drwho_Node.h" /** * @class Protocol_Record * * @brief Stores information about a single friend's status. */ class Protocol_Record { public: Protocol_Record (); Protocol_Record (int use_dummy); Protocol_Record (const char *key_name1, Protocol_Record *next = 0); ~Protocol_Record (); const char *get_host (); const char *set_host (const char *str); const char *get_login (); const char *set_login (const char *str); const char *get_real (); const char *set_real (const char *str); Drwho_Node *get_drwho_list (); static Drwho_Node drwho_node_; const char *key_name1_; const char *key_name2_; Drwho_Node *drwho_list_; Protocol_Record *next_; int is_active_; }; #endif /* _PROTOCOL_RECORD_H */ ace-8.0.4+dfsg.orig/apps/drwho/BS_Client.h0000644000175000017500000000237315027201773017235 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file BS_Client.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _BS_CLIENT_H #define _BS_CLIENT_H #include "Binary_Search.h" /** * @class BS_Client * * @brief Provides the client's binary search lookup table abstraction. */ class BS_Client : public Binary_Search { public: // = Initialization. /// Constructor. BS_Client (); /** * This function is used to merge the from server * into the sorted list of userids kept on the client's * side. Since we *know* we are going to find the name we use the * traditional binary search. */ virtual Protocol_Record *insert (const char *key_name, int max_len = MAXUSERIDNAMELEN); /** * An iterator, similar to Binary_Search::get_next_friend, though in * this case the friend records are returned in the order they * appeared in the friend file, rather than in sorted order. Also, * we skip over entries that don't have any hosts associated with * them. */ virtual Protocol_Record *get_each_entry (); }; #endif /* _BS_CLIENT_H */ ace-8.0.4+dfsg.orig/apps/drwho/Multicast_Manager.cpp0000644000175000017500000001121515027201773021360 0ustar sudipsudip#include "Multicast_Manager.h" #include "ace/Mem_Map.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_arpa_inet.h" #include "ace/OS_NS_netdb.h" #include "ace/OS_Memory.h" #include "ace/OS_NS_ctype.h" // Initialize all the static member vars. int Multicast_Manager::received_host_count = 0; Host_Elem *Multicast_Manager::drwho_list = 0; Host_Elem *Multicast_Manager::current_ptr = 0; // Names of hosts to query for friend info. const char *Multicast_Manager::host_names[] = { "tango.cs.wustl.edu", 0 // The NULL entry... }; void Multicast_Manager::insert_default_hosts () { // Enter the static list of hosts into the dynamic table! for (const char **np = host_names; *np != 0; np++) Multicast_Manager::add_host (*np); } // Inserts all the names in FILENAME into the list of hosts to // contact. int Multicast_Manager::insert_hosts_from_file (const char *filename) { //FUZZ: disable check_for_lack_ACE_OS ACE_Mem_Map mmap (filename); //FUZZ: enable check_for_lack_ACE_OS char *host_ptr = (char *) mmap.addr (); if (host_ptr == 0) return -1; else { for (char *end_ptr = host_ptr + mmap.size (); host_ptr < end_ptr; ) { Multicast_Manager::add_host (host_ptr); while (*host_ptr != '\n') host_ptr++; *host_ptr++ = '\0'; } return 0; } } // Returns the IP host address for the next unexamined host in the // list. If no more unexamined hosts remain a 0 is returned, else a // 1. int Multicast_Manager::get_next_host_addr (in_addr &host_addr) { for (Multicast_Manager::current_ptr = Multicast_Manager::current_ptr == 0 ? Multicast_Manager::drwho_list : Multicast_Manager::current_ptr->next; Multicast_Manager::current_ptr != 0; Multicast_Manager::current_ptr = Multicast_Manager::current_ptr->next) { const char *host_name = Multicast_Manager::current_ptr->host_name; hostent *hp = Multicast_Manager::get_host_entry (host_name); if (hp == 0) { ACE_ERROR ((LM_ERROR, "%s: host unknown.\n", host_name)); continue; } Multicast_Manager::received_host_count++; ACE_OS::memcpy (&host_addr, hp->h_addr, sizeof host_addr); ACE_OS::memcpy (&Multicast_Manager::current_ptr->host_addr, hp->h_addr, sizeof host_addr); return 1; } return 0; } // This function attempts to get the internet address for either a // hostname or hostnumber. The function makes the simplifying // assumption that hostnames begin with an alphabetic character! hostent * Multicast_Manager::get_host_entry (const char *host) { static hostent host_entry; hostent *hp; if (ACE_OS::ace_isdigit (*host)) // IP address. { u_long ia = ACE_OS::inet_addr (host); if (ia == (u_long) -1) hp = 0; else hp = ACE_OS::gethostbyaddr ((char *) &ia, sizeof ia, AF_INET); } else // Host name. hp = ACE_OS::gethostbyname (host); return hp == 0 ? 0 : (hostent *) ACE_OS::memcpy (&host_entry, hp, sizeof *hp); } // Adds an additional new host to the list of host machines. void Multicast_Manager::add_host (const char *host_name) { ACE_NEW (Multicast_Manager::drwho_list, Host_Elem (host_name, Multicast_Manager::drwho_list)); } void Multicast_Manager::checkoff_host (in_addr host_addr) { for (Host_Elem *tmp = Multicast_Manager::drwho_list; tmp != 0; tmp = tmp->next) if (ACE_OS::memcmp (&tmp->host_addr.s_addr, &host_addr.s_addr, sizeof host_addr.s_addr) == 0) { tmp->checked_off = 1; Multicast_Manager::received_host_count--; return; } } int Multicast_Manager::get_next_non_responding_host (const char *&host_name) { for (Multicast_Manager::current_ptr = Multicast_Manager::current_ptr == 0 ? Multicast_Manager::drwho_list : Multicast_Manager::current_ptr->next; Multicast_Manager::current_ptr != 0; Multicast_Manager::current_ptr = Multicast_Manager::current_ptr->next) if (Multicast_Manager::current_ptr->checked_off == 0) { host_name = Multicast_Manager::current_ptr->host_name; return 1; } return 0; } Host_Elem::Host_Elem (const char *h_name, Host_Elem *n) : host_name (h_name), checked_off (0), next (n) { } int Multicast_Manager::outstanding_hosts_remain () { return Multicast_Manager::received_host_count > 0; } ace-8.0.4+dfsg.orig/apps/drwho/SML_Server.cpp0000644000175000017500000000012715027201773017742 0ustar sudipsudip#include "SML_Server.h" SML_Server::SML_Server () { } SML_Server::~SML_Server () { } ace-8.0.4+dfsg.orig/apps/drwho/Rwho_DB_Manager.h0000644000175000017500000000177615027201773020357 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Rwho_DB_Manager.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _RWHO_DB_MANAGER_H #define _RWHO_DB_MANAGER_H #include #include #include "ace/Dirent.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "Protocol_Record.h" /** * @class RWho_DB_Manager * * @brief This class returns the user/machine pairs one at a time from * the rwho database. */ class RWho_DB_Manager { public: RWho_DB_Manager (); ~RWho_DB_Manager (); int get_next_user (Protocol_Record &protocol_record); private: ACE_Dirent rwho_dir; whod host_data; int number_of_users; int current_user; const int WHOD_HEADER_SIZE; char original_pathname[MAXPATHLEN + 1]; const char *rwho_dir_name; int get_next_host (); }; #endif /* _RWHO_DB_MANAGER_H */ ace-8.0.4+dfsg.orig/apps/drwho/PM_Client.h0000644000175000017500000000177015027201773017245 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file PM_Client.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _PM_CLIENT_H #define _PM_CLIENT_H #include "Protocol_Manager.h" /** * @class PM_Client * * @brief Provides the client side of the friend manager lookup table abstraction. */ class PM_Client : public Protocol_Manager { public: PM_Client (); virtual ~PM_Client (); virtual int encode (char *packet, int &total_bytes) = 0; virtual int decode (char *packet, int &total_bytes) = 0; virtual void process (); protected: int max_key_length; virtual char *handle_protocol_entries (const char *cp, const char *key_name1, const char *key_name2 = 0); virtual Protocol_Record *insert_protocol_info (Protocol_Record &protocol_record); }; #endif /* _PM_CLIENT_H */ ace-8.0.4+dfsg.orig/apps/drwho/global.h0000644000175000017500000000220415027201773016664 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file global.h * * Here are all the declarations that are needed throughout the program. * * @author Douglas C. Schmidt */ //============================================================================= #ifndef _GLOBAL_H #define _GLOBAL_H #include "ace/config-all.h" #include "ace/Basic_Types.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ // These constants are used throughout drwho. enum { MAXUSERIDNAMELEN = 8, MAX_USER_TIMEOUT = 300, MAX_HOST_TIMEOUT = 300, UDP_PACKET_SIZE = 1024 * 8, PORT_NUMBER = 12344 }; // Default name of file where friends info is stored. #define FRIEND_FILE ".friends.dta" // Default name where rwho info is stored. #define RWHODIR "/usr/spool/rwho" // Macros for handling message types. #define GET_PACKET_TYPE(P) (ACE_NTOHS (*((short *) P))) #define SET_PACKET_TYPE(P,T) ((*(short *) P) = ACE_NTOHS (T)) #define SKIP_PACKET_TYPE(P) ((P) + sizeof (short)) #define SUBTRACT_PACKET_TYPE(L) ((L) - sizeof (short)) #endif /* _GLOBAL_H */ ace-8.0.4+dfsg.orig/apps/JAWS2/0000755000175000017500000000000015046037655014767 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/JAWS2/1000K.html0000644000175000017500000364110115027201773016347 0ustar sudipsudip 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 ace-8.0.4+dfsg.orig/apps/JAWS2/HTTP_10_Parse.cpp0000644000175000017500000000346215027201773017702 0ustar sudipsudip#include "HTTP_10.h" #include "JAWS/JAWS.h" #include "JAWS/IO.h" #include "JAWS/IO_Handler.h" #include "JAWS/Policy.h" #include "HTTP_10_Request.h" // --------------- PARSE TASK ---------------------- JAWS_HTTP_10_Parse_Task::JAWS_HTTP_10_Parse_Task () { } JAWS_HTTP_10_Parse_Task::~JAWS_HTTP_10_Parse_Task () { } int JAWS_HTTP_10_Parse_Task::handle_put (JAWS_Data_Block *data, ACE_Time_Value *) { JAWS_TRACE ("JAWS_HTTP_10_Parse_Task::handle_put"); JAWS_IO_Handler *handler = data->io_handler (); JAWS_Dispatch_Policy *policy = this->policy (); if (policy == 0) policy = data->policy (); JAWS_IO *io = policy->io (); JAWS_HTTP_10_Request *info; if (data->payload ()) info = reinterpret_cast (data->payload ()); else { info = new JAWS_HTTP_10_Request; if (info == 0) { ACE_ERROR ((LM_ERROR, "%p\n", "JAWS_HTTP_10_Parse_Task::handle_put")); return -1; } data->payload (static_cast (info)); } while (info->receive (*(ACE_Message_Block *)data) == 0) { int next_read_size = data->space (); if (next_read_size == 0) { // Set payload to reflect "request too long" break; } io->read (handler, data, next_read_size); switch (handler->status ()) { case JAWS_IO_Handler::READ_OK: // Behaved synchronously, reiterate continue; case JAWS_IO_Handler::READ_ERROR: case JAWS_IO_Handler::READ_ERROR_A: return -1; default: // This needs to be a value that tells the framework that // the call is asynchronous, but that we should remain in // the current task state. return 2; } } // request completely parsed info->dump (); return 0; } ace-8.0.4+dfsg.orig/apps/JAWS2/HTTP_10_Request.cpp0000644000175000017500000000452015027201773020254 0ustar sudipsudip#include "JAWS/JAWS.h" #include "HTTP_10_Request.h" #include "ace/OS_NS_pwd.h" static int dummy; JAWS_HTTP_10_Request::JAWS_HTTP_10_Request () : path_ (0) { } JAWS_HTTP_10_Request::~JAWS_HTTP_10_Request () { ACE_OS::free (this->path_); this->path_ = 0; } const char * JAWS_HTTP_10_Request::method () const { return this->request_line ()->method_str (); } const char * JAWS_HTTP_10_Request::uri () const { return this->request_line ()->url (); } const char * JAWS_HTTP_10_Request::version () const { return this->request_line ()->version (); } int JAWS_HTTP_10_Request::type () const { return this->request_line ()->method (); } const char * JAWS_HTTP_10_Request::path () const { if (this->path_ == 0) { JAWS_HTTP_10_Request *mutable_this = (JAWS_HTTP_10_Request *)this; mutable_this->path (this->uri ()); } return this->path_; } void JAWS_HTTP_10_Request::set_status (int s) { HTTP_Request::set_status (s); } void JAWS_HTTP_10_Request::path (const char *uri_string) { char const *file_name = uri_string; char buf[MAXPATHLEN + 1]; buf[0] = '\0'; if (file_name == 0) return; if (*file_name == '/') { file_name++; if (*file_name == '~') { char *ptr = buf; while (*++file_name && *file_name != '/') *ptr++ = *file_name; *ptr = '\0'; if (ptr == buf) ACE_OS::strcpy (buf, ACE_OS::getenv ("HOME")); else { #if !defined (ACE_WIN32) && !defined (VXWORKS) char pw_buf[BUFSIZ]; struct passwd pw_struct; if (ACE_OS::getpwnam_r (buf, &pw_struct, pw_buf, sizeof (pw_buf)) == 0) return; ACE_OS::strcpy (buf, pw_struct.pw_dir); #endif /* NOT ACE_WIN32 AND NOT VXWORKS */ } ACE_OS::strcat (buf, "/"); #if 0 ACE_OS::strcat (buf, HTTP_Config::instance ()->user_dir ()); #else ACE_OS::strcat (buf, ".www-docs"); #endif ACE_OS::strcat (buf, file_name); } else { // With a starting '/' but no '~' #if 0 ACE_OS::strcat (buf, HTTP_Config::instance ()->document_root ()); #else ACE_OS::strcat (buf, "."); #endif ACE_OS::strcat (buf, file_name - 1); } } if (*buf != '\0') this->path_ = ACE_OS::strdup (buf); } ace-8.0.4+dfsg.orig/apps/JAWS2/100K.html0000644000175000017500000030324115027201773016264 0ustar sudipsudip 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 ace-8.0.4+dfsg.orig/apps/JAWS2/HTTP_Policy.cpp0000644000175000017500000000042315027201773017561 0ustar sudipsudip#include "HTTP_Policy.h" HTTP_Policy::HTTP_Policy (JAWS_Concurrency_Base *concurrency) : concurrency_ (concurrency) { } JAWS_Concurrency_Base * HTTP_Policy::update (void *) { /* for now, we always return the same concurrency strategy */ return this->concurrency_; } ace-8.0.4+dfsg.orig/apps/JAWS2/HTTP_10.cpp0000644000175000017500000000106515027201773016545 0ustar sudipsudip#include "HTTP_10.h" #include "JAWS/JAWS.h" char * JAWS_HTTP_10_Helper::HTTP_decode_string (char *path) { // replace the percentcodes with the actual character int i, j; char percentcode[3]; for (i = j = 0; path[i] != '\0'; i++, j++) { if (path[i] == '%') { percentcode[0] = path[++i]; percentcode[1] = path[++i]; percentcode[2] = '\0'; path[j] = (char) ACE_OS::strtol (percentcode, (char **) 0, 16); } else path[j] = path[i]; } path[j] = path[i]; return path; } ace-8.0.4+dfsg.orig/apps/JAWS2/500K.html0000644000175000017500000172044115027201773016276 0ustar sudipsudip 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 ace-8.0.4+dfsg.orig/apps/JAWS2/HTTP_10_Write.cpp0000644000175000017500000000773515027201773017731 0ustar sudipsudip#include "JAWS/JAWS.h" #include "JAWS/IO.h" #include "JAWS/IO_Handler.h" #include "JAWS/Policy.h" #include "HTTP_10.h" #include "HTTP_10_Request.h" // --------------- WRITE TASK ---------------------- JAWS_HTTP_10_Write_Task::JAWS_HTTP_10_Write_Task () { } JAWS_HTTP_10_Write_Task::~JAWS_HTTP_10_Write_Task () { } int JAWS_HTTP_10_Write_Task::handle_put (JAWS_Data_Block *data, ACE_Time_Value *) { JAWS_TRACE ("JAWS_HTTP_10_Write_Task::handle_put"); JAWS_IO_Handler *handler = data->io_handler (); JAWS_Dispatch_Policy *policy = this->policy (); if (policy == 0) policy = data->policy (); JAWS_IO *io = policy->io (); JAWS_HTTP_10_Request *info = static_cast (data->payload ()); if (info->status () == (int) JAWS_HTTP_10_Request::STATUS_QUIT) { data->payload (0); delete info; return -3; } #if 0 ACE_DEBUG ((LM_DEBUG, " (%t) request %s::%s::%s parsed\n", (info->method () ? info->method () : "-"), (info->uri () ? info->uri () : "="), (info->version () ? info->version () : "HTTP/0.9"))); #endif if (info->type () != (int) JAWS_HTTP_10_Request::GET) info->set_status (JAWS_HTTP_10_Request::STATUS_NOT_IMPLEMENTED); if (info->type () == (int) JAWS_HTTP_10_Request::QUIT) info->set_status (JAWS_HTTP_10_Request::STATUS_QUIT); if (info->status () != (int) JAWS_HTTP_10_Request::STATUS_OK) { JAWS_TRACE ("JAWS_HTTP_10_Write_Task::handle_put, ! STATUS OK"); char msg[] = "HTTP/1.0 500 Internal Server Error" "

Server Error

HTTP/1.0 500 Internal Server Error" ""; io->send_error_message (handler, msg, sizeof (msg)); switch (handler->status ()) { case JAWS_IO_Handler::WRITE_OK: case JAWS_IO_Handler::WRITE_OK_A: if (info->status () == (int) JAWS_HTTP_10_Request::STATUS_QUIT) { data->payload (0); delete info; return -3; } data->payload (0); delete info; return 0; case JAWS_IO_Handler::WRITE_ERROR: case JAWS_IO_Handler::WRITE_ERROR_A: data->payload (0); delete info; return -1; default: return 2; } return 2; } else { if (ACE_OS::strcmp (info->version (), "HTTP/0.9") == 0) io->transmit_file (handler, info->path (), "", 0, "", 0); else io->transmit_file (handler, info->path (), "HTTP/1.0 200 Ok\r\n\r\n", 19, "", 0); switch (handler->status ()) { case JAWS_IO_Handler::TRANSMIT_OK_A: { JAWS_TRACE ("JAWS_HTTP_10_Write_Task::handle_put, OK_A"); data->payload (0); delete info; return 1; } case JAWS_IO_Handler::TRANSMIT_OK: { JAWS_TRACE ("JAWS_HTTP_10_Write_Task::handle_put, OK"); data->payload (0); delete info; return 0; } case JAWS_IO_Handler::TRANSMIT_ERROR: { JAWS_TRACE ("JAWS_HTTP_10_Write_Task::handle_put, ERROR"); data->payload (0); delete info; return 0; } case JAWS_IO_Handler::TRANSMIT_ERROR_A: { JAWS_TRACE ("JAWS_HTTP_10_Write_Task::handle_put, ERROR_A"); data->payload (0); delete info; return 1; } default: { JAWS_TRACE ("JAWS_HTTP_10_Write_Task::handle_put, DEFAULT"); data->payload (0); delete info; return 1; } } } data->payload (0); delete info; return -1; } ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/0000755000175000017500000000000015046037655015533 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Pipeline_Tasks.cpp0000644000175000017500000001104415027201773021142 0ustar sudipsudip#include "JAWS/Jaws_IO.h" #include "JAWS/Pipeline_Tasks.h" #include "JAWS/Pipeline_Handler_T.h" #include "JAWS/Data_Block.h" #include "JAWS/IO_Handler.h" #include "JAWS/Policy.h" JAWS_Pipeline_Handler::JAWS_Pipeline_Handler () : policy_ (0) { } JAWS_Pipeline_Handler::~JAWS_Pipeline_Handler () { } int JAWS_Pipeline_Handler::put (ACE_Message_Block *mb, ACE_Time_Value *tv) { JAWS_Data_Block *db = dynamic_cast (mb); JAWS_IO_Handler *ioh = db->io_handler (); // guarantee the handler remains for the duration of this call ioh->acquire (); int status = this->handle_put (db, tv); if (status != -1 && status != 2) { JAWS_Pipeline_Handler *task = ioh->task (); JAWS_Pipeline_Handler *next = dynamic_cast (task->next ()); ioh->task (next); } ioh->release (); return status; } JAWS_Dispatch_Policy * JAWS_Pipeline_Handler::policy () { return this->policy_; } void JAWS_Pipeline_Handler::policy (JAWS_Dispatch_Policy *policy) { this->policy_ = policy; } int JAWS_Pipeline_Accept_Task::put (ACE_Message_Block *mb, ACE_Time_Value *tv) { JAWS_Data_Block *db = dynamic_cast (mb); JAWS_Pipeline_Handler *task = db->task (); JAWS_Pipeline_Handler *next = dynamic_cast (task->next ()); JAWS_IO_Handler *ioh = this->new_handler (db); if (ioh == 0) { ACE_ERROR ((LM_ERROR, "%p\n", "JAWS_Pipeline_Accept_Task::put")); return -1; } ioh->acquire (); ioh->task (next); db->io_handler (ioh); int result = this->handle_put (ioh->message_block (), tv); ioh->release (); return result; } int JAWS_Pipeline_Accept_Task::handle_put (JAWS_Data_Block *data, ACE_Time_Value *) { int result = -1; // JAWS_Data_Block should contain an INET_Addr and an IO JAWS_IO_Handler *handler = data->io_handler (); JAWS_Dispatch_Policy *policy = this->policy (); if (policy == 0) policy = data->policy (); // data->policy ()->update (handler); JAWS_IO *io = policy->io (); io->accept (handler); // When accept returns, the resulting handle should be stored into // the JAWS_DATA_BLOCK somewhere. // Check the handler for status of the io call switch (handler->status ()) { case JAWS_IO_Handler::ACCEPT_OK: { ACE_DEBUG ((LM_DEBUG, "(%t) ACCEPT_OK\n")); result = 0; JAWS_TRACE ("JAWS_Pipeline_Accept_Task::handle_put ACCEPT_OK"); // Move on to next stage in pipeline break; } case JAWS_IO_Handler::ACCEPT_ERROR: { ACE_DEBUG ((LM_DEBUG, "(%t) ACCEPT_ERROR\n")); result = -1; JAWS_TRACE ("JAWS_Pipeline_Accept_Task::handle_put ACCEPT_ERROR"); // Should recycle the thread break; } default: { result = 1; JAWS_TRACE ("JAWS_Pipeline_Accept_Task::handle_put ACCEPT_IDLE"); // Should mean that the IO is asynchronous, and the word isn't out // yet. break; } } // In asynchronous and synchronous models, we can -- // have the io_handler set the new task in the data_block // In asynchronous model, we can -- // insert a wait task into the task queue ACE_DEBUG ((LM_DEBUG, "(%t) Returning %d\n", result)); return result; } JAWS_IO_Handler * JAWS_Pipeline_Accept_Task::new_handler (JAWS_Data_Block *data) { // Create a new handler and message block JAWS_Data_Block *ndb = new JAWS_Data_Block (*data); if (ndb == 0) { JAWS_TRACE ("JAWS_Pipeline_Accept_Task::new_handler, failed DB"); return 0; } JAWS_Dispatch_Policy *policy = (this->policy () == 0) ? data->policy () : this->policy (); JAWS_IO_Handler_Factory *ioh_factory = policy->ioh_factory (); JAWS_IO_Handler *nioh = ioh_factory->create_io_handler (); if (nioh == 0) { delete ndb; return 0; } ndb->io_handler (nioh); nioh->task (data->task ()); nioh->message_block (ndb); return nioh; } int JAWS_Pipeline_Done_Task::put (ACE_Message_Block *mb, ACE_Time_Value *) { JAWS_TRACE ("JAWS_Pipeline_Done_Task::put"); JAWS_Data_Block *data = dynamic_cast (mb); JAWS_IO_Handler *handler = data->io_handler (); JAWS_Dispatch_Policy *policy = this->policy (); if (policy == 0) policy = data->policy (); // JAWS_IO *io = policy->io (); data->task (0); data->io_handler (0); if (handler) handler->done (); // hack, let Concurrency know we are done. return -2; } int JAWS_Pipeline_Done_Task::handle_put (JAWS_Data_Block *, ACE_Time_Value *) { return 0; } ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Server.h0000644000175000017500000000162015027201773017142 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_SERVER_H #define JAWS_SERVER_H #include "JAWS/Export.h" #include "JAWS/Data_Block.h" #include "JAWS/Policy.h" class JAWS_IO_Handler_Factory; class JAWS_Export JAWS_Server { public: JAWS_Server (); JAWS_Server (int argc, char *argv[]); void init (int argc, char *argv[]); int open (JAWS_Pipeline_Handler *ph, JAWS_Dispatch_Policy *dp = 0); private: void parse_args (int argc, ACE_TCHAR *argv[]); // Parse arguments private: int ratio_; // ratio of asynch ops to threads int port_; // port to listen on int concurrency_; // 0 => pool, 1 => per request int dispatch_; // 0 => synch, 1 => asynch int nthreads_; // number of threads int maxthreads_; // maximum number of threads long flags_; // thread creation flags JAWS_Default_Dispatch_Policy policy_; }; #endif /* !defined (JAWS_SERVER_H) */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Assoc_Array.h0000644000175000017500000000507015027201773020105 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_ASSOC_ARRAY_H #define JAWS_ASSOC_ARRAY_H template class JAWS_Assoc_Array_Iterator; template class JAWS_Assoc_Array { friend class JAWS_Assoc_Array_Iterator; public: JAWS_Assoc_Array (int maxsize = 1024); ~JAWS_Assoc_Array (); int index (const KEY &k); // Returns the index into the array associated with key k // Returns -1 if not found. DATA * find (const KEY &k); // Returns the data associated with key k. 0 if not found. DATA * find_by_index (int i); // Returns the data associated with array index i. Returns 0 if the // index is invalid. DATA * insert (const KEY &k, const DATA &d); // Inserts a *copy* of the key and data into the associated array. // Both KEY and DATA must have well defined semantics for copy // construction. This method returns a pointer to the inserted item // copy, or 0 if an error occurred. NOTE: if an identical key // already exists in the tree, no new item is created, and the // returned pointer addresses the existing item associated with the // existing key. int remove (const KEY &k); // Removes the item associated with the given key from the // tree and destroys it. Returns 1 if it found the item // and successfully destroyed it, 0 if it did not find the // item, or -1 if an error occurred. void clear (); // Destroys all keys and associated data. protected: int find_i (const KEY &k); // If k points to an associated data item, then this function // returns the index into the arrays that hold it. Otherwise, it // returns an index suitable to insert the item. If the item is not // found and the table is full, maxsize_ is returned. private: KEY **k_array_; DATA **d_array_; int maxsize_; }; template class JAWS_Assoc_Array_Iterator { public: JAWS_Assoc_Array_Iterator (const JAWS_Assoc_Array &aa); ~JAWS_Assoc_Array_Iterator (); KEY * key (); DATA * data (); int first (); int last (); int next (); int previous (); int is_done (); private: // declare private and do not define: explicitly // prevent assignment and copy construction of iterators JAWS_Assoc_Array_Iterator (const JAWS_Assoc_Array_Iterator &); void operator= (const JAWS_Assoc_Array_Iterator &); private: const JAWS_Assoc_Array &aa_; int i_; // The current item pointed by iterator. int j_; // The next item to be pointed to by iterator. }; #include "JAWS/Assoc_Array.cpp" #endif /* !defined (JAWS_ASSOC_ARRAY_H) */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/IO_Acceptor.cpp0000644000175000017500000001031515027201773020357 0ustar sudipsudip#include "JAWS/Data_Block.h" #include "JAWS/IO_Acceptor.h" #include "ace/OS_NS_sys_socket.h" JAWS_IO_Acceptor::JAWS_IO_Acceptor () { } JAWS_IO_Acceptor::~JAWS_IO_Acceptor () { } int JAWS_IO_Acceptor::open (const ACE_INET_Addr &, int) { return -1; } int JAWS_IO_Acceptor::open (const ACE_HANDLE &) { return -1; } void JAWS_IO_Acceptor::close () { } int JAWS_IO_Acceptor::accept (ACE_SOCK_Stream &, ACE_Addr *, ACE_Time_Value *, int, int) const { return -1; } int JAWS_IO_Acceptor::accept (size_t, const void *) { return -1; } ACE_HANDLE JAWS_IO_Acceptor::get_handle () { return ACE_INVALID_HANDLE; } int JAWS_IO_Synch_Acceptor::open (const ACE_INET_Addr &local_sap, int backlog) { return this->acceptor_.open (local_sap, 1, PF_INET, backlog); } int JAWS_IO_Synch_Acceptor::open (const ACE_HANDLE &socket) { ACE_HANDLE handle = this->acceptor_.get_handle (); if (handle == socket) return 0; if (handle != ACE_INVALID_HANDLE) ACE_OS::closesocket (this->acceptor_.get_handle ()); this->acceptor_.set_handle (socket); return 0; } int JAWS_IO_Synch_Acceptor::accept (ACE_SOCK_Stream &new_stream, ACE_Addr *remote_addr, ACE_Time_Value *timeout, int restart, int reset_new_handle) const { return this->acceptor_.accept (new_stream, remote_addr, timeout, restart, reset_new_handle); } int JAWS_IO_Synch_Acceptor::accept (size_t, const void *) { return -1; } ACE_HANDLE JAWS_IO_Synch_Acceptor::get_handle () { return this->acceptor_.get_handle (); } JAWS_IO_Asynch_Acceptor::JAWS_IO_Asynch_Acceptor () #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) : acceptor_ (*(new ACE_Asynch_Acceptor)), acceptor_ptr_ (&acceptor_) #endif { } JAWS_IO_Asynch_Acceptor::~JAWS_IO_Asynch_Acceptor () { #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) delete this->acceptor_ptr_; this->acceptor_ptr_ = 0; #endif } int JAWS_IO_Asynch_Acceptor::open (const ACE_INET_Addr &address, int backlog) { #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) // Tell the acceptor to listen on this->port_, which sets up an // asynchronous I/O request to the OS. return this->acceptor_.open (address, JAWS_Data_Block::JAWS_DATA_BLOCK_SIZE, 1, backlog, 1, 0, 0, 0, 0); #else ACE_UNUSED_ARG (address); ACE_UNUSED_ARG (backlog); return -1; #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ } int JAWS_IO_Asynch_Acceptor::open (const ACE_HANDLE &socket) { #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) ACE_HANDLE handle = this->handle_; if (handle == socket) return 0; if (handle != ACE_INVALID_HANDLE) ACE_OS::closesocket (handle); this->handle_ = socket; return 0; #else ACE_UNUSED_ARG (socket); return -1; #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ } int JAWS_IO_Asynch_Acceptor::accept (size_t bytes_to_read, const void *act) { #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) return this->acceptor_.accept (bytes_to_read, act); #else ACE_UNUSED_ARG (bytes_to_read); ACE_UNUSED_ARG (act); return -1; #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ } int JAWS_IO_Asynch_Acceptor::accept (ACE_SOCK_Stream &, ACE_Addr *, ACE_Time_Value *, int, int) const { return -1; } ACE_HANDLE JAWS_IO_Asynch_Acceptor::get_handle () { #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) return this->acceptor_.get_handle (); #else return ACE_INVALID_HANDLE; #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ } void JAWS_IO_Asynch_Acceptor::close () { #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) delete this->acceptor_ptr_; this->acceptor_ptr_ = 0; #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ } ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Reaper.cpp0000644000175000017500000000163115027201773017447 0ustar sudipsudip#include "JAWS/Reaper.h" #include "JAWS/Concurrency.h" #include "JAWS/IO_Acceptor.h" JAWS_Reaper::JAWS_Reaper (JAWS_Concurrency_Base *concurrency) : concurrency_ (concurrency), waiting_ (0) { } JAWS_Reaper::~JAWS_Reaper () { } int JAWS_Reaper::open (void *) { if (this->waiting_ == 0) { ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, g ,this->lock_, -1); if (this->waiting_ == 0) { if (this->activate () == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "JAWS_Reaper::activate"), -1); this->waiting_ = 1; } } return 0; } int JAWS_Reaper::svc () { ACE_TRACE ("JAWS_Reaper::svc"); int result = this->concurrency_->thr_mgr ()->wait (); JAWS_IO_Synch_Acceptor_Singleton::instance ()->close (); JAWS_IO_Asynch_Acceptor_Singleton::instance ()->close (); ACE_DEBUG ((LM_DEBUG, "(%t) Leaving REAPER\n")); return result; } ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Cache_Manager.h0000644000175000017500000000246015027201773020334 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_CACHE_MANAGER_H #define JAWS_CACHE_MANAGER_H #include "ace/ACE.h" #include "JAWS/Cache_Manager_T.h" class JAWS_String_Hash_Functor { public: JAWS_String_Hash_Functor (const char *s); operator unsigned long () const; private: unsigned long i_; }; class JAWS_String_Equal_Functor { public: JAWS_String_Equal_Functor (const char *s1, const char *s2); operator int () const; private: int i_; }; class JAWS_Strdup_String { public: JAWS_Strdup_String (); JAWS_Strdup_String (const char *s); JAWS_Strdup_String (const JAWS_Strdup_String &s); ~JAWS_Strdup_String (); operator const char * () const; void operator = (const char *s); void operator = (const JAWS_Strdup_String &s); private: int *c_; char *s_; }; typedef JAWS_Cache_Manager JAWS_String_Referenced_Cache_Manager; typedef JAWS_Cache_Manager JAWS_String_Counted_Cache_Manager; #endif /* JAWS_CACHE_MANAGER_H */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Assoc_Array.cpp0000644000175000017500000001231515027201773020440 0ustar sudipsudip#ifndef JAWS_ASSOC_ARRAY_CPP #define JAWS_ASSOC_ARRAY_CPP #include "ace/config-all.h" #include "JAWS/Assoc_Array.h" template JAWS_Assoc_Array::JAWS_Assoc_Array (int maxsize) : k_array_ (0), d_array_ (0), maxsize_ (maxsize) { typedef void * ptr_type; this->k_array_ = reinterpret_cast (new ptr_type[this->maxsize_]); if (this->k_array_ == 0) { this->maxsize_ = 0; return; } this->d_array_ = reinterpret_cast (new ptr_type[this->maxsize_]); if (this->d_array_ == 0) { delete[] this->k_array_; this->maxsize_ = 0; return; } for (int i = 0; i < this->maxsize_; i++) { this->k_array_[i] = 0; this->d_array_[i] = 0; } } template JAWS_Assoc_Array::~JAWS_Assoc_Array () { this->clear (); delete[] reinterpret_cast (this->k_array_); delete[] reinterpret_cast (this->d_array_); this->k_array_ = 0; this->d_array_ = 0; } template int JAWS_Assoc_Array::index (const KEY &k) { return this->find_i (k); } template DATA * JAWS_Assoc_Array::find (const KEY &k) { int i = this->find_i (k); return (i < this->maxsize_) ? this->d_array_[i] : 0; } template DATA * JAWS_Assoc_Array::find_by_index (int i) { return ((0 <= i) && (i < this->maxsize_)) ? this->d_array_[i] : 0; } template DATA * JAWS_Assoc_Array::insert (const KEY &k, const DATA &d) { int i = this->find_i (k); if (i == this->maxsize_) return 0; KEY *&kk = this->k_array_[i]; DATA *&dd = this->d_array_[i]; if (kk == 0) { dd = new DATA (d); if (dd == 0) return 0; KEY *kkk = new KEY (k); if (kkk == 0) { delete dd; return 0; } kk = kkk; } return dd; } template int JAWS_Assoc_Array::remove (const KEY &k) { int i = this->find_i (k); if (i == this->maxsize_) return 0; KEY *&kk = this->k_array_[i]; DATA *&dd = this->d_array_[i]; if (kk != 0) { KEY *kkk = kk; kk = 0; delete kkk; delete dd; dd = 0; return 1; } return 0; } template void JAWS_Assoc_Array::clear () { for (int i = 0; i < this->maxsize_; i++) { if (this->k_array_[i] != 0) { delete this->k_array_[i]; delete this->d_array_[i]; this->k_array_[i] = 0; this->d_array_[i] = 0; } } } template int JAWS_Assoc_Array::find_i (const KEY &k) { int j = this->maxsize_; for (int i = 0; i < this->maxsize_; i++) { KEY *kk = this->k_array_[i]; if (kk) { if (*kk == k) return i; } else if (j == this->maxsize_) j = i; } return j; } template JAWS_Assoc_Array_Iterator:: JAWS_Assoc_Array_Iterator (const JAWS_Assoc_Array &aa) : aa_ (aa), i_ (0), j_ (0) { } template JAWS_Assoc_Array_Iterator::~JAWS_Assoc_Array_Iterator () { } template KEY * JAWS_Assoc_Array_Iterator::key () { return this->aa_.k_array_[this->i_]; } template DATA * JAWS_Assoc_Array_Iterator::data () { return this->aa_.d_array_[this->i_]; } template int JAWS_Assoc_Array_Iterator::first () { this->i_ = 0; for (this->j_ = 0; this->j_ < this->aa_.maxsize_; this->j_++) { if (this->aa_.k_array_[this->j_] != 0) break; } return this->next (); } template int JAWS_Assoc_Array_Iterator::last () { this->j_ = this->aa_.maxsize_; for (this->i_ = this->aa_.maxsize_; this->i_ > 0; this->i_--) { if (this->aa_.k_array_[this->i_-1] != 0) break; } return (this->i_-- > 0); } template int JAWS_Assoc_Array_Iterator::next () { if (this->j_ < this->aa_.maxsize_) { this->i_ = this->j_; for (this->j_++; this->j_ < this->aa_.maxsize_; this->j_++) { if (this->aa_.k_array_[this->j_] != 0) break; } } return (this->i_ < this->aa_.maxsize_); } template int JAWS_Assoc_Array_Iterator::previous () { if (this->i_ > 0) { for (this->j_ = this->i_; this->i_ > 0; this->i_--) { if (this->aa_.k_array_[this->i_-1] != 0) break; } } if (this->i_ == 0) this->first (); else this->i_--; return 1; } template int JAWS_Assoc_Array_Iterator::is_done () { return (this->j_ == this->aa_.maxsize_); } template JAWS_Assoc_Array_Iterator:: JAWS_Assoc_Array_Iterator (const JAWS_Assoc_Array_Iterator &aai) : aa_ (aai.aa_), i_ (aai.i_), j_ (aai.j_) { } template void JAWS_Assoc_Array_Iterator:: operator= (const JAWS_Assoc_Array_Iterator &) { } #endif /* !defined (JAWS_ASSOC_ARRAY_CPP) */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Reaper.h0000644000175000017500000000174615027201773017123 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_REAPER_H #define JAWS_REAPER_H #include "ace/Singleton.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Task.h" #include "ace/Synch_Traits.h" #include "JAWS/Export.h" // A reaper class to reap the threads. class JAWS_Concurrency_Base; /** * Reap threads for the concurrency strategies * * The JAWS_Reaper uses the default Thread Manager (while each * concurrency strategy uses their own). The idea is that the * reaper will spawn a thread to reap the threads of a concurrency * strategy. This allows the main thread to reap the threads of * the reaper before exiting. */ class JAWS_Export JAWS_Reaper : public ACE_Task { public: JAWS_Reaper (JAWS_Concurrency_Base *concurrency); virtual ~JAWS_Reaper (); virtual int open (void * = 0); virtual int svc (); private: JAWS_Concurrency_Base *concurrency_; int waiting_; ACE_SYNCH_MUTEX lock_; }; #endif /* JAWS_REAPER_H */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Cache_Heap_T.cpp0000644000175000017500000001614015027201773020455 0ustar sudipsudip#ifndef JAWS_CACHE_HEAP_T_CPP #define JAWS_CACHE_HEAP_T_CPP #include "JAWS/Cache_Heap_T.h" #include "JAWS/Cache_Manager_T.h" template JAWS_Cache_Heap::JAWS_Cache_Heap (ACE_Allocator *alloc, size_t maxsize) : allocator_ (alloc), maxsize_ (maxsize), size_ (0) { if (this->allocator_ == 0) this->allocator_ = ACE_Allocator::instance (); size_t memsize = this->maxsize_ * sizeof (Cache_Heap_Item *); this->heap_ = (Cache_Heap_Item **) this->allocator_->malloc (memsize); if (this->heap_) { for (size_t i = 0; i < this->maxsize_; i++) this->heap_[i] = 0; } else { this->maxsize_ = 0; // should indicate something } } template JAWS_Cache_Heap::~JAWS_Cache_Heap () { if (this->heap_ != 0) { for (size_t i = 0; i < this->maxsize_; i++) { if (this->heap_[i]) { ACE_DES_FREE_TEMPLATE4(this->heap_[i], this->allocator_->free, JAWS_Cache_Heap_Item, EXT_ID, FACT, H_FN, E_FN); this->heap_[i] = 0; } } this->allocator_->free (this->heap_); this->heap_ = 0; } this->allocator_ = 0; } template int JAWS_Cache_Heap::is_empty () const { return (this->size_ == 0); } template int JAWS_Cache_Heap::is_full () const { return (this->size_ == this->maxsize_); } template size_t JAWS_Cache_Heap::size () const { return this->size_; } template size_t JAWS_Cache_Heap::maxsize () const { return this->maxsize_; } template int JAWS_Cache_Heap::maxsize (Cache_Manager *cm, size_t new_maxsize) { int result = -1; size_t memsize = new_maxsize * sizeof (Cache_Heap_Item *); Cache_Heap_Item **new_heap = (Cache_Heap_Item **) this->allocator_->malloc (memsize); if (new_heap) { while (new_maxsize < this->size_) cm->FLUSH_i (); for (size_t i = 0; i < new_maxsize; i++) if (i < this->size_) new_heap[i] = this->heap_[i]; else new_heap[i] = 0; Cache_Heap_Item ** volatile temp = this->heap_; this->heap_ = new_heap; this->maxsize_ = new_maxsize; this->allocator_->free (temp); result = 0; } return result; } template void JAWS_Cache_Heap::insert_i (Cache_Heap_Item *item) { /* ASSERT: this->size_ < this->maxsize_ */ size_t i; for (i = this->size_ + 1; i > 1; i /= 2) { if (item->priority () > this->heap_[i/2 - 1]->priority ()) break; this->heap_[i-1] = this->heap_[i/2 - 1]; this->heap_[i-1]->heap_idx_ = i-1; } this->heap_[i-1] = item; this->heap_[i-1]->heap_idx_ = i-1; this->size_++; } template int JAWS_Cache_Heap::insert (const EXT_ID &ext_id, JAWS_Cache_Object *const &int_id) { if (this->is_full ()) return -1; Cache_Heap_Item *item; ACE_NEW_MALLOC_RETURN (item, (Cache_Heap_Item *) this->allocator_->malloc (sizeof (Cache_Heap_Item)), Cache_Heap_Item (ext_id, int_id), -1); this->insert_i (item); return 0; } template void JAWS_Cache_Heap::remove_i () { /* ASSERT: this->size_ > 0 */ this->size_--; Cache_Heap_Item *temp = this->heap_[this->size_]; this->heap_[this->size_] = 0; size_t i = 1; while (2*i <= this->size_) { size_t child = 2*i; if ((child < this->size_) && (this->heap_[2*i]->priority () < this->heap_[2*i - 1]->priority ())) child = 2*i + 1; if (temp->priority () < this->heap_[child-1]->priority ()) break; this->heap_[i-1] = this->heap_[child-1]; this->heap_[i-1]->heap_idx_ = i-1; i = child; } if (this->size_ > 0) { this->heap_[i-1] = temp; this->heap_[i-1]->heap_idx_ = i-1; } } template void JAWS_Cache_Heap::remove_i (size_t pos) { Cache_Heap_Item *item = this->heap_[pos]; if (pos > 0) { int i = pos + 1; do { this->heap_[i-1] = this->heap_[i/2 - 1]; this->heap_[i-1]->heap_idx_ = i-1; i /= 2; } while (i > 1); } this->heap_[0] = item; this->remove_i (); } template int JAWS_Cache_Heap::remove (EXT_ID &ext_id, JAWS_Cache_Object *&int_id) { if (this->is_empty ()) return -1; Cache_Heap_Item *item = this->heap_[0]; item->int_id_->heap_item (0); this->remove_i (); ext_id = item->ext_id_; int_id = item->int_id_; ACE_DES_FREE_TEMPLATE4(item, this->allocator_->free, JAWS_Cache_Heap_Item, EXT_ID, FACT, H_FN, E_FN); item = 0; return 0; } template int JAWS_Cache_Heap::remove (void *item) { if (item == 0) return 0; Cache_Heap_Item *real_item = (Cache_Heap_Item *) item; // Make sure the item is where it thinks it is. if (this->heap_[real_item->heap_idx_] != real_item) return -1; real_item->int_id_->heap_item (0); this->remove_i (real_item->heap_idx_); ACE_DES_FREE_TEMPLATE4(real_item, this->allocator_->free, JAWS_Cache_Heap_Item, EXT_ID, FACT, H_FN, E_FN); real_item = 0; return 0; } template int JAWS_Cache_Heap::adjust (void *item) { if (item == 0) return 0; Cache_Heap_Item *real_item = (Cache_Heap_Item *) item; // Make sure the item is where it thinks it is. if (this->heap_[real_item->heap_idx_] != real_item) return -1; this->remove_i (real_item->heap_idx_); this->insert_i (real_item); return 0; } template JAWS_Cache_Heap_Item:: JAWS_Cache_Heap_Item (const EXT_ID &ext_id, JAWS_Cache_Object *const &int_id) : ext_id_ (ext_id), int_id_ (int_id), heap_idx_ (0) { this->int_id_->heap_item (this); } template unsigned int JAWS_Cache_Heap_Item::priority () { return this->int_id_->priority (); } #endif /* JAWS_CACHE_HEAP_T_CPP */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Waiter.cpp0000644000175000017500000000201215027201773017456 0ustar sudipsudip#include "ace/Proactor.h" #include "JAWS/Waiter.h" #include "JAWS/IO_Handler.h" JAWS_Waiter::JAWS_Waiter () : iter_ (*this) { } JAWS_Waiter::~JAWS_Waiter () { } JAWS_Waiter_Base_Iterator & JAWS_Waiter::iter () { return this->iter_; } int JAWS_Waiter::index () { #if 0 // A future version of ACE will support this. ACE_Thread_ID tid = ACE_OS::thr_self (); #else // Do it this way for now ACE_thread_t thr_name; thr_name = ACE_OS::thr_self (); JAWS_Thread_ID tid (thr_name); #endif /* 0 */ return JAWS_Waiter_Base::index (tid); } JAWS_IO_Handler * JAWS_Waiter::wait_for_completion (int i) { JAWS_IO_Handler *ioh; JAWS_IO_Handler **iohptr; iohptr = (i >= 0) ? this->find_by_index (i) : this->find_by_index (this->index ()); while (*iohptr == 0) if (ACE_Proactor::instance ()->handle_events () == -1) { ACE_ERROR ((LM_ERROR, "%p\n", "JAWS_Waiter::wait_for_completion")); return 0; } ioh = *iohptr; *iohptr = 0; ioh->lock (); ioh->release (); return ioh; } ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Pipeline.cpp0000644000175000017500000000057115027201773020000 0ustar sudipsudip#include "JAWS/Pipeline.h" JAWS_Pipeline::JAWS_Pipeline () { } int JAWS_Pipeline::open (void *) { // Simply call into the virtual svc() method. if (this->svc () == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "JAWS_Pipeline::svc"), -1); return 0; } int JAWS_Pipeline::close (u_long) { return 0; } ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Pipeline_Tasks.h0000644000175000017500000000277315027201773020620 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_PIPELINE_TASKS_H #define JAWS_PIPELINE_TASKS_H #include "ace/Singleton.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "JAWS/Export.h" #include "JAWS/Pipeline.h" #include "JAWS/Pipeline_Handler_T.h" #include "JAWS/Data_Block.h" class JAWS_Export JAWS_Pipeline_Handler : public JAWS_Pipeline_Abstract_Handler { public: JAWS_Pipeline_Handler (); virtual ~JAWS_Pipeline_Handler (); virtual int put (ACE_Message_Block *mb, ACE_Time_Value *tv = 0); virtual int handle_put (JAWS_Data_Block *data, ACE_Time_Value *tv) = 0; virtual JAWS_Dispatch_Policy * policy (); virtual void policy (JAWS_Dispatch_Policy *); private: JAWS_Dispatch_Policy *policy_; }; class JAWS_Pipeline_Accept_Task : public JAWS_Pipeline_Handler { public: virtual int put (ACE_Message_Block *mb, ACE_Time_Value *tv = 0); virtual int handle_put (JAWS_Data_Block *data, ACE_Time_Value *tv); virtual JAWS_IO_Handler * new_handler (JAWS_Data_Block *data); }; class JAWS_Pipeline_Done_Task : public JAWS_Pipeline_Handler { public: virtual int put (ACE_Message_Block *mb, ACE_Time_Value *tv = 0); virtual int handle_put (JAWS_Data_Block *data, ACE_Time_Value *tv); }; typedef ACE_Singleton JAWS_Pipeline_Accept_Task_Singleton; typedef ACE_Singleton JAWS_Pipeline_Done_Task_Singleton; #endif /* !defined (JAWS_PIPELINE_TASKS_H) */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/FILE.h0000644000175000017500000000200315027201773016407 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_FILE_H #define JAWS_FILE_H #include "ace/FILE_IO.h" #include "ace/Mem_Map.h" #include "JAWS/Export.h" #include "ace/Synch_Traits.h" #include "ace/Thread_Mutex.h" class JAWS_Export JAWS_FILE : public ACE_FILE_IO // // Like ACE_FILE_IO, but support for ACE_Mem_Map; { public: JAWS_FILE (); ~JAWS_FILE (); ACE_Mem_Map *mem_map (int length = -1, int prot = PROT_RDWR, int share = ACE_MAP_PRIVATE, void *addr = 0, ACE_OFF_T offset = 0, LPSECURITY_ATTRIBUTES sa = 0); ACE_Mem_Map *mem_map (int length = -1, int prot = PROT_RDWR, int share = ACE_MAP_PRIVATE, void *addr = 0, ACE_OFF_T offset = 0, LPSECURITY_ATTRIBUTES sa = 0) const; ACE_Mem_Map *map () const; private: ACE_SYNCH_MUTEX lock_; ACE_Mem_Map *map_; }; #endif /* JAWS_FILE_H */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Pipeline.h0000644000175000017500000000146515027201773017450 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_PIPELINE_H #define JAWS_PIPELINE_H #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Service_Config.h" #include "ace/Stream.h" #include "ace/Module.h" #include "ace/Task.h" #include "JAWS/Export.h" typedef ACE_Stream JAWS_Pipeline_Stream; typedef ACE_Module JAWS_Pipeline_Module; typedef ACE_Task JAWS_Pipeline_Task; class JAWS_IO_Handler; class JAWS_Dispatch_Policy; class JAWS_Export JAWS_Pipeline : public JAWS_Pipeline_Task // = TITLE // Methods that are common to pipeline components { public: JAWS_Pipeline (); // ACE_Task hooks virtual int open (void * = 0); virtual int close (u_long = 0); }; #endif /* !defined (JAWS_PIPELINE_H) */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Headers.cpp0000644000175000017500000000624515027201773017612 0ustar sudipsudip#include "JAWS/Headers.h" #include "ace/OS_NS_stdlib.h" #include "ace/OS_NS_strings.h" #include "ace/OS_NS_string.h" // Header Data JAWS_Header_Data::JAWS_Header_Data (const char *name, const char *value, int type) : header_name_ (name ? ACE_OS::strdup (name) : 0), header_value_ (value ? ACE_OS::strdup (value) : 0), header_type_ (type) { } JAWS_Header_Data::JAWS_Header_Data (const char *name, int type, const char *value) : header_name_ (name ? ACE_OS::strdup (name) : 0), header_value_ (value ? ACE_OS::strdup (value) : 0), header_type_ (type) { } JAWS_Header_Data::~JAWS_Header_Data () { if ( this->header_name_ ) ACE_OS::free ((void *)this->header_name_); if ( this->header_value_ ) ACE_OS::free ((void *)this->header_value_); this->header_name_ = 0; this->header_value_ = 0; } const char * JAWS_Header_Data::header_name () const { return this->header_name_; } const char * JAWS_Header_Data::header_value () const { return this->header_value_; } int JAWS_Header_Data::header_type () const { return this->header_type_; } void JAWS_Header_Data::header_name (const char *name) { if (this->header_name_) ACE_OS::free ((void *)this->header_name_); this->header_name_ = name ? ACE_OS::strdup (name) : 0; } void JAWS_Header_Data::header_value (const char *value) { if (this->header_value_) ACE_OS::free ((void *)this->header_value_); this->header_value_ = value ? ACE_OS::strdup (value) : 0; } void JAWS_Header_Data::header_type (int type) { this->header_type_ = type; } // Header Table JAWS_Headers::JAWS_Headers () : iter_ (*this) { } JAWS_Headers::~JAWS_Headers () { } JAWS_Header_Table_Iterator & JAWS_Headers::iter () { return this->iter_; } int JAWS_Headers::insert (JAWS_Header_Data *new_data) { // Since there may be duplicate header entries, we don't worry about // doing this find anymore. Make the application developer figure // out how to interpret duplicate entries. return (JAWS_Header_Table::insert_tail (new_data) ? 0 : -1); } JAWS_Header_Data * JAWS_Headers::find (const char *const &header_name) { this->iter_.first (); return this->find_next (header_name); } JAWS_Header_Data * JAWS_Headers::find_next (const char *const &header_name) { JAWS_Header_Data *data = 0; JAWS_Header_Table_Iterator &i = this->iter_; while (! i.done ()) { data = i.next (); if (data != 0) { if (ACE_OS::strcasecmp (data->header_name (), header_name) != 0) data = 0; } i.advance (); if (data != 0) break; } return data; } void JAWS_Headers::remove_all (const char *const &header_name) { JAWS_Header_Data *data; int done; do { JAWS_Header_Table_Iterator i (*this); i.first (); done = 1; while (! i.done ()) { data = i.next (); if (data != 0 && ACE_OS::strcasecmp (data->header_name (), header_name) == 0) { i.remove (); delete data; done = 0; break; } else i.advance (); } } while (! done); } ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Hash_Bucket_T.h0000644000175000017500000001506415027201773020346 0ustar sudipsudip/* -*- c++ -*- */ // Hey Emacs! This is a C++ file! #ifndef JAWS_HASH_BUCKET_T_H #define JAWS_HASH_BUCKET_T_H #include "ace/Containers.h" #define JAWS_HASH_BUCKET_ITEM JAWS_Hash_Bucket_Item #define JAWS_HASH_BUCKET_DLCSTACK JAWS_Hash_Bucket_DLCStack #define JAWS_HASH_BUCKET_DLCSTACK_ITERATOR \ JAWS_Hash_Bucket_DLCStack_Iterator // Why Hash_Bucket? // // This is an attempt to simplify the creation of high-performance // hash tables with respect to concurrent access by multiple threads. // To this end, we attempt to raise the amount of concurrency through // the use or readers/writer locks rather than through mutual // exclusion. template class JAWS_Hash_Bucket_Item { public: JAWS_Hash_Bucket_Item (const EXT_ID &ext_id, const INT_ID &int_id, JAWS_Hash_Bucket_Item *next = 0, JAWS_Hash_Bucket_Item *prev = 0); JAWS_Hash_Bucket_Item (JAWS_Hash_Bucket_Item *next = 0, JAWS_Hash_Bucket_Item *prev = 0); ~JAWS_Hash_Bucket_Item (); // Destructor. EXT_ID ext_id_; // Key used to look up an entry. INT_ID int_id_; // The contents of the entry itself. JAWS_Hash_Bucket_Item *next_; // Pointer to the next item in the bucket of overflow nodes. JAWS_Hash_Bucket_Item *prev_; // Pointer to the prev item in the bucket of overflow nodes. }; template class JAWS_Hash_Bucket_DLCStack_Iterator; template class JAWS_Hash_Bucket_Manager; template class JAWS_Hash_Bucket_DLCStack // Create a doubly linked circular stack to be managed by the // Hash_Bucket_Manager { friend class JAWS_Hash_Bucket_DLCStack_Iterator; public: JAWS_Hash_Bucket_DLCStack (ACE_Allocator *alloc = 0); ~JAWS_Hash_Bucket_DLCStack (); int is_empty () const; // Returns 1 if the container is empty, otherwise returns 0. JAWS_Hash_Bucket_Item *push (const EXT_ID &ext_id, const INT_ID &int_id); // Adds to the head of the list. // Returns the new item that was inserted. JAWS_Hash_Bucket_Item *pop (); // Removes and returns the first in the list. Returns // internal node's address on success, 0 if the queue was empty. // This method will *not* free the internal node. void reset (); // Reset the to be empty. // Notice that since no one is interested in the items within, // This operation will delete all items. int remove (JAWS_Hash_Bucket_Item *item); // If item is still part of the CStack, it is removed. // In anycase, if there is no error, item is freed. // Returns 0 if ok, -1 on error. ACE_Allocator *allocator_; private: JAWS_Hash_Bucket_Item *head_; JAWS_Hash_Bucket_Item *tail_; }; template class JAWS_Hash_Bucket_DLCStack_Iterator { public: JAWS_Hash_Bucket_DLCStack_Iterator (const JAWS_HASH_BUCKET_DLCSTACK &dlcstack); int first (); // Moves to first element in the set, clears done flag. Returns 0 // if empty, 1 otherwise. int last (); // Moves to last element in the set, clears done flag. Returns 0 if // empty, 1 otherwise. int advance (); // Move forward by one element of set. Returns 0 if empty or we end // up being the first element in the set, 1 otherwise. If advance // takes us to the first element, done is set to true. int revert (); // Move backward by one element of set. Returns 0 if empty or we // end up being the last element in the set, 1 otherwise. If revert // takes us to the last element, done is set to true. int next (JAWS_HASH_BUCKET_ITEM *&item); int next (JAWS_HASH_BUCKET_ITEM *&item) const; // Pass back the next item. Returns 0 if done is true, 1 otherwise. int prev (JAWS_HASH_BUCKET_ITEM *&item); int prev (JAWS_HASH_BUCKET_ITEM *&item) const; // Pass back the previous item. Returns 0 if done is true, 1 // otherwise. int done () const; // Returns 1 if done_ flag is set, 0 otherwise. done_ flag is set // if next takes us to first element or prev takes us to last // element. private: const JAWS_HASH_BUCKET_DLCSTACK &dlcstack_; JAWS_HASH_BUCKET_ITEM *next_; JAWS_HASH_BUCKET_ITEM *prev_; int done_; }; template class JAWS_Hash_Bucket_Manager { public: JAWS_Hash_Bucket_Manager (ACE_Allocator *alloc = 0); int open (ACE_Allocator *alloc = 0); ~JAWS_Hash_Bucket_Manager (); int close (); int find (const EXT_ID &ext_id) const; int find (const EXT_ID &ext_id, INT_ID &int_id) const; // Locate and pass out parameter via . If found, // return 0, returns -1 if not found. int bind (const EXT_ID &ext_id, const INT_ID &int_id); int trybind (const EXT_ID &ext_id, INT_ID &int_id); // Associate with if and only if is not // in the map. If is already in the map then the // parameter is assigned the existing value in the map. Returns 0 // if a new entry is bound successfully, returns 1 if an attempt is // made to bind an existing entry, and returns -1 if failures occur. int rebind (const EXT_ID &ext_id, const INT_ID &int_id, EXT_ID &old_ext_id, INT_ID &old_int_id); // Associate with . If is not in the map // then behaves just like . Otherwise, store the old values // of and into the "out" parameters and rebind the // new parameters. This is very useful if you need to have an // atomic way of updating and you also need full // control over memory allocation. Returns 0 if a new entry is // bound successfully, returns 1 if an existing entry was rebound, // and returns -1 if failures occur. int unbind (const EXT_ID &ext_id); int unbind (const EXT_ID &ext_id, INT_ID &int_id); // Break any association of . Returns the value of // in case the caller needs to deallocate memory. Return value is 0 // if unbind succeeds, -1 otherwise. protected: JAWS_Hash_Bucket_Item *find_i (const EXT_ID &ext_id) const; // Returns the item associated with ext_id if found in list. // Returns NULL if not found. private: JAWS_Hash_Bucket_DLCStack dlcstack_; }; #include "JAWS/Hash_Bucket_T.cpp" #endif /* JAWS_HASH_BUCKET_T_H */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Filecache.cpp0000644000175000017500000000423115027201773020073 0ustar sudipsudip#include "ace/FILE_Connector.h" #include "ace/OS_NS_unistd.h" #include "JAWS/Filecache.h" #include "JAWS/Cache_List_T.h" void JAWS_Referenced_Filecache_Factory::destroy (JAWS_Cache_Object *object) { JAWS_FILE *file = (JAWS_FILE *) object->data (); file->close (); if (file->map ()) file->map ()->close (); delete file; this->JAWS_Referenced_Cache_Object_Factory::destroy (object); } void JAWS_Counted_Filecache_Factory::destroy (JAWS_Cache_Object *object) { JAWS_FILE *file = (JAWS_FILE *) object->data (); file->close (); if (file->map ()) file->map ()->close (); delete file; this->JAWS_Counted_Cache_Object_Factory::destroy (object); } JAWS_Cached_FILE::JAWS_Cached_FILE (const char *const &filename, JAWS_Filecache_Proxy::Cache_Manager *cm) : JAWS_Filecache_Proxy (filename, cm) { ACE_HANDLE handle = ACE_INVALID_HANDLE; if (this->data () != 0) { handle = ACE_OS::dup (this->data ()->get_handle ()); } else { JAWS_FILE *file = new JAWS_FILE; ACE_FILE_Connector file_connector; int result = file_connector.connect (*file, ACE_FILE_Addr (filename)); if (result == -1 || file->get_handle () == ACE_INVALID_HANDLE) { // TODO: do something here! } ACE_FILE_Info info; file->get_info (info); handle = ACE_OS::dup (file->get_handle ()); { JAWS_Cached_FILE cf (filename, file, info.size_, cm); if (cf.data () != 0) { new (this) JAWS_Cached_FILE (filename, cm); return; } } } this->file_.set_handle (handle); } JAWS_Cached_FILE::JAWS_Cached_FILE (const char *const &filename, JAWS_FILE *&file, size_t size, JAWS_Filecache_Proxy::Cache_Manager *cm) : JAWS_Filecache_Proxy (filename, file, size, cm) { } JAWS_Cached_FILE::~JAWS_Cached_FILE () { this->file_.close (); } ACE_FILE_IO * JAWS_Cached_FILE::file () { return &(this->file_); } ACE_Mem_Map * JAWS_Cached_FILE::mmap () { return (this->data () == 0 ? 0 : this->data ()->mem_map ()); } ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Cache_Object.h0000644000175000017500000000621515027201773020172 0ustar sudipsudip// -*- C++ -*- #ifndef JAWS_CACHE_OBJECT_H #define JAWS_CACHE_OBJECT_H #include "ace/Thread_Mutex.h" #include "ace/Synch_Traits.h" #include "ace/Malloc.h" #include "ace/RW_Thread_Mutex.h" #include "ace/Lock_Adapter_T.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Allocator; ACE_END_VERSIONED_NAMESPACE_DECL // Cache bucket -- use Hash_Bucket to hold cacheable objects. class JAWS_Cache_Object { public: JAWS_Cache_Object (const void *, size_t); virtual ~JAWS_Cache_Object (); void *internal () const; void internal (void *); const void *data () const; size_t size () const; unsigned int count () const; int acquire (); int release (); time_t last_access () const; time_t first_access () const; unsigned int priority () const; enum { ACE_CO_REFERENCED, ACE_CO_COUNTED }; void *heap_item () const; void heap_item (void *item); virtual ACE_Lock & lock () = 0; protected: virtual unsigned int count_i () const = 0; virtual int acquire_i () = 0; virtual int release_i () = 0; virtual unsigned int priority_i () const = 0; private: void *internal_; const void *data_; size_t size_; time_t last_access_; time_t first_access_; time_t new_last_access_; void *heap_item_; }; class JAWS_Referenced_Cache_Object : public JAWS_Cache_Object { public: JAWS_Referenced_Cache_Object (const void *, size_t); virtual ~JAWS_Referenced_Cache_Object (); virtual ACE_Lock & lock (); protected: virtual unsigned int count_i () const; virtual int acquire_i (); virtual int release_i (); virtual unsigned int priority_i () const; private: mutable ACE_SYNCH_RW_MUTEX count_; mutable ACE_Lock_Adapter lock_adapter_; }; class JAWS_Counted_Cache_Object : public JAWS_Cache_Object { public: JAWS_Counted_Cache_Object (const void *, size_t); virtual ~JAWS_Counted_Cache_Object (); virtual ACE_Lock & lock (); protected: virtual unsigned int count_i () const; virtual int acquire_i (); virtual int release_i (); virtual unsigned int priority_i () const; private: unsigned int count_; unsigned int new_count_; mutable ACE_SYNCH_MUTEX lock_; mutable ACE_Lock_Adapter lock_adapter_; }; class JAWS_Cache_Object_Factory { public: JAWS_Cache_Object_Factory (ACE_Allocator *alloc = 0); virtual ~JAWS_Cache_Object_Factory (); int open (ACE_Allocator *alloc = 0); virtual JAWS_Cache_Object * create (const void *, size_t) = 0; virtual void destroy (JAWS_Cache_Object *) = 0; protected: ACE_Allocator *allocator_; }; class JAWS_Referenced_Cache_Object_Factory : public JAWS_Cache_Object_Factory { public: JAWS_Referenced_Cache_Object_Factory (ACE_Allocator *alloc = 0); virtual ~JAWS_Referenced_Cache_Object_Factory (); virtual JAWS_Cache_Object * create (const void *, size_t); virtual void destroy (JAWS_Cache_Object *); }; class JAWS_Counted_Cache_Object_Factory : public JAWS_Cache_Object_Factory { public: JAWS_Counted_Cache_Object_Factory (ACE_Allocator *alloc = 0); virtual ~JAWS_Counted_Cache_Object_Factory (); virtual JAWS_Cache_Object * create (const void *, size_t); virtual void destroy (JAWS_Cache_Object *); }; #endif /* JAWS_CACHE_OBJECT_H */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Export.h0000644000175000017500000000355215027201773017163 0ustar sudipsudip// -*- C++ -*- // Definition for Win32 Export directives. // This file is generated automatically by generate_export_file.pl -s JAWS // ------------------------------ #ifndef JAWS_EXPORT_H #define JAWS_EXPORT_H #include "ace/config-all.h" #if defined (ACE_AS_STATIC_LIBS) && !defined (JAWS_HAS_DLL) # define JAWS_HAS_DLL 0 #endif /* ACE_AS_STATIC_LIBS && JAWS_HAS_DLL */ #if !defined (JAWS_HAS_DLL) # define JAWS_HAS_DLL 1 #endif /* ! JAWS_HAS_DLL */ #if defined (JAWS_HAS_DLL) && (JAWS_HAS_DLL == 1) # if defined (JAWS_BUILD_DLL) # define JAWS_Export ACE_Proper_Export_Flag # define JAWS_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) # define JAWS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) # else /* JAWS_BUILD_DLL */ # define JAWS_Export ACE_Proper_Import_Flag # define JAWS_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) # define JAWS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) # endif /* JAWS_BUILD_DLL */ #else /* JAWS_HAS_DLL == 1 */ # define JAWS_Export # define JAWS_SINGLETON_DECLARATION(T) # define JAWS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) #endif /* JAWS_HAS_DLL == 1 */ // Set JAWS_NTRACE = 0 to turn on library specific tracing even if // tracing is turned off for ACE. #if !defined (JAWS_NTRACE) # if (ACE_NTRACE == 1) # define JAWS_NTRACE 1 # else /* (ACE_NTRACE == 1) */ # define JAWS_NTRACE 0 # endif /* (ACE_NTRACE == 1) */ #endif /* !JAWS_NTRACE */ #if (JAWS_NTRACE == 1) # define JAWS_TRACE(X) #else /* (JAWS_NTRACE == 1) */ # if !defined (ACE_HAS_TRACE) # define ACE_HAS_TRACE # endif /* ACE_HAS_TRACE */ # define JAWS_TRACE(X) ACE_TRACE_IMPL(X) # include "ace/Trace.h" #endif /* (JAWS_NTRACE == 1) */ #endif /* JAWS_EXPORT_H */ // End of auto generated file. ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/IO_Handler.h0000644000175000017500000002166115027201773017647 0ustar sudipsudip/* -*- c++ -*- */ //============================================================================= /** * @file IO_Handler.h * * @author James Hu */ //============================================================================= #ifndef JAWS_IO_HANDLER_H #define JAWS_IO_HANDLER_H #include "ace/Asynch_IO.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Singleton.h" #include "ace/Synch_Traits.h" #include "ace/RW_Thread_Mutex.h" #include "JAWS/Export.h" class JAWS_IO; class JAWS_Synch_IO; class JAWS_Asynch_IO; class JAWS_IO_Handler; class JAWS_IO_Handler_Factory; class JAWS_Data_Block; class JAWS_Pipeline_Handler; class JAWS_Waiter; ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Message_Block; ACE_END_VERSIONED_NAMESPACE_DECL /** * @class JAWS_Abstract_IO_Handler * * @brief This class defines the abstract interface for an I/O handler * class in the context of Web-likes servers */ class JAWS_Export JAWS_Abstract_IO_Handler { public: virtual ~JAWS_Abstract_IO_Handler (); virtual void task (JAWS_Pipeline_Handler *ph) = 0; virtual JAWS_Pipeline_Handler *task () = 0; virtual void message_block (JAWS_Data_Block *mb) = 0; virtual JAWS_Data_Block *message_block () = 0; /// This method is called by the IO class when new passive connection has /// been established. virtual void accept_complete (ACE_HANDLE handle) = 0; /// This method is called by the IO class when new passive connection has /// been established. virtual void accept_error () = 0; #if 0 /// This method is called by the IO class when new active connection has /// been established. virtual void connect_complete (ACE_Message_Block *) = 0; /// This method is called by the IO class when new active connection has /// been established. virtual void connect_error (ACE_Message_Block *) = 0; #endif /// This method is called by the IO class when new client data shows /// up. virtual void read_complete (ACE_Message_Block *data) = 0; /// This method is called by the IO class when there was an error in /// reading new data from the client. virtual void read_error () = 0; /// This method is called by the IO class when the requested file has /// been successfully transmitted to the client. virtual void transmit_file_complete () = 0; /// This method is called by the IO class when there was an error in /// transmitting the requested file to the client. virtual void transmit_file_error (int result) = 0; /// This method is called by the IO class when the requested file has /// been successfully received from the client. virtual void receive_file_complete () = 0; /// This method is called by the IO class when there was an error in /// receiving the requested file from the client. virtual void receive_file_error (int result) = 0; /// This method is called by the IO class when there was an error in /// writing data to the client. virtual void write_error () = 0; /// This method is called by the IO class when the confirmation /// message has been delivered to the client. virtual void confirmation_message_complete () = 0; /// This method is called by the IO class when the error message has /// been delivered to the client. virtual void error_message_complete () = 0; /// Returns the factory for this IO handler virtual JAWS_IO_Handler_Factory *factory () = 0; /// Returns the socket handle for this handler virtual ACE_HANDLE handle () const = 0; /// Cleans up the handler. virtual void done () = 0; /// Returns the status of the handler virtual int status () = 0; /// puts handler in an idle state virtual void idle () = 0; enum { IDLE = 0, IDLE_A = 1, ACCEPT_OK = 2, ACCEPT_OK_A = 3, ACCEPT_ERROR = 4, ACCEPT_ERROR_A = 5, READ_OK = 6, READ_OK_A = 7, READ_ERROR = 8, READ_ERROR_A = 9, WRITE_OK = 10, WRITE_OK_A = 11, WRITE_ERROR = 12, WRITE_ERROR_A = 13, TRANSMIT_OK = 14, TRANSMIT_OK_A = 15, TRANSMIT_ERROR = 16, TRANSMIT_ERROR_A = 17, RECEIVE_OK = 18, RECEIVE_OK_A = 19, /// The different states of the handler RECEIVE_ERROR = 20, RECEIVE_ERROR_A = 21 }; }; #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined(ACE_HAS_AIO_CALLS) // Forward reference. class JAWS_Asynch_IO_Handler; class JAWS_Export JAWS_Asynch_Handler : public ACE_Service_Handler { public: JAWS_Asynch_Handler (); virtual ~JAWS_Asynch_Handler (); /// This method will be called when an asynchronous read completes on /// a stream. virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result); /// This method will be called when an asynchronous write completes /// on a stream. virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result); /// This method will be called when an asynchronous transmit file /// completes. virtual void handle_transmit_file (const ACE_Asynch_Transmit_File::Result &result); /// This method will be called when an asynchronous accept completes. virtual void handle_accept (const ACE_Asynch_Accept::Result &result); virtual void handler (JAWS_Asynch_IO_Handler *ioh); virtual JAWS_Asynch_IO_Handler * handler (); virtual void dispatch_handler (); /// Call back entry point for ACE_Asynch_Acceptor virtual void open (ACE_HANDLE h, ACE_Message_Block &mb); /// Receives the ACT. virtual void act (const void *act_ref); //virtual ACE_HANDLE handle () const; private: JAWS_Asynch_IO_Handler *ioh_; }; #endif /* defined(ACE_HAS_WIN32_OVERLAPPED_IO) || defined(ACE_HAS_AIO_CALLS) */ class JAWS_Export JAWS_IO_Handler : public JAWS_Abstract_IO_Handler { public: JAWS_IO_Handler (JAWS_IO_Handler_Factory *factory); virtual ~JAWS_IO_Handler (); // Inherited from JAWS_IO_Handler virtual void accept_complete (ACE_HANDLE handle); virtual void accept_error (); virtual void read_complete (ACE_Message_Block *data); virtual void read_error (); virtual void transmit_file_complete (); virtual void transmit_file_error (int result); virtual void receive_file_complete (); virtual void receive_file_error (int result); virtual void write_error (); virtual void confirmation_message_complete (); virtual void error_message_complete (); virtual JAWS_IO_Handler_Factory *factory (); virtual ACE_HANDLE handle () const; virtual void done (); virtual int status (); virtual void idle (); virtual void acquire (); virtual void lock (); virtual void release (); virtual void task (JAWS_Pipeline_Handler *ph); virtual JAWS_Pipeline_Handler *task (); virtual void message_block (JAWS_Data_Block *mb); virtual JAWS_Data_Block *message_block (); protected: /// The state of the handler. int status_; /// This maintains the state of the request. JAWS_Data_Block *mb_; /// The socket handle returned from accept. ACE_HANDLE handle_; /// This is a reference to the next stage of the pipeline when the IO /// request completes. JAWS_Pipeline_Handler *task_; /// The reference to the handler's factory. JAWS_IO_Handler_Factory *factory_; }; class JAWS_Export JAWS_IO_Handler_Factory { public: /// Destructor virtual ~JAWS_IO_Handler_Factory (); /// This creates a new JAWS_IO_Handler virtual JAWS_IO_Handler *create_io_handler (); /// This deletes a JAWS_IO_Handler virtual void destroy_io_handler (JAWS_IO_Handler *handler); }; typedef JAWS_IO_Handler JAWS_Synch_IO_Handler; typedef JAWS_IO_Handler_Factory JAWS_Synch_IO_Handler_Factory; typedef ACE_Singleton JAWS_Synch_IO_Handler_Factory_Singleton; #if defined(ACE_HAS_WIN32_OVERLAPPED_IO) || defined(ACE_HAS_AIO_CALLS) class JAWS_Export JAWS_Asynch_IO_Handler_Factory : public JAWS_IO_Handler_Factory { public: /// Destructor virtual ~JAWS_Asynch_IO_Handler_Factory (); /// This creates a new JAWS_IO_Handler virtual JAWS_IO_Handler *create_io_handler (); /// This deletes a JAWS_IO_Handler virtual void destroy_io_handler (JAWS_IO_Handler *handler); }; class JAWS_Export JAWS_Asynch_IO_Handler : public JAWS_IO_Handler { friend class JAWS_Asynch_Handler; friend class JAWS_Asynch_IO_Handler_Factory; friend class JAWS_Waiter; // Provide implementations for the common functions. public: explicit JAWS_Asynch_IO_Handler (JAWS_Asynch_IO_Handler_Factory *factory); virtual ~JAWS_Asynch_IO_Handler (); virtual ACE_Handler *handler (); virtual void acquire (); virtual void lock (); virtual void release (); protected: JAWS_Asynch_Handler *handler_; ACE_SYNCH_RW_MUTEX count_; }; #else typedef JAWS_IO_Handler JAWS_Asynch_IO_Handler; typedef JAWS_IO_Handler_Factory JAWS_Asynch_IO_Handler_Factory; #endif /* defined(ACE_HAS_WIN32_OVERLAPPED_IO) || defined(ACE_HAS_AIO_CALLS) */ typedef ACE_Singleton JAWS_Asynch_IO_Handler_Factory_Singleton; #endif /* JAWS_IO_HANDLER_H */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Waiter.h0000644000175000017500000000221315027201773017126 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_WAITER_H #define JAWS_WAITER_H #include "ace/Singleton.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Synch_Traits.h" #include "JAWS/Assoc_Array.h" #include "JAWS/Export.h" class JAWS_IO_Handler; typedef ACE_thread_t JAWS_Thread_ID; typedef JAWS_Assoc_Array JAWS_Waiter_Base; typedef JAWS_Assoc_Array_Iterator JAWS_Waiter_Base_Iterator; class JAWS_Export JAWS_Waiter : public JAWS_Waiter_Base { public: JAWS_Waiter (); ~JAWS_Waiter (); JAWS_Waiter_Base_Iterator &iter (); // Returns an iterator to the headers container. int index (); // Returns the index into the table associated with calling thread. JAWS_IO_Handler * wait_for_completion (int i = -1); // The entry point for this class, handles outstanding asynchronous // events. Can optionally accept a parameter that points to which // table entry to return. private: JAWS_Waiter_Base_Iterator iter_; }; typedef ACE_Singleton JAWS_Waiter_Singleton; #endif /* JAWS_WAITER_H */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Jaws_IO.cpp0000644000175000017500000003617515027201773017537 0ustar sudipsudip#include "ace/Message_Block.h" #include "ace/SOCK_Stream.h" #include "ace/Filecache.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_sys_uio.h" #include "ace/OS_NS_sys_socket.h" #include "JAWS/Data_Block.h" #include "JAWS/Policy.h" #include "JAWS/Jaws_IO.h" #include "JAWS/IO_Handler.h" #include "JAWS/IO_Acceptor.h" #include "JAWS/Filecache.h" #include "ace/Asynch_IO.h" //for ACE_Asynch_Write_Stream #include JAWS_IO::JAWS_IO () : handle_ (ACE_INVALID_HANDLE), handler_ (0), inet_addr_ (0), acceptor_ (0) { } JAWS_IO::~JAWS_IO () { } #if 0 ACE_HANDLE JAWS_IO::handle () { return this->handle_; } void JAWS_IO::handle (ACE_HANDLE handle) { this->handle_ = handle; } void JAWS_IO::handler (JAWS_IO_Handler *handler) { this->handler_ = handler; } void JAWS_IO::acceptor (JAWS_IO_Acceptor *acceptor) { this->acceptor_ = acceptor; } #endif /* 0 */ JAWS_Synch_IO::JAWS_Synch_IO () { this->acceptor_ = JAWS_IO_Synch_Acceptor_Singleton::instance (); } JAWS_Synch_IO::~JAWS_Synch_IO () { if (this->handle_ != ACE_INVALID_HANDLE) ACE_OS::closesocket (this->handle_); } void JAWS_Synch_IO::accept (JAWS_IO_Handler *ioh, ACE_Message_Block *, unsigned int) { ACE_SOCK_Stream new_stream; new_stream.set_handle (ACE_INVALID_HANDLE); if (this->acceptor_->accept (new_stream) == -1) ioh->accept_error (); else ioh->accept_complete (new_stream.get_handle ()); } void JAWS_Synch_IO::read (JAWS_IO_Handler *ioh, ACE_Message_Block *mb, unsigned int size) { JAWS_TRACE ("JAWS_Synch_IO::read"); ACE_SOCK_Stream stream; stream.set_handle (ioh->handle ()); int result = stream.recv (mb->wr_ptr (), size); if (result <= 0) ioh->read_error (); else { JAWS_TRACE ("JAWS_Synch_IO::read success"); mb->wr_ptr (result); ioh->read_complete (mb); } } void JAWS_Synch_IO::receive_file (JAWS_IO_Handler *ioh, const char *filename, void *initial_data, unsigned int initial_data_length, unsigned int entire_length) { ACE_Filecache_Handle handle (filename, (int) entire_length); int result = handle.error (); if (result == ACE_Filecache_Handle::ACE_SUCCESS) { ACE_SOCK_Stream stream; stream.set_handle (ioh->handle ()); int const bytes_to_memcpy = (std::min) (entire_length, initial_data_length); ACE_OS::memcpy (handle.address (), initial_data, bytes_to_memcpy); int bytes_to_read = entire_length - bytes_to_memcpy; int bytes = stream.recv_n ((char *) handle.address () + initial_data_length, bytes_to_read); if (bytes == bytes_to_read) ioh->receive_file_complete (); else result = -1; } if (result != ACE_Filecache_Handle::ACE_SUCCESS) ioh->receive_file_error (result); } void JAWS_Synch_IO::transmit_file (JAWS_IO_Handler *ioh, ACE_HANDLE handle, const char *header, unsigned int header_size, const char *trailer, unsigned int trailer_size) { int result = 0; if (handle != ACE_INVALID_HANDLE) { ACE_SOCK_Stream stream; stream.set_handle (ioh->handle ()); if ((unsigned long) stream.send_n (header, header_size) < header_size) { result = -1; } else { int count; char buf[BUFSIZ]; do { count = ACE_OS::read (handle, buf, sizeof (buf)); if (count <= 0) break; if (stream.send_n (buf, count) < count) { result = -1; } } while (result == 0); if ((unsigned long) stream.send_n (trailer, trailer_size) < trailer_size) { result = -1; } } } if (result == 0) ioh->transmit_file_complete (); else ioh->transmit_file_error (result); } void JAWS_Synch_IO::transmit_file (JAWS_IO_Handler *ioh, const char *filename, const char *header, unsigned int header_size, const char *trailer, unsigned int trailer_size) { int result = 0; if (filename == 0) { ioh->transmit_file_error (-1); return; } JAWS_Cached_FILE cf (filename); if (cf.file ()->get_handle () != ACE_INVALID_HANDLE && cf.mmap () != 0) { #if defined (ACE_JAWS_BASELINE) || defined (ACE_WIN32) ACE_FILE_Info info; cf.file ()->get_info (info); if (cf.file ()->get_info (info) == 0 && info.size_ > 0) { ACE_SOCK_Stream stream; stream.set_handle (ioh->handle ()); if (((u_long) stream.send_n (header, header_size) == header_size) && (stream.send_n (cf.mmap ()->addr (), info.size_) == info.size_) && ((u_long) stream.send_n (trailer, trailer_size) == trailer_size)) { ioh->transmit_file_complete (); return; } else { result = -1; } } else { result = -1; } #else // Attempting to use writev // Is this faster? iovec iov[3]; int iovcnt = 0; if (header_size > 0) { iov[iovcnt].iov_base = const_cast (header); iov[iovcnt].iov_len = header_size; iovcnt++; } ACE_FILE_Info info; if (cf.file ()->get_info (info) == 0 && info.size_ > 0) { iov[iovcnt].iov_base = (char *) cf.mmap ()->addr (); iov[iovcnt].iov_len = info.size_; iovcnt++; } if (trailer_size > 0) { iov[iovcnt].iov_base = const_cast (trailer); iov[iovcnt].iov_len = trailer_size; iovcnt++; } if (ACE_OS::writev (ioh->handle (), iov, iovcnt) < 0) { result = -1; } else { ioh->transmit_file_complete (); return; } #endif /* ACE_JAWS_BASELINE */ } else if (cf.file ()->get_handle () != ACE_INVALID_HANDLE && cf.mmap () == 0) { this->transmit_file (ioh, cf.file ()->get_handle (), header, header_size, trailer, trailer_size); return; } else { result = -1; } if (result != 0) { ioh->transmit_file_error (result); } } void JAWS_Synch_IO::send_confirmation_message (JAWS_IO_Handler *ioh, const char *buffer, unsigned int length) { this->send_message (ioh, buffer, length); ioh->confirmation_message_complete (); } void JAWS_Synch_IO::send_error_message (JAWS_IO_Handler *ioh, const char *buffer, unsigned int length) { this->send_message (ioh, buffer, length); ioh->error_message_complete (); } void JAWS_Synch_IO::send_message (JAWS_IO_Handler *ioh, const char *buffer, unsigned int length) { ACE_SOCK_Stream stream; stream.set_handle (ioh->handle ()); stream.send_n (buffer, length); } // This only works on asynch I/O-capable systems. #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) JAWS_Asynch_IO::JAWS_Asynch_IO () { } JAWS_Asynch_IO::~JAWS_Asynch_IO () { if (this->handle_ != ACE_INVALID_HANDLE) ACE_OS::closesocket (this->handle_); } void JAWS_Asynch_IO::accept (JAWS_IO_Handler *ioh, ACE_Message_Block *, unsigned int) { JAWS_TRACE ("JAWS_Asynch_IO::accept"); ioh->idle (); JAWS_Data_Block *db = ioh->message_block (); //ACE_HANDLE listen_handle = db->policy ()->acceptor ()->get_handle (); //JAWS_Asynch_IO_Handler *aioh = // dynamic_cast (ioh); size_t bytes_to_read = JAWS_Data_Block::JAWS_DATA_BLOCK_SIZE; if (db->policy ()->acceptor ()->accept (bytes_to_read, ioh) == -1) ioh->accept_error (); } void JAWS_Asynch_IO::read (JAWS_IO_Handler *ioh, ACE_Message_Block* mb, unsigned int size) { JAWS_TRACE ("JAWS_Asynch_IO::read"); ioh->idle (); JAWS_Asynch_IO_Handler *aioh = dynamic_cast (ioh); ACE_Asynch_Read_Stream ar; if (ar.open (*(aioh->handler ()), aioh->handle ()) == -1 || ar.read (*mb, size) == -1) aioh->read_error (); } void JAWS_Asynch_IO::receive_file (JAWS_IO_Handler *ioh, const char *filename, void *initial_data, unsigned int initial_data_length, unsigned int entire_length) { JAWS_TRACE ("JAWS_Asynch_IO::receive_file"); ioh->idle (); JAWS_Asynch_IO_Handler *aioh = dynamic_cast (ioh); ACE_Message_Block *mb = 0; ACE_Filecache_Handle *handle; ACE_NEW (handle, ACE_Filecache_Handle (filename, entire_length, ACE_NOMAP)); int result = handle->error (); if (result == ACE_Filecache_Handle::ACE_SUCCESS) { ACE_OS::memcpy (handle->address (), initial_data, initial_data_length); int bytes_to_read = entire_length - initial_data_length; ACE_NEW (mb, ACE_Message_Block ((char *)handle->address () + initial_data_length, bytes_to_read)); if (mb == 0) { errno = ENOMEM; result = -1; } else { ACE_Asynch_Read_Stream ar; if (ar.open (*(aioh->handler ()), aioh->handle ()) == -1 || ar.read (*mb, mb->size () - mb->length (), handle) == -1) result = -1; } } if (result != ACE_Filecache_Handle::ACE_SUCCESS) { this->handler_->receive_file_error (result); delete mb; delete handle; } } void JAWS_Asynch_IO::transmit_file (JAWS_IO_Handler *ioh, ACE_HANDLE handle, const char *header, unsigned int header_size, const char *trailer, unsigned int trailer_size) { JAWS_TRACE ("JAWS_Asynch_IO::transmit_file"); ioh->idle (); JAWS_Asynch_IO_Handler *aioh = dynamic_cast (ioh); ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer = 0; int result = 0; if (handle != ACE_INVALID_HANDLE) { ACE_Message_Block hdr_mb (header, header_size); ACE_Message_Block trl_mb (trailer, trailer_size); header_and_trailer = new ACE_Asynch_Transmit_File::Header_And_Trailer (hdr_mb.duplicate (), header_size, trl_mb.duplicate (), trailer_size); ACE_Asynch_Transmit_File tf; if (tf.open (*(aioh->handler ()), aioh->handle ()) == -1 || tf.transmit_file (handle, // file handle header_and_trailer, // header and trailer data 0, // bytes_to_write 0, // offset 0, // offset_high 0, // bytes_per_send 0, // flags 0 // act ) == -1) result = -1; } if (result != 0) { ioh->transmit_file_error (result); delete header_and_trailer; } } void JAWS_Asynch_IO::transmit_file (JAWS_IO_Handler *ioh, const char *filename, const char *header, unsigned int header_size, const char *trailer, unsigned int trailer_size) { int result = 0; JAWS_TRACE ("JAWS_Asynch_IO::transmit_file"); ioh->idle (); JAWS_Asynch_IO_Handler *aioh = dynamic_cast (ioh); ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer = 0; JAWS_Cached_FILE *cf = new JAWS_Cached_FILE (filename); if (cf->file ()->get_handle () != ACE_INVALID_HANDLE) { ACE_Message_Block hdr_mb (header, header_size); ACE_Message_Block trl_mb (trailer, trailer_size); header_and_trailer = new ACE_Asynch_Transmit_File::Header_And_Trailer (hdr_mb.duplicate (), header_size, trl_mb.duplicate (), trailer_size); ACE_Asynch_Transmit_File tf; if (tf.open (*(aioh->handler ()), aioh->handle ()) == -1 || tf.transmit_file (cf->file ()->get_handle (), // file handle header_and_trailer, // header and trailer data 0, // bytes_to_write 0, // offset 0, // offset_high 0, // bytes_per_send 0, // flags cf // act ) == -1) result = -1; } if (result != 0) { ioh->transmit_file_error (result); delete header_and_trailer; delete cf; } } void JAWS_Asynch_IO::send_confirmation_message (JAWS_IO_Handler *ioh, const char *buffer, unsigned int length) { this->send_message (ioh, buffer, length, CONFIRMATION); } void JAWS_Asynch_IO::send_error_message (JAWS_IO_Handler *ioh, const char *buffer, unsigned int length) { this->send_message (ioh, buffer, length, ERROR_MESSAGE); } void JAWS_Asynch_IO::send_message (JAWS_IO_Handler *ioh, const char *buffer, unsigned int length, long act) { ioh->idle (); JAWS_Asynch_IO_Handler *aioh = dynamic_cast (ioh); ACE_Message_Block *mb = 0; ACE_NEW (mb, ACE_Message_Block (buffer, length)); if (mb == 0) { this->handler_->error_message_complete (); return; } ACE_Asynch_Write_Stream aw; if (aw.open (*(aioh->handler ()), aioh->handle ()) == -1 || aw.write (*mb, length, (void *) static_cast (act)) == -1) { mb->release (); if (act == CONFIRMATION) ioh->confirmation_message_complete (); else ioh->error_message_complete (); } } void JAWS_Asynch2_IO::accept (JAWS_IO_Handler *, ACE_Message_Block *, unsigned int) { } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/IO_Acceptor.h0000644000175000017500000000751115027201773020030 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_IO_ACCEPTOR_H #define JAWS_IO_ACCEPTOR_H // Use the Adapter pattern to encapsulate either a LOCK_SOCK_Acceptor or // an ACE_Asynch_Acceptor #include "ace/Asynch_Acceptor.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/LOCK_SOCK_Acceptor.h" #include "ace/Singleton.h" #include "JAWS/Export.h" #include "JAWS/Jaws_IO.h" #include "JAWS/IO_Handler.h" // Forward declaration. ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Proactor; class ACE_Reactor; ACE_END_VERSIONED_NAMESPACE_DECL #if defined (JAWS_HAS_THREAD_SAFE_ACCEPT) typedef ACE_LOCK_SOCK_Acceptor JAWS_IO_SOCK_Acceptor; #else typedef ACE_LOCK_SOCK_Acceptor JAWS_IO_SOCK_Acceptor; #endif /* JAWS_HAS_THREAD_SAFE_ACCEPT */ class JAWS_Export JAWS_IO_Acceptor { public: JAWS_IO_Acceptor (); virtual ~JAWS_IO_Acceptor (); virtual int open (const ACE_INET_Addr &address, int backlog = 20); // Initiate a passive mode socket. virtual int open (const ACE_HANDLE &socket); // Initiate a passive mode socket. virtual int accept (ACE_SOCK_Stream &new_stream, ACE_Addr *remote_addr = 0, ACE_Time_Value *timeout = 0, int restart = 1, int reset_new_handle = 0) const; // Synchronously accept the connection virtual int accept (size_t bytes_to_read = 0, const void *act = 0); // This initiates a new asynchronous accept through the AcceptEx call. virtual ACE_HANDLE get_handle (); // Get the listener's handle virtual void close (); // Close the acceptor. enum { ASYNC = 0, SYNCH = 1 }; // identify if this is being used for asynchronous or synchronous // accept calls }; class JAWS_Export JAWS_IO_Synch_Acceptor : public JAWS_IO_Acceptor { public: virtual int open (const ACE_INET_Addr &local_sap, int backlog = 20); // Initiate a passive mode socket. virtual int open (const ACE_HANDLE &socket); // Initiate a passive mode socket. virtual int accept (ACE_SOCK_Stream &new_stream, ACE_Addr *remote_addr = 0, ACE_Time_Value *timeout = 0, int restart = 1, int reset_new_handle = 0) const; // Accept the connection virtual ACE_HANDLE get_handle (); // Get the listener's handle private: virtual int accept (size_t bytes_to_read = 0, const void *act = 0); private: JAWS_IO_SOCK_Acceptor acceptor_; }; class JAWS_Export JAWS_IO_Asynch_Acceptor : public JAWS_IO_Acceptor { public: JAWS_IO_Asynch_Acceptor (); virtual ~JAWS_IO_Asynch_Acceptor (); virtual int open (const ACE_INET_Addr &address, int backlog = 20); // Initiate an asynchronous passive connection virtual int open (const ACE_HANDLE &socket); // Initiate an asynchronous passive connection virtual int accept (size_t bytes_to_read = 0, const void *act = 0); // This initiates a new asynchronous accept through the AcceptEx call. virtual ACE_HANDLE get_handle (); // Get the listener's handle virtual void close (); private: virtual int accept (ACE_SOCK_Stream &new_stream, ACE_Addr *remote_addr = 0, ACE_Time_Value *timeout = 0, int restart = 1, int reset_new_handle = 0) const; private: #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) ACE_Asynch_Acceptor &acceptor_; ACE_Asynch_Acceptor *acceptor_ptr_; ACE_HANDLE handle_; #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ }; typedef ACE_Singleton JAWS_IO_Synch_Acceptor_Singleton; typedef ACE_Singleton JAWS_IO_Asynch_Acceptor_Singleton; #endif /* !defined (JAWS_IO_ACCEPTOR_H) */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Jaws_IO.h0000644000175000017500000002000015027201773017160 0ustar sudipsudip/* -*- c++ -*- */ //============================================================================= /** * @file Jaws_IO.h * * @author James Hu */ //============================================================================= #ifndef JAWS_IO_H #define JAWS_IO_H #include "ace/ACE.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Asynch_IO.h" #include "ace/SOCK_Stream.h" #include "ace/Singleton.h" #include "ace/Synch_Traits.h" #include "JAWS/Export.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Message_Block; ACE_END_VERSIONED_NAMESPACE_DECL class JAWS_IO_Handler; class JAWS_IO_Acceptor; /** * @class JAWS_IO * * @brief This class defines the abstract interface for an I/O class in * the context of Web-likes servers * * An I/O class should have the following interface. Derived * classes will define the exactly how the I/O will take place * (Asynchronous, Synchronous, Reactive) */ class JAWS_Export JAWS_IO { public: JAWS_IO (); virtual ~JAWS_IO (); // void acceptor (JAWS_IO_Acceptor *acceptor); // void handler (JAWS_IO_Handler *handler); // void handle (ACE_HANDLE h); // ACE_HANDLE handle (); // James, please add documentation here. /// accept a passive connection virtual void accept (JAWS_IO_Handler *ioh, ACE_Message_Block *mb = 0, unsigned int size = 0) = 0; /// read from the handle size bytes into the message block. virtual void read (JAWS_IO_Handler *ioh, ACE_Message_Block *mb, unsigned int size) = 0; /// send header, filename, trailer to the handle. virtual void transmit_file (JAWS_IO_Handler *ioh, ACE_HANDLE file, const char *header, unsigned int header_size, const char *trailer, unsigned int trailer_size) = 0; /// send header, filename, trailer to the handle. virtual void transmit_file (JAWS_IO_Handler *ioh, const char *filename, const char *header, unsigned int header_size, const char *trailer, unsigned int trailer_size) = 0; /// read data from the handle and store in filename. virtual void receive_file (JAWS_IO_Handler *ioh, const char *filename, void *initial_data, unsigned int initial_data_length, unsigned int entire_length) = 0; /// send a confirmation message to the handle. virtual void send_confirmation_message (JAWS_IO_Handler *ioh, const char *buffer, unsigned int length) = 0; /// send an error message to the handle. virtual void send_error_message (JAWS_IO_Handler *ioh, const char *buffer, unsigned int length) = 0; protected: ACE_HANDLE handle_; JAWS_IO_Handler *handler_; ACE_INET_Addr *inet_addr_; JAWS_IO_Acceptor *acceptor_; }; /** * @class JAWS_Synch_IO * * @brief This class defines the interface for a Synchronous I/O class. */ class JAWS_Export JAWS_Synch_IO : public JAWS_IO { public: JAWS_Synch_IO (); virtual ~JAWS_Synch_IO (); virtual void accept (JAWS_IO_Handler *ioh, ACE_Message_Block *mb = 0, unsigned int size = 0); virtual void read (JAWS_IO_Handler *ioh, ACE_Message_Block *mb, unsigned int size); virtual void transmit_file (JAWS_IO_Handler *ioh, ACE_HANDLE handle, const char *header, unsigned int header_size, const char *trailer, unsigned int trailer_size); virtual void transmit_file (JAWS_IO_Handler *ioh, const char *filename, const char *header, unsigned int header_size, const char *trailer, unsigned int trailer_size); virtual void receive_file (JAWS_IO_Handler *ioh, const char *filename, void *initial_data, unsigned int initial_data_length, unsigned int entire_length); virtual void send_confirmation_message (JAWS_IO_Handler *ioh, const char *buffer, unsigned int length); virtual void send_error_message (JAWS_IO_Handler *ioh, const char *buffer, unsigned int length); protected: virtual void send_message (JAWS_IO_Handler *ioh, const char *buffer, unsigned int length); }; typedef ACE_Singleton JAWS_Synch_IO_Singleton; // This only works on asynch I/O-capable systems. #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) /** * @class JAWS_Asynch_IO * * @brief This class defines the interface for a Asynchronous I/O class. */ class JAWS_Export JAWS_Asynch_IO : public JAWS_IO { public: JAWS_Asynch_IO (); virtual ~JAWS_Asynch_IO (); virtual void accept (JAWS_IO_Handler *ioh, ACE_Message_Block *mb = 0, unsigned int size = 0); virtual void read (JAWS_IO_Handler *ioh, ACE_Message_Block *mb, unsigned int size); virtual void transmit_file (JAWS_IO_Handler *ioh, ACE_HANDLE handle, const char *header, unsigned int header_size, const char *trailer, unsigned int trailer_size); virtual void transmit_file (JAWS_IO_Handler *ioh, const char *filename, const char *header, unsigned int header_size, const char *trailer, unsigned int trailer_size); virtual void receive_file (JAWS_IO_Handler *ioh, const char *filename, void *initial_data, unsigned int initial_data_length, unsigned int entire_length); virtual void send_confirmation_message (JAWS_IO_Handler *ioh, const char *buffer, unsigned int length); virtual void send_error_message (JAWS_IO_Handler *ioh, const char *buffer, unsigned int length); #ifdef ACE_LYNXOS_MAJOR #ifdef ERROR_MESSAGE #undef ERROR_MESSAGE #endif /* ERROR_MESSAGE */ #endif /* ACE_LYNXOS_MAJOR */ enum Message_Types { CONFIRMATION, ERROR_MESSAGE }; protected: virtual void send_message (JAWS_IO_Handler *ioh, const char *buffer, unsigned int length, long act); }; typedef ACE_Singleton JAWS_Asynch_IO_Singleton; /** * @class JAWS_Asynch2_IO This version of Asynch_IO has a do nothing accept() implementation. */ class JAWS_Export JAWS_Asynch2_IO : public JAWS_Asynch_IO { public: /// does nothing virtual void accept (JAWS_IO_Handler *ioh, ACE_Message_Block *mb = 0, unsigned int size = 0); }; typedef ACE_Singleton JAWS_Asynch2_IO_Singleton; #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ #endif /* JAWS_IO_H */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Data_Block.h0000644000175000017500000000210015027201773017651 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_DATA_BLOCK_H #define JAWS_DATA_BLOCK_H #include "ace/Message_Block.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "JAWS/Export.h" #include "JAWS/Pipeline.h" class JAWS_IO_Handler; class JAWS_Dispatch_Policy; class JAWS_Data_Block; class JAWS_Pipeline_Handler; class JAWS_Export JAWS_Data_Block : public ACE_Message_Block // = TITLE // Defines the communication unit between pipeline components { public: JAWS_Data_Block (); JAWS_Data_Block (JAWS_Data_Block &db); ~JAWS_Data_Block (); JAWS_Pipeline_Handler *task (); JAWS_IO_Handler *io_handler (); JAWS_Dispatch_Policy *policy (); void *payload (); void task (JAWS_Pipeline_Handler *taskp); void io_handler (JAWS_IO_Handler *handlerp); void policy (JAWS_Dispatch_Policy *policyp); void payload (void *payloadp); enum { JAWS_DATA_BLOCK_SIZE = 8192 }; private: JAWS_IO_Handler *io_handler_; JAWS_Dispatch_Policy *policy_; JAWS_Pipeline_Handler *task_; void *payload_; }; #endif /* !defined (JAWS_DATA_BLOCK_H) */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Parse_Headers.cpp0000644000175000017500000002361115027201773020740 0ustar sudipsudip#include "JAWS/Parse_Headers.h" #include "ace/OS_NS_string.h" #include "ace/Log_Msg.h" #define ACCESSOR(T,C,x) \ T C :: x () const { return this-> x##_; }\ void C :: x (T t) { this-> x##_ = t; } int JAWS_Parse_Headers::parse_headers (JAWS_Header_Info *info, ACE_Message_Block &mb) { for (;;) { if (mb.rd_ptr () == mb.wr_ptr ()) break; char *p = mb.rd_ptr (); if (info->end_of_line () && (*p != ' ' && *p != '\t')) { int r = this->parse_header_name (info, mb); if (r == 1) return info->end_of_headers (); continue; } else { int r = this->parse_header_value (info, mb); if (r == 1) { if (info->end_of_headers ()) return 1; break; } continue; } } // If we arrive here, it means either there is nothing more to read, // or parse_header_value ran into difficulties (like maybe the // header value was too long). if (mb.rd_ptr () != mb.base ()) { mb.crunch (); return 0; } else if (mb.length () < mb.size ()) { return 0; } else if (mb.length () == mb.size ()) { // This is one of those cases that should rarely ever happen. // If we get here, the header type name is over 8K long. We // flag this as a bad thing. // In HTTP/1.1, I have to remember that a bad request means the // connection needs to be closed and the client has to // reinitiate the connection. info->status (JAWS_Header_Info::STATUS_CODE_TOO_LONG); return 1; } else if (mb.length () > mb.size ()) { ACE_DEBUG ((LM_DEBUG, "JAWS_Parse_Headers: buffer overrun!!\n")); info->status (JAWS_Header_Info::STATUS_CODE_TOO_LONG); return 1; } ACE_DEBUG ((LM_DEBUG, "JAWS_Parse_Headers -- shouldn't be here!\n")); return 1; } char * JAWS_Parse_Headers::skipset (const char *set, char *start, char *end) { char *p = start; while (p < end) { if (ACE_OS::strchr (set, *p) != 0) break; p++; } return p; } char * JAWS_Parse_Headers::skipcset (const char *set, char *start, char *end) { char *p = start; while (p < end) { if (ACE_OS::strchr (set, *p) == 0) break; p++; } return p; } int JAWS_Parse_Headers::parse_header_name (JAWS_Header_Info *info, ACE_Message_Block &mb) { char *p = mb.rd_ptr (); char *q; q = this->skipset (":\n", p, mb.wr_ptr ()); if (q == mb.wr_ptr ()) { // no more progress can be made until we find a ':' return 1; } if (*q != '\n' && q == p) { // Ignore empty header type names info->finish_last_header_value (); info->create_next_header_value (0); info->end_of_line (0); mb.rd_ptr (q+1); return 0; } if (*q == '\n') { // ignore this line mb.rd_ptr (q+1); if (q == p || ((q-1) == p && q[-1] == '\r')) { // blank line means end of headers info->finish_last_header_value (); info->create_next_header_value (0); info->end_of_headers (1); if (mb.rd_ptr () == mb.wr_ptr ()) mb.crunch (); return 1; } // not a blank line, but no ':', so ignore it info->finish_last_header_value (); info->create_next_header_value (0); return 0; } // otherwise, we have a header type name! *q = '\0'; info->create_next_header_value (p); info->end_of_line (0); mb.rd_ptr (q+1); return 0; } int JAWS_Parse_Headers::parse_header_value (JAWS_Header_Info *info, ACE_Message_Block &mb) { // break --> return 1; // continue --> return 0; char *q = mb.rd_ptr (); if (info->last_header_data () == 0) { // Ignoring this header (it is too long or something). q = this->skipset ("\n", mb.rd_ptr (), mb.wr_ptr ()); if (q == mb.wr_ptr ()) { info->end_of_line (0); mb.rd_ptr (q); // Move the rd_ptr back one character if the last thing we // see is a carriage return. Assert: wr_ptr > rd_ptr. if (q[-1] == '\r') mb.rd_ptr (q-1); return 1; } if (*q == '\0') { // We are in the middle of binary data. Get out! mb.rd_ptr (q); info->end_of_line (1); info->end_of_headers (1); return 1; } // Move past the newline, set the end of line flag if (*q == '\n') { info->end_of_line (1); q++; } mb.rd_ptr (q); return 0; } else { if (info->end_of_line ()) { // Skip over leading linear white space q = this->skipcset (" \t", mb.rd_ptr (), mb.wr_ptr ()); if (q == mb.wr_ptr ()) { // need more input info->end_of_line (1); mb.rd_ptr (q-1); return 1; } if (*q != '\n') info->append_last_header_value (' '); } // Append to last header value character by character while (q < mb.wr_ptr ()) { if (*q == '\n') break; info->append_last_header_value (*q); q++; } // Need more input if (q == mb.wr_ptr ()) { mb.rd_ptr (q); info->end_of_line (0); return 1; } // Reached a newline if (*q == '\n') { // Reduce by one character if line discipline is "\r\n" if (info->append_last_header_value () == '\r') info->reduce_last_header_value (); // Move past newline, set end of line flag mb.rd_ptr (q+1); info->end_of_line (1); return 0; } } // NOT REACHED return 1; } JAWS_Header_Info::JAWS_Header_Info () : end_of_headers_ (0), end_of_line_ (1), last_header_data_ (0), last_header_length_ (0), status_ (0) { } JAWS_Header_Info::~JAWS_Header_Info () { JAWS_Header_Table_Iterator iter (this->table_); JAWS_Header_Data *data_ptr; for (iter.first (); !iter.done (); iter.advance ()) { data_ptr = iter.next (); if (data_ptr) delete data_ptr; } } void JAWS_Header_Info::dump () { JAWS_Header_Table_Iterator iter (this->table_); ACE_DEBUG ((LM_DEBUG, "== BEGIN HEADER INFO DUMP ==\n")); for (iter.first (); ! iter.done (); iter.advance ()) { JAWS_Header_Data *data; data = iter.next (); if (data != 0) ACE_DEBUG ((LM_DEBUG, "%s -- %s\n", data->header_name (), data->header_value ())); else ACE_DEBUG ((LM_DEBUG, "NULL ENTRY\n")); } ACE_DEBUG ((LM_DEBUG, "== END HEADER INFO DUMP ==\n")); } JAWS_Headers * JAWS_Header_Info::table () { return &(this->table_); } void JAWS_Header_Info::append_last_header_value (char c) { if (this->last_header_data_ == 0) return; if (this->last_header_length_ == 0 && (c == ' ' || c == '\t')) return; if (this->last_header_length_ < MAX_HEADER_LENGTH-1) { this->header_buf_[this->last_header_length_] = c; this->last_header_length_++; this->header_buf_[this->last_header_length_] = '\0'; } } int JAWS_Header_Info::append_last_header_value () { if (this->last_header_data_ == 0 || this->last_header_length_ == 0) return -1; return this->header_buf_[this->last_header_length_-1]; } void JAWS_Header_Info::append_last_header_value (const char *begin, const char *end) { if (this->last_header_data_ == 0) return; while (this->last_header_length_ < MAX_HEADER_LENGTH-1) { if (begin == end) break; this->header_buf_[this->last_header_length_] = *begin; this->last_header_length_++; begin++; } this->header_buf_[this->last_header_length_] = '\0'; } void JAWS_Header_Info::reduce_last_header_value () { if (this->last_header_data_ == 0) return; if (this->last_header_length_ > 0) { this->last_header_length_--; this->header_buf_[this->last_header_length_] = '\0'; } } void JAWS_Header_Info::create_next_header_value (char *ht) { if (ht == 0) { // discard last header data delete this->last_header_data_; this->last_header_data_ = 0; this->last_header_length (0); return; } this->finish_last_header_value (); if (this->status () == JAWS_Header_Info::STATUS_CODE_OK) { // create a new last_header_data_ node this->last_header_data_ = new JAWS_Header_Data (ht, 0); // The above performs a strdup. if (this->last_header_data_ == 0 || this->last_header_name () == 0) { this->status (JAWS_Header_Info::STATUS_CODE_NO_MEMORY); delete this->last_header_data_; this->last_header_data_ = 0; } this->last_header_length (0); this->header_buf_[0] = '\0'; } } void JAWS_Header_Info::finish_last_header_value () { if (this->last_header_data_ != 0) { // prepare to insert last header data into the table. this->last_header_data_->header_value (this->header_buf ()); // The above performs a strdup. if (this->status () == JAWS_Header_Info::STATUS_CODE_OK) this->table_.insert (this->last_header_data_); else delete this->last_header_data_; this->last_header_data_ = 0; } } char * JAWS_Header_Info::header_buf () { return this->header_buf_; } const char * JAWS_Header_Info::last_header_name () const { return this->last_header_data_ ? this->last_header_data_->header_name () : 0; } const JAWS_Header_Data * JAWS_Header_Info::last_header_data () const { return this->last_header_data_; } ACCESSOR(int,JAWS_Header_Info,last_header_length) ACCESSOR(int,JAWS_Header_Info,end_of_line) ACCESSOR(int,JAWS_Header_Info,end_of_headers) ACCESSOR(int,JAWS_Header_Info,status) ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Concurrency.h0000644000175000017500000000643315027201773020175 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_CONCURRENCY_H #define JAWS_CONCURRENCY_H #include "ace/Singleton.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Task.h" #include "ace/Synch_Traits.h" #include "JAWS/Export.h" #include "JAWS/Jaws_IO.h" class JAWS_Data_Block; class JAWS_Dispatch_Policy; class JAWS_Reaper; class JAWS_Export JAWS_Concurrency_Base : public ACE_Task // = TITLE // Base class for different concurrency models // // = DESCRIPTION // Provides a default implementaion of the virtual put() method // which calls putq(), but can be overloaded to do something // synchronously, such as call put_next(). { public: JAWS_Concurrency_Base (); ~JAWS_Concurrency_Base (); virtual int put (ACE_Message_Block *mb, ACE_Time_Value *tv = 0); virtual int svc (); virtual int svc_loop (JAWS_Data_Block *db); // in thread pool, this is an infinite loop // in thread per request, it is a single iteration virtual int svc_hook (JAWS_Data_Block *db); // does the work of following the pipeline tasks virtual int activate_hook (); // callback for IO_Handler when accept completes virtual ACE_Message_Block *singleton_mb (); protected: int mb_acquired_; ACE_Message_Block *mb_; JAWS_Reaper *reaper_; ACE_SYNCH_MUTEX lock_; }; class JAWS_Export JAWS_Dispatcher // = TITLE // The class that is responsible to delivering events to the // appropriate concurrency mechanism. // // = DESCRIPTION // JAWS_IO_Handler calls into the dispatcher so that the completed // IO can find a thread to take care of it. { public: JAWS_Dispatcher (); int dispatch (ACE_Message_Block *mb); JAWS_Dispatch_Policy *policy (); JAWS_Dispatch_Policy *policy (JAWS_Dispatch_Policy *p); private: JAWS_Dispatch_Policy *policy_; }; class JAWS_Export JAWS_Thread_Pool_Task : public JAWS_Concurrency_Base // = TITLE // Used to implement Thread Pool Concurrency Strategy // // = DESCRIPTION // This task is created to hold a pool of threads that receive // requests through the message queue. { public: virtual int make (long flags, int nthreads, int maxthreads); // Initiate the thread_pool task private: long flags_; int nthreads_; int maxthreads_; }; class JAWS_Export JAWS_Thread_Per_Task : public JAWS_Concurrency_Base // = TITLE // Used to implement Thread Per Request Concurrency Strategy // // = DESCRIPTION // As each new message arrives from the queue, a new thread is // spawned to handle it. This is done by overloading put to call // activate. { public: virtual int make (long flags, int maxthreads); // Initiate the thread_per task virtual int put (ACE_Message_Block *mb, ACE_Time_Value *tv = 0); virtual int svc_loop (JAWS_Data_Block *db); // a single iteration virtual int activate_hook (); // callback for IO_Handler when accept completes private: long flags_; int maxthreads_; }; typedef ACE_Singleton JAWS_Dispatcher_Singleton; typedef ACE_Singleton JAWS_Thread_Pool_Singleton; typedef ACE_Singleton JAWS_Thread_Per_Singleton; #endif /* !defined (JAWS_CONCURRENCY_H) */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/jaws2.mpc0000644000175000017500000000151415027201773017254 0ustar sudipsudip// -*- MPC -*- project(JAWS2) : ace_output, acelib { sharedname = JAWS2 dynamicflags += JAWS_BUILD_DLL avoids += uses_wchar ace_for_tao includes += .. Source_Files { Assoc_Array.cpp Cache_Manager.cpp Cache_Object.cpp Concurrency.cpp Data_Block.cpp FILE.cpp Filecache.cpp Headers.cpp Jaws_IO.cpp IO_Acceptor.cpp IO_Handler.cpp Parse_Headers.cpp Pipeline.cpp Pipeline_Tasks.cpp Policy.cpp Reaper.cpp Server.cpp Waiter.cpp } Template_Files{ Cache_Hash_T.cpp Cache_Heap_T.cpp Cache_List_T.cpp Pipeline_Handler_T.cpp Hash_Bucket_T.cpp Cache_Manager_T.cpp } Header_Files{ *.h } Inline_Files{ } } ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Cache_Manager_T.h0000644000175000017500000001265215027201773020623 0ustar sudipsudip/* -*- c++ -*- */ // Hey Emacs! This is a C++ file! #ifndef JAWS_CACHE_MANAGER_T_H #define JAWS_CACHE_MANAGER_T_H #include "ace/Singleton.h" #include "JAWS/Cache_Object.h" template class JAWS_Cache_Hash; template class JAWS_Cache_Heap; template class JAWS_Cache_List; template class JAWS_Cache_Manager { friend class JAWS_Cache_Hash; friend class JAWS_Cache_Heap; friend class JAWS_Cache_List; public: typedef ACE_Singleton Object_Factory; typedef JAWS_Cache_Hash Cache_Hash; typedef JAWS_Cache_List Cache_Heap; JAWS_Cache_Manager (ACE_Allocator *alloc = 0, JAWS_Cache_Object_Factory *cof = 0, size_t hashsize = 8192, // number of hash buckets size_t maxsize = 65535, // max number of in memory // objects size_t maxobjsize = 256, // max cached object size in kB size_t minobjsize = 0, // min cached object size in kB size_t highwater = 100, // max size of cache in MB size_t lowwater = 50, // min size of cache when // expiring after highwater // has been reached int timetolive = -1, // amt of time the lowest // priority item is allowed to // remain in the cache int counted = 0 // flag for whether to use // counts ); int open (ACE_Allocator *alloc = 0, JAWS_Cache_Object_Factory *cof = 0, size_t hashsize = 1024, // number of hash buckets size_t maxsize = 4096, // max number of in memory // objects size_t maxobjsize = 5120, // max cached object size in kB size_t minobjsize = 0, // min cached object size in kB size_t highwater = 50, // max size of cache in MB size_t lowwater = 30, // min size of cache when // expiring after highwater // has been reached int timetolive = -1, // amount of time the lowest // priority item is allowed to // remain in the cache int counted = 0 // flag for whether to use // counts ); ~JAWS_Cache_Manager (); int close (); // Search Methods int GET (const KEY &key, JAWS_Cache_Object *&cobj); // Retrieve the object associated with key from cache. Return 0 on // success, -1 on failure. int PUT (const KEY &key, const void *data, size_t size, JAWS_Cache_Object *&obj); // Inserts or replaces object associated with key into cache. // Return 0 on success, -1 on failure. int MAKE (const void *data, size_t size, JAWS_Cache_Object *&cobj); // Create a cached object, increment reference count. int TAKE (JAWS_Cache_Object *const &cobj); // Increment reference count. int DROP (JAWS_Cache_Object *&cobj); // Decrement reference count on cached object, perhaps delete. // Returns 0 if only decremented, 1 if deleted, -1 if error. int FLUSH (); // Removes lowest priority object from cache. protected: int GET_i (const KEY &key, JAWS_Cache_Object *&object); // Retrieve the object associated with key from cache. Return 0 on // success, -1 on failure. int PUT_i (const KEY &key, const void *data, size_t size, JAWS_Cache_Object *&object); // Inserts or replaces object associated with key into cache. // Return 0 on success, -1 on failure. int FLUSH_i (); // Removes lowest priority object from cache. int FLUSH_i (const KEY &key); // Removes object associated with key from cache. int DROP_i (JAWS_Cache_Object *&cobj); // Decrement reference count on cached object, perhaps delete. private: ACE_Allocator *allocator_; JAWS_Cache_Object_Factory *factory_; size_t hashsize_; size_t maxsize_; size_t maxobjsize_; size_t minobjsize_; size_t highwater_; size_t lowwater_; size_t waterlevel_; int timetolive_; int counted_; Cache_Hash *hash_; Cache_Heap *heap_; ACE_SYNCH_RW_MUTEX lock_; }; template class JAWS_Cache_Proxy { public: typedef CACHE_MANAGER Cache_Manager; typedef ACE_Singleton Cache_Manager_Singleton; JAWS_Cache_Proxy (const KEY &, Cache_Manager * = 0); // Corresponds to a GET JAWS_Cache_Proxy (const KEY &, DATA *, size_t, Cache_Manager * = 0); // Corresponds to a U/PUT virtual ~JAWS_Cache_Proxy (); DATA *data () const; operator DATA * () const; virtual int close (DATA *); private: JAWS_Cache_Object *object_; Cache_Manager *manager_; }; #include "JAWS/Cache_Manager_T.cpp" #endif /* JAWS_CACHE_MANAGER_T_H */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Cache_List_T.cpp0000644000175000017500000001233015027201773020510 0ustar sudipsudip#ifndef JAWS_CACHE_LIST_T_CPP #define JAWS_CACHE_LIST_T_CPP #include "JAWS/Cache_List_T.h" #include "JAWS/Cache_Manager_T.h" template JAWS_Cache_List::JAWS_Cache_List (ACE_Allocator *alloc, size_t maxsize) : allocator_ (alloc), maxsize_ (maxsize), size_ (0), head_ (0), tail_ (0) { if (this->allocator_ == 0) this->allocator_ = ACE_Allocator::instance (); } template JAWS_Cache_List::~JAWS_Cache_List () { while (this->head_ != 0) this->remove (this->head_); this->allocator_ = 0; } template int JAWS_Cache_List::is_empty () const { return (this->size_ == 0); } template int JAWS_Cache_List::is_full () const { return (this->size_ == this->maxsize_); } template size_t JAWS_Cache_List::size () const { return this->size_; } template size_t JAWS_Cache_List::maxsize () const { return this->maxsize_; } template int JAWS_Cache_List::maxsize (Cache_Manager *, size_t new_maxsize) { this->maxsize_ = new_maxsize; return 0; } template void JAWS_Cache_List::insert_i (Cache_List_Item *item) { /* ASSERT: this->size_ < this->maxsize_ */ item->next_ = 0; item->prev_ = 0; if (this->size_++ == 0) this->head_ = this->tail_ = item; else { this->tail_->next_ = item; item->prev_ = this->tail_; this->tail_ = item; } } template int JAWS_Cache_List::insert (const EXT_ID &ext_id, JAWS_Cache_Object *const &int_id) { if (this->is_full ()) return -1; Cache_List_Item *item = 0; ACE_NEW_MALLOC_RETURN (item, (Cache_List_Item *) this->allocator_->malloc (sizeof (Cache_List_Item)), Cache_List_Item (ext_id, int_id), -1); this->insert_i (item); return 0; } template void JAWS_Cache_List::remove_i () { /* ASSERT: this->size_ > 0 */ this->size_--; this->item_ = this->head_; if (this->head_ == this->tail_) { this->head_ = this->tail_ = 0; return; } this->head_ = this->head_->next_; this->head_->prev_ = 0; this->item_->next_ = 0; } template void JAWS_Cache_List::remove_i (Cache_List_Item *item) { this->size_--; this->item_ = item; if (item->next_ == 0 && item->prev_ == 0) { this->head_ = this->tail_ = 0; } else if (item->next_ == 0) { this->tail_ = item->prev_; this->tail_->next_ = 0; } else if (item->prev_ == 0) { this->head_ = item->next_; this->head_->prev_ = 0; } else { item->next_->prev_ = item->prev_; item->prev_->next_ = item->next_; } item->next_ = 0; item->prev_ = 0; } template int JAWS_Cache_List::remove (EXT_ID &ext_id, JAWS_Cache_Object *&int_id) { if (this->is_empty ()) return -1; this->remove_i (); ext_id = this->item_->ext_id_; int_id = this->item_->int_id_; int_id->heap_item (0); ACE_DES_FREE_TEMPLATE4(this->item_, this->allocator_->free, JAWS_Cache_List_Item, EXT_ID, FACT, H_FN, E_FN); this->item_ = 0; return 0; } template int JAWS_Cache_List::remove (void *item) { if (item == 0) return 0; this->remove_i ((Cache_List_Item *) item); this->item_->int_id_->heap_item (0); ACE_DES_FREE_TEMPLATE4(this->item_, this->allocator_->free, JAWS_Cache_List_Item, EXT_ID, FACT, H_FN, E_FN); this->item_ = 0; return 0; } template int JAWS_Cache_List::adjust (void *item) { if (item == 0) return 0; Cache_List_Item *real_item = (Cache_List_Item *) item; this->remove_i (real_item); this->insert_i (real_item); this->item_ = 0; return 0; } template JAWS_Cache_List_Item:: JAWS_Cache_List_Item (const EXT_ID &ext_id, JAWS_Cache_Object *const &int_id) : ext_id_ (ext_id), int_id_ (int_id) { this->int_id_->heap_item (this); } template unsigned int JAWS_Cache_List_Item::priority () { return this->int_id_->priority (); } #endif /* JAWS_CACHE_LIST_T_CPP */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Server.cpp0000644000175000017500000001215415027201773017501 0ustar sudipsudip#include "ace/config-lite.h" #include "ace/OS_NS_string.h" #include "ace/Get_Opt.h" #if (ACE_NTRACE != 1) #include "ace/Trace.h" #endif /* (ACE_NTRACE != 1) */ #include "JAWS/Server.h" #include "JAWS/Data_Block.h" #include "JAWS/Concurrency.h" #include "JAWS/Jaws_IO.h" #include "JAWS/IO_Handler.h" #include "JAWS/IO_Acceptor.h" #include "JAWS/Pipeline_Tasks.h" JAWS_Server::JAWS_Server () : port_ (5432), concurrency_ (0), dispatch_ (0), nthreads_ (5), maxthreads_ (20), flags_ (THR_NEW_LWP) { } JAWS_Server::JAWS_Server (int argc, char *argv[]) : ratio_ (1), port_ (5432), concurrency_ (0), dispatch_ (0), nthreads_ (5), maxthreads_ (20), flags_ (THR_NEW_LWP) { this->init (argc, argv); } void JAWS_Server::init (int argc, char *argv[]) { this->parse_args (argc, argv); this->policy_.ratio (this->ratio_); if (this->concurrency_ == 1) { JAWS_Thread_Per_Singleton::instance ()->make (this->flags_, this->maxthreads_); this->policy_.concurrency (JAWS_Thread_Per_Singleton::instance ()); } else { JAWS_Thread_Pool_Singleton::instance ()->make (this->flags_, this->nthreads_, this->maxthreads_); this->policy_.concurrency (JAWS_Thread_Pool_Singleton::instance ()); } #if !(defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS)) this->dispatch_ = 0; #endif /* !(ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS) */ if (this->dispatch_ == 1) { #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) this->policy_.io (JAWS_Asynch_IO_Singleton::instance ()); this->policy_.ioh_factory (JAWS_Asynch_IO_Handler_Factory_Singleton::instance ()); this->policy_.acceptor (JAWS_IO_Asynch_Acceptor_Singleton::instance ()); #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ } else { this->policy_.io (JAWS_Synch_IO_Singleton::instance ()); this->policy_.ioh_factory (JAWS_Synch_IO_Handler_Factory_Singleton::instance ()); this->policy_.acceptor (JAWS_IO_Synch_Acceptor_Singleton::instance ()); } //FUZZ: disable check_for_lack_ACE_OS ACE_INET_Addr inet_addr (this->port_); //FUZZ: enable check_for_lack_ACE_OS this->policy_.acceptor ()->open (inet_addr); } int JAWS_Server::open (JAWS_Pipeline_Handler *protocol, JAWS_Dispatch_Policy *policy) { if (policy == 0) policy = &this->policy_; JAWS_Data_Block *db = new JAWS_Data_Block; if (db == 0) { ACE_DEBUG ((LM_DEBUG, "(%t) JAWS_Server::open, could not create Data_Block\n")); return -1; } // initialize data block db->task (JAWS_Pipeline_Accept_Task_Singleton::instance ()); db->policy (policy); db->io_handler (0); db->task ()->next (protocol); // prime the acceptor if appropriate if (this->dispatch_ == 1) { #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) int n = this->nthreads_; if (this->concurrency_ == 1) n = 1; for (int i = 0; i < n * this->ratio_ - n; i++) db->task ()->put (db); #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ } // The message block should contain an INET_Addr, and call the // io->accept (INET_Addr) method! policy->concurrency ()->put (db); ACE_Thread_Manager::instance ()->wait (); db->release (); return 0; } void JAWS_Server::parse_args (int argc, ACE_TCHAR *argv[]) { int c; int t = 0; //FUZZ: disable check_for_lack_ACE_OS ACE_Get_Opt getopt (argc, argv, ACE_TEXT("t" "p:c:d:n:m:f:r:")); while ((c = getopt ()) != -1) //FUZZ: enable check_for_lack_ACE_OS switch (c) { case 't': t = !t; break; case 'p': this->port_ = ACE_OS::atoi (getopt.opt_arg ()); break; case 'c': if (ACE_OS::strcmp (getopt.opt_arg (), "PER_REQUEST") == 0) this->concurrency_ = 1; else this->concurrency_ = 0; break; case 'd': if (ACE_OS::strcmp (getopt.opt_arg (), "ASYNCH") == 0) this->dispatch_ = 1; else this->dispatch_ = 0; break; case 'n': this->nthreads_ = ACE_OS::atoi (getopt.opt_arg ()); break; case 'm': this->maxthreads_ = ACE_OS::atoi (getopt.opt_arg ()); break; case 'f': if (ACE_OS::strcmp (getopt.opt_arg (), "THR_BOUND") == 0) this->flags_ |= THR_BOUND; else if (ACE_OS::strcmp (getopt.opt_arg (), "THR_DAEMON") == 0) this->flags_ |= THR_DAEMON; else if (ACE_OS::strcmp (getopt.opt_arg (), "THR_DETACHED") == 0) this->flags_ |= THR_DETACHED; break; case 'r': this->ratio_ = ACE_OS::atoi (getopt.opt_arg ()); break; } #if (ACE_NTRACE != 1) if (t) ACE_Trace::start_tracing (); else ACE_Trace::stop_tracing (); #endif /* ACE_NTRACE != 1*/ if (this->port_ == 0) this->port_ = 5432; if (this->nthreads_ == 0) this->nthreads_ = 5; if (this->maxthreads_ == 0) this->maxthreads_ = 20; } ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Parse_Headers.h0000644000175000017500000000614515027201773020410 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_PARSE_HEADERS_H #define JAWS_PARSE_HEADERS_H #include "JAWS/Export.h" #include "ace/Singleton.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Message_Block.h" #include "ace/Synch_Traits.h" #include "Headers.h" class JAWS_Export JAWS_Header_Info { public: JAWS_Header_Info (); ~JAWS_Header_Info (); int end_of_line () const; void end_of_line (int flag); const char *last_header_name () const; int last_header_length () const; void last_header_length (int len); const JAWS_Header_Data * last_header_data () const; char *header_buf (); void append_last_header_value (char c); int append_last_header_value (); void append_last_header_value (const char *begin, const char *end); void reduce_last_header_value (); void create_next_header_value (char *ht); // This will insert last_header_data into the table if it is not // null. Then, it will create a new header_data node and populate // it. If ht is null, last_header_data is not inserted. void finish_last_header_value (); // This will insert last_header_data into the table if it is not // null. int end_of_headers () const; void end_of_headers (int flag); int status () const; void status (int s); JAWS_Headers *table (); enum STATUS_CODE { STATUS_CODE_OK = 0, STATUS_CODE_NO_MEMORY, STATUS_CODE_TOO_LONG }; enum { MAX_HEADER_LENGTH = 8192 }; // Note that RFC 822 does not mention the maximum length of a header // line. So in theory, there is no maximum length. // In Apache, they assume that each header line should not exceed // 8K. Who am I to disagree? void dump (); private: int end_of_headers_; int end_of_line_; JAWS_Header_Data *last_header_data_; int last_header_length_; int status_; char header_buf_[MAX_HEADER_LENGTH]; JAWS_Headers table_; }; class JAWS_Export JAWS_Parse_Headers { public: int parse_headers (JAWS_Header_Info *info, ACE_Message_Block &mb); // Return 0 means need more data, and call it again. // Return 1 means all done or error. int parse_header_name (JAWS_Header_Info *info, ACE_Message_Block &mb); // Return 0 means reiterate on remaining input. // Return 1 means input has ended (either because it ended // prematurely, or that there are no more headers). int parse_header_value (JAWS_Header_Info *info, ACE_Message_Block &mb); // Return 0 means reiterate on remaining input. // Return 1 means input has ended or that an error has occurred. char * skipset (const char *set, char *start, char *end); // Scans from start to end for characters that match skip set. // Returns pointer to first location between start and end of a // character that is in the skip set. char * skipcset (const char *set, char *start, char *end); // Scans from start to end for characters that match skip set. // Returns pointer to first location between start and end of a // character that is *not* in the skip set. }; typedef ACE_Singleton JAWS_Parse_Headers_Singleton; #endif /* !defined (JAWS_PARSE_HEADERS_H) */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Cache_Manager_T.cpp0000644000175000017500000003244115027201773021154 0ustar sudipsudip#ifndef JAWS_CACHE_MANAGER_T_CPP #define JAWS_CACHE_MANAGER_T_CPP #include "JAWS/Cache_Manager_T.h" #include "JAWS/Cache_Hash_T.h" #include "JAWS/Cache_List_T.h" // FUZZ: disable check_for_streams_include #include "ace/streams.h" class Cache_Manager; template JAWS_Cache_Manager ::JAWS_Cache_Manager (ACE_Allocator *alloc, JAWS_Cache_Object_Factory *cof, size_t hashsize, size_t maxsize, size_t maxobjsize, size_t minobjsize, size_t highwater, size_t lowwater, int timetolive, int counted) : allocator_ (alloc), factory_ (cof), hashsize_ (hashsize), maxsize_ (maxsize), maxobjsize_ (maxobjsize), minobjsize_ (minobjsize), highwater_ (highwater), lowwater_ (lowwater), waterlevel_ (0), timetolive_ (timetolive), counted_ (counted), hash_ (0), heap_ (0) { // Some sanity checking needed here -- if (this->lowwater_ > this->highwater_) this->lowwater_ = this->highwater_ / 2; if (this->maxobjsize_ > (this->highwater_ - this->lowwater_) * 1024) this->maxobjsize_ = (this->highwater_ - this->lowwater_) * (1024/2); if (this->minobjsize_ > this->maxobjsize_) this->minobjsize_ = this->maxobjsize_ / 2; if (this->allocator_ == 0) this->allocator_ = ACE_Allocator::instance (); if (this->factory_ == 0) this->factory_ = Object_Factory::instance (); ACE_NEW_MALLOC (this->hash_, (Cache_Hash *) this->allocator_->malloc (sizeof (Cache_Hash)), Cache_Hash (alloc, hashsize)); if (this->hash_ == 0) { this->hashsize_ = 0; return; } ACE_NEW_MALLOC (this->heap_, (Cache_Heap *) this->allocator_->malloc (sizeof (Cache_Heap)), Cache_Heap (alloc, maxsize)); if (this->heap_ == 0) { this->maxsize_ = 0; ACE_DES_FREE_TEMPLATE3(this->hash_, this->allocator_->free, JAWS_Cache_Hash, KEY, HASH_FUNC, EQ_FUNC); this->hash_ = 0; this->hashsize_ = 0; } } template int JAWS_Cache_Manager ::open (ACE_Allocator *alloc, JAWS_Cache_Object_Factory *cof, size_t hashsize, size_t maxsize, size_t maxobjsize, size_t minobjsize, size_t highwater, size_t lowwater, int timetolive, int counted) { this->close (); this->allocator_ = alloc; this->factory_ = cof; this->hashsize_ = hashsize; this->maxsize_ = maxsize; this->maxobjsize_ = maxobjsize; this->minobjsize_ = minobjsize; this->highwater_ = highwater; this->lowwater_ = lowwater; this->waterlevel_ = 0; this->timetolive_ = timetolive; this->counted_ = counted; // Some sanity checking needed here -- if (this->lowwater_ > this->highwater_) this->lowwater_ = this->highwater_ / 2; if (this->maxobjsize_ > (this->highwater_ - this->lowwater_) * 1024) this->maxobjsize_ = (this->highwater_ - this->lowwater_) * (1024/2); if (this->minobjsize_ > this->maxobjsize_) this->minobjsize_ = this->maxobjsize_ / 2; if (this->allocator_ == 0) this->allocator_ = ACE_Allocator::instance (); if (this->factory_ == 0) this->factory_ = Object_Factory::instance (); this->hash_ = (Cache_Hash *) this->allocator_->malloc (sizeof (Cache_Hash)); if (this->hash_ == 0) { errno = ENOMEM; this->hashsize_ = 0; return -1; } new (this->hash_) Cache_Hash (alloc, hashsize); this->heap_ = (Cache_Heap *) this->allocator_->malloc (sizeof (Cache_Heap)); if (this->heap_ == 0) { errno = ENOMEM; this->maxsize_ = 0; ACE_DES_FREE_TEMPLATE3(this->hash_, this->allocator_->free, JAWS_Cache_Hash, KEY, HASH_FUNC, EQ_FUNC); this->hash_ = 0; this->hashsize_ = 0; return -1; } new (this->heap_) Cache_Heap (alloc, maxsize); return 0; } template JAWS_Cache_Manager::~JAWS_Cache_Manager () { this->close (); } template int JAWS_Cache_Manager::close () { while (this->waterlevel_ > 0) this->FLUSH_i (); if (this->hash_) { ACE_DES_FREE_TEMPLATE3(this->hash_, this->allocator_->free, JAWS_Cache_Hash, KEY, HASH_FUNC, EQ_FUNC); this->hash_ = 0; } if (this->heap_) { ACE_DES_FREE_TEMPLATE4(this->heap_, this->allocator_->free, JAWS_Cache_List, KEY, FACTORY, HASH_FUNC, EQ_FUNC); this->heap_ = 0; } return 0; } template int JAWS_Cache_Manager ::GET_i (const KEY &key, JAWS_Cache_Object *&object) { int const result = this->hash_->find (key, object); if (result == 0) this->TAKE (object); else object = 0; return result; } template int JAWS_Cache_Manager ::PUT_i (const KEY &key, const void *data, size_t size, JAWS_Cache_Object *&obj) { int result = 0; if (data == 0) { this->FLUSH_i (key); obj = 0; return 0; } result = this->MAKE (data, size, obj); if (result == -1) { if (size/1024 <= this->maxobjsize_) cerr << "MAKE failed. Bummer!" << endl; else this->DROP_i (obj); return -1; } obj->internal (new KEY (key)); KEY old_key; JAWS_Cache_Object *old_obj; result = this->hash_->rebind (key, obj, old_key, old_obj); if (result == -1) { cerr << "*** hash bind error: " << key << endl; obj->release (); this->DROP_i (obj); return -1; } else if (result == 1) { this->heap_->remove (old_obj->heap_item ()); this->waterlevel_ -= old_obj->size (); old_obj->release (); this->DROP_i (old_obj); } result = this->heap_->insert (key, obj); if (result == -1) { cerr << "*** heap insertion error: " << key << endl; this->hash_->unbind (key); obj->release (); this->DROP_i (obj); return -1; } this->waterlevel_ += size; // Acquire this one for the putter. this->TAKE (obj); return 0; } template int JAWS_Cache_Manager ::FLUSH_i (const KEY &key) { JAWS_Cache_Object *temp_object; #ifdef ENTERA_VERBOSE_TRACE cerr << "*** flush key unbinding: " << key << endl; #endif int result = this->hash_->unbind (key, temp_object); if (result == 0) { this->waterlevel_ -= temp_object->size (); if (this->heap_->remove (temp_object->heap_item ()) == -1) cerr << "*** flush key heap remove failed: " << endl; temp_object->release (); this->DROP_i (temp_object); } else cerr << "*** flush key hash unbind failed: " << key << endl; return result; } template int JAWS_Cache_Manager ::FLUSH_i () { KEY temp_key; JAWS_Cache_Object *temp_object; int result = this->heap_->remove (temp_key, temp_object); if (result == 0) { #ifdef ENTERA_VERBOSE_TRACE cerr << "*** flush unbinding: " << temp_key << endl; #endif result = this->hash_->unbind (temp_key); if (result == -1) cerr << "*** flush hash unbind failed: " << temp_key << endl; result = 0; this->waterlevel_ -= temp_object->size (); temp_object->release (); this->DROP_i (temp_object); } else { cerr << "*** flush heap remove failed" << endl; } return result; } template int JAWS_Cache_Manager ::DROP_i (JAWS_Cache_Object *&obj) { int result = 0; if (obj->count () == 0) { KEY *key = (KEY *) obj->internal (); this->factory_->destroy (obj); delete key; obj = 0; result = 1; } else result = this->heap_->adjust (obj->heap_item ()); return result; } template int JAWS_Cache_Manager ::GET (const KEY &key, JAWS_Cache_Object *&object) { ACE_READ_GUARD_RETURN (ACE_SYNCH_RW_MUTEX, g,this->lock_, -1); return this->GET_i (key, object); } template int JAWS_Cache_Manager ::PUT (const KEY &key, const void *data, size_t size, JAWS_Cache_Object *&obj) { ACE_WRITE_GUARD_RETURN (ACE_SYNCH_RW_MUTEX, g,this->lock_, -1); return this->PUT_i (key, data, size, obj); } template int JAWS_Cache_Manager ::MAKE (const void *data, size_t size, JAWS_Cache_Object *&obj) { // verify object is within cacheable range if (size/1024 > this->maxobjsize_) { #if 0 // What we do is cache it anyway, but remove it as soon as the // requester returns it. obj = this->factory_->create (data, size); return 0; #else // The above is a little tricky to implement. Think about it // some more. obj = this->factory_->create (data, size); return -1; #endif /* 0 */ } if (size/1024 < this->minobjsize_) { // Don't bother to cache this. cerr << "*** " << static_cast(size) << " is too small to cache" << endl; return -1; } // make sure we have sufficient memory if (this->waterlevel_ + size > this->highwater_ * (1024 * 1024)) { do { if (this->FLUSH_i () == -1) { cerr << "*** cache flooded, flush error" << endl; return -1; } } while (this->waterlevel_ > this->lowwater_ * (1024 * 1024)); } // make sure heap has enough room if (this->heap_->is_full ()) { cerr << "*** heap full, flushing" << endl; if (this->FLUSH_i () == -1) { cerr << "*** heap full, flush error" << endl; return -1; } } obj = this->factory_->create (data, size); if (this->TAKE (obj) == -1) { cerr << "*** take error" << endl; this->factory_->destroy (obj); obj = 0; return -1; } return 0; } template int JAWS_Cache_Manager ::TAKE (JAWS_Cache_Object *const &obj) { if (obj == 0) return -1; return obj->acquire (); } template int JAWS_Cache_Manager ::DROP (JAWS_Cache_Object *&obj) { if (obj == 0) return -1; ACE_WRITE_GUARD_RETURN (ACE_SYNCH_RW_MUTEX, g, this->lock_, -1); int result = obj->release (); if (result == 0) { if (obj->count () == 0) { KEY *key = (KEY *) obj->internal (); this->factory_->destroy (obj); delete key; obj = 0; result = 1; } else { result = this->DROP_i (obj); } } return result; } template int JAWS_Cache_Manager ::FLUSH () { ACE_WRITE_GUARD_RETURN (ACE_SYNCH_RW_MUTEX, g, this->lock_, -1); return this->FLUSH_i (); } template JAWS_Cache_Proxy ::JAWS_Cache_Proxy (const KEY &key, Cache_Manager *manager) : object_ (0), manager_ (manager) { if (this->manager_ == 0) this->manager_ = Cache_Manager_Singleton::instance (); int const result = this->manager_->GET (key, this->object_); if (result == -1) this->object_ = 0; } template JAWS_Cache_Proxy ::JAWS_Cache_Proxy (const KEY &key, DATA *data, size_t size, Cache_Manager *manager) : object_ (0), manager_ (manager) { if (this->manager_ == 0) this->manager_ = Cache_Manager_Singleton::instance (); int result = this->manager_->PUT (key, data, size, this->object_); if (result == -1) this->object_ = 0; } template JAWS_Cache_Proxy::~JAWS_Cache_Proxy () { DATA *data = this->data (); this->manager_->DROP (this->object_); if (this->object_ == 0) this->close (data); } template DATA * JAWS_Cache_Proxy::data () const { return this->object_ ? (DATA *) this->object_->data () : 0; } template JAWS_Cache_Proxy::operator DATA * () const { return this->data (); } template int JAWS_Cache_Proxy::close (DATA *) { return 0; } #endif /* JAWS_CACHE_MANAGER_T_CPP */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Cache_Heap_T.h0000644000175000017500000000441015027201773020117 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_CACHE_HEAP_T_H #define JAWS_CACHE_HEAP_T_H #include "ace/Malloc.h" #include "JAWS/Cache_Object.h" // Forward declarations template class JAWS_Cache_Manager; template class JAWS_Cache_Heap_Item; template class JAWS_Cache_Heap // Roll my own heap here. Eventually, a heap should be its own // standalone data structure. { public: typedef JAWS_Cache_Manager Cache_Manager; typedef JAWS_Cache_Heap_Item Cache_Heap_Item; JAWS_Cache_Heap (ACE_Allocator *alloc = 0, size_t maxsize = 8192); // maxsize is the total number of objects the in memory cache is // willing to manage ~JAWS_Cache_Heap (); int is_empty () const; int is_full () const; size_t size () const; size_t maxsize () const; int maxsize (Cache_Manager *cm, size_t new_maxsize); // attempt to grow (or shrink) the heap. Return 0 on success, -1 on // error. int insert (const EXT_ID &ext_id, JAWS_Cache_Object *const &int_id); // attempt to insert int_id into heap. int remove (EXT_ID &ext_id, JAWS_Cache_Object *&int_id); // attempt to remove the top element of heap. int remove (void *item); // treat item as a Cache_Heap_Item, and remove it from the heap int adjust (void *item); // treat item as a Cache_Heap_Item, and alter its heap position protected: void insert_i (Cache_Heap_Item *item); // insert item into heap. void remove_i (size_t pos); // remove the element residing at pos, but do not delete it. void remove_i (); // remove the element residing at the top of heap, but do not delete it. private: ACE_Allocator *allocator_; size_t maxsize_; size_t size_; Cache_Heap_Item **heap_; }; template class JAWS_Cache_Heap_Item { friend class JAWS_Cache_Heap; public: JAWS_Cache_Heap_Item (const EXT_ID &ext_id, JAWS_Cache_Object *const &int_id); unsigned int priority (); private: EXT_ID ext_id_; JAWS_Cache_Object *int_id_; size_t heap_idx_; }; #include "JAWS/Cache_Heap_T.cpp" #endif /* JAWS_CACHE_HEAP_T_H */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Cache_Object.cpp0000644000175000017500000001247415027201773020531 0ustar sudipsudip#include "JAWS/Cache_Object.h" #include "ace/Malloc_Base.h" #include "ace/Guard_T.h" #include "ace/OS_NS_time.h" JAWS_Cache_Object::JAWS_Cache_Object (const void *data, size_t size) : internal_ (0), data_ (data), size_ (size) { this->first_access_ = ACE_OS::time ((time_t *)0); this->new_last_access_ = this->last_access_ = this->first_access_; } JAWS_Cache_Object::~JAWS_Cache_Object () { this->data_ = 0; this->size_ = 0; } void * JAWS_Cache_Object::internal () const { return this->internal_; } void JAWS_Cache_Object::internal (void *item) { this->internal_ = item; } const void * JAWS_Cache_Object::data () const { return this->data_; } size_t JAWS_Cache_Object::size () const { return this->size_; } unsigned int JAWS_Cache_Object::count () const { return this->count_i (); } int JAWS_Cache_Object::acquire () { this->new_last_access_ = ACE_OS::time ((time_t *)0); return this->acquire_i (); } int JAWS_Cache_Object::release () { this->last_access_ = this->new_last_access_; return this->release_i (); } time_t JAWS_Cache_Object::last_access () const { return this->last_access_; } time_t JAWS_Cache_Object::first_access () const { return this->first_access_; } unsigned int JAWS_Cache_Object::priority () const { return this->priority_i (); } void * JAWS_Cache_Object::heap_item () const { return this->heap_item_; } void JAWS_Cache_Object::heap_item (void *item) { this->heap_item_ = item; } JAWS_Referenced_Cache_Object:: JAWS_Referenced_Cache_Object (const void *data, size_t size) : JAWS_Cache_Object (data, size), lock_adapter_ (count_) { } JAWS_Referenced_Cache_Object::~JAWS_Referenced_Cache_Object () { } ACE_Lock & JAWS_Referenced_Cache_Object::lock () { return this->lock_adapter_; } unsigned int JAWS_Referenced_Cache_Object::count_i () const { if (this->count_.tryacquire_write () == 0) return 0; return 1; } int JAWS_Referenced_Cache_Object::acquire_i () { return this->count_.acquire_read (); } int JAWS_Referenced_Cache_Object::release_i () { return this->count_.release (); } unsigned int JAWS_Referenced_Cache_Object::priority_i () const { unsigned int priority = ~(0U); double delta = ACE_OS::difftime (this->last_access (), this->first_access ()); if (delta >= 0.0 && delta < ~(0U)) priority = (unsigned) delta; return priority; } JAWS_Counted_Cache_Object:: JAWS_Counted_Cache_Object (const void *data, size_t size) : JAWS_Cache_Object (data, size), count_ (0), new_count_ (0), lock_adapter_ (lock_) { } JAWS_Counted_Cache_Object::~JAWS_Counted_Cache_Object () { } ACE_Lock & JAWS_Counted_Cache_Object::lock () { return this->lock_adapter_; } unsigned int JAWS_Counted_Cache_Object::count_i () const { ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, g ,this->lock_, 0); return this->count_; } int JAWS_Counted_Cache_Object::acquire_i () { ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, g ,this->lock_, 0); ++this->new_count_; return 0; } int JAWS_Counted_Cache_Object::release_i () { ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, g ,this->lock_, 0); --this->new_count_; this->count_ = this->new_count_; return 0; } unsigned int JAWS_Counted_Cache_Object::priority_i () const { return this->count_i (); } JAWS_Cache_Object_Factory::JAWS_Cache_Object_Factory (ACE_Allocator *alloc) : allocator_ (alloc) { if (this->allocator_ == 0) this->allocator_ = ACE_Allocator::instance (); } JAWS_Cache_Object_Factory::~JAWS_Cache_Object_Factory () { } int JAWS_Cache_Object_Factory::open (ACE_Allocator *alloc) { this->allocator_ = alloc; if (this->allocator_ == 0) this->allocator_ = ACE_Allocator::instance (); return 0; } JAWS_Referenced_Cache_Object_Factory ::JAWS_Referenced_Cache_Object_Factory (ACE_Allocator *alloc) : JAWS_Cache_Object_Factory (alloc) { } JAWS_Referenced_Cache_Object_Factory ::~JAWS_Referenced_Cache_Object_Factory () { } JAWS_Cache_Object * JAWS_Referenced_Cache_Object_Factory::create (const void *data, size_t size) { JAWS_Referenced_Cache_Object *obj; size_t obj_size = sizeof (JAWS_Referenced_Cache_Object); ACE_NEW_MALLOC_RETURN (obj, (JAWS_Referenced_Cache_Object *) this->allocator_->malloc (obj_size), JAWS_Referenced_Cache_Object (data, size), 0); return obj; } void JAWS_Referenced_Cache_Object_Factory::destroy (JAWS_Cache_Object *obj) { JAWS_Referenced_Cache_Object *rco = (JAWS_Referenced_Cache_Object *) obj; ACE_DES_FREE (rco, this->allocator_->free, JAWS_Referenced_Cache_Object); } JAWS_Counted_Cache_Object_Factory ::JAWS_Counted_Cache_Object_Factory (ACE_Allocator *alloc) : JAWS_Cache_Object_Factory (alloc) { } JAWS_Counted_Cache_Object_Factory ::~JAWS_Counted_Cache_Object_Factory () { } JAWS_Cache_Object * JAWS_Counted_Cache_Object_Factory::create (const void *data, size_t size) { JAWS_Counted_Cache_Object *obj; size_t obj_size = sizeof (JAWS_Counted_Cache_Object); ACE_NEW_MALLOC_RETURN (obj, (JAWS_Counted_Cache_Object *) this->allocator_->malloc (obj_size), JAWS_Counted_Cache_Object (data, size), 0); return obj; } void JAWS_Counted_Cache_Object_Factory::destroy (JAWS_Cache_Object *obj) { JAWS_Counted_Cache_Object *cco = (JAWS_Counted_Cache_Object *) obj; ACE_DES_FREE (cco, this->allocator_->free, JAWS_Counted_Cache_Object); } ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/IO_Handler.cpp0000644000175000017500000002503515027201773020201 0ustar sudipsudip#include "ace/Proactor.h" #include "ace/Filecache.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_sys_socket.h" #include "JAWS/Jaws_IO.h" #include "JAWS/IO_Handler.h" #include "JAWS/IO_Acceptor.h" #include "JAWS/Data_Block.h" #include "JAWS/Policy.h" #include "JAWS/Waiter.h" #include "JAWS/Filecache.h" JAWS_Abstract_IO_Handler::~JAWS_Abstract_IO_Handler () { } JAWS_IO_Handler_Factory::~JAWS_IO_Handler_Factory () { } JAWS_IO_Handler * JAWS_IO_Handler_Factory::create_io_handler () { JAWS_TRACE ("JAWS_IO_Handler_Factory::create"); JAWS_IO_Handler *handler; handler = new JAWS_IO_Handler (this); return handler; } void JAWS_IO_Handler_Factory::destroy_io_handler (JAWS_IO_Handler *handler) { JAWS_TRACE ("JAWS_IO_Handler_Factory::destroy"); if (handler != 0) { delete handler->message_block (); delete handler; } } JAWS_IO_Handler::JAWS_IO_Handler (JAWS_IO_Handler_Factory *factory) : status_ (0), mb_ (0), handle_ (ACE_INVALID_HANDLE), task_ (0), factory_ (factory) { } JAWS_IO_Handler::~JAWS_IO_Handler () { this->mb_ = 0; this->status_ = 0; this->task_ = 0; this->factory_ = 0; ACE_OS::closesocket (this->handle_); this->handle_ = ACE_INVALID_HANDLE; } void JAWS_IO_Handler::accept_complete (ACE_HANDLE handle) { // callback into pipeline task, notify that the accept has completed this->handle_ = handle; this->status_ |= ACCEPT_OK; this->status_ &= (ACCEPT_OK+1); JAWS_Dispatch_Policy *policy = this->mb_->policy (); // Do this so that Thread Per Request can spawn a new thread policy->concurrency ()->activate_hook (); } void JAWS_IO_Handler::accept_error () { // callback into pipeline task, notify that the accept has failed this->status_ |= ACCEPT_ERROR; this->status_ &= (ACCEPT_ERROR+1); } void JAWS_IO_Handler::read_complete (ACE_Message_Block *data) { ACE_UNUSED_ARG (data); // We can call back into the pipeline task at this point // this->pipeline_->read_complete (data); this->status_ |= READ_OK; this->status_ &= (READ_OK+1); } void JAWS_IO_Handler::read_error () { // this->pipeline_->read_error (); this->status_ |= READ_ERROR; this->status_ &= (READ_ERROR+1); } void JAWS_IO_Handler::transmit_file_complete () { JAWS_TRACE ("JAWS_IO_Handler::transmit_file_complete"); // this->pipeline_->transmit_file_complete (); this->status_ |= TRANSMIT_OK; this->status_ &= (TRANSMIT_OK+1); } void JAWS_IO_Handler::transmit_file_error (int result) { JAWS_TRACE ("JAWS_IO_Handler::transmit_file_error"); ACE_UNUSED_ARG (result); // this->pipeline_->transmit_file_complete (result); this->status_ |= TRANSMIT_ERROR; this->status_ &= (TRANSMIT_ERROR+1); } void JAWS_IO_Handler::receive_file_complete () { this->status_ |= RECEIVE_OK; this->status_ &= (RECEIVE_OK+1); } void JAWS_IO_Handler::receive_file_error (int result) { ACE_UNUSED_ARG(result); this->status_ |= RECEIVE_ERROR; this->status_ &= (RECEIVE_ERROR+1); } void JAWS_IO_Handler::write_error () { ACE_DEBUG ((LM_DEBUG, " (%t) error in writing response\n")); this->status_ |= WRITE_ERROR; this->status_ &= (WRITE_ERROR+1); this->done (); } void JAWS_IO_Handler::confirmation_message_complete () { this->status_ |= WRITE_OK; this->status_ &= (WRITE_OK+1); } void JAWS_IO_Handler::error_message_complete () { this->status_ |= WRITE_OK; this->status_ &= (WRITE_OK+1); } JAWS_IO_Handler_Factory * JAWS_IO_Handler::factory () { return this->factory_; } ACE_HANDLE JAWS_IO_Handler::handle () const { return this->handle_; } void JAWS_IO_Handler::task (JAWS_Pipeline_Handler *ph) { this->task_ = ph; } JAWS_Pipeline_Handler * JAWS_IO_Handler::task () { return this->task_; } void JAWS_IO_Handler::message_block (JAWS_Data_Block *mb) { this->mb_ = mb; } JAWS_Data_Block * JAWS_IO_Handler::message_block () { return this->mb_; } void JAWS_IO_Handler::done () { this->factory ()->destroy_io_handler (this); } int JAWS_IO_Handler::status () { return this->status_; } void JAWS_IO_Handler::idle () { this->status_ &= (IDLE+1); } void JAWS_IO_Handler::acquire () { } void JAWS_IO_Handler::lock () { } void JAWS_IO_Handler::release () { } #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) JAWS_Asynch_IO_Handler_Factory::~JAWS_Asynch_IO_Handler_Factory () { } JAWS_IO_Handler * JAWS_Asynch_IO_Handler_Factory::create_io_handler () { JAWS_TRACE ("JAWS_Asynch_IO_Handler_Factory::create"); JAWS_Asynch_IO_Handler *handler = 0; handler = new JAWS_Asynch_IO_Handler (this); return handler; } void JAWS_Asynch_IO_Handler_Factory::destroy_io_handler (JAWS_IO_Handler *handler) { JAWS_TRACE ("JAWS_IO_Handler_Factory::destroy"); if (handler != 0) { //cerr << "(" << thr_self () << ") locking for destruction: " << handler << endl; handler->lock (); delete handler->message_block (); handler->message_block (0); delete handler; } } JAWS_Asynch_IO_Handler::JAWS_Asynch_IO_Handler (JAWS_Asynch_IO_Handler_Factory *factory) : JAWS_IO_Handler (factory), handler_ (0) { this->status_ = 1; } JAWS_Asynch_IO_Handler::~JAWS_Asynch_IO_Handler () { delete this->handler_; this->handler_ = 0; } ACE_Handler * JAWS_Asynch_IO_Handler::handler () { return this->handler_; } void JAWS_Asynch_IO_Handler::acquire () { //cerr << "(" << thr_self () << ") acquire handler: " << this << endl; this->count_.acquire_read (); } void JAWS_Asynch_IO_Handler::lock () { //cerr << "(" << thr_self () << ") locking handler: " << this << endl; this->count_.acquire_write (); } void JAWS_Asynch_IO_Handler::release () { //cerr << "(" << thr_self () << ") release handler: " << this << endl; this->count_.release (); } JAWS_Asynch_Handler::JAWS_Asynch_Handler () : ioh_ (0) { this->proactor (ACE_Proactor::instance ()); } JAWS_Asynch_Handler::~JAWS_Asynch_Handler () { } void JAWS_Asynch_Handler::open (ACE_HANDLE h, ACE_Message_Block &mb) { JAWS_TRACE ("JAWS_Asynch_Handler::open"); // This currently does nothing, but just in case. ACE_Service_Handler::open (h, mb); // ioh_ set from the ACT hopefully //this->dispatch_handler (); #if !defined (ACE_WIN32) // Assume at this point there is no data. mb.rd_ptr (mb.wr_ptr ()); mb.crunch (); #else // AcceptEx reads some initial data from the socket. this->handler ()->message_block ()->copy (mb.rd_ptr (), mb.length ()); #endif ACE_Asynch_Accept_Result_Impl *fake_result = ACE_Proactor::instance ()->create_asynch_accept_result (this->proxy (), JAWS_IO_Asynch_Acceptor_Singleton::instance ()->get_handle (), h, mb, JAWS_Data_Block::JAWS_DATA_BLOCK_SIZE, this->ioh_, ACE_INVALID_HANDLE, 0); this->handler ()->handler_ = this; fake_result->complete (0, 1, 0); } void JAWS_Asynch_Handler::act (const void *act_ref) { JAWS_TRACE ("JAWS_Asynch_Handler::act"); // Set the ioh from the act this->ioh_ = (JAWS_Asynch_IO_Handler *) act_ref; } #if 0 ACE_HANDLE JAWS_Asynch_Handler::handle () const { return this->ioh_->handle (); } #endif void JAWS_Asynch_Handler::dispatch_handler () { #if 0 // A future version of ACE will support this. ACE_Thread_ID tid = ACE_OS::thr_self (); #else // Do it this way for now ACE_thread_t thr_name; thr_name = ACE_OS::thr_self (); JAWS_Thread_ID tid (thr_name); #endif /* 0 */ JAWS_IO_Handler **iohref = JAWS_Waiter_Singleton::instance ()->find (tid); *iohref = this->handler (); } void JAWS_Asynch_Handler::handle_read_stream (const ACE_Asynch_Read_Stream::Result &result) { JAWS_TRACE ("JAWS_Asynch_Handler::handle_read_stream"); this->dispatch_handler (); if (result.act () != 0) { // This callback is for io->receive_file() JAWS_TRACE ("JAWS_Asynch_Handler::handle_read_stream (recv_file)"); int code = 0; if (result.success () && result.bytes_transferred () != 0) { if (result.message_block ().length () == result.message_block ().size ()) code = ACE_Filecache_Handle::ACE_SUCCESS; else { ACE_Asynch_Read_Stream ar; if (ar.open (*this, this->handler ()->handle ()) == -1 || ar.read (result.message_block (), result.message_block ().size () - result.message_block ().length (), result.act ()) == -1) code = -1; else return; } } else code = -1; if (code == ACE_Filecache_Handle::ACE_SUCCESS) this->handler ()->receive_file_complete (); else this->handler ()->receive_file_error (code); result.message_block ().release (); delete (ACE_Filecache_Handle *) result.act (); } else { // This callback is for this->read() JAWS_TRACE ("JAWS_Asynch_Handler::handle_read_stream (read)"); if (result.success () && result.bytes_transferred () != 0) this->handler ()->read_complete (&result.message_block ()); else this->handler ()->read_error (); } } void JAWS_Asynch_Handler::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result) { this->dispatch_handler (); result.message_block ().release (); if (result.act () == (void *) JAWS_Asynch_IO::CONFIRMATION) this->handler ()->confirmation_message_complete (); else this->handler ()->error_message_complete (); } void JAWS_Asynch_Handler::handle_transmit_file (const ACE_Asynch_Transmit_File::Result &result) { this->dispatch_handler (); if (result.success ()) this->handler ()->transmit_file_complete (); else this->handler ()->transmit_file_error (-1); result.header_and_trailer ()->header ()->release (); result.header_and_trailer ()->trailer ()->release (); delete result.header_and_trailer (); delete (JAWS_Cached_FILE *) result.act (); } void JAWS_Asynch_Handler::handle_accept (const ACE_Asynch_Accept::Result &result) { JAWS_TRACE ("JAWS_Asynch_Handler::handle_accept"); this->dispatch_handler (); if (result.success ()) { JAWS_TRACE ("JAWS_Asynch_Handler::handle_accept, success"); this->handler ()->accept_complete (result.accept_handle ()); } else this->handler ()->accept_error (); } void JAWS_Asynch_Handler::handler (JAWS_Asynch_IO_Handler *ioh) { this->ioh_ = ioh; } JAWS_Asynch_IO_Handler * JAWS_Asynch_Handler::handler () { return this->ioh_; } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Pipeline_Handler_T.cpp0000644000175000017500000000121015027201773021707 0ustar sudipsudip#ifndef JAWS_PIPELINE_HANDLER_T_CPP #define JAWS_PIPELINE_HANDLER_T_CPP #include "JAWS/Pipeline_Handler_T.h" template JAWS_Pipeline_Abstract_Handler::JAWS_Pipeline_Abstract_Handler () { } template JAWS_Pipeline_Abstract_Handler::~JAWS_Pipeline_Abstract_Handler () { } template int JAWS_Pipeline_Abstract_Handler::put (ACE_Message_Block *mb, ACE_Time_Value *tv) { TYPE *data = reinterpret_cast (mb->data_block ()); int status = this->handle_put (data, tv); return status; } #endif /* !defined (JAWS_PIPELINE_HANDLER_T_CPP) */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Concurrency.cpp0000644000175000017500000001734015027201773020527 0ustar sudipsudip#include "JAWS/Concurrency.h" #include "JAWS/IO_Handler.h" #include "JAWS/Pipeline.h" #include "JAWS/Pipeline_Tasks.h" #include "JAWS/Policy.h" #include "JAWS/Data_Block.h" #include "JAWS/Waiter.h" #include "JAWS/Reaper.h" JAWS_Concurrency_Base::JAWS_Concurrency_Base () : ACE_Task (new ACE_Thread_Manager), mb_acquired_ (0), mb_ (0), reaper_ (new JAWS_Reaper (this)) { } JAWS_Concurrency_Base::~JAWS_Concurrency_Base () { delete this->thr_mgr_; delete this->reaper_; } ACE_Message_Block * JAWS_Concurrency_Base::singleton_mb () { if (this->mb_acquired_ == 0) { ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, g, this->lock_, 0); if (this->mb_acquired_ == 0) { int result; ACE_Message_Block *mb = 0; result = this->getq (mb); this->mb_acquired_ = 1; if (result == -1 || mb == 0) return 0; this->mb_ = mb; } } return this->mb_; } int JAWS_Concurrency_Base::put (ACE_Message_Block *mb, ACE_Time_Value *tv) { return this->putq (mb, tv); } int JAWS_Concurrency_Base::svc () { JAWS_TRACE ("JAWS_Concurrency_Base::svc"); ACE_Message_Block *mb = 0; // The message queue element JAWS_Data_Block *db = 0; // Contains the task list mb = this->singleton_mb (); // A NULL data block indicates that the thread should shut // itself down if (mb == 0) { JAWS_TRACE ("JAWS_Concurrency_Base::svc, empty message block"); return -1; } db = dynamic_cast (mb); this->svc_loop (db); return 0; } int JAWS_Concurrency_Base::svc_loop (JAWS_Data_Block *db) { JAWS_TRACE ("JAWS_Concurrency_Base::svc_loop"); // Thread specific message block and data block ACE_DEBUG ((LM_DEBUG, "(%t) Creating DataBlock\n")); JAWS_Data_Block *ts_db = new JAWS_Data_Block (*db); if (ts_db == 0) { ACE_ERROR ((LM_ERROR, "%p\n", "JAWS_Concurrency_Base::svc_hook")); return -1; } for (;;) { if (this->svc_hook (ts_db) != 0) break; ts_db->task (db->task ()); ts_db->policy (db->policy ()); ts_db->payload (0); ts_db->io_handler (0); ts_db->rd_ptr (ts_db->wr_ptr ()); ts_db->crunch (); } ACE_DEBUG ((LM_DEBUG, "(%t) Deleting DataBlock\n")); delete ts_db; // ts_db->release (); return 0; } int JAWS_Concurrency_Base::svc_hook (JAWS_Data_Block *ts_db) { JAWS_TRACE ("JAWS_Concurrency_Base::svc_hook"); int result = 0; JAWS_IO_Handler *handler = 0; // Keeps the state of the task JAWS_Pipeline_Handler *task = 0; // The task itself JAWS_Data_Block *mb = 0; // The task message block task = ts_db->task (); handler = 0; // Get the waiter index JAWS_Waiter *waiter = JAWS_Waiter_Singleton::instance (); int waiter_index = waiter->index (); mb = ts_db; do { JAWS_TRACE ("JAWS_Concurrency_Base::svc_hook, looping"); // Use a NULL task to make the thread recycle now if (task == 0) { JAWS_TRACE ("JAWS_Concurrency_Base::svc_hook, recycling"); if (handler) handler->done (); handler = 0; JAWS_IO_Handler **ioh = waiter->find_by_index (waiter_index); *ioh = 0; break; } // the task should set the handler to the appropriate next step result = task->put (mb); if (result == 0 || result == -3) handler = mb->io_handler (); else handler = 0; if (result == 1 || result == 2) { JAWS_TRACE ("JAWS_Concurrency_Base::svc_hook, waiting"); // need to wait for an asynchronous event // We need a way to destroy all the handlers created by the // Asynch_Acceptor. Figure this out later. handler = waiter->wait_for_completion (waiter_index); if (handler == 0) { JAWS_TRACE ("JAWS_Concurrency_Base::svc_hook, bad proactor"); // Proactor failed result = -1; break; } } if (result < 0) { JAWS_TRACE ("JAWS_Concurrency_Base::svc_hook, negative result"); if (result == -1) ACE_ERROR ((LM_ERROR, "%p\n", "JAWS_Concurrency_Base::svc_hook")); if (handler) handler->done (); handler = 0; if (result == -2) { JAWS_IO_Handler **ioh = waiter->find_by_index (waiter_index); *ioh = 0; result = 0; } break; } if (handler == 0) break; mb = handler->message_block (); task = handler->task (); result = 0; } while (result == 0); return result; } int JAWS_Concurrency_Base::activate_hook () { return 0; } JAWS_Dispatcher::JAWS_Dispatcher () : policy_(0) { } int JAWS_Dispatcher::dispatch (ACE_Message_Block *mb) { return this->policy ()->concurrency ()->put (mb); } JAWS_Dispatch_Policy * JAWS_Dispatcher::policy () { return this->policy_; } JAWS_Dispatch_Policy * JAWS_Dispatcher::policy (JAWS_Dispatch_Policy *p) { this->policy_ = p; return this->policy_; } int JAWS_Thread_Pool_Task::make (long flags, int nthreads, int maxthreads) { this->flags_ = flags; this->nthreads_ = nthreads; this->maxthreads_ = maxthreads; ACE_thread_t *thr_names = new ACE_thread_t[nthreads]; if (this->activate (flags | THR_SUSPENDED, nthreads, 0, // force active ACE_DEFAULT_THREAD_PRIORITY, -1, // group id 0, // ACE_Task_Base 0, // thread handles 0, // stack 0, // stack size thr_names) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "JAWS_Thread_Pool_Task::activate"), -1); for (int i = 0; i < nthreads; i++) { JAWS_Thread_ID thr_id(thr_names[i]); JAWS_IO_Handler *dummy = 0; JAWS_Waiter_Singleton::instance ()->insert (thr_id, dummy); } delete[] thr_names; this->thr_mgr_->resume_all (); if (this->reaper_->open () == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "JAWS_Reaper::open"), -1); return 0; } int JAWS_Thread_Per_Task::make (long flags, int maxthreads) { this->flags_ = flags; this->maxthreads_ = maxthreads; return 0; } int JAWS_Thread_Per_Task::put (ACE_Message_Block *mb, ACE_Time_Value *tv) { JAWS_TRACE ("JAWS_Thread_Per_Task::put"); this->putq (mb, tv); return this->activate_hook (); } int JAWS_Thread_Per_Task::svc_loop (JAWS_Data_Block *db) { return this->svc_hook (db); } int JAWS_Thread_Per_Task::activate_hook () { const int force_active = 1; const int nthreads = 1; ACE_thread_t thr_name; if (this->activate (this->flags_ | THR_SUSPENDED, nthreads, force_active, ACE_DEFAULT_THREAD_PRIORITY, -1, // group id 0, // ACE_Task_Base 0, // thread handle 0, // stack 0, // stack size &thr_name) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "JAWS_Thread_Pool_Task::activate"), -1); JAWS_Thread_ID thr_id (thr_name); JAWS_IO_Handler *dummy = 0; // In the thread-per-request strategy, need to take care of the // case when the waiter array is full. Think about that problem // later. JAWS_Waiter_Singleton::instance ()->insert (thr_id, dummy); this->thr_mgr_->resume (thr_name); if (this->reaper_->open () == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "JAWS_Reaper::open"), -1); return 0; } ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Policy.h0000644000175000017500000000336315027201773017141 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_POLICY_H #define JAWS_POLICY_H #include "JAWS/Export.h" #include "JAWS/Concurrency.h" class JAWS_IO; class JAWS_IO_Handler; class JAWS_IO_Handler_Factory; /** * Policy mechanism for choosing different concurrency models. * * Given some (unspecified) state, decides what the concurrency * model should be. (For now, we always return the same model.) */ class JAWS_Export JAWS_Dispatch_Policy { public: JAWS_Dispatch_Policy (); virtual ~JAWS_Dispatch_Policy (); virtual int ratio () = 0; virtual JAWS_IO * io () = 0; virtual JAWS_IO_Handler_Factory *ioh_factory () = 0; virtual JAWS_IO_Acceptor *acceptor () = 0; virtual JAWS_Concurrency_Base * concurrency () = 0; virtual void ratio (int r) = 0; virtual void io (JAWS_IO *iop) = 0; virtual void ioh_factory (JAWS_IO_Handler_Factory *factoryp) = 0; virtual void acceptor (JAWS_IO_Acceptor *acceptorp) = 0; virtual void concurrency (JAWS_Concurrency_Base *concp) = 0; }; class JAWS_Export JAWS_Default_Dispatch_Policy : public JAWS_Dispatch_Policy { public: JAWS_Default_Dispatch_Policy (); virtual ~JAWS_Default_Dispatch_Policy (); virtual int ratio (); virtual JAWS_IO *io (); virtual JAWS_IO_Handler_Factory *ioh_factory (); virtual JAWS_IO_Acceptor *acceptor (); virtual JAWS_Concurrency_Base *concurrency (); virtual void ratio (int r); virtual void io (JAWS_IO *iop); virtual void ioh_factory (JAWS_IO_Handler_Factory *factoryp); virtual void acceptor (JAWS_IO_Acceptor *acceptorp); virtual void concurrency (JAWS_Concurrency_Base *concp); private: int ratio_; JAWS_Concurrency_Base *concurrency_; JAWS_IO_Handler_Factory *ioh_factory_; JAWS_IO_Acceptor *acceptor_; JAWS_IO *io_; }; #endif /* !defined (JAWS_POLICY_H) */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Headers.h0000644000175000017500000000417015027201773017252 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_HEADERS_H #define JAWS_HEADERS_H #include "JAWS/Export.h" #include "ace/Containers.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ // Use scenario -- // Parse_Headers will parse out a header name and then will want to // update "last header data" in Header_Info. At this point, only the // header name is strdup'd. // Parse_Headers will then append additional data to the header value // until the header value of "last header data" is done. // Parse_Headers will notify Header_Info that "last header data" is // done and is ready to be inserted into the Headers data structure. // At this point, the header value is strdup'd. class JAWS_Export JAWS_Header_Data { public: JAWS_Header_Data (const char *name, const char *value = 0, int type = 0); JAWS_Header_Data (const char *name, int type, const char *value = 0); ~JAWS_Header_Data (); const char * header_name () const; const char * header_value () const; int header_type () const; void header_name (const char *name); void header_value (const char *value); void header_type (int type); private: const char * header_name_; const char * header_value_; int header_type_; }; typedef ACE_DLList JAWS_Header_Table; typedef ACE_DLList_Iterator JAWS_Header_Table_Iterator; class JAWS_Export JAWS_Headers : public JAWS_Header_Table { public: JAWS_Headers (); ~JAWS_Headers (); int insert (JAWS_Header_Data *new_data); // insert the new data 0 -> success, -1 -> failure JAWS_Header_Data * find (const char *const &header_name); // find always begins from the beginning of the list // result is NULL if not found JAWS_Header_Data * find_next (const char *const &header_name); // behaves like find, but from where that last find left off // result is NULL if not found void remove_all (const char *const &header_name); // remove all headers from list that match header_name JAWS_Header_Table_Iterator &iter (); // returns an iterator to the headers container private: JAWS_Header_Table_Iterator iter_; }; #endif /* !defined (JAWS_HEADERS_H) */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Filecache.h0000644000175000017500000000326515027201773017546 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_FILECACHE_H #define JAWS_FILECACHE_H #include "ace/FILE_IO.h" #include "JAWS/Cache_Manager.h" #include "JAWS/FILE.h" #include "JAWS/Export.h" class JAWS_Export JAWS_Referenced_Filecache_Factory : public JAWS_Referenced_Cache_Object_Factory { public: virtual void destroy (JAWS_Cache_Object *); }; class JAWS_Export JAWS_Counted_Filecache_Factory : public JAWS_Counted_Cache_Object_Factory { public: virtual void destroy (JAWS_Cache_Object *); }; typedef JAWS_Cache_Manager JAWS_Referenced_Filecache_Manager; typedef JAWS_Cache_Manager JAWS_Counted_Filecache_Manager; typedef JAWS_Counted_Filecache_Manager JAWS_Filecache_Manager; typedef JAWS_Cache_Proxy JAWS_Filecache_Proxy; class JAWS_Export JAWS_Cached_FILE : private JAWS_Filecache_Proxy { public: JAWS_Cached_FILE (const char *const &filename, JAWS_Filecache_Proxy::Cache_Manager *cm = 0); JAWS_Cached_FILE (const char *const &filename, JAWS_FILE *&file, size_t size, JAWS_Filecache_Proxy::Cache_Manager *cm = 0); ~JAWS_Cached_FILE (); ACE_FILE_IO * file (); ACE_Mem_Map * mmap (); private: ACE_FILE_IO file_; }; #endif /* JAWS_FILECACHE_H */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Policy.cpp0000644000175000017500000000300115027201773017461 0ustar sudipsudip#include "JAWS/Policy.h" #include "JAWS/Concurrency.h" #include "JAWS/IO_Handler.h" #include "JAWS/IO_Acceptor.h" JAWS_Dispatch_Policy::JAWS_Dispatch_Policy () { } JAWS_Dispatch_Policy::~JAWS_Dispatch_Policy () { } JAWS_Default_Dispatch_Policy::JAWS_Default_Dispatch_Policy () : ratio_ (1), concurrency_ (JAWS_Thread_Pool_Singleton::instance ()), ioh_factory_ (JAWS_Synch_IO_Handler_Factory_Singleton::instance ()), acceptor_ (JAWS_IO_Synch_Acceptor_Singleton::instance ()), io_ (JAWS_Synch_IO_Singleton::instance ()) { } JAWS_Default_Dispatch_Policy::~JAWS_Default_Dispatch_Policy () { } int JAWS_Default_Dispatch_Policy::ratio () { return this->ratio_; } JAWS_IO * JAWS_Default_Dispatch_Policy::io () { return this->io_; } JAWS_IO_Handler_Factory * JAWS_Default_Dispatch_Policy::ioh_factory () { return this->ioh_factory_; } JAWS_IO_Acceptor * JAWS_Default_Dispatch_Policy::acceptor () { return this->acceptor_; } JAWS_Concurrency_Base * JAWS_Default_Dispatch_Policy::concurrency () { return this->concurrency_; } void JAWS_Default_Dispatch_Policy::ratio (int r) { this->ratio_ = r; } void JAWS_Default_Dispatch_Policy::io (JAWS_IO *io) { this->io_ = io; } void JAWS_Default_Dispatch_Policy::ioh_factory (JAWS_IO_Handler_Factory *iohf) { this->ioh_factory_ = iohf; } void JAWS_Default_Dispatch_Policy::acceptor (JAWS_IO_Acceptor *acceptor) { this->acceptor_ = acceptor; } void JAWS_Default_Dispatch_Policy::concurrency (JAWS_Concurrency_Base *concp) { this->concurrency_ = concp; } ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Hash_Bucket_T.cpp0000644000175000017500000002523215027201773020677 0ustar sudipsudip#ifndef JAWS_HASH_BUCKET_T_CPP #define JAWS_HASH_BUCKET_T_CPP #include "JAWS/Hash_Bucket_T.h" // ----------------- // Hash_Bucket_Item // ----------------- template JAWS_Hash_Bucket_Item ::JAWS_Hash_Bucket_Item (const EXT_ID &ext_id, const INT_ID &int_id, JAWS_Hash_Bucket_Item *next, JAWS_Hash_Bucket_Item *prev) : ext_id_ (ext_id), int_id_ (int_id), next_ (next), prev_ (prev) { } template JAWS_Hash_Bucket_Item ::JAWS_Hash_Bucket_Item (JAWS_Hash_Bucket_Item *next, JAWS_Hash_Bucket_Item *prev) : next_ (next), prev_ (prev) { } template JAWS_Hash_Bucket_Item::~JAWS_Hash_Bucket_Item () { this->next_ = 0; this->prev_ = 0; } // --------------------- // Hash_Bucket_DLCStack // --------------------- template JAWS_Hash_Bucket_DLCStack:: JAWS_Hash_Bucket_DLCStack (ACE_Allocator *alloc) : allocator_ (alloc), head_ (0), tail_ (0) { if (this->allocator_ == 0) this->allocator_ = ACE_Allocator::instance (); } template JAWS_Hash_Bucket_DLCStack:: ~JAWS_Hash_Bucket_DLCStack () { this->reset (); } template int JAWS_Hash_Bucket_DLCStack:: is_empty () const { return this->head_ == 0 && this->tail_ == 0; } template JAWS_HASH_BUCKET_ITEM * JAWS_Hash_Bucket_DLCStack:: push (const EXT_ID &ext_id, const INT_ID &int_id) { size_t malloc_size = sizeof (JAWS_HASH_BUCKET_ITEM); JAWS_HASH_BUCKET_ITEM *item; ACE_NEW_MALLOC_RETURN (item, (JAWS_HASH_BUCKET_ITEM *) this->allocator_->malloc (malloc_size), JAWS_HASH_BUCKET_ITEM (ext_id, int_id), 0); if (item != 0) { if (this->is_empty ()) { this->head_ = item; this->tail_ = item; item->next_ = this->head_; item->prev_ = this->tail_; } else { item->next_ = this->head_; item->prev_ = this->tail_; this->head_->prev_ = item; this->tail_->next_ = item; this->head_ = item; } } return item; } template JAWS_HASH_BUCKET_ITEM * JAWS_Hash_Bucket_DLCStack::pop () { JAWS_HASH_BUCKET_ITEM *item = 0; if (! this->is_empty ()) { item = this->head_; if (this->head_ == this->tail_) { this->head_ = this->tail_ = 0; } else { this->head_ = this->head_->next_; this->head_->prev_ = this->tail_; this->tail_->next_ = this->head_; } item->next_ = 0; item->prev_ = 0; } return item; } template void JAWS_Hash_Bucket_DLCStack::reset () { JAWS_HASH_BUCKET_ITEM *item = 0; while ((item = this->pop ()) != 0) this->remove (item); } template int JAWS_Hash_Bucket_DLCStack::remove (JAWS_HASH_BUCKET_ITEM *item) { int result = 0; if (item != 0) { if (item->next_ != 0 && item->prev_ != 0) { if (item->next_ != item) { if (this->head_ == item) this->head_ = item->next_; if (this->tail_ == item) this->tail_ = item->prev_; item->next_->prev_ = item->prev_; item->prev_->next_ = item->next_; } else { this->head_ = this->tail_ = 0; } item->next_ = 0; item->prev_ = 0; } if (item->next_ == 0 && item->prev_ == 0) { ACE_DES_FREE_TEMPLATE2 (item, this->allocator_->free, JAWS_Hash_Bucket_Item, EXT_ID, INT_ID); } else result = -1; } return result; } // ------------------------------ // Hash_Bucket_DLCStack_Iterator // ------------------------------ template JAWS_Hash_Bucket_DLCStack_Iterator:: JAWS_Hash_Bucket_DLCStack_Iterator (const JAWS_HASH_BUCKET_DLCSTACK &dlcstack) : dlcstack_ (dlcstack), next_ (0), prev_ (0), done_ (0) { } template int JAWS_Hash_Bucket_DLCStack_Iterator::first () { int result = 0; if (! this->dlcstack_.is_empty ()) { result = 1; this->next_ = this->dlcstack_.head_; this->prev_ = this->dlcstack_.tail_; this->done_ = 0; } return result; } template int JAWS_Hash_Bucket_DLCStack_Iterator::last () { return this->first (); } template int JAWS_Hash_Bucket_DLCStack_Iterator::advance () { int result = 1; if (this->next_ != 0) { this->prev_ = this->next_; this->next_ = this->next_->next_; if (this->next_ == this->dlcstack_.head_) { this->done_ = 1; result = 0; } } else result = this->first (); return result; } template int JAWS_Hash_Bucket_DLCStack_Iterator::revert () { int result = 1; if (this->prev_ != 0) { this->next_ = this->prev_; this->prev_ = this->prev_->prev_; if (this->prev_ == this->dlcstack_.tail_) { this->done_ = 1; result = 0; } } else result = this->last (); return result; } template int JAWS_Hash_Bucket_DLCStack_Iterator:: next (JAWS_HASH_BUCKET_ITEM *&item) { if (this->next_ == 0) this->first (); item = this->next_; return ! this->done (); } template int JAWS_Hash_Bucket_DLCStack_Iterator:: next (JAWS_HASH_BUCKET_ITEM *&item) const { item = this->next_; return ! this->done (); } template int JAWS_Hash_Bucket_DLCStack_Iterator:: prev (JAWS_HASH_BUCKET_ITEM *&item) { if (this->prev_ == 0) this->last (); item = this->prev_; return ! this->done (); } template int JAWS_Hash_Bucket_DLCStack_Iterator:: prev (JAWS_HASH_BUCKET_ITEM *&item) const { item = this->prev_; return ! this->done (); } template int JAWS_Hash_Bucket_DLCStack_Iterator::done () const { return this->done_; } // -------------------- // Hash_Bucket_Manager // -------------------- template JAWS_Hash_Bucket_Manager ::JAWS_Hash_Bucket_Manager (ACE_Allocator *alloc) : dlcstack_ (alloc) { if (alloc == 0) this->dlcstack_.allocator_ = ACE_Allocator::instance (); } template int JAWS_Hash_Bucket_Manager::open (ACE_Allocator *alloc) { this->dlcstack_.allocator_ = alloc; if (alloc == 0) this->dlcstack_.allocator_ = ACE_Allocator::instance (); return 0; } template JAWS_Hash_Bucket_Manager::~JAWS_Hash_Bucket_Manager () { } template int JAWS_Hash_Bucket_Manager::close () { this->dlcstack_.reset (); return 0; } template JAWS_HASH_BUCKET_ITEM * JAWS_Hash_Bucket_Manager ::find_i (const EXT_ID &ext_id) const { JAWS_HASH_BUCKET_DLCSTACK_ITERATOR iter (this->dlcstack_); JAWS_HASH_BUCKET_ITEM *item = 0; if (iter.first ()) while (!iter.done ()) { iter.next (item); if (item && EQ_FUNC (item->ext_id_, ext_id)) break; iter.advance (); } return (item && EQ_FUNC (item->ext_id_, ext_id)) ? item : 0; } template int JAWS_Hash_Bucket_Manager::find (const EXT_ID &ext_id, INT_ID &int_id) const { int result = -1; JAWS_HASH_BUCKET_ITEM *item = this->find_i (ext_id); if (item) { int_id = item->int_id_; result = 0; } return result; } template int JAWS_Hash_Bucket_Manager ::find (const EXT_ID &ext_id) const { INT_ID dummy_id; return this->find (ext_id, dummy_id); } template int JAWS_Hash_Bucket_Manager::bind (const EXT_ID &ext_id, const INT_ID &int_id) { int result = 0; if (this->find (ext_id) == 0) { result = 1; } else { if (this->dlcstack_.push (ext_id, int_id) == 0) result = -1; } return result; } template int JAWS_Hash_Bucket_Manager::trybind (const EXT_ID &ext_id, INT_ID &int_id) { int result = 0; if (this->find (ext_id, int_id) == 0) { result = 1; } else { if (this->dlcstack_.push (ext_id, int_id) == 0) result = -1; } return result; } template int JAWS_Hash_Bucket_Manager::rebind (const EXT_ID &ext_id, const INT_ID &int_id, EXT_ID &old_ext_id, INT_ID &old_int_id) { int result = 0; JAWS_HASH_BUCKET_ITEM *item = this->find_i (ext_id); if (item) { result = 1; old_ext_id = item->ext_id_; old_int_id = item->int_id_; this->dlcstack_.remove (item); } if (this->dlcstack_.push (ext_id, int_id) == 0) result = -1; return result; } template int JAWS_Hash_Bucket_Manager::unbind (const EXT_ID &ext_id, INT_ID &int_id) { int result = -1; JAWS_HASH_BUCKET_ITEM *item = this->find_i (ext_id); if (item) { result = 0; int_id = item->int_id_; this->dlcstack_.remove (item); } return result; } template int JAWS_Hash_Bucket_Manager::unbind (const EXT_ID &ext_id) { INT_ID dummy_id; return this->unbind (ext_id, dummy_id); } #endif /* JAWS_HASH_BUCKET_T_CPP */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Cache_Manager.cpp0000644000175000017500000000327115027201773020670 0ustar sudipsudip#include "ace/ACE.h" #include "ace/OS_NS_string.h" #include "JAWS/Cache_Manager.h" #include "JAWS/Cache_List_T.h" JAWS_String_Hash_Functor::JAWS_String_Hash_Functor (const char *s) : i_ (0) { this->i_ = ACE::hash_pjw (s); } JAWS_String_Hash_Functor::operator unsigned long () const { return this->i_; } JAWS_String_Equal_Functor::JAWS_String_Equal_Functor (const char *s1, const char *s2) : i_ (0) { this->i_ = ACE_OS::strcmp (s1, s2); } JAWS_String_Equal_Functor::operator int () const { return this->i_ == 0; } JAWS_Strdup_String::JAWS_Strdup_String () : c_ (0), s_ (0) { } JAWS_Strdup_String::JAWS_Strdup_String (const char *s) : c_ (0), s_ (0) { this->c_ = new int (1); this->s_ = ACE_OS::strdup (s); } JAWS_Strdup_String::JAWS_Strdup_String (const JAWS_Strdup_String &s) : c_ (s.c_), s_ (s.s_) { ++*(this->c_); } JAWS_Strdup_String::~JAWS_Strdup_String () { if (this->c_ && --*(this->c_) == 0) { if (this->s_) ACE_OS::free (this->s_); delete this->c_; } this->s_ = 0; this->c_ = 0; } JAWS_Strdup_String::operator const char * () const { return this->s_; } void JAWS_Strdup_String::operator = (const char *s) { if (this->c_ && --*(this->c_) == 0) { if (this->s_) ACE_OS::free (this->s_); delete this->c_; } this->c_ = new int (1); this->s_ = ACE_OS::strdup (s); } void JAWS_Strdup_String::operator = (const JAWS_Strdup_String &s) { if (this == &s) return; if (this->c_ && --*(this->c_) == 0) { if (this->s_) ACE_OS::free (this->s_); delete this->c_; } this->c_ = s.c_; this->s_ = s.s_; ++*(this->c_); } ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Cache_Hash_T.cpp0000644000175000017500000001443515027201773020470 0ustar sudipsudip#ifndef JAWS_CACHE_HASH_T_CPP #define JAWS_CACHE_HASH_T_CPP #include "JAWS/Cache_Hash_T.h" #include "JAWS/Hash_Bucket_T.h" template unsigned long JAWS_Cache_Hash::hash (const EXT_ID &ext_id) const { return HASH_FUNC (ext_id) % this->size_; } template bool JAWS_Cache_Hash::isprime (size_t number) const { size_t d = 3; if (number <= 2) return (number == 2); if (number % 2 == 0) return 0; while (d <= number/d) { if (number % d == 0) return 0; d += 2; } return 1; } template int JAWS_Cache_Hash::new_cachebucket (size_t hash_idx) { if (this->hashtable_[hash_idx] == 0) { size_t alloc_size = sizeof (CACHE_BUCKET_MANAGER); ACE_NEW_MALLOC_RETURN (this->hashtable_[hash_idx], (CACHE_BUCKET_MANAGER *) this->allocator_->malloc (alloc_size), CACHE_BUCKET_MANAGER (this->allocator_), -1); } return 0; } template JAWS_Cache_Hash::JAWS_Cache_Hash (ACE_Allocator *alloc, size_t size) : allocator_ (alloc), hashtable_ (0) { while (!this->isprime (size)) size++; this->size_ = size; if (this->allocator_ == 0) this->allocator_ = ACE_Allocator::instance (); size_t memsize = this->size_ * sizeof (CACHE_BUCKET_MANAGER *); this->hashtable_ = (CACHE_BUCKET_MANAGER **) this->allocator_->malloc (memsize); if (this->hashtable_) { for (size_t i = 0; i < this->size_; i++) this->hashtable_[i] = 0; } else { this->size_ = 0; // should indicate something is wrong to the user. } } template JAWS_Cache_Hash::~JAWS_Cache_Hash () { if (this->hashtable_) { for (size_t i = 0; i < this->size_; i++) { if (this->hashtable_[i]) { ACE_DES_FREE_TEMPLATE3(this->hashtable_[i], this->allocator_->free, JAWS_Hash_Bucket_Manager, EXT_ID, JAWS_Cache_Object *, EQ_FUNC); this->hashtable_[i] = 0; } } this->allocator_->free (this->hashtable_); this->hashtable_ = 0; } this->allocator_ = 0; } template int JAWS_Cache_Hash::find (const EXT_ID &ext_id) const { unsigned long hash_idx = this->hash (ext_id); if (this->hashtable_[hash_idx] == 0) return -1; return this->hashtable_[hash_idx]->find (ext_id); } template int JAWS_Cache_Hash::find (const EXT_ID &ext_id, JAWS_Cache_Object *&int_id) const { unsigned long hash_idx = this->hash (ext_id); if (this->hashtable_[hash_idx] == 0) return -1; return this->hashtable_[hash_idx]->find (ext_id, int_id); } template int JAWS_Cache_Hash::bind (const EXT_ID &ext_id, JAWS_Cache_Object *const &int_id) { int result; unsigned long hash_idx = this->hash (ext_id); if (this->hashtable_[hash_idx] == 0) { ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, g, this->lock_, -1); if (this->new_cachebucket (hash_idx) == -1) return -1; result = this->hashtable_[hash_idx]->bind (ext_id, int_id); } else result = this->hashtable_[hash_idx]->bind (ext_id, int_id); return result; } template int JAWS_Cache_Hash::trybind (const EXT_ID &ext_id, JAWS_Cache_Object *&int_id) { int result; unsigned long hash_idx = this->hash (ext_id); if (this->hashtable_[hash_idx] == 0) { ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, g, this->lock_, -1); if (this->new_cachebucket (hash_idx) == -1) return -1; result = this->hashtable_[hash_idx]->trybind (ext_id, int_id); } else result = this->hashtable_[hash_idx]->trybind (ext_id, int_id); return result; } template int JAWS_Cache_Hash::rebind (const EXT_ID &ext_id, JAWS_Cache_Object *const &int_id, EXT_ID &old_ext_id, JAWS_Cache_Object *&old_int_id) { int result; unsigned long hash_idx = this->hash (ext_id); if (this->hashtable_[hash_idx] == 0) { ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, g, this->lock_, -1); if (this->new_cachebucket (hash_idx) == -1) return -1; result = this->hashtable_[hash_idx]->rebind (ext_id, int_id, old_ext_id, old_int_id); } else result = this->hashtable_[hash_idx]->rebind (ext_id, int_id, old_ext_id, old_int_id); return result; } template int JAWS_Cache_Hash::unbind (const EXT_ID &ext_id) { unsigned long hash_idx = this->hash (ext_id); if (this->hashtable_[hash_idx] == 0) return -1; return this->hashtable_[hash_idx]->unbind (ext_id); } template int JAWS_Cache_Hash::unbind (const EXT_ID &ext_id, JAWS_Cache_Object *&int_id) { unsigned long hash_idx = this->hash (ext_id); if (this->hashtable_[hash_idx] == 0) return -1; return this->hashtable_[hash_idx]->unbind (ext_id, int_id); } template size_t JAWS_Cache_Hash::size () const { return this->size_; } #endif /* JAWS_CACHEHASH_T_CPP */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/FILE.cpp0000644000175000017500000000303115027201773016744 0ustar sudipsudip#include "ace/Guard_T.h" #include "JAWS/FILE.h" JAWS_FILE::JAWS_FILE () : map_ (0) { } JAWS_FILE::~JAWS_FILE () { delete this->map_; this->map_ = 0; } ACE_Mem_Map * JAWS_FILE::mem_map (int length, int prot, int share, void *addr, ACE_OFF_T offset, LPSECURITY_ATTRIBUTES sa) const { JAWS_FILE *mutable_this = (JAWS_FILE *) this; return mutable_this->mem_map (length, prot, share, addr, offset, sa); } ACE_Mem_Map * JAWS_FILE::mem_map (int length, int prot, int share, void *addr, ACE_OFF_T offset, LPSECURITY_ATTRIBUTES sa) { if (this->map_ == 0) { ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, g ,this->lock_, 0); if (this->map_ == 0) { this->map_ = new ACE_Mem_Map; if (this->map_ != 0) { int r = this->map_->map (this->get_handle (), static_cast (length), prot, share, addr, offset, sa); if (r < 0) { delete this->map_; this->map_ = 0; } } } } return this->map_; } ACE_Mem_Map * JAWS_FILE::map () const { return this->map_; } ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Pipeline_Handler_T.h0000644000175000017500000000131115027201773021356 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_PIPELINE_HANDLER_T_H #define JAWS_PIPELINE_HANDLER_T_H #include "JAWS/Export.h" #include "JAWS/Pipeline.h" template class JAWS_Pipeline_Abstract_Handler : public JAWS_Pipeline_Task // = TITLE // Methods that are common to pipeline components { public: JAWS_Pipeline_Abstract_Handler (); virtual ~JAWS_Pipeline_Abstract_Handler (); // ACE_Task hooks virtual int put (ACE_Message_Block *mb, ACE_Time_Value *tv = 0); // inherited from ACE_Task virtual int handle_put (TYPE *data, ACE_Time_Value *tv) = 0; // Callback hook for specialized data processing }; #include "JAWS/Pipeline_Handler_T.cpp" #endif /* !defined (JAWS_PIPELINE_HANDLER_T_H) */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Cache_List_T.h0000644000175000017500000000506015027201773020157 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_CACHE_LIST_T_H #define JAWS_CACHE_LIST_T_H #include "ace/Malloc.h" #include "JAWS/Cache_Object.h" // Forward declarations template class JAWS_Cache_Manager; template class JAWS_Cache_List_Item; template class JAWS_Cache_List // Roll my own heap here. Eventually, a heap should be its own // standalone data structure. // // This version is not a heap, but a doubly linked list. We are // trying to simplify all the heap operations to be O(1). { public: typedef JAWS_Cache_Manager Cache_Manager; typedef JAWS_Cache_List_Item Cache_List_Item; JAWS_Cache_List (ACE_Allocator *alloc = 0, size_t maxsize = 8192); // maxsize is the total number of objects the in memory cache is // willing to manage ~JAWS_Cache_List (); int is_empty () const; int is_full () const; size_t size () const; size_t maxsize () const; int maxsize (Cache_Manager *cm, size_t new_maxsize); // attempt to grow (or shrink) the heap. Return 0 on success, -1 on // error. int insert (const EXT_ID &ext_id, JAWS_Cache_Object *const &int_id); // attempt to insert int_id into heap. int remove (EXT_ID &ext_id, JAWS_Cache_Object *&int_id); // attempt to remove the top element of heap. int remove (void *item); // treat item as a Cache_List_Item, and remove it from the heap int adjust (void *item); // treat item as a Cache_List_Item, and alter its heap position protected: void insert_i (Cache_List_Item *item); // insert item into heap. void remove_i (Cache_List_Item *item); // remove the element residing at pos, but do not delete it. void remove_i (); // remove the element residing at the top of heap, but do not delete it. private: ACE_Allocator *allocator_; size_t maxsize_; size_t size_; Cache_List_Item *item_; Cache_List_Item *head_; Cache_List_Item *tail_; }; template class JAWS_Cache_List_Item { friend class JAWS_Cache_List; public: typedef JAWS_Cache_List Cache_List; JAWS_Cache_List_Item (const EXT_ID &ext_id, JAWS_Cache_Object *const &int_id); unsigned int priority (); private: EXT_ID ext_id_; JAWS_Cache_Object *int_id_; JAWS_Cache_List_Item *next_; JAWS_Cache_List_Item *prev_; }; #include "JAWS/Cache_List_T.cpp" #endif /* JAWS_CACHE_LIST_T_H */ ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Data_Block.cpp0000644000175000017500000000215115027201773020212 0ustar sudipsudip#include "JAWS/Data_Block.h" #include "JAWS/Policy.h" JAWS_Data_Block::JAWS_Data_Block () : ACE_Message_Block (JAWS_DATA_BLOCK_SIZE), io_handler_ (0), policy_ (0), task_ (0), payload_ (0) { } JAWS_Data_Block::JAWS_Data_Block (JAWS_Data_Block &db) : ACE_Message_Block (JAWS_DATA_BLOCK_SIZE), io_handler_ (db.io_handler_), policy_ (db.policy_), task_ (db.task_), payload_ (db.payload_) { } JAWS_Data_Block::~JAWS_Data_Block () { } JAWS_Pipeline_Handler * JAWS_Data_Block::task () { return this->task_; } JAWS_IO_Handler * JAWS_Data_Block::io_handler () { return this->io_handler_; } JAWS_Dispatch_Policy * JAWS_Data_Block::policy () { return this->policy_; } void * JAWS_Data_Block::payload () { return this->payload_; } void JAWS_Data_Block::task (JAWS_Pipeline_Handler *taskp) { this->task_ = taskp; } void JAWS_Data_Block::io_handler (JAWS_IO_Handler *handlerp) { this->io_handler_ = handlerp; } void JAWS_Data_Block::policy (JAWS_Dispatch_Policy *policyp) { this->policy_ = policyp; } void JAWS_Data_Block::payload (void *payloadp) { this->payload_ = payloadp; } ace-8.0.4+dfsg.orig/apps/JAWS2/JAWS/Cache_Hash_T.h0000644000175000017500000000301115027201773020121 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_CACHE_HASH_T_H #define JAWS_CACHE_HASH_T_H #include "JAWS/Cache_Object.h" // Forward declaration template class JAWS_Hash_Bucket_Manager; template class JAWS_Cache_Hash { public: typedef JAWS_Hash_Bucket_Manager CACHE_BUCKET_MANAGER; JAWS_Cache_Hash (ACE_Allocator *alloc = 0, size_t size = 521); // 521 == smallest number > 512 that is prime. Why is a prime // number important? I am trying to maximize scattering when using // mod on the hashed value. This might be bogus though. virtual ~JAWS_Cache_Hash (); int find (const EXT_ID &ext_id) const; int find (const EXT_ID &ext_id, JAWS_Cache_Object *&int_id) const; int bind (const EXT_ID &ext_id, JAWS_Cache_Object *const &int_id); int trybind (const EXT_ID &ext_id, JAWS_Cache_Object *&int_id); int rebind (const EXT_ID &ext_id, JAWS_Cache_Object *const &int_id, EXT_ID &old_ext_id, JAWS_Cache_Object *&old_int_id); int unbind (const EXT_ID &ext_id); int unbind (const EXT_ID &ext_id, JAWS_Cache_Object *&int_id); size_t size () const; protected: virtual unsigned long hash (const EXT_ID &ext_id) const; bool isprime (size_t number) const; int new_cachebucket (size_t idx); private: ACE_Allocator *allocator_; size_t size_; ACE_SYNCH_MUTEX lock_; CACHE_BUCKET_MANAGER **hashtable_; }; #include "JAWS/Cache_Hash_T.cpp" #endif /* ACE_CACHE_HASH_T_H */ ace-8.0.4+dfsg.orig/apps/JAWS2/HTTP_10_Read.cpp0000644000175000017500000000243015027201773017475 0ustar sudipsudip#include "HTTP_10.h" #include "JAWS/JAWS.h" #include "JAWS/IO.h" #include "JAWS/IO_Handler.h" #include "JAWS/Policy.h" // --------------- READ TASK ---------------------- JAWS_HTTP_10_Read_Task::JAWS_HTTP_10_Read_Task () { } JAWS_HTTP_10_Read_Task::~JAWS_HTTP_10_Read_Task () { } int JAWS_HTTP_10_Read_Task::handle_put (JAWS_Data_Block *data, ACE_Time_Value *) { JAWS_TRACE ("JAWS_HTTP_10_Read_Task::handle_put"); JAWS_IO_Handler *handler = data->io_handler (); JAWS_Dispatch_Policy *policy = this->policy (); if (policy == 0) policy = data->policy (); JAWS_IO *io = policy->io (); if (data->length () > 0) { if (data->rd_ptr ()[0] != '\0') { JAWS_TRACE ("JAWS_HTTP_10_Read_Task::handle_put, have data"); return 0; } } data->rd_ptr (data->wr_ptr ()); data->crunch (); io->read (handler, data, data->size ()); switch (handler->status ()) { case JAWS_IO_Handler::READ_OK: { JAWS_TRACE ("JAWS_HTTP_10_Read_Task::handle_put, READ_OK"); return 0; } break; case JAWS_IO_Handler::READ_ERROR: case JAWS_IO_Handler::READ_ERROR_A: { JAWS_TRACE ("JAWS_HTTP_10_Read_Task::handle_put, READ_ERROR"); return -1; } default: break; } return 1; } ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/0000755000175000017500000000000015046037655015673 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/http_base.inl0000644000175000017500000000141315027201773020340 0ustar sudipsudip// -*- c++ -*- #if !defined (ACE_HAS_INLINED_OSCALLS) # undef ACE_INLINE # define ACE_INLINE #endif /* ACE_HAS_INLINED_OSCALLS */ ACE_INLINE HTTP_Base::HTTP_Base () : status_ (200), line_ (0), deliver_state_ (0), no_headers_ (0), iter_ (*(this->info_.table ())), mb_ (0) { } ACE_INLINE HTTP_Base::~HTTP_Base () { if (this->line_) ACE_OS::free (this->line_); if (this->mb_) delete this->mb_; this->line_ = 0; this->mb_ = 0; } ACE_INLINE int HTTP_Base::status () const { return this->status_; } ACE_INLINE const char * HTTP_Base::line () const { return this->line_; } ACE_INLINE HTTP_Headers * HTTP_Base::http_headers () { return &(this->info_); } ACE_INLINE JAWS_Headers * HTTP_Base::headers () { return this->info_.table (); } ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/http_headers.h0000644000175000017500000001022715027201773020511 0ustar sudipsudip// by James Hu // Borrowed from HTTP_Headers.*, which appears to be irrelevent now anyway. #ifndef HTTPU_HTTP_HEADERS_H #define HTTPU_HTTP_HEADERS_H #include "ace/RB_Tree.h" #include "ace/Null_Mutex.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Singleton.h" #include "JAWS/Parse_Headers.h" #include "HTTPU/http_export.h" // A header file on HP-UX defines SERVER #if defined (SERVER) #undef SERVER #endif /* SERVER */ class HTTP_Headers; class HTTPU_Export HTTP_Hdr_Node { // Constructor should be passed literal strings. friend class HTTP_HCodes; public: operator int () const; operator const char * () const; const char * format () const; private: HTTP_Hdr_Node (const char *token, const char *format); private: int index_; const char *token_; const char *format_; }; class HTTP_HCodes; class HTTPU_Export HTTP_Header_Nodes : public ACE_RB_Tree, ACE_Null_Mutex> { friend class HTTP_HCodes; friend class HTTP_Hdr_Node; public: HTTP_Header_Nodes (); private: int num_header_strings_; }; typedef ACE_Singleton HTTP_Header_Nodes_Singleton; class HTTPU_Export HTTP_HCodes { public: HTTP_HCodes (); enum { REPLACE_HEADER = 1, // Remove any existing header that matches first APPEND_HEADER = 2, // Unconditionally append the header INSERT_HEADER = 4, // Insert header if one does not already exist APPENDTO_HEADER = 8 // Concatenate data to existing header value }; static HTTP_Hdr_Node HTTP; static HTTP_Hdr_Node ACCEPT; static HTTP_Hdr_Node ACCEPTCHARSET; static HTTP_Hdr_Node ACCEPTENCODING; static HTTP_Hdr_Node ACCEPTLANGUAGE; static HTTP_Hdr_Node ACCEPTRANGES; static HTTP_Hdr_Node AGE; static HTTP_Hdr_Node ALLOW; static HTTP_Hdr_Node AUTHORIZATION; static HTTP_Hdr_Node CACHECONTROL; static HTTP_Hdr_Node CONNECTION; static HTTP_Hdr_Node CONTENTENCODING; static HTTP_Hdr_Node CONTENTLENGTH; static HTTP_Hdr_Node CONTENTLOCATION; static HTTP_Hdr_Node CONTENTMD5; static HTTP_Hdr_Node CONTENTRANGE; static HTTP_Hdr_Node CONTENTTYPE; static HTTP_Hdr_Node DATE; static HTTP_Hdr_Node ETAG; static HTTP_Hdr_Node EXPECT; static HTTP_Hdr_Node EXPIRES; static HTTP_Hdr_Node FROM; static HTTP_Hdr_Node HOST; static HTTP_Hdr_Node IFMATCH; static HTTP_Hdr_Node IFMODIFIEDSINCE; static HTTP_Hdr_Node IFNONEMATCH; static HTTP_Hdr_Node IFRANGE; static HTTP_Hdr_Node IFUNMODIFIEDSINCE; static HTTP_Hdr_Node LASTMODIFIED; static HTTP_Hdr_Node LOCATION; static HTTP_Hdr_Node MAXFORWARDS; static HTTP_Hdr_Node PRAGMA; static HTTP_Hdr_Node PROXYAUTHENTICATE; static HTTP_Hdr_Node PROXYAUTHORIZATION; static HTTP_Hdr_Node RANGE; static HTTP_Hdr_Node REFERER; static HTTP_Hdr_Node RETRYAFTER; static HTTP_Hdr_Node SERVER; static HTTP_Hdr_Node TE; static HTTP_Hdr_Node TRAILER; static HTTP_Hdr_Node TRANSFERENCODING; static HTTP_Hdr_Node UPGRADE; static HTTP_Hdr_Node USERAGENT; static HTTP_Hdr_Node VARY; static HTTP_Hdr_Node VIA; static HTTP_Hdr_Node WARNING; static HTTP_Hdr_Node WWWAUTHENTICATE; static HTTP_Hdr_Node GET; static HTTP_Hdr_Node HEAD; static HTTP_Hdr_Node POST; static HTTP_Hdr_Node PUT; static HTTP_Hdr_Node QUIT; static HTTP_Hdr_Node DUNNO; static HTTP_Hdr_Node META; static HTTP_Hdr_Node A; static HTTP_Hdr_Node SCRIPT; static HTTP_Hdr_Node APPLET; static const int &NUM_HEADER_STRINGS; protected: const HTTP_Hdr_Node &hcode (int type) const; protected: HTTP_Header_Nodes *header_nodes_; }; class HTTPU_Export HTTP_Headers : public JAWS_Header_Info, public HTTP_HCodes { public: const char *header(int name) const; const char *value(int name); const char *value_next(int name); void value_reset (); public: HTTP_Headers (); const char *header_token (int name) const; const char *header_strings (int name) const; }; #if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE # endif /* ACE_INLINE */ # define ACE_INLINE inline # include "HTTPU/http_headers.inl" # endif /* ACE_HAS_INLINED_OSCALLS */ #endif /* !defined (HTTPU_HTTP_HEADERS_HPP) */ ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/parse_url.cpp0000644000175000017500000001306715027201773020373 0ustar sudipsudip#include "ace/OS_NS_string.h" #include "ace/OS_NS_stdlib.h" #include "ace/Log_Msg.h" #include "HTTPU/parse_url.h" HTTP_Parse_URL::HTTP_Parse_URL (const char *url) : url_ (0), scheme_ (0), user_ (0), passwd_ (0), host_ (0), port_ (-1), url_path_ (0), error_ (URL_ERROR_NONE), is_cgi_ (0) { this->init (url); } HTTP_Parse_URL::~HTTP_Parse_URL () { if (this->url_) ACE_OS::free (this->url_); this->url_ = 0; this->scheme_ = 0; this->user_ = 0; this->passwd_ = 0; this->host_ = 0; this->port_ = -1; this->url_path_ = 0; } void HTTP_Parse_URL::init( const char *url ) { // Should really reset completely and cleanly here before // doing anything else! if ( url == 0 ) return; if ( url_ ) ACE_OS::free( url_ ); url_ = ACE_OS::strdup( url ); if ( url_ == 0 ) { error_ = URL_ERROR_STRDUP; return; } if (ACE_OS::strlen (this->url_) > 3 && ACE_OS::strstr ("://", this->url_)) { // Parse it out completely. Figure out what it is later. parse_url(); } else { this->url_path_ = this->url_; this->is_cgi (this->url_path_); } } void HTTP_Parse_URL::parse_url () { char *p = this->url_; char *q; if ((q = ACE_OS::strchr (this->url_, '\r')) || (q = ACE_OS::strchr (this->url_, '\n'))) *q = '\0'; this->parse_scheme (p); if (*p == '\0') { this->error_ = URL_ERROR_SCHEME; return; } // Parse past "//" if (*p != '/' || *(p+1) != '/') { this->error_ = URL_ERROR_SLASHSLASH; return; } p += 2; this->parse_host (p); while (*p == '/') p++; if (*p == '\0') return; this->url_path_ = p; this->is_cgi (this->url_path_); } void HTTP_Parse_URL::parse_scheme (char *&p) { // Parse the scheme. The scheme is delimited by a ':'. if (*p != '\0') { this->scheme_ = p++; for (;;) { switch (*p) { case '\0': break; case ':': *p++ = '\0'; break; default: p++; continue; } break; } } } void HTTP_Parse_URL::parse_host (char *&p) { // Parse user, password, host, port if (*p == '/' || *p == '\0') { this->set_port_from_scheme (); return; } char *at = 0; char *colon1 = 0; char *colon2 = 0; char *q = p; while (*q != '\0') { if (*q == '/') { *q = '\0'; q++; break; } if (*q == ':') { if (colon1 == 0) { if (at != 0 && colon2 == 0) colon2 = q; else colon1 = q; } else { if (at != 0 && colon2 == 0) colon2 = q; } } if (*q == '@') { if (at == 0) at = q; } q++; } // no user, no port if (at == 0 && colon1 == 0) { if (*p != '\0' && *p != '/') this->host_ = p; } // no user, port else if (at == 0 && colon1 != 0) { if (p != colon1) this->host_ = p; *colon1++ = '\0'; this->port_ = ACE_OS::atoi (colon1); } // user, no passwd, no port else if (at != 0 && colon1 == 0 && colon2 == 0) { this->user_ = p; *at++ = '\0'; if (*at != '\0' && *at != '/') this->host_ = at; } // user, no passwd, port else if (at != 0 && colon1 == 0 && colon2 != 0) { this->user_ = p; *at++ = '\0'; if (at != colon2) this->host_ = at; *colon2++ = '\0'; this->port_ = ACE_OS::atoi (colon2); } // user, passwd, no port else if (at != 0 && colon1 != 0 && colon2 == 0) { this->user_ = p; *colon1++ = '\0'; this->passwd_ = colon1; *at++ = '\0'; if (*at != '\0') this->host_ = at; } // user, passwd, and port else if (at != 0 && colon1 != 0 && colon2 != 0) { this->user_ = p; *colon1++ = '\0'; this->passwd_ = colon1; *at++ = '\0'; if (at != colon2) this->host_ = at; *colon2++ = '\0'; this->port_ = ACE_OS::atoi (colon2); } // impossible! else { ACE_ERROR ((LM_ERROR, "uh oh!\n")); p = q; return; } this->set_port_from_scheme (); p = q; } void HTTP_Parse_URL::set_port_from_scheme () { if (ACE_OS::strcmp (this->scheme_, "ftp") == 0) { if (this->port_ == -1) this->port_ = 21; if (this->user_ == 0) { this->user_ = "anonymous"; // *** need something better here this->passwd_ = "a@b.c"; } } else if (ACE_OS::strcmp (this->scheme_, "http") == 0) { if (this->port_ == -1) this->port_ = 80; } } const char * HTTP_Parse_URL::scheme () const { return this->scheme_; } const char * HTTP_Parse_URL::user () const { return this->user_; } const char * HTTP_Parse_URL::passwd () const { return this->passwd_; } const char * HTTP_Parse_URL::host () const { return this->host_; } int HTTP_Parse_URL::port () const { return this->port_; } const char * HTTP_Parse_URL::url_path () const { return this->url_path_ ? this->url_path_ : ""; } void HTTP_Parse_URL::is_cgi (const char *path) { int yes; yes = (ACE_OS::strchr (path, '?') != 0); if (!yes && (ACE_OS::strlen (path) >= 3)) yes = (ACE_OS::strstr (path, "cgi") != 0); if (!yes) yes = (ACE_OS::strstr (path, "asp") != 0); this->is_cgi_ = yes; } int HTTP_Parse_URL::is_cgi () const { return this->is_cgi_; } ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/http_response.h0000644000175000017500000000206715027201773020737 0ustar sudipsudip// There are two kinds of HTTP Responses in a proxy. // One is the kind you have to read in from the HTTP server. // The other is the kind you issue to the HTTP client. #ifndef HTTPU_HTTP_RESPONSE_HPP #define HTTPU_HTTP_RESPONSE_HPP #include "ace/Message_Block.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "JAWS/Parse_Headers.h" #include "HTTPU/http_export.h" #include "HTTPU/http_base.h" #include "HTTPU/parse_http_response.h" class HTTPU_Export HTTP_Response : public HTTP_Base { public: HTTP_Response (); ~HTTP_Response (); Parse_HTTP_Response *response_line (); // Returns the parsed response line. void dump (); protected: virtual void parse_line (); virtual int espouse_line (); private: Parse_HTTP_Response response_; }; #if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE # endif /* ACE_INLINE */ # define ACE_INLINE inline # include "HTTPU/http_response.inl" # endif /* ACE_HAS_INLINED_OSCALLS */ #endif /* !defined (HTTPU_HTTP_RESPONSE_HPP) */ ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/http_response.cpp0000644000175000017500000000230015027201773021260 0ustar sudipsudip#include "HTTPU/http_response.h" void HTTP_Response::parse_line () { this->response_.init (this->line ()); if (this->response_.error () != Parse_HTTP_Response::HTTPU_OK) this->status_ = STATUS_INTERNAL_SERVER_ERROR; } int HTTP_Response::espouse_line () { int count; int status; if (this->status_ != (int)STATUS_OK) status = this->status_; else status = this->response_line ()->code (); count = ACE_OS::sprintf (this->mb_->wr_ptr (), "%s %d %s\r\n", "HTTP/1.1", status, (char *)(*HTTP_SCode::instance ())[status]); // Last arg is hard coded since we are suppose to report the // level of server we are, and not act like the level of the // client. This information should be obtained from the config. if (count < 0) return -1; this->mb_->wr_ptr (count); return 0; } void HTTP_Response::dump () { ACE_DEBUG ((LM_DEBUG, "===== BEGIN entera_HTTP_Response::dump =====\n")); HTTP_Base::dump (); ACE_DEBUG ((LM_DEBUG, "===== END entera_HTTP_Response::dump =====\n")); } #if !defined (ACE_HAS_INLINED_OSCALLS) # include "HTTPU/http_response.inl" # endif /* ACE_HAS_INLINED_OSCALLS */ ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/http_request.h0000644000175000017500000000242215027201773020564 0ustar sudipsudip// There are two kinds of HTTP Requests in a proxy. // One is the kind you have to read in from the HTTP client. // The other is the kind you issue to the server. #ifndef HTTPU_HTTP_REQUEST_HPP #define HTTPU_HTTP_REQUEST_HPP #include "ace/Message_Block.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "JAWS/Parse_Headers.h" #include "HTTPU/http_export.h" #include "HTTPU/http_base.h" #include "HTTPU/parse_http_request.h" #include "HTTPU/parse_url.h" class HTTPU_Export HTTP_Request : public HTTP_Base { public: HTTP_Request (); virtual ~HTTP_Request (); Parse_HTTP_Request *request_line (); // Returns the parsed request line. const Parse_HTTP_Request *request_line () const; // Returns the parsed request line. HTTP_Parse_URL *url (); // Returns the parsed url. void dump (); protected: virtual void parse_line (); virtual int espouse_line (); virtual void set_status (int); private: Parse_HTTP_Request request_; HTTP_Parse_URL url_; }; #if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE # endif /* ACE_INLINE */ # define ACE_INLINE inline # include "HTTPU/http_request.inl" # endif /* ACE_HAS_INLINED_OSCALLS */ #endif /* !defined (HTTPU_HTTP_REQUEST_HPP) */ ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/http_headers.inl0000644000175000017500000000163215027201773021044 0ustar sudipsudip// -*- c++ -*- #if !defined (ACE_HAS_INLINED_OSCALLS) # undef ACE_INLINE # define ACE_INLINE #endif /* ACE_HAS_INLINED_OSCALLS */ ACE_INLINE HTTP_Hdr_Node::operator int () const { return this->index_; } ACE_INLINE HTTP_Hdr_Node::operator const char * () const { return this->token_; } ACE_INLINE const char * HTTP_Hdr_Node::format () const { return this->format_; } ACE_INLINE const HTTP_Hdr_Node & HTTP_HCodes::hcode (int type) const { const HTTP_Hdr_Node **hn = this->header_nodes_->find (type); // No error checking! return **hn; } ACE_INLINE const char * HTTP_Headers::header_token (int name) const { const HTTP_Hdr_Node **hn = this->header_nodes_->find (name); return ((hn && *hn) ? (const char *)**hn : 0); } ACE_INLINE const char * HTTP_Headers::header_strings (int name) const { const HTTP_Hdr_Node **hn = this->header_nodes_->find (name); return ((hn && *hn) ? (*hn)->format () : 0); } ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/http_request.inl0000644000175000017500000000110215027201773021111 0ustar sudipsudip// -*- c++ -*- #if !defined (ACE_HAS_INLINED_OSCALLS) # undef ACE_INLINE # define ACE_INLINE #endif /* ACE_HAS_INLINED_OSCALLS */ ACE_INLINE HTTP_Request::HTTP_Request () { } ACE_INLINE HTTP_Request::~HTTP_Request () { } ACE_INLINE Parse_HTTP_Request * HTTP_Request::request_line () { return &(this->request_); } ACE_INLINE const Parse_HTTP_Request * HTTP_Request::request_line () const { return &(this->request_); } ACE_INLINE HTTP_Parse_URL * HTTP_Request::url () { return &(this->url_); } ACE_INLINE void HTTP_Request::set_status (int s) { this->status_ = s; } ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/parse_http_response.cpp0000644000175000017500000000264515027201773022466 0ustar sudipsudip#include "HTTPU/parse_http_response.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_stdlib.h" Parse_HTTP_Response::Parse_HTTP_Response (const char *response) : code_ (200), code_str_ (0), major_version_ (0), minor_version_ (9), version_ (0), response_ (0), error_ (0) { if (response != 0) this->init (response); } Parse_HTTP_Response::~Parse_HTTP_Response () { if (this->response_) ACE_OS::free (this->response_); this->response_ = 0; this->code_str_ = 0; this->version_ = 0; } void Parse_HTTP_Response::init (const char *response) { this->response_ = ACE_OS::strdup (response); if (this->response_ == 0) { this->error_ = NO_MEMORY; return; } int n = ::sscanf (this->response_, "HTTP/%d.%d %d %*s", &(this->major_version_), &(this->minor_version_), &(this->code_)); if (n == 3) { char *p = this->response_; while (*p == ' ' || *p == '\t') p++; this->version_ = p++; while (*p != ' ' && *p != '\t') p++; *p++ = '\0'; while (*p == ' ' || *p == '\t') p++; this->code_str_ = p; while (*p && !ACE_OS::strchr (" \t\r\n", *p)) p++; *p++ = '\0'; } else this->error_ = BAD_RESPONSE; } #if !defined (ACE_HAS_INLINED_OSCALLS) # include "HTTPU/parse_http_response.inl" #endif /* ACE_HAS_INLINED_OSCALLS */ ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/http_request.cpp0000644000175000017500000000362615027201773021126 0ustar sudipsudip#include "HTTPU/http_request.h" #include "HTTPU/parse_http_request.h" void HTTP_Request::parse_line () { this->status_ = STATUS_OK; this->request_.init (this->line ()); if (this->request_.error () != Parse_HTTP_Request::HTTPU_OK) { this->status_ = STATUS_INTERNAL_SERVER_ERROR; return; } if (this->request_.major_version () == 0) { this->no_headers_ = 1; return; } this->url_.init (this->request_.url ()); if (this->url_.error () != 0) this->status_ = STATUS_INTERNAL_SERVER_ERROR; } int HTTP_Request::espouse_line () { int count; if (this->request_.major_version () == 0) { count = ACE_OS::sprintf (this->mb_->wr_ptr (), "%s /%s\r\n\r\n", this->request_.method_str (), this->url_.url_path ()); if (count < 0) return -1; this->mb_->wr_ptr (count); return 1; } count = ACE_OS::sprintf (this->mb_->wr_ptr (), "%s /%s %s\r\n", this->request_.method_str (), this->url_.url_path (), this->request_.version ()); if (count < 0) return -1; this->mb_->wr_ptr (count); if (this->url_.host () != 0) { JAWS_Header_Data *hd = this->headers ()->find ("Host"); if (hd == 0) { count = ACE_OS::sprintf (this->mb_->wr_ptr (), "Host: %s\r\n", this->url_.host ()); if (count < 0) return -1; this->mb_->wr_ptr (count); } } return 0; } void HTTP_Request::dump () { ACE_DEBUG ((LM_DEBUG, "===== BEGIN entera_HTTP_Request::dump =====\n")); HTTP_Base::dump (); this->request_.dump (); ACE_DEBUG ((LM_DEBUG, "===== END entera_HTTP_Request::dump =====\n")); } #if !defined (ACE_HAS_INLINED_OSCALLS) # include "HTTPU/http_request.inl" # endif /* ACE_HAS_INLINED_OSCALLS */ ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/http_base.cpp0000644000175000017500000001707015027201773020346 0ustar sudipsudip#include "JAWS/Parse_Headers.h" #include "HTTPU/http_base.h" #include "HTTPU/http_headers.h" int HTTP_Base::receive (ACE_Message_Block &mb) { if (this->line () == 0) { if (this->extract_line (mb) == 0) return 0; if (this->status () != STATUS_OK) return 1; // Call into the receive hook. this->parse_line (); if (this->status_ == STATUS_INTERNAL_SERVER_ERROR || this->no_headers_) return 1; } // Parse headers JAWS_Parse_Headers *parser = JAWS_Parse_Headers_Singleton::instance (); int ret = parser->parse_headers (&(this->info_), mb); switch (this->info_.status ()) { case JAWS_Header_Info::STATUS_CODE_OK: break; case JAWS_Header_Info::STATUS_CODE_NO_MEMORY: case JAWS_Header_Info::STATUS_CODE_TOO_LONG: default: this->status_ = STATUS_INTERNAL_SERVER_ERROR; break; } return ret; } int HTTP_Base::deliver (ACE_Message_Block &mb) { JAWS_Header_Data *data = 0; // Deliver this outgoing request. // We do this by building the request up and writing it into the // message block. if (this->mb_ == 0) { // Make our Message Block big enough to hold a header name and // header value this->mb_ = new ACE_Message_Block (16384); // MAGIC! 2 x 8192 if (this->mb_ == 0) { this->status_ = STATUS_INTERNAL_SERVER_ERROR; return -1; } // Call into the deliver hook int r = this->espouse_line (); if (r == -1) return -1; if (r == 1) this->deliver_state_ = 2; this->iter_.first (); } while (this->deliver_state_ < 3) { // Deliver whatever is currently held in this->mb_. size_t sz = (mb.space () < this->mb_->length () ? mb.space () : this->mb_->length ()); if (sz > 0) { mb.copy (this->mb_->rd_ptr (), sz); this->mb_->rd_ptr (sz); } if (mb.space () == 0) return 0; // Arriving here means this->mb_ has been emptied. this->mb_->crunch (); switch (this->deliver_state_) { case 0: // Obtain the next header data // Deliver a header name this->deliver_state_ = this->deliver_header_name (data); break; case 1: // Deliver a header value this->deliver_state_ = this->deliver_header_value (data); break; case 2: // Finished! delete this->mb_; this->mb_ = 0; this->deliver_state_ = 3; } } return 1; } int HTTP_Base::receive_payload (ACE_Message_Block &mb) { int result = 0; if (this->payload_.space () < mb.length ()) result = this->payload_.size (this->payload_.size () + mb.length () - this->payload_.space ()); if (result == 0) { this->payload_.copy (mb.rd_ptr (), mb.length ()); mb.rd_ptr (mb.wr_ptr ()); mb.crunch (); } else this->status_ = STATUS_INTERNAL_SERVER_ERROR; return result; } int HTTP_Base::receive_payload (ACE_Message_Block &mb, long length) { int result = 0; if (length == -1) return this->receive_payload (mb); if (this->payload_.size () < (unsigned long) length) result = this->payload_.size (length); if (result == -1) { this->status_ = STATUS_INTERNAL_SERVER_ERROR; return -1; } if (this->payload_.space () >= mb.length ()) { this->payload_.copy (mb.rd_ptr (), mb.length ()); mb.rd_ptr (mb.wr_ptr ()); mb.crunch (); } else { size_t space = this->payload_.space (); this->payload_.copy (mb.rd_ptr (), space); mb.rd_ptr (space); } return this->payload_.length () == (unsigned long) length; } const char * HTTP_Base::payload () { return this->payload_.rd_ptr (); } unsigned long HTTP_Base::payload_size () { return this->payload_.length (); } int HTTP_Base::build_headers (JAWS_Headers *new_headers) { JAWS_Header_Data *data = 0; JAWS_Header_Data *data2 = 0; JAWS_Header_Table_Iterator iter (*new_headers); iter.first (); while (! iter.done ()) { data = iter.next (); if (data == 0) { iter.advance (); continue; } if (data->header_type () == HTTP_HCodes::REPLACE_HEADER) this->headers ()->remove_all (data->header_name ()); else if (data->header_type () == HTTP_HCodes::INSERT_HEADER || data->header_type () == HTTP_HCodes::APPENDTO_HEADER) { data2 = this->headers ()->find (data->header_name ()); if (data2 != 0) { if (data->header_type () == HTTP_HCodes::APPENDTO_HEADER) { // Append to existing header size_t len = ACE_OS::strlen (data->header_value ()) + ACE_OS::strlen (data2->header_value ()) + 3; /* for comma, space, and nul */ char *buf = new char [len]; if (buf == 0) { this->status_ = STATUS_INTERNAL_SERVER_ERROR; return -1; } ACE_OS::sprintf (buf, "%s, %s", data2->header_value (), data->header_value ()); data2->header_value (buf); delete [] buf; } // Only insert if it isn't already present iter.advance (); continue; } } data2 = new JAWS_Header_Data (data->header_name (), data->header_value ()); if (data2 == 0 || data2->header_name () == 0 || data2->header_value () == 0) { this->status_ = STATUS_INTERNAL_SERVER_ERROR; return -1; } this->headers ()->insert (data2); iter.advance (); } return 0; } int HTTP_Base::deliver_header_name (JAWS_Header_Data *&data) { data = 0; for (;;) { if ((data = this->iter_.next ()) == 0) { // No more headers, deliver final "\r\n" this->mb_->copy ("\r\n", 2); return 2; } if (data->header_name ()) break; this->iter_.advance (); } // Assume the following lines will always succeed. this->mb_->copy (data->header_name ()); this->mb_->wr_ptr (this->mb_->wr_ptr () - 1); this->mb_->copy (": ", 2); return 1; } int HTTP_Base::deliver_header_value (JAWS_Header_Data *&data) { // Assume the following line will always succeed. if (data->header_value ()) { this->mb_->copy (data->header_value ()); this->mb_->wr_ptr (this->mb_->wr_ptr () - 1); } this->mb_->copy ("\r\n", 2); this->iter_.advance (); return 0; } int HTTP_Base::extract_line (ACE_Message_Block &mb) { JAWS_Parse_Headers *parser = JAWS_Parse_Headers_Singleton::instance (); char *p = parser->skipset ("\n", mb.rd_ptr (), mb.wr_ptr ()); if (p == mb.wr_ptr ()) return 0; this->status_ = STATUS_OK; *p = '\0'; if (p[-1] == '\r') p[-1] = '\0'; this->line_ = ACE_OS::strdup (mb.rd_ptr ()); if (this->line_ == 0) this->status_ = STATUS_INTERNAL_SERVER_ERROR; mb.rd_ptr (p+1); this->info_.end_of_line (1); return 1; } void HTTP_Base::dump () { ACE_DEBUG ((LM_DEBUG, "%s\n", this->line ())); this->info_.dump (); ACE_DEBUG ((LM_DEBUG, "STATUS IS %d %s\n", this->status (), (*HTTP_SCode::instance ())[this->status ()])); } #if !defined (ACE_HAS_INLINED_OSCALLS) # include "HTTPU/http_base.inl" # endif /* ACE_HAS_INLINED_OSCALLS */ ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/parse_http_request.cpp0000644000175000017500000000450515027201773022315 0ustar sudipsudip#include "HTTPU/parse_http_request.h" Parse_HTTP_Request::Parse_HTTP_Request (const char *request) : method_ (0), major_version_ (-1), minor_version_ (-1), version_ (0), url_ (0), request_ (0), error_ (0) { if (request != 0) this->init (request); } Parse_HTTP_Request::~Parse_HTTP_Request () { if (this->request_) ACE_OS::free (this->request_); this->request_ = 0; this->version_ = 0; this->url_ = 0; } void Parse_HTTP_Request::dump () { ACE_DEBUG ((LM_DEBUG, "%s %s %s\n", this->method_str (), this->url (), this->version ())); } void Parse_HTTP_Request::init (const char *request) { char *method; this->request_ = ACE_OS::strdup (request); if (this->request_ == 0) { this->error_ = NO_MEMORY; return; } char buf[BUFSIZ]; int n = ::sscanf (this->request_, "%s %*s HTTP/%d.%d", buf, &(this->major_version_), &(this->minor_version_)); if (n == 1 || n == 3) { char *p = this->request_; while (*p == ' ' || *p == '\t') p++; method = p++; while (*p != ' ' && *p != '\t') p++; *p++ = '\0'; while (*p == ' ' || *p == '\t') p++; this->url_ = p; while (*p && !ACE_OS::strchr (" \t\r\n", *p)) p++; *p++ = '\0'; if (n == 1) { this->major_version_ = 0; this->minor_version_ = 9; } else { while (*p == ' ' || *p == '\t') p++; this->version_ = p; while (*p && !ACE_OS::strchr (" \t\r\n", *p)) p++; *p++ = '\0'; } if (ACE_OS::strcmp (method, "GET") == 0) this->method_ = &GET; else if (ACE_OS::strcmp (method, "HEAD") == 0) this->method_ = &HEAD; else if (ACE_OS::strcmp (method, "POST") == 0) this->method_ = &POST; else if (ACE_OS::strcmp (method, "PUT") == 0) this->method_ = &PUT; else if (ACE_OS::strcmp (method, "QUIT") == 0) this->method_ = &QUIT; else { this->method_ = &DUNNO; this->error_ = NOT_IMPLEMENTED; } } else this->error_ = BAD_REQUEST; } #if !defined (ACE_HAS_INLINED_OSCALLS) # include "HTTPU/parse_http_request.inl" #endif /* ACE_HAS_INLINED_OSCALLS */ ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/http_headers.cpp0000644000175000017500000001433415027201773021047 0ustar sudipsudip#include "ace/RB_Tree.h" #include "HTTPU/http_headers.h" HTTP_Hdr_Node HTTP_HCodes::HTTP ("HTTP", "HTTP%s %s"); HTTP_Hdr_Node HTTP_HCodes::ACCEPT ("Accept", "Accept: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::ACCEPTCHARSET ("Accept-Charset", "Accept-Charset: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::ACCEPTENCODING ("Accept-Encoding", "Accept-Encoding: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::ACCEPTLANGUAGE ("Accept-Language", "Accept-Language: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::ACCEPTRANGES ("Accept-Ranges", "Accept-Ranges: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::AGE ("Age", "Age: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::ALLOW ("Allow", "Allow: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::AUTHORIZATION ("Authorization", "Authorization: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::CACHECONTROL ("Cache-Control", "Cache-Control: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::CONNECTION ("Connection", "Connection: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::CONTENTENCODING ("Content-Encoding", "Content-Encoding: %d\r\n"); HTTP_Hdr_Node HTTP_HCodes::CONTENTLENGTH ("Content-Length", "Content-Length: %d\r\n"); HTTP_Hdr_Node HTTP_HCodes::CONTENTLOCATION ("Content-Location", "Content-Location: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::CONTENTMD5 ("Content-MD5", "Content-MD5: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::CONTENTRANGE ("Content-Range", "Content-Range: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::CONTENTTYPE ("Content-Type", "Content-Type: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::DATE ("Date", "Date: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::ETAG ("ETag", "ETag: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::EXPECT ("Expect", "Expect: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::EXPIRES ("Expires", "Expires: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::FROM ("From", "From: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::HOST ("Host", "Host: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::IFMATCH ("If-Match", "If-Match: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::IFMODIFIEDSINCE ("If-Modified-Since", "If-Modified-Since: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::IFNONEMATCH ("If-None-Match", "If-None-Match: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::IFRANGE ("If-Range", "If-Range: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::IFUNMODIFIEDSINCE ("If-Unmodified-Since", "If-Unmodified-Since: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::LASTMODIFIED ("Last-Modified", "Last-Modified: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::LOCATION ("Location", "Location: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::MAXFORWARDS ("Max-Forwards", "Max-Forwards: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::PRAGMA ("Pragma", "Pragma: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::PROXYAUTHENTICATE ("Proxy-Authenticate", "Proxy-Authenticate: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::PROXYAUTHORIZATION ("Proxy-Authorization", "Proxy-Authorization: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::RANGE ("Range", "Range: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::REFERER ("Referer", "Referer: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::SERVER ("Server", "Server: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::TE ("TE", "TE: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::TRAILER ("Trailer", "Trailer: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::TRANSFERENCODING ("Transfer-Encoding", "Transfer-Encoding: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::UPGRADE ("Ugrade", "Ugrade: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::USERAGENT ("User-Agent", "User-Agent: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::VARY ("Vary", "Vary: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::VIA ("Via", "Via: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::WARNING ("Warning", "Warning: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::WWWAUTHENTICATE ("WWW-Authenticate", "WWW-Authenticate: %s\r\n"); HTTP_Hdr_Node HTTP_HCodes::GET ("GET", "GET %s HTTP/%s\r\n"); HTTP_Hdr_Node HTTP_HCodes::HEAD ("HEAD", "HEAD %s HTTP/%s\r\n"); HTTP_Hdr_Node HTTP_HCodes::POST ("POST", "POST %s HTTP/%s\r\n"); HTTP_Hdr_Node HTTP_HCodes::PUT ("PUT", "PUT %s HTTP/%s\r\n"); HTTP_Hdr_Node HTTP_HCodes::QUIT ("QUIT", "QUIT %s HTTP/%s\r\n"); HTTP_Hdr_Node HTTP_HCodes::DUNNO ("", ""); HTTP_Hdr_Node HTTP_HCodes::META (""); HTTP_Hdr_Node HTTP_HCodes::A (""); HTTP_Hdr_Node HTTP_HCodes::SCRIPT (""); HTTP_Hdr_Node HTTP_HCodes::APPLET (""); const int &HTTP_HCodes::NUM_HEADER_STRINGS = HTTP_Header_Nodes_Singleton::instance ()->num_header_strings_; HTTP_Header_Nodes::HTTP_Header_Nodes () : num_header_strings_ (0) { } HTTP_Hdr_Node::HTTP_Hdr_Node (const char *token, const char *format) : token_ (token), format_ (format) { HTTP_Header_Nodes *header_nodes = HTTP_Header_Nodes_Singleton::instance (); this->index_ = header_nodes->num_header_strings_; header_nodes->insert (this->index_, this); header_nodes->num_header_strings_++; } HTTP_HCodes::HTTP_HCodes () : header_nodes_ (HTTP_Header_Nodes_Singleton::instance ()) { } HTTP_Headers::HTTP_Headers () { } const char * HTTP_Headers::header (int name) const { return this->header_token (name); } const char * HTTP_Headers::value (int index) { this->value_reset (); return this->value_next (index); } const char * HTTP_Headers::value_next (int index) { const char *hs = 0; const char *hv = 0; JAWS_Header_Data *data; if (0 <= index && index < NUM_HEADER_STRINGS) { hs = this->header (index); data = this->table ()->find_next (hs); if (data != 0) hv = data->header_value (); } return hv; } void HTTP_Headers::value_reset () { this->table ()->iter ().first (); } #if !defined (ACE_HAS_INLINED_OSCALLS) # include "HTTPU/http_headers.inl" # endif /* ACE_HAS_INLINED_OSCALLS */ ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/http_status.cpp0000644000175000017500000000561615027201773020762 0ustar sudipsudip#include "ace/Log_Msg.h" #include "HTTPU/http_status.h" const char * HTTP_SCode::table_ [HTTP_SCode::SC_TABLE_SIZE]; HTTP_SCode_Node HTTP_SCode_Base::STATUS_OK (200, "OK"); HTTP_SCode_Node HTTP_SCode_Base::STATUS_CREATED (201, "Created"); HTTP_SCode_Node HTTP_SCode_Base::STATUS_ACCEPTED (202, "Accepted"); HTTP_SCode_Node HTTP_SCode_Base::STATUS_NO_CONTENT (204, "No Content"); HTTP_SCode_Node HTTP_SCode_Base::STATUS_MULTIPLE_CHOICES (300, "Multiple Choices"); HTTP_SCode_Node HTTP_SCode_Base::STATUS_MOVED_PERMANENTLY (301, "Moved Permanently"); HTTP_SCode_Node HTTP_SCode_Base::STATUS_MOVED_TEMPORARILY (302, "Moved Temporarily"); HTTP_SCode_Node HTTP_SCode_Base::STATUS_NOT_MODIFIED (304, "Not Modified"); HTTP_SCode_Node HTTP_SCode_Base::STATUS_INSUFFICIENT_DATA (399, "Insufficient Data"); HTTP_SCode_Node HTTP_SCode_Base::STATUS_BAD_REQUEST (400, "Bad Request"); HTTP_SCode_Node HTTP_SCode_Base::STATUS_UNAUTHORIZED (401, "Unauthorized"); HTTP_SCode_Node HTTP_SCode_Base::STATUS_FORBIDDEN (403, "Forbidden"); HTTP_SCode_Node HTTP_SCode_Base::STATUS_NOT_FOUND (404, "Not Found"); HTTP_SCode_Node HTTP_SCode_Base::STATUS_INTERNAL_SERVER_ERROR (500, "Internal Server Error"); HTTP_SCode_Node HTTP_SCode_Base::STATUS_NOT_IMPLEMENTED (501, "Not Implemented"); HTTP_SCode_Node HTTP_SCode_Base::STATUS_BAD_GATEWAY (502, "Bad Gateway"); HTTP_SCode_Node HTTP_SCode_Base::STATUS_SERVICE_UNAVAILABLE (503, "Service Unavailable"); HTTP_SCode_Node HTTP_SCode_Base::STATUS_QUIT (599, "Quit"); HTTP_SCode_Node HTTP_SCode_Base::DUMMY (0, 0); HTTP_SCode_Node::HTTP_SCode_Node (int code, const char *code_str) : code_ (code), code_str_ (code_str) { if ((HTTP_SCode::MIN_STATUS_CODE <= code) && (code <= HTTP_SCode::MAX_STATUS_CODE)) HTTP_SCode::table_[code - HTTP_SCode::MIN_STATUS_CODE] = code_str; } const char * HTTP_SCode::operator[] (int i) const { const char *s = "Unknown"; if (MIN_STATUS_CODE <= i && i <= MAX_STATUS_CODE) s = this->table_[i - MIN_STATUS_CODE]; return s; } HTTP_SCode * HTTP_SCode::instance () { return HTTP_SCode_Singleton::instance (); } void HTTP_SCode::dump () { for (int i = 0; i < SC_TABLE_SIZE; i++) ACE_DEBUG ((LM_DEBUG, "%s\n", this->table_[i])); } HTTP_SCode::HTTP_SCode () { int i; for (i = 0; i < SC_TABLE_SIZE; i++) { if (this->table_[i] == 0) this->table_[i] = this->table_[(i/100) * 100]; } } HTTP_SCode::~HTTP_SCode () { } #if !defined (ACE_HAS_INLINED_OSCALLS) # include "HTTPU/http_status.inl" # endif /* ACE_HAS_INLINED_OSCALLS */ ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/parse_http_request.h0000644000175000017500000000214315027201773021756 0ustar sudipsudip#ifndef HTTPU_PARSE_HTTP_REQUEST_H #define HTTPU_PARSE_HTTP_REQUEST_H #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "HTTPU/http_headers.h" class HTTPU_Export Parse_HTTP_Request : public HTTP_HCodes { public: Parse_HTTP_Request (const char *request = 0); ~Parse_HTTP_Request (); void init (const char *request); int method () const; const char *method_str () const; int major_version () const; int minor_version () const; const char *version () const; const char *url () const; enum { HTTPU_OK, NO_MEMORY, BAD_REQUEST, NOT_IMPLEMENTED }; int error () const; // 0 -> ok void dump (); private: HTTP_Hdr_Node *method_; int major_version_; int minor_version_; char *version_; char *url_; char *request_; int error_; }; #if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE # endif /* ACE_INLINE */ # define ACE_INLINE inline # include "HTTPU/parse_http_request.inl" # endif /* ACE_HAS_INLINED_OSCALLS */ #endif /* !defined (HTTPU_PARSE_HTTP_REQUEST_H) */ ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/http_export.h0000644000175000017500000000202015027201773020407 0ustar sudipsudip// Definition for Win32 Export directives. // This file is generated automatically by // ${TAO_ROOT}/TAO_IDL/GenExportH.BAT // ------------------------------ #ifndef HTTPU_EXPORT_H #define HTTPU_EXPORT_H #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #if defined (HTTPU_HAS_DLL) # if (HTTPU_HAS_DLL == 1) # if defined (HTTPU_BUILD_DLL) # define HTTPU_Export ACE_Proper_Export_Flag # define HTTPU_SINGLETON_DECLARATION(T) \ ACE_EXPORT_SINGLETON_DECLARATION (T) # else # define HTTPU_Export ACE_Proper_Import_Flag # define HTTPU_SINGLETON_DECLARATION(T) \ ACE_IMPORT_SINGLETON_DECLARATION (T) # endif /* HTTPU_BUILD_DLL */ # else # define HTTPU_Export # define HTTPU_SINGLETON_DECLARATION(T) # endif /* ! HTTPU_HAS_DLL == 1 */ #else # define HTTPU_Export # define HTTPU_SINGLETON_DECLARATION(T) #endif /* HTTPU_HAS_DLL */ #endif /* HTTPU_EXPORT_H */ // End of auto generated file. ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/http_response.inl0000644000175000017500000000050615027201773021266 0ustar sudipsudip// -*- c++ -*- #if !defined (ACE_HAS_INLINED_OSCALLS) # undef ACE_INLINE # define ACE_INLINE #endif /* ACE_HAS_INLINED_OSCALLS */ ACE_INLINE HTTP_Response::HTTP_Response () { } ACE_INLINE HTTP_Response::~HTTP_Response () { } ACE_INLINE Parse_HTTP_Response * HTTP_Response::response_line () { return &(this->response_); } ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/httpu.mpc0000644000175000017500000000052015027201773017526 0ustar sudipsudip// -*- MPC -*- project(HTTPU) : ace_output, acelib { sharedname = HTTPU dynamicflags += HTTPU_BUILD_DLL avoids += uses_wchar ace_for_tao after += JAWS2 libs += JAWS2 includes += .. Source_Files { *.cpp } Template_Files{ } Header_Files{ *.h } Inline_Files{ } } ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/http_base.h0000644000175000017500000000415015027201773020006 0ustar sudipsudip#ifndef HTTPU_HTTP_BASE_H #define HTTPU_HTTP_BASE_H #include "ace/Message_Block.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "JAWS/Parse_Headers.h" #include "HTTPU/http_export.h" #include "HTTPU/http_status.h" #include "HTTPU/http_headers.h" class HTTPU_Export HTTP_Base : public HTTP_SCode_Base { public: HTTP_Base (); virtual ~HTTP_Base (); virtual int receive (ACE_Message_Block &mb); virtual int deliver (ACE_Message_Block &mb); virtual int receive_payload (ACE_Message_Block &mb); virtual int receive_payload (ACE_Message_Block &mb, long length); const char * payload (); unsigned long payload_size (); int status () const; const char *line () const; HTTP_Headers *http_headers (); JAWS_Headers *headers (); int build_headers (JAWS_Headers *new_headers); // takes a set of new headers that will replace existing headers or // be added to the header list if there is no corresponding one to replace. void dump (); protected: virtual void parse_line () = 0; // Hook into the receive function to do specialized parsing of initial line. // Sets the status_ variable. virtual int espouse_line () = 0; // Hook into the deliver function to do specialized initial line creation. // Returns 0 for success and -1 for failure. int deliver_header_name (JAWS_Header_Data *&data); // Returns the next deliver state int deliver_header_value (JAWS_Header_Data *&data); // Returns the next deliver state virtual int extract_line (ACE_Message_Block &mb); // The first line of a request or a response. // Return 0 if more data needed. // Return 1 if line successfully parsed. protected: int status_; char *line_; int deliver_state_; int no_headers_; HTTP_Headers info_; JAWS_Header_Table_Iterator iter_; ACE_Message_Block *mb_; ACE_Message_Block payload_; }; #if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE # endif /* ACE_INLINE */ # define ACE_INLINE inline # include "HTTPU/http_base.inl" # endif /* ACE_HAS_INLINED_OSCALLS */ #endif /* !defined (HTTPU_HTTP_BASE_H) */ ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/http_status.inl0000644000175000017500000000045115027201773020752 0ustar sudipsudip// -*- c++ -*- #if !defined (ACE_HAS_INLINED_OSCALLS) # undef ACE_INLINE # define ACE_INLINE #endif /* ACE_HAS_INLINED_OSCALLS */ ACE_INLINE HTTP_SCode_Node::operator int () const { return this->code_; } ACE_INLINE HTTP_SCode_Node::operator const char * () const { return this->code_str_; } ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/parse_http_request.inl0000644000175000017500000000143415027201773022313 0ustar sudipsudip// -*- c++ -*- #if !defined (ACE_HAS_INLINED_OSCALLS) # undef ACE_INLINE # define ACE_INLINE #endif /* ACE_HAS_INLINED_OSCALLS */ ACE_INLINE int Parse_HTTP_Request::method () const { return (int) *this->method_; } ACE_INLINE const char * Parse_HTTP_Request::method_str () const { return (const char *) *this->method_; } ACE_INLINE int Parse_HTTP_Request::major_version () const { return this->major_version_; } ACE_INLINE int Parse_HTTP_Request::minor_version () const { return this->minor_version_; } ACE_INLINE const char * Parse_HTTP_Request::version () const { return this->version_ ? this->version_ : "HTTP/0.9"; } ACE_INLINE const char * Parse_HTTP_Request::url () const { return this->url_; } ACE_INLINE int Parse_HTTP_Request::error () const { return this->error_; } ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/parse_url.h0000644000175000017500000000253715027201773020040 0ustar sudipsudip/* -*- c++ -*- */ #ifndef HTTPU_HTTP_PARSE_H #define HTTPU_HTTP_PARSE_H #include "HTTPU/http_export.h" class HTTPU_Export HTTP_Parse_URL { // CAVEAT: // The user of the class is responsible for testing the difference // between a missing username versus an empty one. Same goes for // password The RFC (1738) makes the differentiation for username // and password. If the hostname is missing (or empty), this class // always returns a null value for the host. public: HTTP_Parse_URL (const char *url = 0); ~HTTP_Parse_URL (); void init (const char *url); enum URL_SCHEME { HTTP, FTP }; const char *scheme () const; const char *user () const; const char *passwd () const; const char *host () const; int port () const; const char *url_path () const; enum URL_ERROR { URL_ERROR_NONE, URL_ERROR_STRDUP, URL_ERROR_SCHEME, URL_ERROR_SLASHSLASH }; int error () const { return( error_ ); } int is_cgi () const; private: void parse_url (); void parse_scheme (char *&p); void parse_host (char *&p); void parse_url_path (char *&p); void is_cgi (const char *path); void set_port_from_scheme (); private: char *url_; const char *scheme_; const char *user_; const char *passwd_; const char *host_; int port_; const char *url_path_; int error_; int is_cgi_; }; #endif /* !defined (HTTPU_HTTP_PARSE_H) */ ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/http_status.h0000644000175000017500000000471415027201773020425 0ustar sudipsudip#ifndef HTTPU_HTTP_STATUS_HPP #define HTTPU_HTTP_STATUS_HPP #include "ace/Singleton.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "HTTPU/http_export.h" #include "ace/Synch_Traits.h" class HTTP_SCode_Base; class HTTPU_Export HTTP_SCode_Node // Constructor should be passed a string literal. { friend class HTTP_SCode_Base; public: operator int () const; operator const char * () const; private: HTTP_SCode_Node (int code, const char *code_str); private: int code_; const char *code_str_; }; class HTTPU_Export HTTP_SCode_Base { public: static HTTP_SCode_Node STATUS_OK; static HTTP_SCode_Node STATUS_CREATED; static HTTP_SCode_Node STATUS_ACCEPTED; static HTTP_SCode_Node STATUS_NO_CONTENT; static HTTP_SCode_Node STATUS_MULTIPLE_CHOICES; static HTTP_SCode_Node STATUS_MOVED_PERMANENTLY; static HTTP_SCode_Node STATUS_MOVED_TEMPORARILY; static HTTP_SCode_Node STATUS_NOT_MODIFIED; static HTTP_SCode_Node STATUS_INSUFFICIENT_DATA; static HTTP_SCode_Node STATUS_BAD_REQUEST; static HTTP_SCode_Node STATUS_UNAUTHORIZED; static HTTP_SCode_Node STATUS_FORBIDDEN; static HTTP_SCode_Node STATUS_NOT_FOUND; static HTTP_SCode_Node STATUS_INTERNAL_SERVER_ERROR; static HTTP_SCode_Node STATUS_NOT_IMPLEMENTED; static HTTP_SCode_Node STATUS_BAD_GATEWAY; static HTTP_SCode_Node STATUS_SERVICE_UNAVAILABLE; static HTTP_SCode_Node STATUS_QUIT; enum { MIN_STATUS_CODE = 200, MAX_STATUS_CODE = 599 }; private: static HTTP_SCode_Node DUMMY; }; class HTTPU_Export HTTP_SCode : public HTTP_SCode_Base { // = TITLE // Go from numeric status codes to descriptive strings. // friend class HTTP_SCode_Node; friend class ACE_Singleton; protected: HTTP_SCode (); ~HTTP_SCode (); public: const char * operator[] (int) const; // Return the reason string corresponding to a status code number. static HTTP_SCode *instance (); // Return reference to the singleton. enum { SC_TABLE_SIZE = MAX_STATUS_CODE - MIN_STATUS_CODE + 1 }; void dump (); private: static const char *table_[SC_TABLE_SIZE]; }; typedef ACE_Singleton HTTP_SCode_Singleton; #if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE # endif /* ACE_INLINE */ # define ACE_INLINE inline # include "HTTPU/http_status.inl" # endif /* ACE_HAS_INLINED_OSCALLS */ #endif /* HTTPU_HTTP_STATUS_HPP */ ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/parse_http_response.h0000644000175000017500000000201615027201773022123 0ustar sudipsudip#ifndef HTTPU_PARSE_HTTP_RESPONSE_H #define HTTPU_PARSE_HTTP_RESPONSE_H #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "HTTPU/http_export.h" class HTTPU_Export Parse_HTTP_Response { public: Parse_HTTP_Response (const char *response = 0); ~Parse_HTTP_Response (); void init (const char *response); int code () const; const char *code_str () const; int major_version () const; int minor_version () const; const char *version () const; enum { HTTPU_OK, NO_MEMORY, BAD_RESPONSE }; int error () const; // 0 -> ok private: int code_; char *code_str_; int major_version_; int minor_version_; char *version_; char *response_; int error_; }; #if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE # endif /* ACE_INLINE */ # define ACE_INLINE inline # include "HTTPU/parse_http_response.inl" # endif /* ACE_HAS_INLINED_OSCALLS */ #endif /* !defined (HTTPU_PARSE_HTTP_RESPONSE_H) */ ace-8.0.4+dfsg.orig/apps/JAWS2/HTTPU/parse_http_response.inl0000644000175000017500000000131615027201773022460 0ustar sudipsudip// -*- c++ -*- #if !defined (ACE_HAS_INLINED_OSCALLS) # undef ACE_INLINE # define ACE_INLINE #endif /* ACE_HAS_INLINED_OSCALLS */ ACE_INLINE int Parse_HTTP_Response::code () const { return this->code_; } ACE_INLINE const char * Parse_HTTP_Response::code_str () const { return this->code_str_ ? this->code_str_ : "200"; } ACE_INLINE int Parse_HTTP_Response::major_version () const { return this->major_version_; } ACE_INLINE int Parse_HTTP_Response::minor_version () const { return this->minor_version_; } ACE_INLINE const char * Parse_HTTP_Response::version () const { return this->version_ ? this->version_ : "HTTP/0.9"; } ACE_INLINE int Parse_HTTP_Response::error () const { return this->error_; } ace-8.0.4+dfsg.orig/apps/JAWS2/HTTP_10_Request.h0000644000175000017500000000077715027201773017733 0ustar sudipsudip// -*- c++ -*- #ifndef JAWS_HTTP_10_REQUEST_H #define JAWS_HTTP_10_REQUEST_H #include "HTTPU/http_request.h" class JAWS_HTTP_10_Request : public HTTP_Request, public HTTP_HCodes { public: JAWS_HTTP_10_Request (); ~JAWS_HTTP_10_Request (); int type () const; const char * method () const; const char * uri () const; const char * version () const; const char * path () const; void path (const char *); void set_status (int); private: char *path_; }; #endif /* JAWS_HTTP_10_REQUEST_H */ ace-8.0.4+dfsg.orig/apps/JAWS2/50K.html0000644000175000017500000014152115027201773016211 0ustar sudipsudip 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 ace-8.0.4+dfsg.orig/apps/JAWS2/main.cpp0000644000175000017500000000171115027201773016410 0ustar sudipsudip#include "JAWS/Server.h" #include "HTTP_10.h" #ifdef ACE_HAS_SIG_C_FUNC extern "C" { #endif /* ACE_HAS_SIG_C_FUNC */ static void handler (int) { ACE_OS::exit (0); // call exit() so that static destructors get called } #ifdef ACE_HAS_SIG_C_FUNC } #endif /* ACE_HAS_SIG_C_FUNC */ static JAWS_HTTP_10_Read_Task HTTP_Read; static JAWS_HTTP_10_Parse_Task HTTP_Parse; static JAWS_HTTP_10_Write_Task HTTP_Write; int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { ACE_OS::signal (SIGCHLD, SIG_IGN); // SigAction not needed since the handler will shutdown the server. ACE_OS::signal (SIGINT, (ACE_SignalHandler) handler); ACE_OS::signal (SIGUSR2, (ACE_SignalHandler) handler); JAWS_Server server (argc, argv); HTTP_Read.next (&HTTP_Parse); HTTP_Parse.next (&HTTP_Write); // HTTP_Write.next (JAWS_Pipeline_Done_Task_Singleton::instance ()); if (server.open (&HTTP_Read) == -1) ACE_DEBUG ((LM_DEBUG, "JAWS: Error opening server\n")); return 0; } ace-8.0.4+dfsg.orig/apps/JAWS2/README0000644000175000017500000000245615027201773015647 0ustar sudipsudip This directory contains the source code to the JAWS framework as described in Object-Oriented Application Frameworks, Volume 3. The subdirectories are as follows ./JAWS the core JAWS framework source ./HTTPU utility classes for HTTP handling The top level directory contains source to a simple HTTP/0.9 web server written using the JAWS framework. The Makefile uses the ACE Makefile system, so a correctly configured ACE should require no changes to get JAWS to compile. Users of Windows NT can start with the supplied project files, but they may require some fiddling with to get it all to compile. Server command line options: -t : enable/disable tracing (disabled by default) -p PORT : set listen port to PORT (5432 default) -c CONCURRENCY : set concurrency strategy, one of PER_REQUEST, or POOL (the default). -d DISPATCH : set dispatch strategy, one of ASYNCH, or SYNCH (default) -n NTHREADS : set number of threads for POOL (5 default) -m MAXTHREADS : set maximum number of threads for PER_REQUEST, (20 default) -f THREADFLAGS : set thread creation flags, recognizes THR_BOUND, THR_DAEMON, and THR_DETACHED -r RATIO : set asynch tasks per thread ratio (1 default) -- James ace-8.0.4+dfsg.orig/apps/JAWS2/HTTP_10.h0000644000175000017500000000234715027201773016216 0ustar sudipsudip/* -*- c++ -*- */ #ifndef JAWS_HTTP_10_H #define JAWS_HTTP_10_H #include "ace/RB_Tree.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "JAWS/Pipeline_Tasks.h" // Forward declaration class JAWS_HTTP_10_Request; // Reading the initial request class JAWS_HTTP_10_Read_Task : public JAWS_Pipeline_Handler { public: JAWS_HTTP_10_Read_Task (); virtual ~JAWS_HTTP_10_Read_Task (); virtual int handle_put (JAWS_Data_Block *data, ACE_Time_Value *tv); private: }; // Parsing the request class JAWS_HTTP_10_Parse_Task : public JAWS_Pipeline_Handler { public: JAWS_HTTP_10_Parse_Task (); virtual ~JAWS_HTTP_10_Parse_Task (); virtual int handle_put (JAWS_Data_Block *data, ACE_Time_Value *tv); }; // Write the response class JAWS_HTTP_10_Write_Task : public JAWS_Pipeline_Handler { public: JAWS_HTTP_10_Write_Task (); virtual ~JAWS_HTTP_10_Write_Task (); virtual int handle_put (JAWS_Data_Block *data, ACE_Time_Value *tv); private: }; // Helpers class JAWS_HTTP_10_Helper // Static functions to enhance the lives of HTTP programmers everywhere. { public: static char *HTTP_decode_string (char *path); // Decode '%' escape codes in a URI }; #endif /* !defined (JAWS_HTTP_10_H) */ ace-8.0.4+dfsg.orig/apps/JAWS2/HTTP_Policy.h0000644000175000017500000000062315027201773017230 0ustar sudipsudip/* -*- c++ -*- */ #ifndef HTTP_POLICY_H #define HTTP_POLICY_H #include "JAWS/Concurrency.h" #include "JAWS/Policy.h" /* create a policy */ class HTTP_Policy : public JAWS_Dispatch_Policy { public: HTTP_Policy (JAWS_Concurrency_Base *concurrency); virtual JAWS_Concurrency_Base * update (void *state = 0); private: JAWS_Concurrency_Base *concurrency_; }; #endif /* !defined (HTTP_POLICY_H) */ ace-8.0.4+dfsg.orig/apps/JAWS2/5K.html0000644000175000017500000001161115027201773016125 0ustar sudipsudip 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 1010101010101010101010101010101010101010101010101 ace-8.0.4+dfsg.orig/apps/README0000644000175000017500000000245015027201773015013 0ustar sudipsudip The subdirectories in this directory provide a number of complete applications that utilize the ACE features. . drwho - This provides a "Distributed RWHO (drwho)" utility that gets around certain rwho limitations, adds functionality, and also prints a much prettier listing of who's logged in around a network. . Gateway -- Implements a connection-oriented application-level gateway that uses source-based and destination-based routing of messages between peers connected via TCP/IP networks. . gperf -- The GNU perfect hash function generator. This has now been integrated into the TAO IDL compiler, where it is used for generating the lookup function for operation names associated with IDL interfaces. . JAWS -- This is a high-performance HTTP 1.0 web server written with ACE. It illustrates a number of sophisticated ACE concurrency and event demultiplexing strategies. . JAWS2 is an implementation of HTTP/1.0 similar to JAWS. It has no HTTP/1.1 features. It extends JAWS to add a more flexible I/O and concurrency framework utilizing strategies. . JAWS3 is a framework that provides a state-machine interface to developing a server, but it does not implement HTTP. ace-8.0.4+dfsg.orig/apps/gperf/0000755000175000017500000000000015046037655015244 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/gperf/ace_gperf.texi0000644000175000017500000014327615027201773020060 0ustar sudipsudip\input texinfo @c -*-texinfo-*- @include version.texi @c %**start of header @settitle User's Guide to @code{gperf} @setfilename gperf.info @c %**end of header @ifinfo @dircategory GNU programming tools @direntry * Gperf: (ace_gperf). Perfect Hash Function Generator. @end direntry @end ifinfo @ifinfo This file documents the features of the GNU Perfect Hash Function Generator Copyright (C) 1989 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. @ignore Permission is granted to process this file through @TeX{} and print the results, provided the printed document carries copying permission notice identical to this one except for the removal of this paragraph (this paragraph not being relevant to the printed manual). @end ignore Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the section entitled ``GNU General Public License'' is included exactly as in the original, and provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that the section entitled ``GNU @code{gperf} General Public License'' an d this permission notice may be included in translations approved by the Free Software Foundation instead of in the original English. @end ifinfo @setchapternewpage odd @titlepage @title GNU GPERF Utility @subtitle User's Guide @subtitle Last updated @value{UPDATED} @subtitle For GPERF version @value{VERSION} @author Douglas C. Schmidt @c The following two commands @c start the copyright page. @page @vskip 0pt plus 1filll Copyright @copyright{} 1989 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the section entitled ``GNU @code{gperf} General Public License'' is included exactl y as in the original, and provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that the section entitled ``GNU @code{gperf} General Public License'' ma y be included in a translation approved by the author instead of in the original English. @end titlepage @ifinfo @node Top, Copying, (dir), (dir) @top GNU GPERF Utility @chapter Introduction This manual documents the GNU @code{gperf} perfect hash function generator utility, focusing on its features and how to use them, and how to report bugs. @end ifinfo @menu * Copying:: GNU @code{gperf} General Public License says how you can copy and share @code{gperf}. * Contributors:: People who have contributed to @code{gperf}. * Motivation:: Static search structures and GNU GPERF. * Search Structures:: Static search structures and GNU @code{gperf} * Description:: High-level discussion of how GPERF functions. * Options:: A description of options to the program. * Bugs:: Known bugs and limitations with GPERF. * Projects:: Things still left to do. * Implementation:: Implementation Details for GNU GPERF. * Bibliography:: Material Referenced in this Report. --- The Detailed Node Listing --- High-Level Description of GNU @code{gperf} * Input Format:: Input Format to @code{gperf} * Output Format:: Output Format for Generated C Code with @code{gperf} Input Format to @code{gperf} * Declarations:: @code{struct} Declarations and C Code Inclusion. * Keywords:: Format for Keyword Entries. * Functions:: Including Additional C Functions. @end menu @node Copying, Contributors, Top, Top @unnumbered GNU GENERAL PUBLIC LICENSE @center Version 1, February 1989 @display Copyright @copyright{} 1989 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @end display @unnumberedsec Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software---to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. @iftex @unnumberedsec TERMS AND CONDITIONS @end iftex @ifinfo @center TERMS AND CONDITIONS @end ifinfo @enumerate @item This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The ``Program'', below, refers to any such program or work, and a ``work based on the Program'' means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as ``you''. @item You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. @item You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: @itemize @bullet @item cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and @item cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). @item If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. @item You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. @end itemize Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. @item You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: @itemize @bullet @item accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, @item accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, @item accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) @end itemize Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. @item You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. @item By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. @item Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. @item The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and ``any later version'', you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. @item If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. @iftex @heading NO WARRANTY @end iftex @ifinfo @center NO WARRANTY @end ifinfo @item BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. @item IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. @end enumerate @iftex @heading END OF TERMS AND CONDITIONS @end iftex @ifinfo @center END OF TERMS AND CONDITIONS @end ifinfo @page @unnumberedsec Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the ``copyright'' line and a pointer to where the full notice is found. @smallexample @var{one line to give the program's name and a brief idea of what it does.} Copyright (C) 19@var{yy} @var{name of author} 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 1, 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. @end smallexample Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: @smallexample Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author} Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. @end smallexample The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items---whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a ``copyright disclaimer'' for the program, if necessary. Here a sample; alter the names: @example Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. @var{signature of Ty Coon}, 1 April 1989 Ty Coon, President of Vice @end example That's all there is to it! @node Contributors, Motivation, Copying, Top @unnumbered Contributors to GNU @code{gperf} Utility @itemize @bullet @item The GNU @code{gperf} perfect hash function generator utility was originally written in GNU C++ by Douglas C. Schmidt. It is now also available in a highly-portable ``old-style'' C version. The general idea for the perfect hash function generator was inspired by Keith Bostic's algorithm written in C, and distributed to net.sources around 1984. The current program is a heavily modified, enhanced, and extended implementation of Keith's basic idea, created at the University of California, Irvine. Bugs, patches, and suggestions should be reported to schmidt at ics.uci.edu. @item Special thanks is extended to Michael Tiemann and Doug Lea, for providing a useful compiler, and for giving me a forum to exhibit my creation. In addition, Adam de Boor and Nels Olson provided many tips and insights that greatly helped improve the quality and functionality of @code{gperf}. @end itemize @node Motivation, Search Structures, Contributors, Top @chapter Introduction @code{gperf} is a perfect hash function generator written in C++. It transforms an @emph{n} element user-specified keyword set @emph{W} into a perfect hash function @emph{F}. @emph{F} uniquely maps keywords in @emph{W} onto the range 0..@emph{k}, where @emph{k} >= @emph{n}. If @emph{k = n} then @emph{F} is a @emph{minimal} perfect hash function. @code{gperf} generates a 0..@emph{k} element static lookup table and a pair of C functions. These functions determine whether a given character string @emph{s} occurs in @emph{W}, using at most one probe into the lookup table. @code{gperf} currently generates the reserved keyword recognizer for lexical analyzers in several production and research compilers and language processing tools, including GNU C, GNU C++, GNU Pascal, GNU Modula 3, and GNU indent. Complete C++ source code for @code{gperf} is available via anonymous ftp from ics.uci.edu. @code{gperf} also is distributed along with the GNU libg++ library. A highly portable, functionally equivalent K&R C version of @code{gperf} is archived in comp.sources.unix, volume 20. Finally, a paper describing @code{gperf}'s design and implementation in greater detail is available in the Second USENIX C++ Conference proceedings. @node Search Structures, Description, Motivation, Top @chapter Static search structures and GNU @code{gperf} A @dfn{static search structure} is an Abstract Data Type with certain fundamental operations, @emph{e.g.}, @emph{initialize}, @emph{insert}, and @emph{retrieve}. Conceptually, all insertions occur before any retrievals. In practice, @code{gperf} generates a @code{static} array containing search set keywords and any associated attributes specified by the user. Thus, there is essentially no execution-time cost for the insertions. It is a useful data structure for representing @emph{static search sets}. Static search sets occur frequently in software system applications. Typical static search sets include compiler reserved words, assembler instruction opcodes, and built-in shell interpreter commands. Search set members, called @dfn{keywords}, are inserted into the structure only once, usually during program initialization, and are not generally modified at run-time. Numerous static search structure implementations exist, @emph{e.g.}, arrays, linked lists, binary search trees, digital search tries, and hash tables. Different approaches offer trade-offs between space utilization and search time efficiency. For example, an @emph{n} element sorted array is space efficient, though the average-case time complexity for retrieval operations using binary search is proportional to log @emph{n}. Conversely, hash table implementations often locate a table entry in constant time, but typically impose additional memory overhead and exhibit poor worst case performance. @emph{Minimal perfect hash functions} provide an optimal solution for a particular class of static search sets. A minimal perfect hash function is defined by two properties: @itemize @bullet @item It allows keyword recognition in a static search set using at most @emph{one} probe into the hash table. This represents the ``perfect'' property. @item The actual memory allocated to store the keywords is precisely large enough for the keyword set, and @emph{no larger}. This is the ``minimal'' property. @end itemize For most applications it is far easier to generate @emph{perfect} hash functions than @emph{minimal perfect} hash functions. Moreover, non-minimal perfect hash functions frequently execute faster than minimal ones in practice. This phenomena occurs since searching a sparse keyword table increases the probability of locating a ``null'' entry, thereby reducing string comparisons. @code{gperf}'s default behavior generates @emph{near-minimal} perfect hash functions for keyword sets. However, @code{gperf} provides many options that permit user control over the degree of minimality and perfection. Static search sets often exhibit relative stability over time. For example, Ada's 63 reserved words have remained constant for nearly a decade. It is therefore frequently worthwhile to expend concerted effort building an optimal search structure @emph{once}, if it subsequently receives heavy use multiple times. @code{gperf} removes the drudgery associated with constructing time- and space-efficient search structures by hand. It has proven a useful and practical tool for serious programming projects. Output from @code{gperf} is currently used in several production and research compilers, including GNU C, GNU C++, GNU Pascal, and GNU Modula 3. The latter two compilers are not yet part of the official GNU distribution. Each compiler utilizes @code{gperf} to automatically generate static search structures that efficiently identify their respective reserved keywords. @node Description, Options, Search Structures, Top @chapter High-Level Description of GNU @code{gperf} @menu * Input Format:: Input Format to @code{gperf} * Output Format:: Output Format for Generated C Code with @code{gperf} @end menu The perfect hash function generator @code{gperf} reads a set of ``keywords'' from a @dfn{keyfile} (or from the standard input by default). It attempts to derive a perfect hashing function that recognizes a member of the @dfn{static keyword set} with at most a single probe into the lookup table. If @code{gperf} succeeds in generating such a function it produces a pair of C source code routines that perform hashing and table lookup recognition. All generated C code is directed to the standard output. Command-line options described below allow you to modify the input and output format to @code{gperf}. By default, @code{gperf} attempts to produce time-efficient code, with less emphasis on efficient space utilization. However, several options exist that permit trading-off execution time for storage space and vice versa. In particular, expanding the generated table size produces a sparse search structure, generally yielding faster searches. Conversely, you can direct @code{gperf} to utilize a C @code{switch} statement scheme that minimizes data space storage size. Furthermore, using a C @code{switch} may actually speed up the keyword retrieval time somewhat. Actual results depend on your C compiler, of course. In general, @code{gperf} assigns values to the characters it is using for hashing until some set of values gives each keyword a unique value. A helpful heuristic is that the larger the hash value range, the easier it is for @code{gperf} to find and generate a perfect hash function. Experimentation is the key to getting the most from @code{gperf}. @node Input Format, Output Format, Description, Description @section Input Format to @code{gperf} You can control the input keyfile format by varying certain command-line arguments, in particular the @samp{-t} option. The input's appearance is similar to GNU utilities @code{flex} and @code{bison} (or UNIX utilities @code{lex} and @code{yacc}). Here's an outline of the general format: @example @group declarations %% keywords %% functions @end group @end example @emph{Unlike} @code{flex} or @code{bison}, all sections of @code{gperf}'s input are optional. The following sections describe the input format for each section. @menu * Declarations:: @code{struct} Declarations and C Code Inclusion. * Keywords:: Format for Keyword Entries. * Functions:: Including Additional C Functions. @end menu @node Declarations, Keywords, Input Format, Input Format @subsection @code{struct} Declarations and C Code Inclusion The keyword input file optionally contains a section for including arbitrary C declarations and definitions, as well as provisions for providing a user-supplied @code{struct}. If the @samp{-t} option @emph{is} enabled, you @emph{must} provide a C @code{struct} as the last component in the declaration section from the keyfile file. The first field in this struct must be a @code{char *} identifier called ``name,'' although it is possible to modify this field's name with the @samp{-K} option described below. Here is simple example, using months of the year and their attributes as input: @example @group struct months @{ char *name; int number; int days; int leap_days; @}; %% january, 1, 31, 31 february, 2, 28, 29 march, 3, 31, 31 april, 4, 30, 30 may, 5, 31, 31 june, 6, 30, 30 july, 7, 31, 31 august, 8, 31, 31 september, 9, 30, 30 october, 10, 31, 31 november, 11, 30, 30 december, 12, 31, 31 @end group @end example Separating the @code{struct} declaration from the list of key words and other fields are a pair of consecutive percent signs, @code{%%}, appearing left justified in the first column, as in the UNIX utility @code{lex}. Using a syntax similar to GNU utilities @code{flex} and @code{bison}, it is possible to directly include C source text and comments verbatim into the generated output file. This is accomplished by enclosing the region inside left-justified surrounding @code{%@{}, @code{%@}} pairs. Here is an input fragment based on the previous example that illustrates this feature: @example @group %@{ #include /* This section of code is inserted directly into the output. */ int return_month_days (struct months *months, int is_leap_year); %@} struct months @{ char *name; int number; int days; int leap_days; @}; %% january, 1, 31, 31 february, 2, 28, 29 march, 3, 31, 31 ... @end group @end example It is possible to omit the declaration section entirely. In this case the keyfile begins directly with the first keyword line, @emph{e.g.}: @example @group january, 1, 31, 31 february, 2, 28, 29 march, 3, 31, 31 april, 4, 30, 30 ... @end group @end example @node Keywords, Functions, Declarations, Input Format @subsection Format for Keyword Entries The second keyfile format section contains lines of keywords and any associated attributes you might supply. A line beginning with @samp{#} in the first column is considered a comment. Everything following the @samp{#} is ignored, up to and including the following newline. The first field of each non-comment line is always the key itself. It should be given as a simple name, @emph{i.e.}, without surrounding string quotation marks, and be left-justified flush against the first column. In this context, a ``field'' is considered to extend up to, but not include, the first blank, comma, or newline. Here is a simple example taken from a partial list of C reserved words: @example @group # These are a few C reserved words, see the c.@code{gperf} file # for a complete list of ANSI C reserved words. unsigned sizeof switch signed if default for while return @end group @end example Note that unlike @code{flex} or @code{bison} the first @code{%%} marker may be elided if the declaration section is empty. Additional fields may optionally follow the leading keyword. Fields should be separated by commas, and terminate at the end of line. What these fields mean is entirely up to you; they are used to initialize the elements of the user-defined @code{struct} provided by you in the declaration section. If the @samp{-t} option is @emph{not} enabled these fields are simply ignored. All previous examples except the last one contain keyword attributes. @node Functions, , Keywords, Input Format @subsection Including Additional C Functions The optional third section also corresponds closely with conventions found in @code{flex} and @code{bison}. All text in this section, starting at the final @code{%%} and extending to the end of the input file, is included verbatim into the generated output file. Naturally, it is your responsibility to ensure that the code contained in this section is valid C. @node Output Format, , Input Format, Description @section Output Format for Generated C Code with @code{gperf} Several options control how the generated C code appears on the standard output. Two C function are generated. They are called @code{hash} and @code{in_word_set}, although you may modify the name for @code{in_word_set} with a command-line option. Both functions require two arguments, a string, @code{char *} @var{str}, and a length parameter, @code{int} @var{len}. Their default function prototypes are as follows: @example @group static int hash (char *str, int len); int in_word_set (char *str, int len); @end group @end example By default, the generated @code{hash} function returns an integer value created by adding @var{len} to several user-specified @var{str} key positions indexed into an @dfn{associated values} table stored in a local static array. The associated values table is constructed internally by @code{gperf} and later output as a static local C array called @var{hash_table}; its meaning and properties are described below. @xref{Implementation}. The relevant key positions are specified via the @samp{-k} option when running @code{gperf}, as detailed in the @emph{Options} section below. @xref{Options}. Two options, @samp{-g} (assume you are compiling with GNU C and its @code{inline} feature) and @samp{-a} (assume ANSI C-style function prototypes), alter the content of both the generated @code{hash} and @code{in_word_set} routines. However, function @code{in_word_set} may be modified more extensively, in response to your option settings. The options that affect the @code{in_word_set} structure are: @itemize @bullet @table @samp @item -p Have function @code{in_word_set} return a pointer rather than a boolean. @item -t Make use of the user-defined @code{struct}. @item -S @var{total switch statements} Generate 1 or more C @code{switch} statement rather than use a large, (and potentially sparse) static array. Although the exact time and space savings of this approach vary according to your C compiler's degree of optimization, this method often results in smaller and faster code. @end table @end itemize If the @samp{-t}, @samp{-S}, and @samp{-p} options are omitted the default action is to generate a @code{char *} array containing the keys, together with additional null strings used for padding the array. By experimenting with the various input and output options, and timing the resulting C code, you can determine the best option choices for different keyword set characteristics. @node Options, Bugs, Description, Top @chapter Options to the @code{gperf} Utility There are @emph{many} options to @code{gperf}. They were added to make the program more convenient for use with real applications. ``On-line'' help is readily available via the @samp{-h} option. Other options include: @itemize @bullet @table @samp @item -a Generate ANSI Standard C code using function prototypes. The default is to use ``classic'' K&R C function declaration syntax. @item -c Generates C code that uses the @code{strncmp} function to perform string comparisons. The default action is to use @code{strcmp}. @item -C Makes the contents of all generated lookup tables constant, @emph{i.e.}, ``readonly.'' Many compilers can generate more efficient code for this by putting the tables in readonly memory. @item -d Enables the debugging option. This produces verbose diagnostics to ``standard error'' when @code{gperf} is executing. It is useful both for maintaining the program and for determining whether a given set of options is actually speeding up the search for a solution. Some useful information is dumped at the end of the program when the @samp{-d} option is enabled. @item -D Handle keywords whose key position sets hash to duplicate values. Duplicate hash values occur for two reasons: @itemize @bullet @item Since @code{gperf} does not backtrack it is possible for it to process all your input keywords without finding a unique mapping for each word. However, frequently only a very small number of duplicates occur, and the majority of keys still require one probe into the table. @item Sometimes a set of keys may have the same names, but possess different attributes. With the -D option @code{gperf} treats all these keys as part of an equivalence class and generates a perfect hash function with multiple comparisons for duplicate keys. It is up to you to completely disambiguate the keywords by modifying the generated C code. However, @code{gperf} helps you out by organizing the output. @end itemize Option @samp{-D} is extremely useful for certain large or highly redundant keyword sets, @emph{i.e.}, assembler instruction opcodes. Using this option usually means that the generated hash function is no longer perfect. On the other hand, it permits @code{gperf} to work on keyword sets that it otherwise could not handle. @item -e @var{keyword delimiter list} Allows the user to provide a string containing delimiters used to separate keywords from their attributes. The default is ",\n". This option is essential if you want to use keywords that have embedded commas or newlines. One useful trick is to use -e'TAB', where TAB is the literal tab character. @item -E Define constant values using an enum local to the lookup function rather than with #defines. This also means that different lookup functions can reside in the same file. Thanks to James Clark (jjc at ai.mit.edu). @item -f @var{iteration amount} Generate the perfect hash function ``fast.'' This decreases @code{gperf}'s running time at the cost of minimizing generated table-size. The iteration amount represents the number of times to iterate when resolving a collision. `0' means `iterate by the number of keywords. This option is probably most useful when used in conjunction with options @samp{-D} and/or @samp{-S} for @emph{large} keyword sets. @item -g Assume a GNU compiler, @emph{e.g.}, @code{g++} or @code{gcc}. This makes all generated routines use the ``inline'' keyword to remove the cost of function calls. Note that @samp{-g} does @emph{not} imply @samp{-a}, since other non-ANSI C compilers may have provisions for a function @code{inline} feature. @item -G Generate the static table of keywords as a static global variable, rather than hiding it inside of the lookup function (which is the default behavior). @item -h Prints a short summary on the meaning of each program option. Aborts further program execution. @item -H @var{hash function name} Allows you to specify the name for the generated hash function. Default name is `hash.' This option permits the use of two hash tables in the same file. @item -i @var{initial value} Provides an initial @var{value} for the associate values array. Default is 0. Increasing the initial value helps inflate the final table size, possibly leading to more time efficient keyword lookups. Note that this option is not particularly useful when @samp{-S} is used. Also, @samp{-i} is overriden when the @samp{-r} option is used. @item -j @var{jump value} Affects the ``jump value,'' @emph{i.e.}, how far to advance the associated character value upon collisions. @var{Jump value} is rounded up to an odd number, the default is 5. If the @var{jump value} is 0 @code{gper f} jumps by random amounts. @item -k @var{keys} Allows selection of the character key positions used in the keywords' hash function. The allowable choices range between 1-126, inclusive. The positions are separated by commas, @emph{e.g.}, @samp{-k 9,4,13,14}; ranges may be used, @emph{e.g.}, @samp{-k 2-7}; and positions may occur in any order. Furthermore, the meta-character '*' causes the generated hash function to consider @strong{all} character positions in each key, whereas '$' instructs the hash function to use the ``final character'' of a key (this is the only way to use a character position greater than 126, incidentally). For instance, the option @samp{-k 1,2,4,6-10,'$'} generates a hash function that considers positions 1,2,4,6,7,8,9,10, plus the last character in each key (which may differ for each key, obviously). Keys with length less than the indicated key positions work properly, since selected key positions exceeding the key length are simply not referenced in the hash function. @item -K @var{key name} By default, the program assumes the structure component identifier for the keyword is ``name.'' This option allows an arbitrary choice of identifier for this component, although it still must occur as the first field in your supplied @code{struct}. @item -l Compare key lengths before trying a string comparison. This might cut down on the number of string comparisons made during the lookup, since keys with different lengths are never compared via @code{strcmp}. However, using @samp{-l} might greatly increase the size of the generated C code if the lookup table range is large (which implies that the switch option @samp{-S} is not enabled), since the length table contains as many elements as there are entries in the lookup table. @item -L @var{generated language name} Instructs @code{gperf} to generate code in the language specified by the option's argument. Languages handled are currently C++ and C. The default is C. @item -n Instructs the generator not to include the length of a keyword when computing its hash value. This may save a few assembly instructions in the generated lookup table. @item -N @var{lookup function name} Allows you to specify the name for the generated lookup function. Default name is `in_word_set.' This option permits completely automatic generation of perfect hash functions, especially when multiple generated hash functions are used in the same application. @item -o Reorders the keywords by sorting the keywords so that frequently occuring key position set components appear first. A second reordering pass follows so that keys with ``already determined values'' are placed towards the front of the keylist. This may decrease the time required to generate a perfect hash function for many keyword sets, and also produce more minimal perfect hash functions. The reason for this is that the reordering helps prune the search time by handling inevitable collisions early in the search process. On the other hand, if the number of keywords is @emph{very} large using @samp{-o} may @emph{increase} @code{gperf}'s execution time, since collisions will begin earlier and continue throughout the remainder of keyword processing. See Cichelli's paper from the January 1980 Communications of the ACM for details. @item -p Changes the return value of the generated function @code{in_word_set} from boolean (@emph{i.e.}, 0 or 1), to either type ``pointer to user-defined struct,'' (if the @samp{-t} option is enabled), or simply to @code{char *}, if @samp{-t} is not enabled. This option is most useful when the @samp{-t} option (allowing user-defined structs) is used. For example, it is possible to automatically generate the GNU C reserved word lookup routine with the options @samp{-p} and @samp{-t}. @item -r Utilizes randomness to initialize the associated values table. This frequently generates solutions faster than using deterministic initialization (which starts all associated values at 0). Furthermore, using the randomization option generally increases the size of the table. If @code{gperf} has difficultly with a certain keyword set try using @samp{-r} or @samp{-D}. @item -s @var{size-multiple} Affects the size of the generated hash table. The numeric argument for this option indicates ``how many times larger or smaller'' the maximum associated value range should be, in relationship to the number of keys. If the @var{size-multiple} is negative the maximum associated value is calculated by @emph{dividing} it into the total number of keys. For example, a value of 3 means ``allow the maximum associated value to be about 3 times larger than the number of input keys.'' Conversely, a value of -3 means ``allow the maximum associated value to be about 3 times smaller than the number of input keys.'' Negative values are useful for limiting the overall size of the generated hash table, though this usually increases the number of duplicate hash values. If `generate switch' option @samp{-S} is @emph{not} enabled, the maximum associated value influences the static array table size, and a larger table should decrease the time required for an unsuccessful search, at the expense of extra table space. The default value is 1, thus the default maximum associated value about the same size as the number of keys (for efficiency, the maximum associated value is always rounded up to a power of 2). The actual table size may vary somewhat, since this technique is essentially a heuristic. In particular, setting this value too high slows down @code{gperf}'s runtime, since it must search through a much larger range of values. Judicious use of the @samp{-f} option helps alleviate this overhead, however. @item -S @var{total switch statements} Causes the generated C code to use a @code{switch} statement scheme, rather than an array lookup table. This can lead to a reduction in both time and space requirements for some keyfiles. The argument to this option determines how many @code{switch} statements are generated. A value of 1 generates 1 @code{switch} containing all the elements, a value of 2 generates 2 tables with 1/2 the elements in each @code{switch}, etc. This is useful since many C compilers cannot correctly generate code for large @code{switch} statements. This option was inspired in part by Keith Bostic's original C program. @item -t Allows you to include a @code{struct} type declaration for generated code. Any text before a pair of consecutive %% is consider part of the type declaration. Key words and additional fields may follow this, one group of fields per line. A set of examples for generating perfect hash tables and functions for Ada, C, and G++, Pascal, and Modula 2 and 3 reserved words are distributed with this release. @item -T Prevents the transfer of the type declaration to the output file. Use this option if the type is already defined elsewhere. @item -v Prints out the current version number. @item -Z @var{class name} Allow user to specify name of generated C++ class. Default name is @code{Perfect_Hash}. @end table @end itemize @node Bugs, Projects, Options, Top @chapter Known Bugs and Limitations with @code{gperf} The following are some limitations with the current release of @code{gperf}: @itemize @bullet @item The @code{gperf} utility is tuned to execute quickly, and works quickly for small to medium size data sets (around 1000 keywords). It is extremely useful for maintaining perfect hash functions for compiler keyword sets. Several recent enhancements now enable @code{gperf} to work efficiently on much larger keyword sets (over 15,000 keywords). When processing large keyword sets it helps greatly to have over 8 megs of RAM. However, since @code{gperf} does not backtrack no guaranteed solution occurs on every run. On the other hand, it is usually easy to obtain a solution by varying the option parameters. In particular, try the @samp{-r} option, and also try changing the default arguments to the @samp{-s} and @samp{-j} options. To @emph{guarantee} a solution, use the @samp{-D} and @samp{-S} options, although the final results are not likely to be a @emph{perfect} hash function anymore! Finally, use the @samp{-f} option if you want @code{gperf} to generate the perfect hash function @emph{fast}, with less emphasis on making it minimal. @item The size of the generate static keyword array can get @emph{extremely} large if the input keyword file is large or if the keywords are quite similar. This tends to slow down the compilation of the generated C code, and @emph{greatly} inflates the object code size. If this situation occurs, consider using the @samp{-S} option to reduce data size, potentially increasing keyword recognition time a negligible amount. Since many C compilers cannot correctly generated code for large switch statements it is important to qualify the @var{-S} option with an appropriate numerical argument that controls the number of switch statements generated. @item The maximum number of key positions selected for a given key has an arbitrary limit of 126. This restriction should be removed, and if anyone considers this a problem write me and let me know so I can remove the constraint. @item The C++ source code only compiles correctly with GNU G++, version 1.36 (and hopefully later versions). Porting to AT&T cfront would be tedious, but possible (and desirable). There is also a K&R C version available now. This should compile without change on most BSD systems, but may require a bit of work to run on SYSV, since @code{gperf} uses @var{alloca} in several places. Send mail to schmidt at ics.uci.edu for information. @end itemize @node Projects, Implementation, Bugs, Top @chapter Things Still Left to Do It should be ``relatively'' easy to replace the current perfect hash function algorithm with a more exhaustive approach; the perfect hash module is essential independent from other program modules. Additional worthwhile improvements include: @itemize @bullet @item Make the algorithm more robust. At present, the program halts with an error diagnostic if it can't find a direct solution and the @samp{-D} option is not enabled. A more comprehensive, albeit computationally expensive, approach would employ backtracking or enable alternative options and retry. It's not clear how helpful this would be, in general, since most search sets are rather small in practice. @item Another useful extension involves modifying the program to generate ``minimal'' perfect hash functions (under certain circumstances, the current version can be rather extravagant in the generated table size). Again, this is mostly of theoretical interest, since a sparse table often produces faster lookups, and use of the @samp{-S} @code{switch} option can minimize the data size, at the expense of slightly longer lookups (note that the gcc compiler generally produces good code for @code{switch} statements, reducing the need for more complex schemes). @item In addition to improving the algorithm, it would also be useful to generate a C++ class or Ada package as the code output, in addition to the current C routines. @end itemize @node Implementation, Bibliography, Projects, Top @chapter Implementation Details of GNU @code{gperf} A paper describing the high-level description of the data structures and algorithms used to implement @code{gperf} will soon be available. This paper is useful not only from a maintenance and enhancement perspective, but also because they demonstrate several clever and useful programming techniques, @emph{e.g.}, `Iteration Number' boolean arrays, double hashing, a ``safe'' and efficient method for reading arbitrarily long input from a file, and a provably optimal algorithm for simultaneously determining both the minimum and maximum elements in a list. @page @node Bibliography, , Implementation, Top @chapter Bibliography [1] Chang, C.C.: @i{A Scheme for Constructing Ordered Minimal Perfect Hashing Functions} Information Sciences 39(1986), 187-195. [2] Cichelli, Richard J. @i{Author's Response to ``On Cichelli's Minimal Perfec t Hash Functions Method''} Communications of the ACM, 23, 12(December 1980), 729. [3] Cichelli, Richard J. @i{Minimal Perfect Hash Functions Made Simple} Communications of the ACM, 23, 1(January 1980), 17-19. [4] Cook, C. R. and Oldehoeft, R.R. @i{A Letter Oriented Minimal Perfect Hashing Function} SIGPLAN Notices, 17, 9(September 1982), 18-27. [5] Cormack, G. V. and Horspool, R. N. S. and Kaiserwerth, M. @i{Practical Perfect Hashing} Computer Journal, 28, 1(January 1985), 54-58. [6] Jaeschke, G. @i{Reciprocal Hashing: A Method for Generating Minimal Perfect Hashing Functions} Communications of the ACM, 24, 12(December 1981), 829-833. [7] Jaeschke, G. and Osterburg, G. @i{On Cichelli's Minimal Perfect Hash Functions Method} Communications of the ACM, 23, 12(December 1980), 728-729. [8] Sager, Thomas J. @i{A Polynomial Time Generator for Minimal Perfect Hash Functions} Communications of the ACM, 28, 5(December 1985), 523-532 [9] Schmidt, Douglas C. @i{GPERF: A Perfect Hash Function Generator} Second USENIX C++ Conference Proceedings, April 1990. [10] Sebesta, R.W. and Taylor, M.A. @i{Minimal Perfect Hash Functions for Reserved Word Lists} SIGPLAN Notices, 20, 12(September 1985), 47-53. [11] Sprugnoli, R. @i{Perfect Hashing Functions: A Single Probe Retrieving Method for Static Sets} Communications of the ACM, 20 11(November 1977), 841-850. [12] Stallman, Richard M. @i{Using and Porting GNU CC} Free Software Foundation, 1988. [13] Stroustrup, Bjarne @i{The C++ Programming Language.} Addison-Wesley, 1986. [14] Tiemann, Michael D. @i{User's Guide to GNU C++} Free Software Foundation, 1989. @contents @bye ace-8.0.4+dfsg.orig/apps/gperf/tests/0000755000175000017500000000000015046037655016406 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/gperf/tests/gplus.gperf0000644000175000017500000000403315027201773020556 0ustar sudipsudip%{ /* Command-line: gperf -p -j1 -o -t -N is_reserved_word -k1,4,$ gplus.gperf */ %} struct resword { const char *name; short token; enum rid rid;}; %% __alignof, ALIGNOF, NORID __alignof__, ALIGNOF, NORID __asm, ASM, NORID __asm__, ASM, NORID __attribute, ATTRIBUTE, NORID __attribute__, ATTRIBUTE, NORID __const, TYPE_QUAL, RID_CONST __const__, TYPE_QUAL, RID_CONST __inline, SCSPEC, RID_INLINE __inline__, SCSPEC, RID_INLINE __signed, TYPESPEC, RID_SIGNED __signed__, TYPESPEC, RID_SIGNED __typeof, TYPEOF, NORID __typeof__, TYPEOF, NORID __volatile, TYPE_QUAL, RID_VOLATILE __volatile__, TYPE_QUAL, RID_VOLATILE all, ALL, NORID /* Extension */, except, EXCEPT, NORID /* Extension */, exception, AGGR, RID_EXCEPTION /* Extension */, raise, RAISE, NORID /* Extension */, raises, RAISES, NORID /* Extension */, reraise, RERAISE, NORID /* Extension */, try, TRY, NORID /* Extension */, asm, ASM, NORID, auto, SCSPEC, RID_AUTO, break, BREAK, NORID, case, CASE, NORID, catch, CATCH, NORID, char, TYPESPEC, RID_CHAR, class, AGGR, RID_CLASS, const, TYPE_QUAL, RID_CONST, continue, CONTINUE, NORID, default, DEFAULT, NORID, delete, DELETE, NORID, do, DO, NORID, double, TYPESPEC, RID_DOUBLE, dynamic, DYNAMIC, NORID, else, ELSE, NORID, enum, ENUM, NORID, extern, SCSPEC, RID_EXTERN, float, TYPESPEC, RID_FLOAT, for, FOR, NORID, friend, SCSPEC, RID_FRIEND, goto, GOTO, NORID, if, IF, NORID, inline, SCSPEC, RID_INLINE, int, TYPESPEC, RID_INT, long, TYPESPEC, RID_LONG, new, NEW, NORID, operator, OPERATOR, NORID, overload, OVERLOAD, NORID, private, PRIVATE, NORID, protected, PROTECTED, NORID, public, PUBLIC, NORID, register, SCSPEC, RID_REGISTER, return, RETURN, NORID, short, TYPESPEC, RID_SHORT, signed, TYPESPEC, RID_SIGNED, sizeof, SIZEOF, NORID, static, SCSPEC, RID_STATIC, struct, AGGR, RID_RECORD, switch, SWITCH, NORID, this, THIS, NORID, typedef, SCSPEC, RID_TYPEDEF, typeof, TYPEOF, NORID, union, AGGR, RID_UNION, unsigned, TYPESPEC, RID_UNSIGNED, virtual, SCSPEC, RID_VIRTUAL, void, TYPESPEC, RID_VOID, volatile, TYPE_QUAL, RID_VOLATILE, while, WHILE, NORID, ace-8.0.4+dfsg.orig/apps/gperf/tests/c.exp0000644000175000017500000000110615027201773017335 0ustar sudipsudipin word set if in word set do in word set int in word set for in word set case in word set char in word set auto in word set goto in word set else in word set long in word set void in word set enum in word set float in word set short in word set union in word set break in word set while in word set const in word set double in word set static in word set extern in word set struct in word set return in word set sizeof in word set switch in word set signed in word set typedef in word set default in word set unsigned in word set continue in word set register in word set volatile ace-8.0.4+dfsg.orig/apps/gperf/tests/adadefs.gperf0000644000175000017500000000073115027201773021014 0ustar sudipsudipboolean character constraint_error false float integer natural numeric_error positive program_error storage_error string tasking_error true address aft base callable constrained count delta digits emax epsilon first firstbit fore image large last lastbit length machine_emax machine_emin machine_mantissa machine_overflows machine_radix machine_rounds mantissa pos position pred range safe_emax safe_large safe_small size small storage_size succ terminated val value width ace-8.0.4+dfsg.orig/apps/gperf/tests/corba.exp0000644000175000017500000000124215027201773020202 0ustar sudipsudipin word set any in word set module in word set raises in word set readonly in word set attribute in word set exception in word set context in word set interface in word set const in word set typedef in word set struct in word set enum in word set string in word set wstring in word set sequence in word set union in word set switch in word set case in word set default in word set float in word set double in word set long in word set short in word set unsigned in word set char in word set wchar in word set boolean in word set octet in word set void in word set native in word set TRUE in word set FALSE in word set inout in word set in in word set out in word set oneway ace-8.0.4+dfsg.orig/apps/gperf/tests/ada-pred.exp0000644000175000017500000000214115027201773020570 0ustar sudipsudipin word set boolean in word set character in word set constraint_error in word set false in word set float in word set integer in word set natural in word set numeric_error in word set positive in word set program_error in word set storage_error in word set string in word set tasking_error in word set true in word set address in word set aft in word set base in word set callable in word set constrained in word set count in word set delta in word set digits in word set emax in word set epsilon in word set first in word set firstbit in word set fore in word set image in word set large in word set last in word set lastbit in word set length in word set machine_emax in word set machine_emin in word set machine_mantissa in word set machine_overflows in word set machine_radix in word set machine_rounds in word set mantissa in word set pos in word set position in word set pred in word set range in word set safe_emax in word set safe_large in word set safe_small in word set size in word set small in word set storage_size in word set succ in word set terminated in word set val in word set value in word set width ace-8.0.4+dfsg.orig/apps/gperf/tests/idl.exp0000644000175000017500000000027615027201773017672 0ustar sudipsudipin word set set in word set _is_a in word set destroy in word set get in word set _get_width in word set _set_width in word set _get_height in word set _set_height in word set _non_existent ace-8.0.4+dfsg.orig/apps/gperf/tests/modula3.gperf0000644000175000017500000000114015027201773020764 0ustar sudipsudipAND ARRAY BEGIN BITS BY CASE CONST DIV DO ELSE ELSIF END EVAL EXCEPT EXCEPTION EXIT EXPORTS FINALLY FOR FROM IF IMPORT INTERFACE IN INLINE LOCK METHODS MOD MODULE NOT OBJECT OF OR PROCEDURE RAISES READONLY RECORD REF REPEAT RETURN SET THEN TO TRY TYPE TYPECASE UNSAFE UNTIL UNTRACED VALUE VAR WHILE WITH and array begin bits by case const div do else elsif end eval except exception exit exports finally for from if import interface in inline lock methods mod module not object of or procedure raises readonly record ref repeat return set then to try type typecase unsafe until untraced value var while with ace-8.0.4+dfsg.orig/apps/gperf/tests/tao.gperf0000644000175000017500000000045615027201773020214 0ustar sudipsudip_is_a _non_existent _interface ackConfBasData ackConfMosData ackConfTwmData ackConfArchData ackConfVonData ackConfFftData ackConfSosData ackConfSscData ackConfCsData ackConfR10Data ackConfR11Data ackConfR12Data ackConfR13Data ackConfR14Data ackConfR15Data shutdown transferTriggerDb transferTriggerTdc ace-8.0.4+dfsg.orig/apps/gperf/tests/gperf_test.mpb0000644000175000017500000000055115027201773021242 0ustar sudipsudip// -*- MPC -*- project: aceexe, crosscompile { after += gperf avoids += uses_wchar Define_Custom(GPERF) { command = $(ACE_ROOT)/bin/ace_gperf libpath += $(ACE_ROOT)/lib output_option = > inputext = .gperf source_outputext = .cpp keyword gperf_cmd = command } Source_Files { test.cpp } } ace-8.0.4+dfsg.orig/apps/gperf/tests/tao.exp0000644000175000017500000000105215027201773017676 0ustar sudipsudipin word set _is_a in word set _non_existent in word set _interface in word set ackConfBasData in word set ackConfMosData in word set ackConfTwmData in word set ackConfArchData in word set ackConfVonData in word set ackConfFftData in word set ackConfSosData in word set ackConfSscData in word set ackConfCsData in word set ackConfR10Data in word set ackConfR11Data in word set ackConfR12Data in word set ackConfR13Data in word set ackConfR14Data in word set ackConfR15Data in word set shutdown in word set transferTriggerDb in word set transferTriggerTdc ace-8.0.4+dfsg.orig/apps/gperf/tests/c.gperf0000644000175000017500000000030615027201773017645 0ustar sudipsudipif do int for case char auto goto else long void enum float short union break while const double static extern struct return sizeof switch signed typedef default unsigned continue register volatile ace-8.0.4+dfsg.orig/apps/gperf/tests/ada.gperf0000644000175000017500000000055615027201773020157 0ustar sudipsudipelse exit terminate type raise range reverse declare end record exception not then return separate select digits renames subtype elsif function for package procedure private while when new entry delay case constant at abort accept and delta access abs pragma array use out do others of or all limited loop null task in is if rem mod begin body xor goto generic with ace-8.0.4+dfsg.orig/apps/gperf/tests/modula2.gperf0000644000175000017500000000034115027201773020765 0ustar sudipsudipAND ARRAY BEGIN BY CASE CONST DEFINITION DIV DO ELSE ELSIF END EXIT EXPORT FOR FROM IF IMPLEMENTATION IMPORT IN LOOP MOD MODULE NOT OF OR POINTER PROCEDURE QUALIFIED RECORD REPEAT RETURN SET THEN TO TYPE UNTIL VAR WHILE WITH ace-8.0.4+dfsg.orig/apps/gperf/tests/idl.gperf0000644000175000017500000000012215027201773020167 0ustar sudipsudipset _is_a destroy get _get_width _set_width _get_height _set_height _non_existent ace-8.0.4+dfsg.orig/apps/gperf/tests/cpp-res.exp0000644000175000017500000000253015027201773020466 0ustar sudipsudipin word set and in word set and_eq in word set asm in word set auto in word set bitand in word set bitor in word set bool in word set break in word set case in word set catch in word set char in word set class in word set compl in word set const in word set const_cast in word set continue in word set default in word set delete in word set do in word set double in word set dynamic_cast in word set else in word set enum in word set explicit in word set extern in word set false in word set float in word set for in word set friend in word set goto in word set if in word set inline in word set int in word set long in word set mutable in word set namespace in word set new in word set not in word set not_eq in word set operator in word set or in word set or_eq in word set private in word set protected in word set public in word set register in word set reinterpret_cast in word set return in word set short in word set signed in word set sizeof in word set static in word set static_cast in word set struct in word set switch in word set template in word set this in word set throw in word set true in word set try in word set typedef in word set typeid in word set typename in word set union in word set unsigned in word set using in word set virtual in word set void in word set volatile in word set wchar_t in word set while in word set xor in word set xor_eq ace-8.0.4+dfsg.orig/apps/gperf/tests/cpp.gperf0000644000175000017500000000075415027201773020214 0ustar sudipsudipand and_eq asm auto bitand bitor bool break case catch char class compl const const_cast continue default delete do double dynamic_cast else enum explicit extern false float for friend goto if inline int long mutable namespace new not not_eq operator or or_eq private protected public register reinterpret_cast return short signed sizeof static static_cast struct switch template this throw true try typedef typeid typename union unsigned using virtual void volatile wchar_t while xor xor_eq ace-8.0.4+dfsg.orig/apps/gperf/tests/ada-res.exp0000644000175000017500000000214215027201773020430 0ustar sudipsudipin word set else in word set exit in word set terminate in word set type in word set raise in word set range in word set reverse in word set declare in word set end in word set record in word set exception in word set not in word set then in word set return in word set separate in word set select in word set digits in word set renames in word set subtype in word set elsif in word set function in word set for in word set package in word set procedure in word set private in word set while in word set when in word set new in word set entry in word set delay in word set case in word set constant in word set at in word set abort in word set accept in word set and in word set delta in word set access in word set abs in word set pragma in word set array in word set use in word set out in word set do in word set others in word set of in word set or in word set all in word set limited in word set loop in word set null in word set task in word set in in word set is in word set if in word set rem in word set mod in word set begin in word set body in word set xor in word set goto in word set generic in word set with ace-8.0.4+dfsg.orig/apps/gperf/tests/corba.gperf0000644000175000017500000000036215027201773020513 0ustar sudipsudipany module raises readonly attribute exception context interface const typedef struct enum string wstring sequence union switch case default float double long short unsigned char wchar boolean octet void native TRUE FALSE inout in out oneway ace-8.0.4+dfsg.orig/apps/gperf/tests/makeinfo.gperf0000644000175000017500000000570115027201773021220 0ustar sudipsudipCOMMAND; %% !, cm_force_sentence_end, false ', insert_self, false *, cm_asterisk, false ., cm_force_sentence_end, false :, cm_force_abbreviated_whitespace, false ?, cm_force_sentence_end, false @, insert_self, false TeX, cm_TeX, true `, insert_self, false appendix, cm_appendix, false appendixsec, cm_appendixsec, false appendixsubsec, cm_appendixsubsec, false asis, cm_asis, true b, cm_bold, true br, cm_br, false bullet, cm_bullet, true bye, cm_bye, false c, cm_comment, false center, cm_center, false chapter, cm_chapter, false cindex, cm_cindex, false cite, cm_cite, true code, cm_code, true comment, cm_comment, false contents, do_nothing, false copyright, cm_copyright, true ctrl, cm_ctrl, true defcodeindex, cm_defindex, false defindex, cm_defindex, false dfn, cm_dfn, true display, cm_display, false dots, cm_dots, true emph, cm_emph, true end, cm_end, false enumerate, cm_enumerate, false equiv, cm_equiv, true error, cm_error, true example, cm_example, false exdent, cm_exdent, false expansion, cm_expansion, true file, cm_file, true findex, cm_findex, false format, cm_format, false group, cm_group, false i, cm_italic, true iappendix, cm_appendix, false iappendixsec, cm_appendixsec, false iappendixsubsec, cm_appendixsubsec, false ichapter, cm_chapter, false ifinfo, cm_ifinfo, false iftex, cm_iftex, false ignore, cm_ignore, false include, cm_include, false inforef, cm_inforef, true input, cm_include, false isection, cm_section, false isubsection, cm_subsection, false isubsubsection, cm_subsubsection, false item, cm_item, false itemize, cm_itemize, false itemx, cm_itemx, false iunnumbered, cm_unnumbered, false iunnumberedsec, cm_unnumberedsec, false iunnumberedsubsec, cm_unnumberedsubsec, false kbd, cm_kbd, true key, cm_key, true kindex, cm_kindex, false lisp, cm_lisp, false menu, cm_menu minus, cm_minus, true need, cm_need, false node, cm_node, false noindent, cm_noindent, false page, do_nothing, false pindex, cm_pindex, false point, cm_point, true print, cm_print, true printindex, cm_printindex, false pxref, cm_pxref, true quotation, cm_quotation, false r, cm_roman, true ref, cm_xref, true refill, cm_refill, false result, cm_result, true samp, cm_samp, true sc, cm_sc, true section, cm_section, false setchapternewpage, cm_setchapternewpage, false setfilename, cm_setfilename, false settitle, cm_settitle, false smallexample, cm_smallexample, false sp, cm_sp, false strong, cm_strong, true subsection, cm_subsection, false subsubsection, cm_subsubsection, false summarycontents, do_nothing, false syncodeindex, cm_synindex, false synindex, cm_synindex, false t, cm_title, true table, cm_table, false tex, cm_tex, false tindex, cm_tindex, false titlepage, cm_titlepage, false unnumbered, cm_unnumbered, false unnumberedsec, cm_unnumberedsec, false unnumberedsubsec, cm_unnumberedsubsec, false var, cm_var, true vindex, cm_vindex, false w, cm_w, true xref, cm_xref, true {, insert_self, false }, insert_self, false infoinclude, cm_infoinclude, false footnote, cm_footnote, false ace-8.0.4+dfsg.orig/apps/gperf/tests/modula.exp0000644000175000017500000000353015027201773020377 0ustar sudipsudipin word set AND in word set ARRAY in word set BEGIN in word set BITS in word set BY in word set CASE in word set CONST in word set DIV in word set DO in word set ELSE in word set ELSIF in word set END in word set EVAL in word set EXCEPT in word set EXCEPTION in word set EXIT in word set EXPORTS in word set FINALLY in word set FOR in word set FROM in word set IF in word set IMPORT in word set INTERFACE in word set IN in word set INLINE in word set LOCK in word set METHODS in word set MOD in word set MODULE in word set NOT in word set OBJECT in word set OF in word set OR in word set PROCEDURE in word set RAISES in word set READONLY in word set RECORD in word set REF in word set REPEAT in word set RETURN in word set SET in word set THEN in word set TO in word set TRY in word set TYPE in word set TYPECASE in word set UNSAFE in word set UNTIL in word set UNTRACED in word set VALUE in word set VAR in word set WHILE in word set WITH in word set and in word set array in word set begin in word set bits in word set by in word set case in word set const in word set div in word set do in word set else in word set elsif in word set end in word set eval in word set except in word set exception in word set exit in word set exports in word set finally in word set for in word set from in word set if in word set import in word set interface in word set in in word set inline in word set lock in word set methods in word set mod in word set module in word set not in word set object in word set of in word set or in word set procedure in word set raises in word set readonly in word set record in word set ref in word set repeat in word set return in word set set in word set then in word set to in word set try in word set type in word set typecase in word set unsafe in word set until in word set untraced in word set value in word set var in word set while in word set with ace-8.0.4+dfsg.orig/apps/gperf/tests/pascal.exp0000644000175000017500000000115415027201773020361 0ustar sudipsudipin word set with in word set array in word set and in word set function in word set case in word set var in word set const in word set until in word set then in word set set in word set record in word set program in word set procedure in word set or in word set packed in word set not in word set nil in word set label in word set in in word set repeat in word set of in word set goto in word set forward in word set for in word set while in word set file in word set else in word set downto in word set do in word set div in word set to in word set type in word set end in word set mod in word set begin in word set if ace-8.0.4+dfsg.orig/apps/gperf/tests/pascal.gperf0000644000175000017500000000027415027201773020672 0ustar sudipsudipwith array and function case var const until then set record program procedure or packed not nil label in repeat of goto forward for while file else downto do div to type end mod begin if ace-8.0.4+dfsg.orig/apps/gperf/tests/c-parse.gperf0000644000175000017500000000264715027201773020767 0ustar sudipsudip%{ /* Command-line: gperf -p -j1 -i 1 -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */ %} struct resword { const char *name; short token; enum rid rid; }; %% __alignof, ALIGNOF, NORID __alignof__, ALIGNOF, NORID __asm, ASM, NORID __asm__, ASM, NORID __attribute, ATTRIBUTE, NORID __attribute__, ATTRIBUTE, NORID __const, TYPE_QUAL, RID_CONST __const__, TYPE_QUAL, RID_CONST __inline, SCSPEC, RID_INLINE __inline__, SCSPEC, RID_INLINE __signed, TYPESPEC, RID_SIGNED __signed__, TYPESPEC, RID_SIGNED __typeof, TYPEOF, NORID __typeof__, TYPEOF, NORID __volatile, TYPE_QUAL, RID_VOLATILE __volatile__, TYPE_QUAL, RID_VOLATILE asm, ASM, NORID auto, SCSPEC, RID_AUTO break, BREAK, NORID case, CASE, NORID char, TYPESPEC, RID_CHAR const, TYPE_QUAL, RID_CONST continue, CONTINUE, NORID default, DEFAULT, NORID do, DO, NORID double, TYPESPEC, RID_DOUBLE else, ELSE, NORID enum, ENUM, NORID extern, SCSPEC, RID_EXTERN float, TYPESPEC, RID_FLOAT for, FOR, NORID goto, GOTO, NORID if, IF, NORID inline, SCSPEC, RID_INLINE int, TYPESPEC, RID_INT long, TYPESPEC, RID_LONG register, SCSPEC, RID_REGISTER return, RETURN, NORID short, TYPESPEC, RID_SHORT signed, TYPESPEC, RID_SIGNED sizeof, SIZEOF, NORID static, SCSPEC, RID_STATIC struct, STRUCT, NORID switch, SWITCH, NORID typedef, SCSPEC, RID_TYPEDEF typeof, TYPEOF, NORID union, UNION, NORID unsigned, TYPESPEC, RID_UNSIGNED void, TYPESPEC, RID_VOID volatile, TYPE_QUAL, RID_VOLATILE while, WHILE, NORID ace-8.0.4+dfsg.orig/apps/gperf/tests/tests.mpc0000644000175000017500000000734715027201773020255 0ustar sudipsudip// -*- MPC -*- project(cinset): gperf_test { exename = cout verbatim(gnuace, bottom) { all: runtests runtests: cout$(EXEEXT) " @echo "Testing cout" " ./cout -v < c.gperf > cout.out " -diff -b c.exp cout.out" endif # CROSS-COMPILE } GPERF_Files { commandflags += -a -p -c -l -S1 -o c.gperf } Source_Files { c.cpp } } project(adainset): gperf_test { exename = aout verbatim(gnuace, bottom) { all: runtests runtests: aout$(EXEEXT) " @echo "Testing aout" " ./aout -v < ada.gperf > aout.out " -diff -b ada-res.exp aout.out" endif # CROSS-COMPILE } GPERF_Files { commandflags += -a -k1,4,$$ ada.gperf } Source_Files { ada.cpp } } project(cppinset): gperf_test { exename = cppout verbatim(gnuace, bottom) { all: runtests runtests: cppout$(EXEEXT) " @echo "Testing cppout" " ./cppout -v < cpp.gperf > cppout.out " -diff -b cpp-res.exp cppout.out" endif # CROSS-COMPILE } GPERF_Files { commandflags += -a -D cpp.gperf } Source_Files { cpp.cpp } } project(preinset): gperf_test { exename = preout verbatim(gnuace, bottom) { all: runtests runtests: preout$(EXEEXT) " @echo "Testing preout" " ./preout -v < adadefs.gperf > preout.out " -diff -b ada-pred.exp preout.out" endif # CROSS-COMPILE } GPERF_Files { commandflags += -a -p -D -k1,$$ -s 2 -o adadefs.gperf } Source_Files { adadefs.cpp } } project(m3inset): gperf_test { exename = m3out verbatim(gnuace, bottom) { all: runtests runtests: m3out$(EXEEXT) " @echo "Testing m3out" " ./m3out -v < modula3.gperf > m3out.out " -diff -b modula.exp m3out.out" endif # CROSS-COMPILE } GPERF_Files { commandflags += -a -k1,2,$$ modula3.gperf } Source_Files { modula3.cpp } } project(pinset): gperf_test { exename = pout verbatim(gnuace, bottom) { all: runtests runtests: pout$(EXEEXT) " @echo "Testing pout" " ./pout -v < pascal.gperf > pout.out " -diff -b pascal.exp pout.out" endif # CROSS-COMPILE } GPERF_Files { commandflags += -a -o -S2 -p pascal.gperf } Source_Files { pascal.cpp } } project(iinset): gperf_test { exename = iout verbatim(gnuace, bottom) { all: runtests runtests: iout$(EXEEXT) " @echo "Testing iout" " ./iout -v < idl.gperf > iout.out " -diff -b idl.exp iout.out" endif # CROSS-COMPILE } GPERF_Files { commandflags += -m -M -c -C -D -S1 -E -T -a -o -p idl.gperf } Source_Files { idl.cpp } } project(iinset2): gperf_test { exename = iout2 after += iinset verbatim(gnuace, bottom) { all: runtests runtests: iout2$(EXEEXT) " @echo "Testing iout2" " ./iout2 -v < idl.gperf > iout2.out " -diff -b idl.exp iout2.out" endif # CROSS-COMPILE } GPERF_Files { gendir = iout2_gen commandflags += -m -M -c -C -D -E -T -a -o -p idl.gperf } Source_Files { iout2_gen/idl.cpp } } project(tinset): gperf_test { exename = tout verbatim(gnuace, bottom) { all: runtests runtests: tout$(EXEEXT) " @echo "Testing tout" " ./tout -v < corba.gperf > tout.out " -diff -b corba.exp tout.out" endif # CROSS-COMPILE } GPERF_Files { commandflags += -a -o corba.gperf } Source_Files { corba.cpp } } project(taoinset): gperf_test { exename = taoout verbatim(gnuace, bottom) { all: runtests runtests: taoout$(EXEEXT) " @echo "Testing taoout" " ./taoout -v < tao.gperf > taoout.out " -diff -b tao.exp taoout.out" endif # CROSS-COMPILE } GPERF_Files { commandflags += -c -C -D -E -f 0 -a -o tao.gperf } Source_Files { tao.cpp } } ace-8.0.4+dfsg.orig/apps/gperf/tests/gpc.gperf0000644000175000017500000000215015027201773020173 0ustar sudipsudip%{ /* ISO Pascal 7185 reserved words. * * For GNU Pascal compiler (GPC) by jtv@hut.fi * * run this through the Doug Schmidt's gperf program * with command * gperf -g -o -j1 -t -p -N is_reserved_word * */ %} struct resword { const char *name; short token; short iclass;}; %% And, AND, PASCAL_ISO Array, ARRAY, PASCAL_ISO Begin, BEGIN_, PASCAL_ISO Case, CASE, PASCAL_ISO Const, CONST, PASCAL_ISO Div, DIV, PASCAL_ISO Do, DO, PASCAL_ISO Downto, DOWNTO, PASCAL_ISO Else, ELSE, PASCAL_ISO End, END, PASCAL_ISO File, FILE_, PASCAL_ISO For, FOR, PASCAL_ISO Function, FUNCTION, PASCAL_ISO Goto, GOTO, PASCAL_ISO If, IF, PASCAL_ISO In, IN, PASCAL_ISO Label, LABEL, PASCAL_ISO Mod, MOD, PASCAL_ISO Nil, NIL, PASCAL_ISO Not, NOT, PASCAL_ISO Of, OF, PASCAL_ISO Or, OR, PASCAL_ISO Packed, PACKED, PASCAL_ISO Procedure, PROCEDURE, PASCAL_ISO Program,PROGRAM,PASCAL_ISO Record, RECORD, PASCAL_ISO Repeat, REPEAT, PASCAL_ISO Set, SET, PASCAL_ISO Then, THEN, PASCAL_ISO To, TO, PASCAL_ISO Type, TYPE, PASCAL_ISO Until, UNTIL, PASCAL_ISO Var, VAR, PASCAL_ISO While, WHILE, PASCAL_ISO With, WITH, PASCAL_ISO ace-8.0.4+dfsg.orig/apps/gperf/tests/test.cpp0000644000175000017500000000146715027201773020072 0ustar sudipsudip// Tests the generated perfect hash function. // The -v option prints diagnostics as to whether a word is in the set // or not. Without -v the program is useful for timing. #include "ace/OS_NS_string.h" #include "ace/OS_NS_stdio.h" static const int MAX_LEN = 80; // Lookup function. const char *in_word_set (const char *str, unsigned int len); int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { int verbose = argc > 1 && ACE_OS::strcmp (argv[1], ACE_TEXT("-v")) == 0 ? 1 : 0; char buf[MAX_LEN]; while (ACE_OS::fgets (buf, sizeof buf, stdin) != 0) { size_t len = ACE_OS::strlen (buf) - 1; buf[len] = '\0'; if (in_word_set (buf, len) && verbose) ACE_OS::printf ("in word set %s\n", buf); else if (verbose) ACE_OS::printf ("NOT in word set %s\n", buf); } return 0; } ace-8.0.4+dfsg.orig/apps/gperf/tests/irc.gperf0000644000175000017500000000351015027201773020200 0ustar sudipsudip%{ extern int m_text(), m_private(), m_who(), m_whois(), m_user(), m_list(); extern int m_topic(), m_invite(), m_channel(), m_version(), m_quit(); extern int m_server(), m_kill(), m_info(), m_links(), m_summon(), m_stats(); extern int m_users(), m_nick(), m_error(), m_help(), m_whoreply(); extern int m_squit(), m_restart(), m_away(), m_die(), m_connect(); extern int m_ping(), m_pong(), m_oper(), m_pass(), m_wall(), m_trace(); extern int m_time(), m_rehash(), m_names(), m_namreply(), m_admin(); extern int m_linreply(), m_notice(), m_lusers(), m_voice(), m_grph(); extern int m_xtra(), m_motd(); %} struct Message { const char *cmd; int (* func)(); int count; int parameters; }; %% NICK, m_nick, 0, 1 MSG, m_text, 0, 1 PRIVMSG, m_private, 0, 2 WHO, m_who, 0, 1 WHOIS, m_whois, 0, 4 USER, m_user, 0, 4 SERVER, m_server, 0, 2 LIST, m_list, 0, 1 TOPIC, m_topic, 0, 1 INVITE, m_invite, 0, 2 CHANNEL, m_channel, 0, 1 VERSION, m_version, 0, 1 QUIT, m_quit, 0, 2 SQUIT, m_squit, 0, 2 KILL, m_kill, 0, 2 INFO, m_info, 0, 1 LINKS, m_links, 0, 1 SUMMON, m_summon, 0, 1 STATS, m_stats, 0, 1 USERS, m_users, 0, 1 RESTART, m_restart, 0, 1 WHOREPLY,m_whoreply, 0, 7 HELP, m_help, 0, 2 ERROR, m_error, 0, 1 AWAY, m_away, 0, 1 DIE, m_die, 0, 1 CONNECT, m_connect, 0, 3 PING, m_ping, 0, 2 PONG, m_pong, 0, 3 OPER, m_oper, 0, 3 PASS, m_pass, 0, 2 WALL, m_wall, 0, 1 TIME, m_time, 0, 1 REHASH, m_rehash, 0, 1 NAMES, m_names, 0, 1 NAMREPLY,m_namreply, 0, 3 ADMIN, m_admin, 0, 1 TRACE, m_trace, 0, 1 LINREPLY,m_linreply, 0, 2 NOTICE, m_notice, 0, 2 LUSERS, m_lusers, 0, 1 VOICE, m_voice, 0, 2 GRPH, m_grph, 0, 2 XTRA, m_xtra, 0, 2 MOTD, m_motd, 0, 2 ace-8.0.4+dfsg.orig/apps/gperf/src/0000755000175000017500000000000015046037655016033 5ustar sudipsudipace-8.0.4+dfsg.orig/apps/gperf/src/Version.cpp0000644000175000017500000000175315027201773020163 0ustar sudipsudip// -*- C++ -*- // Current program version number. /** * Copyright (C) 1989 Free Software Foundation, Inc. * written by Douglas C. Schmidt (d.schmidt@vanderbilt.edu) * * This file is part of GNU GPERF. * * 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 * of the License, 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. */ #include "ace/ACE.h" const char *version_string = "2.8 (ACE version)"; ace-8.0.4+dfsg.orig/apps/gperf/src/Vectors.cpp0000644000175000017500000000214715027201773020161 0ustar sudipsudip// -*- C++ -*- /** * Copyright (C) 1989 Free Software Foundation, Inc. * written by Douglas C. Schmidt (d.schmidt@vanderbilt.edu) * * This file is part of GNU GPERF. * * 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 * of the License, 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. */ #include "Vectors.h" /// Counts occurrences of each key set character. int Vectors::occurrences[ACE_STANDARD_CHARACTER_SET_SIZE]; /// Value associated with each character. int Vectors::asso_values[ACE_STANDARD_CHARACTER_SET_SIZE]; ace-8.0.4+dfsg.orig/apps/gperf/src/Gen_Perf.cpp0000644000175000017500000003223715027201773020224 0ustar sudipsudip// -*- C++ -*- /** * Copyright (C) 1989 Free Software Foundation, Inc. * written by Douglas C. Schmidt (d.schmidt@vanderbilt.edu) * * This file is part of GNU GPERF. * * 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 * of the License, 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. */ #include "Gen_Perf.h" #include "Vectors.h" #include "ace/OS_NS_stdlib.h" #include "ace/OS_NS_time.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_Memory.h" #include "ace/Truncate.h" /// Current release version. extern const char *version_string; /// Reads input keys, possibly applies the reordering heuristic, sets /// the maximum associated value size (rounded up to the nearest power /// of 2), may initialize the associated values array, and determines /// the maximum hash table size. Note: using the random numbers is /// often helpful, though not as deterministic, of course! Gen_Perf::Gen_Perf () : max_hash_value (0), fewest_collisions (0), num_done (1), union_set (0) { } /// Merge two disjoint hash key multisets to form the ordered disjoint /// union of the sets. (In a multiset, an element can occur multiple /// times). Precondition: both set1 and set2 must be /// ordered. Returns the length of the combined set. int Gen_Perf::compute_disjoint_union (char *set1, char *set2, char *set3) { char *base = set3; while (*set1 && *set2) if (*set1 == *set2) set1++, set2++; else { *set3 = *set1 < *set2 ? *set1++ : *set2++; if (set3 == base || *set3 != *(set3 - 1)) set3++; } while (*set1) { *set3 = *set1++; if (set3 == base || *set3 != *(set3 - 1)) set3++; } while (*set2) { *set3 = *set2++; if (set3 == base || *set3 != *(set3 - 1)) set3++; } *set3 = '\0'; return ACE_Utils::truncate_cast (set3 - base); } /// Sort the UNION_SET in increasing frequency of occurrence. This /// speeds up later processing since we may assume the resulting set /// (Set_3, in this case), is ordered. Uses insertion sort, since the /// UNION_SET is typically short. void Gen_Perf::sort_set (char *union_set, int len) { for (int i = 0, j = len - 1; i < j; i++) { int curr, tmp; for (curr = i + 1, tmp = (int) union_set[curr]; curr > 0 && Vectors::occurrences[tmp] < Vectors::occurrences[(int) union_set[curr - 1]]; curr--) union_set[curr] = union_set[curr - 1]; union_set[curr] = static_cast (tmp); } } /// Generate a keysig's hash value. int Gen_Perf::hash (List_Node *key_node) { int sum = option[NOLENGTH] ? 0 : key_node->length; for (char *ptr = key_node->keysig; *ptr; ptr++) sum += Vectors::asso_values[(int) *ptr]; key_node->hash_value = sum; return sum; } /// Find out how character value change affects successfully hash /// items. Returns FALSE if no other hash values are affected, else /// returns TRUE. Note that because Option.Get_Asso_Max is a power of /// two we can guarantee that all legal Vectors::Asso_Values are /// visited without repetition since Option.Get_Jump was forced to be /// an odd value! inline int Gen_Perf::affects_prev (char c, List_Node *curr) { int const original_char = Vectors::asso_values[(int) c]; int total_iterations = 0; if (!option[FAST]) { total_iterations = option.asso_max (); } else { total_iterations = option.iterations (); if (total_iterations == 0) total_iterations = this->key_list.keyword_list_length (); } // Try all legal associated values. for (int i = total_iterations - 1; i >= 0; --i) { Vectors::asso_values[(int) c] = (Vectors::asso_values[(int) c] + (option.jump () ? option.jump () : ACE_OS::rand ())) & (option.asso_max () - 1); // Iteration Number array is a win, O(1) intialization time! this->char_search.reset (); int collisions = 0; // See how this asso_value change affects previous keywords. If // it does better than before we'll take it! for (List_Node *ptr = this->key_list.head; this->char_search.find (this->hash (ptr)) == 0 || ++collisions < fewest_collisions; ptr = ptr->next) { if (ptr == curr) { fewest_collisions = collisions; if (option[DEBUGGING]) { ACE_DEBUG ((LM_DEBUG, "- resolved after %d iterations", total_iterations - i)); } return 0; } } } // Restore original values, no more tries. Vectors::asso_values[(int) c] = original_char; // If we're this far it's time to try the next character.... return 1; } /// Change a character value, try least-used characters first. int Gen_Perf::change (List_Node *prior, List_Node *curr) { if (option[DEBUGGING]) ACE_DEBUG ((LM_DEBUG, "collision on keyword #%d, prior = \"%C\", curr = \"%C\" hash = %d\n", num_done, prior->key, curr->key, curr->hash_value)); Gen_Perf::sort_set (this->union_set, compute_disjoint_union (prior->keysig, curr->keysig, this->union_set)); // Try changing some values, if change doesn't alter other values // continue normal action. ++fewest_collisions; for (char *temp = union_set; *temp != '\0'; temp++) if (affects_prev (*temp, curr) == 0) { if (option[DEBUGGING]) ACE_DEBUG ((LM_DEBUG, " by changing asso_value['%c'] (char #%d) to %d\n", *temp, temp - union_set + 1, Vectors::asso_values[(int) *temp])); // Good, doesn't affect previous hash values, we'll take it. return 0; } for (List_Node *ptr = this->key_list.head; ptr != curr; ptr = ptr->next) this->hash (ptr); this->hash (curr); if (option[DEBUGGING]) ACE_DEBUG ((LM_DEBUG, "** collision not resolved after %d iterations, %d duplicates remain, continuing...\n", !option[FAST] ? option.asso_max () : option.iterations () ? option.iterations () : this->key_list.keyword_list_length (), fewest_collisions + this->key_list.total_duplicates)); return 0; } int Gen_Perf::open () { if (this->key_list.read_keys () == -1) return -1; if (option[ORDER]) this->key_list.reorder (); int asso_value_max = option.asso_max (); int const non_linked_length = this->key_list.keyword_list_length (); if (asso_value_max == 0) asso_value_max = non_linked_length; else if (asso_value_max > 0) asso_value_max *= non_linked_length; else // if (asso_value_max < 0) asso_value_max = non_linked_length / -asso_value_max; option.asso_max (ACE_POW (asso_value_max)); if (option[RANDOM]) { ACE_OS::srand ((u_int) ACE_OS::time (0)); for (int i = 0; i < ACE_STANDARD_CHARACTER_SET_SIZE; ++i) { Vectors::asso_values[i] = (ACE_OS::rand () & (asso_value_max - 1)); } } else { int const asso_value = option.initial_value (); // Initialize array if user requests non-zero default. if (asso_value) { for (int i = ACE_STANDARD_CHARACTER_SET_SIZE - 1; i >= 0; --i) { Vectors::asso_values[i] = asso_value & (option.asso_max () - 1); } } } this->max_hash_value = this->key_list.max_key_length () + option.asso_max () * option.max_keysig_size (); ACE_NEW_RETURN (this->union_set, char[2 * option.max_keysig_size () + 1], -1); ACE_OS::printf ("/* "); if (option[C]) ACE_OS::printf ("C"); else if (option[CPLUSPLUS]) ACE_OS::printf ("C++"); ACE_OS::printf (" code produced by gperf version %s */\n", version_string); Options::print_options (); if (option[DEBUGGING]) ACE_DEBUG ((LM_DEBUG, "total non-linked keys = %d\n" "total duplicates = %d\n" "maximum associated value is %d\n" "maximum size of generated hash table is %d\n", non_linked_length, this->key_list.total_duplicates, asso_value_max, max_hash_value)); if (this->char_search.open (max_hash_value + 1) == -1) return -1; return 0; } /// For binary search, do normal string sort on the keys, and then /// assign hash values from 0 to N-1. Then go ahead with the normal /// logic that is there for perfect hashing. int Gen_Perf::compute_binary_search () { // Do a string sort. this->key_list.string_sort (); // Assign hash values. List_Node *curr = 0; int hash_value; for (hash_value = 0, curr = this->key_list.head; curr != 0; curr = curr->next, hash_value++) { curr->hash_value = hash_value; } return 0; } int Gen_Perf::compute_linear_search () { // Convert the list of keys to a linear list without // equivalence classes. this->key_list.string_sort (); // Assign hash values. List_Node *curr = 0; int hash_value = 0; for (hash_value = 0, curr = this->key_list.head; curr != 0; curr = curr->next, hash_value++) { curr->hash_value = hash_value; } return 0; } int Gen_Perf::compute_perfect_hash () { List_Node *curr = 0; for (curr = this->key_list.head; curr != 0; curr = curr->next) { this->hash (curr); for (List_Node *ptr = this->key_list.head; ptr != curr; ptr = ptr->next) if (ptr->hash_value == curr->hash_value) { if (this->change (ptr, curr) == -1) return -1; break; } num_done++; } // Make one final check, just to make sure nothing weird happened... this->char_search.reset (); for (curr = this->key_list.head; curr; curr = curr->next) { if (this->char_search.find (this->hash (curr)) != 0) { if (option[DUP]) { // Keep track of the number of "dynamic" links (i.e., keys // that hash to the same value) so that we can use it later // when generating the output. this->key_list.total_duplicates++; } else { // Yow, big problems. we're outta here! ACE_ERROR ((LM_ERROR, "\nInternal error, duplicate value %d:\n" "try options -D or -r, or use new key positions.\n\n", this->hash (curr))); return -1; } } } return 0; } /// Does the hard stuff.... Initializes the Bool Array, and attempts /// to find a perfect function that will hash all the key words without /// getting any duplications. This is made much easier since we aren't /// attempting to generate *minimum* functions, only perfect ones. If /// we can't generate a perfect function in one pass *and* the user /// hasn't enabled the DUP option, we'll inform the user to try the /// randomization option, use -D, or choose alternative key positions. /// The alternatives (e.g., back-tracking) are too time-consuming, i.e, /// exponential in the number of keys. int Gen_Perf::run () { if (this->open () == -1) return 1; if (option[BINARYSEARCH]) { if (this->compute_binary_search () == -1) return 1; } else if (option[LINEARSEARCH]) { if (this->compute_linear_search () == -1) return 1; } else { if (this->compute_perfect_hash () == -1) return 1; // Sorts the key word list by hash value, and then outputs the // list. The generated hash table code is only output if the // early stage of processing turned out O.K. this->key_list.sort (); } this->key_list.output (); return 0; } /// Prints out some diagnostics upon completion. Gen_Perf::~Gen_Perf () { if (option[DEBUGGING]) { ACE_DEBUG ((LM_DEBUG, "\ndumping occurrence and associated values tables\n")); for (int i = 0; i < ACE_STANDARD_CHARACTER_SET_SIZE; i++) if (Vectors::occurrences[i]) ACE_DEBUG ((LM_DEBUG, "Vectors::asso_values[%c] = %6d, Vectors::occurrences[%c] = %6d\n", i, Vectors::asso_values[i], i, Vectors::occurrences[i])); ACE_DEBUG ((LM_DEBUG, "end table dumping\n")); } delete [] this->union_set; } ace-8.0.4+dfsg.orig/apps/gperf/src/List_Node.h0000644000175000017500000000405615027201773020062 0ustar sudipsudip// -*- C++ -*- /** * Copyright (C) 1989 Free Software Foundation, Inc. * written by Douglas C. Schmidt (d.schmidt@vanderbilt.edu) * * This file is part of GNU GPERF. * * 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 * of the License, 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. */ #ifndef LIST_NODE_H #define LIST_NODE_H #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "Options.h" /** * Data and function members for defining values and operations of * a list node. */ class List_Node { public: /// Constructor. List_Node (char *key, int len); List_Node (const List_Node &) = delete; List_Node (List_Node &&) = delete; List_Node &operator= (const List_Node &) = delete; List_Node &operator= (List_Node &&) = delete; /// Destructor. ~List_Node (); static void sort (char *base, int len); /// TRUE if key has an identical KEY_SET as another key. List_Node *link; /// Points to next element on the list. List_Node *next; /// Each keyword string stored here. char *key; /// Additional information for building hash function. char *rest; /// Set of characters to hash, specified by user. char *keysig; /// Length of the key. int length; /// Hash value for the key. int hash_value; /// A metric for frequency of key set occurrences. int occurrence; /// Position of this node relative to other nodes. int slot; }; #endif /* LIST_NODE_H */ ace-8.0.4+dfsg.orig/apps/gperf/src/Key_List.h0000644000175000017500000001174715027201773017732 0ustar sudipsudip// -*- C++ -*- /** * Copyright (C) 1989 Free Software Foundation, Inc. * written by Douglas C. Schmidt (d.schmidt@vanderbilt.edu) * * This file is part of GNU GPERF. * * 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 * of the License, 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. */ #ifndef KEY_LIST_H #define KEY_LIST_H #include "Options.h" #include "List_Node.h" #include "Vectors.h" /** * Describes a duplicate entry. * * This is used for generating code by the . */ class Duplicate_Entry { public: Duplicate_Entry () = default; Duplicate_Entry (const Duplicate_Entry &) = delete; Duplicate_Entry (Duplicate_Entry &&) = delete; Duplicate_Entry &operator= (const Duplicate_Entry &) = delete; Duplicate_Entry &operator= (Duplicate_Entry &&) = delete; ~Duplicate_Entry () = default; /// Hash value for this particular duplicate set. int hash_value; /// Slot into the main keyword storage array. int slot; /// Number of consecutive duplicates at this slot. int count; }; /** * Data and function member declarations for the keyword list class. * * The key word list is a useful abstraction that keeps track of * various pieces of information that enable that fast generation of * the Gen_Perf.hash function. A Key_List is a singly-linked list * of List_Nodes. */ class Key_List { public: Key_List (); Key_List (const Key_List &) = delete; Key_List (Key_List &&) = delete; Key_List &operator= (const Key_List &) = delete; Key_List &operator= (Key_List &&) = delete; ~Key_List (); int keyword_list_length (); int max_key_length (); void reorder (); void sort (); void string_sort (); int read_keys (); int output (); /// Points to the head of the linked list. List_Node *head; /// Total number of duplicate hash values. int total_duplicates; private: // = Make hash table 10 times larger than # of keyword entries. enum { TABLE_MULTIPLE = 10 }; static int occurrence (List_Node *ptr); static int already_determined (List_Node *ptr); static void determined (List_Node *ptr); // @@ All of the following methods should be factored out and // replaced by the use of the Strategy/Bridge pattern so that we can // easily add new languages. void output_min_max (); void output_switch (int use_keyword_table = 0); void output_keyword_table (); void output_keylength_table (); void output_hash_function (); void output_lookup_function (); int output_binary_search_function(); int output_linear_search_function (); int output_lookup_array (); void output_strcasecmp (); int output_types (); void dump (); char *array_type (); char *save_include_src (); char *special_input (char delimiter); List_Node *merge (List_Node *list1, List_Node *list2); List_Node *merge_sort (List_Node *head); int count_duplicates (List_Node *link, const char *type); void update_lookup_array (int lookup_array[], int i1, int i2, Duplicate_Entry *dup_ptr, int value); /// Pointer to the type for word list. char *array_type_; // Pointer to return type for lookup function. char *return_type; /// Shorthand for user-defined struct tag type. char *struct_tag; /// C source code to be included verbatim. char *include_src; /// Maximum length of the longest keyword. int max_key_len; /// Minimum length of the shortest keyword. int min_key_len; /// Minimum hash value for all keywords. int min_hash_value; /// Maximum hash value for all keywords. int max_hash_value; /// True if sorting by occurrence. int occurrence_sort; /// True if sorting by hash value. int hash_sort; /// True if sorting by key value. int key_sort; /// True if any additional C code is included. int additional_code; /// Length of head's Key_List, not counting duplicates. int list_len; /// Total number of keys, counting duplicates. int total_keys; /// Default type for generated code. static const char *const default_array_type; /// in_word_set return type, by default. static const char *const default_return_type; /// How wide the printed field width must be to contain the maximum /// hash value. static int field_width; /// Sets the slot location for all keysig characters that are now /// determined. static int determined_[ACE_STANDARD_CHARACTER_SET_SIZE]; }; #endif /* KEY_LIST_H */ ace-8.0.4+dfsg.orig/apps/gperf/src/List_Node.cpp0000644000175000017500000001033115027201773020406 0ustar sudipsudip// -*- C++ -*- /** * Copyright (C) 1989 Free Software Foundation, Inc. * written by Douglas C. Schmidt (d.schmidt@vanderbilt.edu) * * This file is part of GNU GPERF. * * 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 * of the License, 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. */ #include "List_Node.h" #include "Vectors.h" #include "ace/OS_NS_ctype.h" #include "ace/Truncate.h" /// Sorts the key set alphabetically to speed up subsequent operation /// Uses insertion sort since the set is probably quite small. inline void List_Node::sort (char *base, int len) { int i, j; for (i = 0, j = len - 1; i < j; ++i) { char tmp; int curr; for (curr = i + 1, tmp = base[curr]; curr > 0 && tmp < base[curr - 1]; --curr) { base[curr] = base[curr - 1]; } base[curr] = tmp; } } /// Initializes a List_Node. This requires obtaining memory for the /// CHAR_SET initializing them using the information stored in the /// KEY_POSITIONS array in Options, and checking for simple errors. /// It's important to note that KEY and REST are both pointers to the /// different offsets into the same block of dynamic memory pointed to /// by parameter K. The data member REST is used to store any /// additional fields of the input file (it is set to the "" string if /// Option[TYPE] is not enabled). This is useful if the user wishes to /// incorporate a lookup structure, rather than just an array of keys. /// Finally, KEY_NUMBER contains a count of the total number of keys /// seen so far. This is used to initialize the INDEX field to some /// useful value. List_Node::List_Node (char *k, int len) : link (0), next (0), key (k), rest (option[TYPE] ? k + len + 1 : const_cast ("")), length (len), slot (0) { char *ptr = new char[(option[ALLCHARS] ? static_cast(len) : option.max_keysig_size ()) + 1]; keysig = ptr; k[len] = '\0'; // Null terminate KEY to separate it from REST. // Lower case if STRCASECMP option is enabled. if (option[STRCASECMP]) for (char *p = k; *p; p++) if (ACE_OS::ace_isupper (*p)) *p = static_cast (ACE_OS::ace_tolower (*p)); if (option[ALLCHARS]) // Use all the character position in the KEY. for (; *k; k++, ptr++) { *ptr = *k; int i = (int) *ptr; ++Vectors::occurrences[i]; } else { // Only use those character positions specified by the user. option.reset (); // Iterate thru the list of key_positions, initializing // occurrences table and keysig (via char * pointer ptr). for (int i; (i = option.get ()) != EOS; ) { if (i == WORD_END) // Special notation for last KEY position, i.e. '$'. *ptr = key[len - 1]; else if (i <= len) // Within range of KEY length, so we'll keep it. *ptr = key[i - 1]; else // Out of range of KEY length, so we'll just skip it. continue; ++Vectors::occurrences[(int) *ptr++]; } // Didn't get any hits and user doesn't want to consider the // keylength, so there are essentially no usable hash positions! if (ptr == keysig && option[NOLENGTH]) ACE_ERROR ((LM_ERROR, "Can't hash keyword %s with chosen key positions.\n%a", key, 1)); } // Terminate this string. *ptr = '\0'; // Sort the KEYSIG items alphabetically. sort (keysig, ACE_Utils::truncate_cast (ptr - keysig)); } List_Node::~List_Node () { delete [] this->key; delete [] this->keysig; } ace-8.0.4+dfsg.orig/apps/gperf/src/gperf.cpp0000644000175000017500000000361515027201773017640 0ustar sudipsudip// -*- C++ -*- // Driver program for the gperf hash function generator. /** * Copyright (C) 1989 Free Software Foundation, Inc. * written by Douglas C. Schmidt (d.schmidt@vanderbilt.edu) * * This file is part of GNU GPERF. * * 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 * of the License, 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. */ #include "Gen_Perf.h" #include "Options.h" #include "ace/OS_NS_time.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_main.h" int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { // Sets the Options. if (option.parse_args (argc, argv) == -1) return 1; time_t clock; ACE_OS::time (&clock); struct tm *tm = ACE_OS::localtime (&clock); if (option[DEBUGGING]) ACE_OS::printf ("/* starting time is %d:%02d:%02d */\n", tm->tm_hour, tm->tm_min, tm->tm_sec); // Initializes the key word list. Gen_Perf gperf; // Generates and prints the gperf hash table. Don't use exit here, // it skips the destructors. int const status = gperf.run (); ACE_OS::time (&clock); tm = ACE_OS::localtime (&clock); if (option[DEBUGGING]) ACE_OS::printf ("/* ending time is %d:%02d:%02d */\n", tm->tm_hour, tm->tm_min, tm->tm_sec); return status; } ace-8.0.4+dfsg.orig/apps/gperf/src/Iterator.cpp0000644000175000017500000000534315027201773020326 0ustar sudipsudip// -*- C++ -*- /** * Copyright (C) 1989 Free Software Foundation, Inc. * written by Douglas C. Schmidt (d.schmidt@vanderbilt.edu) * * This file is part of GNU GPERF. * * 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 * of the License, 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. */ #include "Iterator.h" #include "ace/OS_NS_ctype.h" /// Constructor for Iterator. Iterator::Iterator (char *s, int lo, int hi, int word_end, int bad_val, int key_end) : str (s), end (key_end), end_word (word_end), error_value (bad_val), hi_bound (hi), lo_bound (lo) { } /// Provide an Iterator, returning the ``next'' value from the list of /// valid values given in the constructor. int Iterator::operator() () { // Variables to record the Iterator's status when handling ranges, // e.g., 3-12. static int size; static int curr_value; static int upper_bound; if (size) { if (++curr_value >= upper_bound) size = 0; return curr_value; } else { while (*str) switch (*str) { default: return error_value; case ',': str++; break; case '$': str++; return end_word; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': for (curr_value = 0; ACE_OS::ace_isdigit (*str); str++) { curr_value = curr_value * 10 + *str - '0'; } if (*str == '-') { for (size = 1, upper_bound = 0; ACE_OS::ace_isdigit (*++str); upper_bound = upper_bound * 10 + *str - '0') { // Do nothing. } if (upper_bound <= curr_value || upper_bound > hi_bound) { return error_value; } } return curr_value >= lo_bound && curr_value <= hi_bound ? curr_value : error_value; } return end; } } ace-8.0.4+dfsg.orig/apps/gperf/src/Bool_Array.h0000644000175000017500000000345315027201773020233 0ustar sudipsudip// -*- C++ -*- /** * Copyright (C) 1989 Free Software Foundation, Inc. * written by Douglas C. Schmidt (d.schmidt@vanderbilt.edu) * * This file is part of GNU GPERF. * * 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 * of the License, 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. */ #ifndef BOOL_ARRAY_H #define BOOL_ARRAY_H #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "Options.h" /** * Efficient lookup table abstraction implemented as a "Generation * Number" Array. * * Uses a "Generation Numbering" implementation to minimize * initialization time. */ class Bool_Array { public: /// Constructor Bool_Array (); /// Initialize the array (requires O(n) time). int open (u_long); /// Destructor. ~Bool_Array (); /// Locate the @a value in the array (requires O(1) time). int find (u_long value); /// Reinitializes the array (requires O(1) time). void reset (); private: /// Initialization of the index space. unsigned long *storage_array_; /// Keep track of the current Generation. unsigned long generation_number_; /// Keep track of array size. unsigned long size_; }; #endif /* BOOL_ARRAY_H */ ace-8.0.4+dfsg.orig/apps/gperf/src/Options.cpp0000644000175000017500000007635015027201773020176 0ustar sudipsudip// -*- C++ -*- /** * Copyright (C) 1989 Free Software Foundation, Inc. * written by Douglas C. Schmidt (d.schmidt@vanderbilt.edu) * * This file is part of GNU GPERF. * * 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 * of the License, 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. */ #include "Options.h" #include "ace/Get_Opt.h" #include "Iterator.h" #include "ace/ACE.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_stdlib.h" #include "ace/Truncate.h" /// These need to appear before the global class instantiation, since /// they are static members with a default constructor that initializes /// an ACE_Allocator needed in the Options class constructor. ACE_CString Options::function_name_; ACE_CString Options::fill_default_; ACE_CString Options::key_name_; ACE_CString Options::class_name_; ACE_CString Options::hash_name_; ACE_CString Options::delimiters_; /// Global option coordinator for the entire program. Options option; /// Current program version. extern const char *version_string; /// Size to jump on a collision. static const int DEFAULT_JUMP_VALUE = 5; /// Default name for generated lookup function. static const char *const DEFAULT_NAME = "in_word_set"; /// Default filler for keyword table. static const char *const DEFAULT_FILL = ""; /// Default name for the key component. static const char *const DEFAULT_KEY = "name"; /// Default name for the generated class. static const char *const DEFAULT_CLASS_NAME = "Perfect_Hash"; /// Default name for generated hash function. static const char *const DEFAULT_HASH_NAME = "hash"; /// Default delimiters that separate keywords from their attributes. static const char *const DEFAULT_DELIMITERS = ",\n"; int Options::option_word_; int Options::total_switches_; u_int Options::total_keysig_size_; int Options::size_; int Options::key_pos_; int Options::jump_; int Options::initial_asso_value_; int Options::argc_; ACE_TCHAR **Options::argv_; int Options::iterations_; char Options::key_positions_[MAX_KEY_POS]; /// Prints program usage to standard error stream. void Options::usage () { ACE_ERROR ((LM_ERROR, "Usage: %n [-abBcCdDef[num]gGhHiIjJ" "kKlLmMnNo" "OprsStTvVZ].\n" "(type %n -h for help)\n")); } /// Output command-line Options. void Options::print_options () { ACE_OS::printf ("/* Command-line: "); ACE_OS::printf ("%s ", ACE_TEXT_ALWAYS_CHAR (ACE::basename (argv_[0]))); for (int i = 1; i < argc_; i++) ACE_OS::printf ("%s ", ACE_TEXT_ALWAYS_CHAR (argv_[i])); ACE_OS::printf ("*/\n"); } /// Sorts the key positions *IN REVERSE ORDER!!* This makes further /// routines more efficient. Especially when generating code. Uses a /// simple Insertion Sort since the set is probably ordered. Returns 1 /// if there are no duplicates, 0 otherwise. int Options::key_sort (char *base, int len) { int j = 0; int i = 0; for (i = 0, j = len - 1; i < j; i++) { int curr = 0; int tmp = 0; for (curr = i + 1, tmp = base[curr]; curr > 0 && tmp >= base[curr - 1]; curr--) if ((base[curr] = base[curr - 1]) == tmp) // Oh no, a duplicate!!! return 0; base[curr] = static_cast (tmp); } return 1; } // Sets the default Options. Options::Options () { key_positions_[0] = WORD_START; key_positions_[1] = WORD_END; key_positions_[2] = EOS; total_keysig_size_ = 2; delimiters_ = DEFAULT_DELIMITERS; jump_ = DEFAULT_JUMP_VALUE; option_word_ = DEFAULTCHARS | C; function_name_ = DEFAULT_NAME; fill_default_ = DEFAULT_FILL; key_name_ = DEFAULT_KEY; hash_name_ = DEFAULT_HASH_NAME; class_name_ = DEFAULT_CLASS_NAME; total_switches_ = size_ = 1; initial_asso_value_ = iterations_ = 0; } /// Dumps option status when debug is set. Options::~Options () { if (ACE_BIT_ENABLED (option_word_, DEBUGGING)) { char *ptr = 0; ACE_OS::fprintf (stderr, "\ndumping Options:" "\nDEBUGGING is...: %s" "\nORDER is.......: %s" "\nANSI is........: %s" "\nTYPE is........: %s" "\nINLINE is......: %s" "\nRANDOM is......: %s" "\nDEFAULTCHARS is: %s" "\nSWITCH is......: %s" "\nPOINTER is.....: %s" "\nNOLENGTH is....: %s" "\nLENTABLE is....: %s" "\nDUP is.........: %s" "\nFAST is........: %s" "\nCOMP is........: %s" "\nNOTYPE is......: %s" "\nGLOBAL is......: %s" "\nCONSTANT is....: %s" "\nCPLUSPLUS is...: %s" "\nC is...........: %s" "\nENUM is........: %s" "\nSTRCASECMP is..: %s" "\nOPTIMIZE is....: %s" "\nLINEARSEARCH is: %s" "\nBINARYSEARCH is: %s" "\niterations = %d" "\nlookup function name = %s" "\nfill default = %s" "\nhash function name = %s" "\nkey name = %s" "\njump value = %d" "\nmax associated value = %d" "\ninitial associated value = %d" "\ndelimiters = %s" "\nnumber of switch statements = %d" "\n", ACE_BIT_ENABLED (option_word_, DEBUGGING) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, ORDER) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, ANSI) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, TYPE) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, INLINE) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, RANDOM) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, DEFAULTCHARS) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, SWITCH) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, POINTER) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, NOLENGTH) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, LENTABLE) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, DUP) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, FAST) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, COMP) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, NOTYPE) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, GLOBAL) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, CONSTANT) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, CPLUSPLUS) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, C) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, ENUM) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, STRCASECMP) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, OPTIMIZE) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, LINEARSEARCH) ? "enabled" : "disabled", ACE_BIT_ENABLED (option_word_, BINARYSEARCH) ? "enabled" : "disabled", iterations_, function_name_.c_str (), fill_default_.c_str (), hash_name_.c_str (), key_name_.c_str (), jump_, size_ - 1, initial_asso_value_, delimiters_.c_str (), total_switches_); if (ACE_BIT_ENABLED (option_word_, ALLCHARS)) ACE_OS::fprintf (stderr, "all characters are used in the hash function\n"); ACE_OS::fprintf (stderr, "maximum keysig size = %d\nkey positions are:\n", total_keysig_size_); for (ptr = key_positions_; *ptr != EOS; ptr++) if (*ptr == WORD_END) ACE_OS::fprintf (stderr, "$\n"); else ACE_OS::fprintf (stderr, "%d\n", *ptr); ACE_OS::fprintf (stderr, "finished dumping Options\n"); } } /// Parses the command line Options and sets appropriate flags in /// option_word_. int Options::parse_args (int argc, ACE_TCHAR *argv[]) { if (ACE_LOG_MSG->open (argv[0]) == -1) return -1; ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("abBcCdDe:Ef:F:gGhH:i:IJj:k:K:lL:mMnN:oOprs:S:tTvVZ:")); argc_ = argc; argv_ = argv; int option_char; while ((option_char = get_opt ()) != -1) { switch (option_char) { // Generated coded uses the ANSI prototype format. case 'a': { ACE_SET_BITS (option_word_, ANSI); break; } // Generate code for Linear Search. case 'b': { ACE_SET_BITS (option_word_, LINEARSEARCH); break; } // Generate code for Binary Search. case 'B': { ACE_SET_BITS (option_word_, BINARYSEARCH); break; } // Generate strncmp rather than strcmp. case 'c': { ACE_SET_BITS (option_word_, COMP); break; } // Make the generated tables readonly (const). case 'C': { ACE_SET_BITS (option_word_, CONSTANT); break; } // Enable debugging option. case 'd': { ACE_SET_BITS (option_word_, DEBUGGING); ACE_ERROR ((LM_ERROR, "Starting program %n, version %s, with debugging on.\n", version_string)); break; } // Enable duplicate option. case 'D': { ACE_SET_BITS (option_word_, DUP); break; } // Allows user to provide keyword/attribute separator case 'e': { delimiters_ = ACE_TEXT_ALWAYS_CHAR(get_opt.opt_arg ()); break; } case 'E': { ACE_SET_BITS (option_word_, ENUM); break; } // Generate the hash table ``fast.'' case 'f': { ACE_SET_BITS (option_word_, FAST); iterations_ = ACE_OS::atoi (get_opt.opt_arg ()); if (iterations_ < 0) { ACE_ERROR ((LM_ERROR, "iterations value must not be negative, assuming 0\n")); iterations_ = 0; } break; } // Use the ``inline'' keyword for generated sub-routines. case 'g': { ACE_SET_BITS (option_word_, INLINE); break; } // Make the keyword table a global variable. case 'G': { ACE_SET_BITS (option_word_, GLOBAL); break; } // Displays a list of helpful Options to the user. case 'h': { Options::usage (); ACE_OS::fprintf (stderr, "-a\tGenerate ANSI standard C output code, i.e., function prototypes.\n" "-b\tGenerate code for Linear Search.\n" "-B\tGenerate code for Binary Search.\n" "-c\tGenerate comparison code using strncmp rather than strcmp.\n" "-C\tMake the contents of generated lookup tables constant, i.e., readonly.\n" "-d\tEnables the debugging option (produces verbose output to the standard\n" "\terror).\n" "-D\tHandle keywords that hash to duplicate values. This is useful\n" "\tfor certain highly redundant keyword sets.\n" "-e\tAllow user to provide a string containing delimiters used to separate\n" "\tkeywords from their attributes. Default is \",\\n\"\n" "-E\tDefine constant values using an enum local to the lookup function\n" "\trather than with defines\n" "-f\tGenerate the gen-perf.hash function ``fast.'' This decreases GPERF's\n" "\trunning time at the cost of minimizing generated table-size.\n" "\tThe numeric argument represents the number of times to iterate when\n" "\tresolving a collision. `0' means ``iterate by the number of keywords.''\n" "-F\tProvided expression will be used to assign default values in keyword\n" "\ttable, i.e., the fill value. Default is \"\".\n" "-g\tMake generated routines use ``inline'' to remove function overhead.\n" "-G\tGenerate the static table of keywords as a static global variable,\n" "\trather than hiding it inside of the lookup function (which is the\n" "\tdefault behavior).\n" "-h\tPrints this message.\n" "-H\tAllow user to specify name of generated hash function. Default\n" "\tis `hash'.\n" "-i\tProvide an initial value for the associate values array. Default is 0.\n" "-I\tGenerate comparison code using case insensitive string comparison, e.g.,\n" "\tstrncasecmp or strcasecmp.\n" "\tSetting this value larger helps inflate the size of the final table.\n" "-j\tAffects the ``jump value,'' i.e., how far to advance the associated\n" "\tcharacter value upon collisions. Must be an odd number, default is %d.\n" "-J\tSkips '#include \"ace/OS_NS_string.h\"' part in the output.\n" "-k\tAllows selection of the key positions used in the hash function.\n" "\tThe allowable choices range between 1-%d, inclusive. The positions\n" "\tare separated by commas, ranges may be used, and key positions may\n" "\toccur in any order. Also, the meta-character '*' causes the generated\n" "\thash function to consider ALL key positions, and $ indicates the\n" "\t``final character'' of a key, e.g., $,1,2,4,6-10.\n" "-K\tAllow use to select name of the keyword component in the keyword\n" "\tstructure.\n" "-l\tCompare key lengths before trying a string comparison. This helps\n" "\tcut down on the number of string comparisons made during the lookup.\n" "-L\tGenerates code in the language specified by the option's argument.\n" "\tLanguages handled are currently C++ and C. The default is C.\n" "-m\tAvoids the warning about identical hash values. This is valid\n" "\tonly if the -D option is enabled.\n" "-M\tSkips class definition in the output. This is valid only in C++ mode.\n" "-n\tDo not include the length of the keyword when computing the hash\n" "\tfunction.\n" "-N\tAllow user to specify name of generated lookup function. Default\n" "\tname is `in_word_set.'\n" "-o\tReorders input keys by frequency of occurrence of the key sets.\n" "\tThis should decrease the search time dramatically.\n" "-O\tOptimize the generated lookup function by assuming that all input\n" "\tkeywords are members of the keyset from the keyfile.\n" "-p\tChanges the return value of the generated function ``in_word_set''\n" "\tfrom its default boolean value (i.e., 0 or 1), to type ``pointer\n" "\tto wordlist array'' This is most useful when the -t option, allowing\n" "\tuser-defined structs, is used.\n" "-r\tUtilizes randomness to initialize the associated values table.\n" "-s\tAffects the size of the generated hash table. The numeric argument\n" "\tfor this option indicates ``how many times larger or smaller'' the\n" "\tassociated value range should be, in relationship to the number of\n" "\tkeys, e.g. a value of 3 means ``allow the maximum associated value\n" "\tto be about 3 times larger than the number of input keys.''\n" "\tConversely, a value of -3 means ``make the maximum associated\n" "\tvalue about 3 times smaller than the number of input keys. A\n" "\tlarger table should decrease the time required for an unsuccessful\n" "\tsearch, at the expense of extra table space. Default value is 1.\n" "-S\tCauses the generated C code to use a switch statement scheme, rather\n" "\tthan an array lookup table. This can lead to a reduction in both\n" "\ttime and space requirements for some keyfiles. The argument to\n" "\tthis option determines how many switch statements are generated.\n" "\tA value of 1 generates 1 switch containing all the elements, a value\n" "\tof 2 generates 2 tables with 1/2 the elements in each table, etc.\n" "\tThis is useful since many C compilers cannot correctly generate code\n" "\tfor large switch statements.\n" "-t\tAllows the user to include a structured type declaration for\n" "\tgenerated code. Any text before %%%% is consider part of the type\n" "\tdeclaration. Key words and additional fields may follow this, one\n" "\tgroup of fields per line.\n" "-T\tPrevents the transfer of the type declaration to the output file.\n" "\tUse this option if the type is already defined elsewhere.\n" "-v\tPrints out the current version number and exits with a value of 0\n" "-V\tExits silently with a value of 0.\n" "-Z\tAllow user to specify name of generated C++ class. Default\n" "\tname is `Perfect_Hash.'\n", DEFAULT_JUMP_VALUE, MAX_KEY_POS - 1); return -1; } // Sets the name for the hash function. case 'H': { hash_name_ = ACE_TEXT_ALWAYS_CHAR(get_opt.opt_arg ()); break; } // Sets the initial value for the associated values array. case 'i': { initial_asso_value_ = ACE_OS::atoi (get_opt.opt_arg ()); if (initial_asso_value_ < 0) ACE_ERROR ((LM_ERROR, "Initial value %d should be non-zero, ignoring and continuing.\n", initial_asso_value_)); if (option[RANDOM]) ACE_ERROR ((LM_ERROR, "warning, -r option superceeds -i, ignoring -i option and continuing\n")); break; } case 'I': { ACE_SET_BITS (option_word_, STRCASECMP); break; } // Sets the jump value, must be odd for later algorithms. case 'j': { jump_ = ACE_OS::atoi (get_opt.opt_arg ()); if (jump_ < 0) ACE_ERROR_RETURN ((LM_ERROR, "Jump value %d must be a positive number.\n%r", jump_, &Options::usage), -1); else if (jump_ && ACE_EVEN (jump_)) ACE_ERROR ((LM_ERROR, "Jump value %d should be odd, adding 1 and continuing...\n", jump_++)); break; } // Skip including the header file ace/OS_NS_string.h. case 'J': { ACE_SET_BITS (option_word_, SKIPSTRINGH); break; } // Sets key positions used for hash function. case 'k': { const int BAD_VALUE = -1; int value; Iterator expand (ACE_TEXT_ALWAYS_CHAR(get_opt.opt_arg ()), 1, MAX_KEY_POS - 1, WORD_END, BAD_VALUE, EOS); // Use all the characters for hashing!!!! if (*get_opt.opt_arg () == '*') option_word_ = (option_word_ & ~DEFAULTCHARS) | ALLCHARS; else { char *l_key_pos; for (l_key_pos = key_positions_; (value = expand ()) != EOS; l_key_pos++) if (value == BAD_VALUE) ACE_ERROR_RETURN ((LM_ERROR, "Illegal key value or range, use 1,2,3-%d,'$' or '*'.\n%r", MAX_KEY_POS - 1, usage), -1); else *l_key_pos = static_cast (value); *l_key_pos = EOS; total_keysig_size_ = ACE_Utils::truncate_cast (l_key_pos - key_positions_); if (total_keysig_size_ == 0) ACE_ERROR_RETURN ((LM_ERROR, "No keys selected.\n%r", &Options::usage), -1); else if (key_sort (key_positions_, total_keysig_size_) == 0) ACE_ERROR_RETURN ((LM_ERROR, "Duplicate keys selected\n%r", &Options::usage), -1); if (total_keysig_size_ != 2 || (key_positions_[0] != 1 || key_positions_[1] != WORD_END)) ACE_CLR_BITS (option_word_, DEFAULTCHARS); } break; } // Make this the keyname for the keyword component field. case 'K': { key_name_ = ACE_TEXT_ALWAYS_CHAR(get_opt.opt_arg ()); break; } // Create length table to avoid extra string compares. case 'l': { ACE_SET_BITS (option_word_, LENTABLE); break; } // Deal with different generated languages. case 'L': { option_word_ &= ~C; if (!ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT("C++"))) ACE_SET_BITS (option_word_, (CPLUSPLUS | ANSI)); else if (!ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT("C"))) ACE_SET_BITS (option_word_, C); else { ACE_ERROR ((LM_ERROR, "unsupported language option %s, defaulting to C\n", get_opt.opt_arg ())); ACE_SET_BITS (option_word_, C); } break; } // Don't print the warnings. case 'm': { ACE_SET_BITS (option_word_, MUTE); break; } // Skip the class definition while in C++ mode. case 'M': { ACE_SET_BITS (option_word_, SKIPCLASS); break; } // Don't include the length when computing hash function. case 'n': { ACE_SET_BITS (option_word_, NOLENGTH); break; } // Make generated lookup function name be.opt_arg () case 'N': { function_name_ = ACE_TEXT_ALWAYS_CHAR(get_opt.opt_arg ()); break; } // Make fill_default be.opt_arg () case 'F': { fill_default_ = ACE_TEXT_ALWAYS_CHAR(get_opt.opt_arg ()); break; } // Order input by frequency of key set occurrence. case 'o': { ACE_SET_BITS (option_word_, ORDER); break; } case 'O': { ACE_SET_BITS (option_word_, OPTIMIZE); break; } // Generated lookup function now a pointer instead of int. case 'p': { ACE_SET_BITS (option_word_, POINTER); break; } // Utilize randomness to initialize the associated values // table. case 'r': { ACE_SET_BITS (option_word_, RANDOM); if (initial_asso_value_ != 0) ACE_ERROR ((LM_ERROR, "warning, -r option superceeds -i, disabling -i option and continuing\n")); break; } // Range of associated values, determines size of final table. case 's': { size_ = ACE_OS::atoi (get_opt.opt_arg ()); if (abs (size_) > 50) ACE_ERROR ((LM_ERROR, "%d is excessive, did you really mean this?! (type %n -h for help)\n", size_)); break; } // Generate switch statement output, rather than lookup table. case 'S': { ACE_SET_BITS (option_word_, SWITCH); total_switches_ = ACE_OS::atoi (get_opt.opt_arg ()); if (total_switches_ <= 0) ACE_ERROR_RETURN ((LM_ERROR, "number of switches %s must be a positive number\n%r", get_opt.opt_arg (), &Options::usage), -1); break; } // Enable the TYPE mode, allowing arbitrary user structures. case 't': { ACE_SET_BITS (option_word_, TYPE); break; } // Don't print structure definition. case 'T': { ACE_SET_BITS (option_word_, NOTYPE); break; } // Print out the version and quit. case 'v': ACE_ERROR ((LM_ERROR, "%n: version %s\n%r\n", version_string, &Options::usage)); ACE_OS::exit (0); /* NOTREACHED */ break; // Exit with value of 0 (this is useful to check if gperf exists) case 'V': ACE_OS::exit (0); /* NOTREACHED */ break; // Set the class name. case 'Z': { class_name_ = ACE_TEXT_ALWAYS_CHAR(get_opt.opt_arg ()); break; } default: ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error: Invalid Option: %s\n"), get_opt.last_option ())); usage (); return -1; } } if (argv[get_opt.opt_ind ()] && ACE_OS::freopen (argv[get_opt.opt_ind ()], ACE_TEXT("r"), stdin) == 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot open keyword file %p\n%r", argv[get_opt.opt_ind ()], &Options::usage), -1); if (get_opt.opt_ind () + 1 < argc) ACE_ERROR_RETURN ((LM_ERROR, "Extra trailing arguments to %n.\n%r", usage), -1); return 0; } /// True if option enable, else false. int Options::operator[] (Option_Type opt) { return ACE_BIT_ENABLED (option_word_, opt); } /// Enables option OPT. void Options::operator = (enum Option_Type opt) { ACE_SET_BITS (option_word_, opt); } /// Disables option OPT. bool Options::operator != (enum Option_Type opt) { // @@ Why is this inequality comparison operator clearing bits? ACE_CLR_BITS (option_word_, opt); return true; } /// Initializes the key Iterator. void Options::reset () { key_pos_ = 0; } /// Returns current key_position and advanced index. int Options::get () { return key_positions_[key_pos_++]; } /// Sets the size of the table size. void Options::asso_max (int r) { size_ = r; } /// Returns the size of the table size. int Options::asso_max () { return size_; } /// Returns total distinct key positions. u_int Options::max_keysig_size () { return total_keysig_size_; } /// Sets total distinct key positions. void Options::keysig_size (u_int a_size) { total_keysig_size_ = a_size; } /// Returns the jump value. int Options::jump () { return jump_; } /// Returns the generated function name. const char * Options::function_name () { return function_name_.c_str (); } /// Returns the fill default const char * Options::fill_default () { return fill_default_.c_str (); } /// Returns the keyword key name. const char * Options::key_name () { return key_name_.c_str (); } /// Returns the hash function name. const char * Options::hash_name () { return hash_name_.c_str (); } /// Returns the generated class name. const char * Options::class_name () { return class_name_.c_str (); } /// Returns the initial associated character value. int Options::initial_value () { return initial_asso_value_; } /// Returns the iterations value. int Options::iterations () { return iterations_; } /// Returns the string used to delimit keywords from other attributes. const char * Options::delimiter () { return delimiters_.c_str (); } /// Gets the total number of switch statements to generate. int Options::total_switches () { return total_switches_; } ace-8.0.4+dfsg.orig/apps/gperf/src/Iterator.h0000644000175000017500000000461515027201773017774 0ustar sudipsudip// -*- C++ -*- /** * Copyright (C) 1989 Free Software Foundation, Inc. * written by Douglas C. Schmidt (d.schmidt@vanderbilt.edu) * * This file is part of GNU GPERF. * * 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 * of the License, 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. */ #ifndef ITERATOR_H #define ITERATOR_H #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "Options.h" /** * Provides an Iterator that expands and decodes a control string * containing digits and ranges, returning an integer every time the * generator function is called. * * This class is used to decode the user's key position requests. * For example: "-k 1,2,5-10,$" will return 1, 2, 5, 6, 7, 8, 9, * 10, and 0 ( representing the abstract ``last character of the * key'' on successive calls to the member function operator (). * No errors are handled in these routines, they are passed back * to the calling routines via a user-supplied Error_Value */ class Iterator { public: Iterator (char *s, int lo, int hi, int word_end, int bad_val, int key_end); Iterator (const Iterator &) = delete; Iterator (Iterator &&) = delete; Iterator &operator= (const Iterator &) = delete; Iterator &operator= (Iterator &&) = delete; int operator () (); private: /// A pointer to the string provided by the user. char *str; /// Value returned after last key is processed. int end; /// A value marking the abstract ``end of word'' (usually '$'). int end_word; /// Error value returned when input is syntactically erroneous. int error_value; /// Greatest possible value, inclusive. int hi_bound; /// Smallest possible value, inclusive. int lo_bound; }; #endif /* ITERATOR_H */ ace-8.0.4+dfsg.orig/apps/gperf/src/Options.h0000644000175000017500000001547615027201773017645 0ustar sudipsudip// -*- C++ -*- /** * Copyright (C) 1989 Free Software Foundation, Inc. * written by Douglas C. Schmidt (d.schmidt@vanderbilt.edu) * * This file is part of GNU GPERF. * * 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 * of the License, 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. */ #ifndef OPTIONS_H #define OPTIONS_H #include "ace/Log_Msg.h" #include "ace/SString.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ /// Enumerate the potential debugging Options. enum Option_Type { DEBUGGING = 01, /* Enable debugging (prints diagnostics to stderr). */ ORDER = 02, /**< Apply ordering heuristic to speed-up search time. */ ANSI = 04, /**< Generate ANSI prototypes. */ ALLCHARS = 010, /**< Use all characters in hash function. */ INLINE = 020, /**< Generate code for inline functions. */ TYPE = 040, /**< Handle user-defined type structured keyword input. */ RANDOM = 0100, /**< Randomly initialize the associated values table. */ DEFAULTCHARS = 0200, /**< Make default char positions be 1,$ (end of keyword). */ SWITCH = 0400, /**< Generate switch output to save space. */ POINTER = 01000, /**< Have in_word_set function return pointer, not boolean. */ NOLENGTH = 02000, /**< Don't include keyword length in hash computations. */ LENTABLE = 04000, /**< Generate a length table for string comparison. */ DUP = 010000, /**< Handle duplicate hash values for keywords. */ FAST = 020000, /**< Generate the hash function ``fast.'' */ NOTYPE = 040000, /**< Don't include user-defined type definition in output -- it's already defined elsewhere. */ COMP = 0100000, /**< Generate strncmp rather than strcmp. */ GLOBAL = 0200000, /**< Make the keyword table a global variable. */ CONSTANT = 0400000, /**< Make the generated tables readonly (const). */ CPLUSPLUS = 01000000, /**< Generate C++ code. */ C = 02000000, /**< Generate C code. */ ENUM = 04000000, /**< Use enum for constants. */ STRCASECMP = 010000000, /**< Use the case insensitive comparison. */ OPTIMIZE = 020000000, /**< Assume all input keywords are in the keyset. */ ADA = 040000000, /**< Generate Ada code. */ MUTE = 0100000000, /**< Dont print the warnings. */ SKIPCLASS = 0200000000, /**< Skip the class definition part in the output while in C++ mode. */ SKIPSTRINGH = 0400000000, /**< Skip including the header file ace/OS_NS_string.h. */ BINARYSEARCH = 01000000000, /**< Generates Binary Search code. */ LINEARSEARCH = 02000000000 /**< Generates Linear Search code. */ }; // Define some useful constants (these don't really belong here, but // I'm not sure where else to put them!). These should be consts, but // g++ doesn't seem to do the right thing with them at the // moment... ;-( enum { MAX_KEY_POS = 128 - 1, /**< Max size of each word's key set. */ WORD_START = 1, /**< Signals the start of a word. */ WORD_END = 0, /**< Signals the end of a word. */ EOS = MAX_KEY_POS /**< Signals end of the key list. */ }; /* * This class provides a uniform interface to the various options * available to a user of the gperf hash function generator. * * In addition to the run-time options, found in the * there is also the hash table Size and the Keys to be used in * the hashing. The overall design of this module was an * experiment in using C++ classes as a mechanism to enhance * centralization of option and and error handling. * * @todo The Options class should be changed to use the Singleton pattern. */ class Options { public: Options (); Options (const Options &) = delete; Options (Options &&) = delete; Options &operator= (const Options &) = delete; Options &operator= (Options &&) = delete; ~Options (); int operator[] (Option_Type option); int parse_args (int argc, ACE_TCHAR *argv[]); void operator= (enum Option_Type); bool operator!= (enum Option_Type); static void print_options (); static void asso_max (int r); static int asso_max (); static void reset (); static int get (); static int iterations (); static u_int max_keysig_size (); static void keysig_size (u_int); static int jump (); static int initial_value (); static int total_switches (); static const char *function_name (); static const char *fill_default (); static const char *key_name (); static const char *class_name (); static const char *hash_name (); static const char *delimiter (); private: /// Holds the user-specified Options. static int option_word_; /// Number of switch statements to generate. static int total_switches_; /// Total number of distinct key_positions. static u_int total_keysig_size_; /// Range of the hash table. static int size_; /// Tracks current key position for Iterator. static int key_pos_; /// Tracks current key position for Iterator. static int jump_; /// Initial value for asso_values table. static int initial_asso_value_; /// Amount to iterate when a collision occurs. static int iterations_; /// Records count of command-line arguments. static int argc_; /// Stores a pointer to command-line vector. static ACE_TCHAR **argv_; /// Names used for generated lookup function. static ACE_CString function_name_; /// Expression used to assign default values in keyword table. static ACE_CString fill_default_; /// Name used for keyword key. static ACE_CString key_name_; /// Name used for generated C++ class. static ACE_CString class_name_; /// Name used for generated hash function. static ACE_CString hash_name_; /// Separates keywords from other attributes. static ACE_CString delimiters_; /// Contains user-specified key choices. static char key_positions_[MAX_KEY_POS]; /// Sorts key positions in REVERSE order. static int key_sort (char *base, int len); /// Prints proper program usage. static void usage (); }; /// Global option coordinator for the entire program. extern Options option; #endif /* OPTIONS_H */ ace-8.0.4+dfsg.orig/apps/gperf/src/Hash_Table.h0000644000175000017500000000367715027201773020204 0ustar sudipsudip// -*- C++ -*- /** * Copyright (C) 1989 Free Software Foundation, Inc. * written by Douglas C. Schmidt (d.schmidt@vanderbilt.edu) * * This file is part of GNU GPERF. * * 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 * of the License, 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. */ #ifndef HASH_TABLE_H #define HASH_TABLE_H #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "Options.h" #include "List_Node.h" /** * Hash table used to check for duplicate keyword entries. * * This implementation uses "double hashing." * * @todo This class should be replaced by something in ACE, e.g., * ACE_Hash_Map_Manager. Perhaps we should implement a new * ACE_Hash_Map that uses double hashing, however! */ class Hash_Table { public: /// Constructor Hash_Table (size_t s); Hash_Table (const Hash_Table &) = delete; Hash_Table (Hash_Table &&) = delete; Hash_Table &operator= (const Hash_Table &) = delete; Hash_Table &operator= (Hash_Table &&) = delete; /// Destructor ~Hash_Table (); List_Node *find (List_Node *item, int ignore_length); private: /// Vector of pointers to linked lists of List_Node's. List_Node **table_; /// Size of the vector. size_t size_; /// Find out how well our double hashing is working! int collisions_; }; #endif /* HASH_TABLE_H */ ace-8.0.4+dfsg.orig/apps/gperf/src/Gen_Perf.h0000644000175000017500000000434515027201773017670 0ustar sudipsudip// -*- C++ -*- /** * Copyright (C) 1989 Free Software Foundation, Inc. * written by Douglas C. Schmidt (d.schmidt@vanderbilt.edu) * * This file is part of GNU GPERF. * * 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 * of the License, 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. */ #ifndef GEN_PERF_H #define GEN_PERF_H #include "Options.h" #include "Key_List.h" #include "Bool_Array.h" /* * Provides high-level routines to manipulate the keyword list * structures the code generation output. */ class Gen_Perf { public: /// Constructor. Gen_Perf (); Gen_Perf (const Gen_Perf &) = delete; Gen_Perf (Gen_Perf &&) = delete; Gen_Perf &operator= (const Gen_Perf &) = delete; Gen_Perf &operator= (Gen_Perf &&) = delete; /// Destructor ~Gen_Perf (); /// Attempt to generate a perfect hash function. int run (); private: int open (); int change (List_Node *prior, List_Node *curr); int affects_prev (char c, List_Node *curr); int compute_perfect_hash (); int compute_binary_search (); int compute_linear_search (); static int hash (List_Node *key_node); static int compute_disjoint_union (char *s1, char *s2, char *s3); static void sort_set (char *union_set, int len); /// Maximum possible hash value. int max_hash_value; /// Records fewest # of collisions for asso value. int fewest_collisions; /// Number of keywords processed without a collision. int num_done; /// Disjoint union. char *union_set; /// List of the keys we're trying to map into a perfect hash /// function. Key_List key_list; /// Table that keeps track of key collisions. Bool_Array char_search; }; #endif /* GEN_PERF_H */ ace-8.0.4+dfsg.orig/apps/gperf/src/Vectors.h0000644000175000017500000000325715027201773017631 0ustar sudipsudip// -*- C++ -*- /** * Copyright (C) 1989 Free Software Foundation, Inc. * written by Douglas C. Schmidt (d.schmidt@vanderbilt.edu) * * This file is part of GNU GPERF. * * 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 * of the License, 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. */ #ifndef VECTORS_H #define VECTORS_H #include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ // Do not change these values wantonly since GPERF depends on them.. #define ACE_ASCII_SIZE 128 #define ACE_EBCDIC_SIZE 256 #if 'a' < 'A' #define ACE_HAS_EBCDIC #define ACE_STANDARD_CHARACTER_SET_SIZE 256 #else #define ACE_HAS_ASCII #define ACE_STANDARD_CHARACTER_SET_SIZE 128 #endif /* 'a' < 'A' */ /* * Static class data members that are shared between several * classes via inheritance. */ class Vectors { public: /// Counts occurrences of each key set character. static int occurrences[ACE_STANDARD_CHARACTER_SET_SIZE]; /// Value associated with each character. static int asso_values[ACE_STANDARD_CHARACTER_SET_SIZE]; }; #endif /* VECTORS_H */ ace-8.0.4+dfsg.orig/apps/gperf/src/Hash_Table.cpp0000644000175000017500000000707215027201773020530 0ustar sudipsudip// -*- C++ -*- /** * Copyright (C) 1989 Free Software Foundation, Inc. * written by Douglas C. Schmidt (d.schmidt@vanderbilt.edu) * * This file is part of GNU GPERF. * * 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 * of the License, 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. */ #include "Hash_Table.h" #include "ace/ACE.h" #include "ace/OS_NS_string.h" #include "ace/OS_Memory.h" // The size of the hash table is always the smallest power of 2 >= the // size indicated by the user. This allows several optimizations, // including the use of double hashing and elimination of the mod // instruction. Note that the size had better be larger than the // number of items in the hash table, else there's trouble!!! Hash_Table::Hash_Table (size_t s) : size_ (ACE_POW (s)), collisions_ (0) { if (this->size_ == 0) this->size_ = 1; ACE_NEW (this->table_, List_Node*[this->size_]); ACE_OS::memset ((char *) this->table_, 0, this->size_ * sizeof *this->table_); } Hash_Table::~Hash_Table () { if (option[DEBUGGING]) { size_t keysig_width = option.max_keysig_size () > ACE_OS::strlen ("keysig") ? option.max_keysig_size () : ACE_OS::strlen ("keysig"); ACE_DEBUG ((LM_DEBUG, "\ndumping the hash table\ntotal available table slots = %d, total bytes = %d, total collisions = %d\n" "location, %*s, keyword\n", this->size_, this->size_ * (int) sizeof *this->table_, this->collisions_, keysig_width, "keysig")); for (int i = static_cast (this->size_ - 1); i >= 0; i--) if (this->table_[i]) ACE_DEBUG ((LM_DEBUG, "%8d, %*s, %s\n", i, keysig_width, this->table_[i]->keysig, this->table_[i]->key)); ACE_DEBUG ((LM_DEBUG, "end dumping hash table\n\n")); } delete [] this->table_; } // If the ITEM is already in the hash table return the item found in // the table. Otherwise inserts the ITEM, and returns FALSE. Uses // double hashing. List_Node * Hash_Table::find (List_Node *item, int ignore_length) { size_t hash_val = ACE::hash_pjw (item->keysig); // The following works since the hash table size_ is always a power // of 2... size_t size = this->size_ - 1; size_t probe; size_t increment = ((hash_val ^ (ignore_length == 0 ? item->length : 0)) | 1) & size; for (probe = hash_val & size; this->table_[probe] && (ACE_OS::strcmp (this->table_[probe]->keysig, item->keysig) != 0 || (ignore_length == 0 && this->table_[probe]->length != item->length)); probe = (probe + increment) & size) { ++this->collisions_; } if (this->table_[probe]) { return this->table_[probe]; } else { this->table_[probe] = item; return 0; } } ace-8.0.4+dfsg.orig/apps/gperf/src/gperf.mpc0000644000175000017500000000073315027201773017633 0ustar sudipsudip// -*- MPC -*- project(gperf) : aceexe, install, crosscompile { install = $(ACE_ROOT)/bin exename = ace_gperf Source_Files { gperf.cpp Options.cpp Iterator.cpp Gen_Perf.cpp Key_List.cpp List_Node.cpp Hash_Table.cpp Bool_Array.cpp Vectors.cpp Version.cpp } verbatim(gnuace, postinstall) { " @$(MKDIR) $(DESTDIR)$(INSTALL_PREFIX)/share/ace/bin" " ln -sf ../../../bin/ace_gperf $(DESTDIR)$(INSTALL_PREFIX)/share/ace/bin" } } ace-8.0.4+dfsg.orig/apps/gperf/src/Key_List.cpp0000644000175000017500000020424215027201773020257 0ustar sudipsudip// -*- C++ -*- /** * Copyright (C) 1989 Free Software Foundation, Inc. * written by Douglas C. Schmidt (d.schmidt@vanderbilt.edu) * * This file is part of GNU GPERF. * * 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 * of the License, 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. */ #include "Key_List.h" #include "Hash_Table.h" #include "ace/Read_Buffer.h" #include "ace/OS_Memory.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include /// Default type for generated code. const char *const Key_List::default_array_type = "char *"; /// in_word_set return type, by default. const char *const Key_List::default_return_type = "char *"; namespace { char * dup_string (const char *const str) { char *buf = 0; ACE_NEW_RETURN (buf, char [ACE_OS::strlen (str) + 1], 0); ACE_OS::strcpy (buf, str); return buf; } } // unnamed namespace /// How wide the printed field width must be to contain the maximum /// hash value. int Key_List::field_width = 0; int Key_List::determined_[ACE_STANDARD_CHARACTER_SET_SIZE]; /// Destructor dumps diagnostics during debugging. Key_List::~Key_List () { if (option[DEBUGGING]) this->dump (); // Free up all the nodes in the list. while (this->head != 0) { List_Node *temp = 0; // Make sure to delete the linked nodes, as well. for (List_Node *ptr = this->head->link; ptr != 0; ptr = temp) { temp = ptr->link; delete ptr; } temp = this->head->next; delete this->head; this->head = temp; } delete [] this->array_type_; delete [] this->return_type; delete [] this->struct_tag; } /// Gathers the input stream into a buffer until one of two things occur: /// /// 1. We read a '%' followed by a '%' /// 2. We read a '%' followed by a '}' /// /// The first symbolizes the beginning of the keyword list proper, The /// second symbolizes the end of the C source code to be generated /// verbatim in the output file. /// /// I assume that the keys are separated from the optional preceding /// struct declaration by a consecutive % followed by either % or } /// starting in the first column. The code below uses an expandible /// buffer to scan off and return a pointer to all the code (if any) /// appearing before the delimiter. char * Key_List::special_input (char delimiter) { int size = 80; char *buf = 0; ACE_NEW_RETURN (buf, char[size], 0); int c; for (int i = 0; (c = getchar ()) != EOF; i++) { if (c == '%') { c = getchar (); if (c == delimiter) { // Discard newline... while ((c = getchar ()) != '\n') continue; if (i == 0) { buf[0] = '\0'; return buf; } else { buf[delimiter == '%' && buf[i - 2] == ';' ? i - 2 : i - 1] = '\0'; return buf; } } else buf[i++] = '%'; } else if (i >= size) { // Yikes, time to grow the buffer! char *temp = 0; ACE_NEW_RETURN (temp, char[size *= 2], 0); for (int j = 0; j < i; j++) temp[j] = buf[j]; delete [] buf; buf = temp; } buf[i] = static_cast (c); } delete [] buf; return 0; } /// Stores any C/C++ source code that must be included verbatim into /// the generated code output. char * Key_List::save_include_src () { int c = getchar (); if (c != '%') ACE_OS::ungetc (c, stdin); else if ((c = getchar ()) != '{') ACE_ERROR_RETURN ((LM_ERROR, "internal error, %c != '{' on line %l in file %N", c), 0); else return special_input ('}'); return (char *) ""; } /// Determines from the input file whether the user wants to build a /// table from a user-defined struct, or whether the user is content to /// simply use the default array of keys. char * Key_List::array_type () { return special_input ('%'); } /// Sets up the Return_Type, the Struct_Tag type and the Array_Type /// based upon various user Options. int Key_List::output_types () { if (option[TYPE]) { delete [] array_type_; array_type_ = array_type (); if (array_type_ == 0) // Something's wrong, but we'll catch it later on.... return -1; else { // Yow, we've got a user-defined type... size_t struct_tag_length = ACE_OS::strcspn (array_type_, "{\n\0"); if (option[POINTER]) // And it must return a pointer... { delete [] return_type; ACE_NEW_RETURN (return_type, char[struct_tag_length + 2], -1); ACE_OS::strncpy (return_type, array_type_, struct_tag_length); return_type[struct_tag_length] = '*'; return_type[struct_tag_length + 1] = '\0'; } delete [] struct_tag; ACE_NEW_RETURN (struct_tag, char[struct_tag_length + 2], -1); ACE_OS::strncpy (struct_tag, array_type_, struct_tag_length); if (struct_tag[struct_tag_length - 1] != ' ') { struct_tag[struct_tag_length] = ' '; ++struct_tag_length; } struct_tag[struct_tag_length] = '\0'; } } else if (option[POINTER]) // Return a char *. { delete [] return_type; return_type = dup_string (Key_List::default_array_type); } return 0; } /// Reads in all keys from standard input and creates a linked list /// pointed to by Head. This list is then quickly checked for /// ``links,'' i.e., unhashable elements possessing identical key sets /// and lengths. int Key_List::read_keys () { this->include_src = this->save_include_src (); if (this->include_src == 0) return -1; else if (this->output_types () == -1) return -1; else { ACE_Read_Buffer input (stdin); char *buffer = input.read ('\n'); if (buffer == 0) ACE_ERROR_RETURN ((LM_ERROR, "No words in input file, did you forget to prepend %%%%" " or use -t accidentally?\n"), -1); // Read in all the keywords from the input file. else { List_Node *temp = 0; const char *delimiter = option.delimiter (); ACE_NEW_RETURN (this->head, List_Node (buffer, static_cast (ACE_OS::strcspn (buffer, delimiter))), -1); for (temp = this->head; (0 != (buffer = input.read ('\n'))) && ACE_OS::strcmp (buffer, "%%"); temp = temp->next) { ACE_NEW_RETURN (temp->next, List_Node (buffer, static_cast (ACE_OS::strcspn (buffer, delimiter))), -1); ++this->total_keys; } // See if any additional source code is included at end of // this file. if (buffer) additional_code = 1; this->list_len = this->total_keys; // Make large hash table for efficiency. Hash_Table table (this->list_len * Key_List::TABLE_MULTIPLE); List_Node *trail = 0; // Test whether there are any links and also set the maximum // length an identifier in the keyword list. for (temp = head; temp != 0; temp = temp->next) { List_Node *ptr = table.find (temp, option[NOLENGTH]); // Check for static key links. We deal with these by // building an equivalence class of all duplicate values // (i.e., links) so that only 1 keyword is // representative of the entire collection. This // *greatly* simplifies processing during later stages // of the program. if (ptr == 0) trail = temp; else { ++total_duplicates; --list_len; trail->next = temp->next; temp->link = ptr->link; ptr->link = temp; // Complain if user hasn't enabled the duplicate // option. if (!option[DUP] || option[DEBUGGING]) ACE_ERROR ((LM_ERROR, "Static key link: \"%C\" = \"%C\", with key set \"%C\".\n", temp->key, ptr->key, temp->keysig)); } // Update minimum and maximum keyword length, if needed. if (max_key_len < temp->length) max_key_len = temp->length; if (min_key_len > temp->length) min_key_len = temp->length; } } // Exit program if links exists and option[DUP] not set, since // we can't continue. if (total_duplicates) { if (option[DUP]) { if (!option[MUTE]) ACE_ERROR_RETURN ((LM_ERROR, "%d input keysigs have identical hash values, examine output carefully...\n", total_duplicates), 0); } else ACE_ERROR_RETURN ((LM_ERROR, "%d input keysigs have identical hash values,\ntry different key positions or use option -D.\n", total_duplicates), -1); } if (option[ALLCHARS]) option.keysig_size (max_key_len); } return 0; } /// Recursively merges two sorted lists together to form one sorted /// list. The ordering criteria is by frequency of occurrence of /// elements in the key set or by the hash value. This is a kludge, /// but permits nice sharing of almost identical code without incurring /// the overhead of a function call comparison. List_Node * Key_List::merge (List_Node *list1, List_Node *list2) { if (list1 == 0) { return list2; } else if (list2 == 0) { return list1; } else if ((occurrence_sort && list1->occurrence < list2->occurrence) || (hash_sort && list1->hash_value > list2->hash_value) || (key_sort && ACE_OS::strcmp (list1->key, list2->key) >= 0)) { list2->next = merge (list2->next, list1); return list2; } else { list1->next = merge (list1->next, list2); return list1; } } // Applies the merge sort algorithm to recursively sort the key list // by frequency of occurrence of elements in the key set. List_Node * Key_List::merge_sort (List_Node *a_head) { if (!a_head || !a_head->next) return a_head; else { List_Node *middle = a_head; List_Node *temp = a_head->next->next; while (temp) { temp = temp->next; middle = middle->next; if (temp) temp = temp->next; } temp = middle->next; middle->next = 0; return merge (merge_sort (a_head), merge_sort (temp)); } } // Returns the frequency of occurrence of elements in the key set. inline int Key_List::occurrence (List_Node *ptr) { int value = 0; for (char *temp = ptr->keysig; *temp; temp++) value += Vectors::occurrences[(int) *temp]; return value; } // Sets the index location for all keysig characters that are now // determined. inline void Key_List::determined (List_Node *ptr) { for (char *temp = ptr->keysig; *temp; temp++) Key_List::determined_[(int) *temp] = 1; } // Returns TRUE if PTR's key set is already completely determined. inline int Key_List::already_determined (List_Node *ptr) { int is_determined = 1; for (char *temp = ptr->keysig; is_determined && *temp; temp++) is_determined = determined_[(int) *temp]; return is_determined; } // Reorders the table by first sorting the list so that frequently // occurring keys appear first, and then the list is reorded so that // keys whose values are already determined will be placed towards the // front of the list. This helps prune the search time by handling // inevitable collisions early in the search process. See Cichelli's // paper from Jan 1980 JACM for details.... void Key_List::reorder () { List_Node *ptr = 0; for (ptr = head; ptr; ptr = ptr->next) ptr->occurrence = occurrence (ptr); // Switch to sorting by occurrence. hash_sort = 0; occurrence_sort = 1; for (ptr = head = merge_sort (head); ptr->next; ptr = ptr->next) { determined (ptr); if (already_determined (ptr->next)) continue; else { List_Node *trail_ptr = ptr->next; List_Node *run_ptr = trail_ptr->next; for (; run_ptr; run_ptr = trail_ptr->next) { if (already_determined (run_ptr)) { trail_ptr->next = run_ptr->next; run_ptr->next = ptr->next; ptr = ptr->next = run_ptr; } else trail_ptr = run_ptr; } } } } // Outputs the maximum and minimum hash values. Since the list is // already sorted by hash value all we need to do is find the final // item! void Key_List::output_min_max () { List_Node *temp = 0; for (temp = head; temp->next; temp = temp->next) continue; min_hash_value = head->hash_value; max_hash_value = temp->hash_value; if (!option[ENUM]) ACE_OS::printf ("\n#define TOTAL_KEYWORDS %d\n#define MIN_WORD_LENGTH %d" "\n#define MAX_WORD_LENGTH %d\n#define MIN_HASH_VALUE %d" "\n#define MAX_HASH_VALUE %d\n#define HASH_VALUE_RANGE %d" "\n#define DUPLICATES %d\n#define WORDLIST_SIZE %d\n\n", total_keys, min_key_len, max_key_len, min_hash_value, max_hash_value, max_hash_value - min_hash_value + 1, total_duplicates ? total_duplicates + 1 : 0, total_keys + min_hash_value); else if (option[GLOBAL]) ACE_OS::printf ("enum\n{\n" " TOTAL_KEYWORDS = %d,\n" " MIN_WORD_LENGTH = %d,\n" " MAX_WORD_LENGTH = %d,\n" " MIN_HASH_VALUE = %d,\n" " MAX_HASH_VALUE = %d,\n" " HASH_VALUE_RANGE = %d,\n" " DUPLICATES = %d\n" " WORDLIST_SIZE = %d};\n\n", total_keys, min_key_len, max_key_len, min_hash_value, max_hash_value, max_hash_value - min_hash_value + 1, total_duplicates ? total_duplicates + 1 : 0, total_keys + min_hash_value); } // Generates the output using a C switch. This trades increased // search time for decreased table space (potentially *much* less // space for sparse tables). It the user has specified their own // struct in the keyword file *and* they enable the POINTER option we // have extra work to do. The solution here is to maintain a local // static array of user defined struct's, as with the // Output_Lookup_Function. Then we use for switch statements to // perform either a strcmp or strncmp, returning 0 if the str fails to // match, and otherwise returning a pointer to appropriate index // location in the local static array. void Key_List::output_switch (int use_keyword_table) { if (!option[GLOBAL] && use_keyword_table == 0) { if (option[LENTABLE] && option[DUP]) output_keylength_table (); if (option[POINTER] && option[TYPE]) output_keyword_table (); } std::unique_ptr safe_comp_buffer; char * comp_buffer; List_Node *curr = head; int pointer_and_type_enabled = option[POINTER] && option[TYPE]; int total_switches = option.total_switches (); int switch_size = keyword_list_length () / total_switches; if (pointer_and_type_enabled) { // Keep track of the longest string we'll need! const char *s = "charmap[*str] == *resword->%s && !ACE_OS::strncasecmp (str + 1, resword->%s + 1, len - 1)"; char * const tmp = new char[ACE_OS::strlen (s) + 2 * ACE_OS::strlen (option.key_name ()) + 1]; safe_comp_buffer.reset (tmp); comp_buffer = safe_comp_buffer.get (); if (option[COMP]) ACE_OS::sprintf (comp_buffer, "%s == *resword->%s && !ACE_OS::%s (str + 1, resword->%s + 1, len - 1)", option[STRCASECMP] ? "charmap[*str]" : "*str", option.key_name (), option[STRCASECMP] ? "strncasecmp" : "strncmp", option.key_name ()); else ACE_OS::sprintf (comp_buffer, "%s == *resword->%s && !ACE_OS::%s (str + 1, resword->%s + 1)", option[STRCASECMP] ? "charmap[*str]" : "*str", option.key_name (), option[STRCASECMP] ? "strcasecmp" : "strcmp", option.key_name ()); } else { if (option[COMP]) comp_buffer = option[STRCASECMP] ? (char *) "charmap[*str] == *resword && !ACE_OS::strncasecmp (str + 1, resword + 1, len - 1)" : (char *) "*str == *resword && !ACE_OS::strncmp (str + 1, resword + 1, len - 1)"; else comp_buffer = option[STRCASECMP] ? (char *) "charmap[*str] == *resword && !ACE_OS::strncasecmp (str + 1, resword + 1, len - 1)" : (char *) "*str == *resword && !ACE_OS::strcmp (str + 1, resword + 1)"; } if (!option[OPTIMIZE]) ACE_OS::printf (" if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)\n {\n"); ACE_OS::printf (" unsigned int const key = %s (str, len);\n\n", option.hash_name ()); if (!option[OPTIMIZE]) ACE_OS::printf (" if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE)\n"); ACE_OS::printf (" {\n"); // Properly deal with user's who request multiple switch statements. while (curr) { List_Node *temp = curr; int lowest_case_value = curr->hash_value; int number_of_cases = 0; // Figure out a good cut point to end this switch. for (; temp && ++number_of_cases < switch_size; temp = temp->next) if (temp->next && temp->hash_value == temp->next->hash_value) while (temp->next && temp->hash_value == temp->next->hash_value) temp = temp->next; if (temp && total_switches != 1) ACE_OS::printf (" if (key <= %d)\n {\n", temp->hash_value); else ACE_OS::printf (" {\n"); // Output each keyword as part of a switch statement indexed by // hash value. if (option[POINTER] || option[DUP] || use_keyword_table) { int i = 0; ACE_OS::printf (" %s%s *resword; %s\n\n", option[CONSTANT] || pointer_and_type_enabled == 0 ? "const " : "", pointer_and_type_enabled ? struct_tag : "char", option[LENTABLE] && !option[DUP] ? "unsigned int key_len;" : ""); if (total_switches == 1) { ACE_OS::printf (" switch (key)\n {\n"); lowest_case_value = 0; } else ACE_OS::printf (" switch (key - %d)\n {\n", lowest_case_value); for (temp = curr; temp && ++i <= number_of_cases; temp = temp->next) { ACE_OS::printf (" case %*d:\n", Key_List::field_width, temp->hash_value - lowest_case_value); // Handle `static links,' i.e., those that occur during // the initial preprocessing. if (temp->link == 0) { if (option[DEBUGGING]) ACE_OS::printf (" /* hash value = %4d, keyword = \"%s\" */\n", temp->hash_value, temp->key); } else { List_Node *links = 0; for (links = temp; links; links = links->link) { if (option[DEBUGGING]) ACE_OS::printf (" /* hash value = %4d, keyword = \"%s\" */\n", temp->hash_value, links->key); if (pointer_and_type_enabled) ACE_OS::printf (" resword = &wordlist[%d];\n", links->slot); else if (use_keyword_table) ACE_OS::printf (" resword = wordlist[%d];\n", links->slot); else ACE_OS::printf (" resword = \"%s\";\n", links->key); ACE_OS::printf (" if (%s) return resword;\n", comp_buffer); } } // Handle unresolved duplicate hash values. These are // guaranteed to be adjacent since we sorted the keyword // list by increasing hash values. if (temp->next && temp->hash_value == temp->next->hash_value) { for ( ; temp->next && temp->hash_value == temp->next->hash_value; temp = temp->next) { if (pointer_and_type_enabled) ACE_OS::printf (" resword = &wordlist[%d];\n", temp->slot); else if (use_keyword_table) ACE_OS::printf (" resword = wordlist[%d];", temp->slot); else ACE_OS::printf (" resword = \"%s\";\n", temp->key); ACE_OS::printf (" if (%s) return resword;\n", comp_buffer); } if (pointer_and_type_enabled) ACE_OS::printf (" resword = &wordlist[%d];\n", temp->slot); else if (use_keyword_table) ACE_OS::printf (" resword = wordlist[%d];", temp->slot); else ACE_OS::printf (" resword = \"%s\";\n", temp->key); ACE_OS::printf (" return %s ? resword : 0;\n", comp_buffer); } else if (temp->link) ACE_OS::printf (" return 0;\n"); else { if (pointer_and_type_enabled) ACE_OS::printf (" resword = &wordlist[%d];", temp->slot); else if (use_keyword_table) ACE_OS::printf (" resword = wordlist[%d];", temp->slot); else ACE_OS::printf (" resword = \"%s\";", temp->key); if (option[LENTABLE] && !option[DUP]) ACE_OS::printf (" key_len = %d;", temp->length); ACE_OS::printf (" break;\n"); } } ACE_OS::printf (" default: return 0;\n }\n"); if (option[OPTIMIZE]) ACE_OS::printf (" return resword;\n"); else { ACE_OS::printf (option[LENTABLE] && !option[DUP] ? " if (len == key_len && %s)\n return resword;\n" : " if (%s)\n return resword;\n", comp_buffer); ACE_OS::printf (" return 0;\n"); } ACE_OS::printf (" }\n"); curr = temp; } else // Nothing special required here. { int i = 0; ACE_OS::printf (" char *s;\n\n switch (key - %d)\n {\n", lowest_case_value); for (temp = curr; temp && ++i <= number_of_cases; temp = temp->next) if (option[LENTABLE]) ACE_OS::printf (" case %*d: if (len == %d) s = \"%s\"; else return 0; break;\n", Key_List::field_width, temp->hash_value - lowest_case_value, temp->length, temp->key); else ACE_OS::printf (" case %*d: s = \"%s\"; break;\n", Key_List::field_width, temp->hash_value - lowest_case_value, temp->key); ACE_OS::printf (" default: return 0;\n }\n "); if (option[COMP]) ACE_OS::printf ("return %s == *s && !ACE_OS::%s;\n }\n", option[STRCASECMP] ? "charmap[*str]" : "*str", option[STRCASECMP] ? "strncasecmp (s + 1, str + 1, len - 1)" : "strcmp (s + 1, str + 1)"); else ACE_OS::printf ("return %s == *s && !ACE_OS::%s;\n }\n", option[STRCASECMP] ? "charmap[*str]" : "*str", option[STRCASECMP] ? "strcasecmp (s + 1, str + 1, len - 1)" : "strcmp (s + 1, str + 1)"); curr = temp; } } ACE_OS::printf (" }\n %s\n}\n", option[OPTIMIZE] ? "" : "}\n return 0;"); } // Prints out a table of keyword lengths, for use with the comparison // code in generated function ``in_word_set.'' void Key_List::output_keylength_table () { const int max_column = 15; int slot = 0; int column = 0; const char *indent = option[GLOBAL] ? "" : " "; List_Node *temp; if (!option[DUP] && !option[SWITCH]) { ACE_OS::printf ("\n%sstatic %sunsigned %s lengthtable[] =\n%s%s{\n ", indent, option[CONSTANT] ? "const " : "", max_key_len <= ((int) UCHAR_MAX) ? "char" : (max_key_len <= ((int) USHRT_MAX) ? "short" : "long"), indent, indent); for (temp = head; temp; temp = temp->next, slot++) { if (slot < temp->hash_value) for ( ; slot < temp->hash_value; slot++) ACE_OS::printf ("%3d,%s", 0, ++column % (max_column - 1) ? "" : "\n "); ACE_OS::printf ("%3d,%s", temp->length, ++column % (max_column - 1 ) ? "" : "\n "); } ACE_OS::printf ("\n%s%s};\n", indent, indent); } } // Prints out the array containing the key words for the Gen_Perf hash // function. void Key_List::output_keyword_table () { const char *l_brace = *head->rest ? "{" : ""; const char *r_brace = *head->rest ? "}," : ""; const char *indent = option[GLOBAL] ? "" : " "; int slot = 0; List_Node *temp; int pointer_and_type_enabled = option[POINTER] && option[TYPE]; ACE_OS::printf ("%sstatic %s%swordlist[] =\n%s%s{\n", indent, option[CONSTANT] || pointer_and_type_enabled == 0 ? "const " : "", struct_tag, indent, indent); // Skip over leading blank entries if there are no duplicates. if (0 < head->hash_value) ACE_OS::printf (" "); int column_defaults; for (column_defaults = 1; slot < head->hash_value; column_defaults++) { ACE_OS::printf ("%s\"\",%s%s%s", l_brace, option.fill_default (), r_brace, column_defaults % 9 ? "" : "\n "); slot++; } if (0 < head->hash_value && column_defaults % 10) ACE_OS::printf ("\n"); // Generate an array of reserved words at appropriate locations. for (temp = head ; temp; temp = temp->next, slot++) { temp->slot = slot; if (!option[SWITCH] && (total_duplicates == 0 || !option[DUP]) && slot < temp->hash_value) { int column; ACE_OS::printf (" "); for (column = 1; slot < temp->hash_value; slot++, column++) ACE_OS::printf ("%s\"\",%s%s%s", l_brace, option.fill_default (), r_brace, column % 9 ? "" : "\n "); if (column % 10) ACE_OS::printf ("\n"); else { ACE_OS::printf ("%s\"%s\", %s%s", l_brace, temp->key, temp->rest, r_brace); if (option[DEBUGGING]) ACE_OS::printf (" /* hash value = %d, slot = %d */", temp->hash_value, temp->slot); putchar ('\n'); continue; } } ACE_OS::printf (" %s\"%s\", %s%s", l_brace, temp->key, temp->rest, r_brace); if (option[DEBUGGING]) ACE_OS::printf (" /* hash value = %d, slot = %d */", temp->hash_value, temp->slot); putchar ('\n'); // Deal with links specially. if (temp->link) for (List_Node *links = temp->link; links; links = links->link) { links->slot = ++slot; ACE_OS::printf (" %s\"%s\", %s%s", l_brace, links->key, links->rest, r_brace); if (option[DEBUGGING]) ACE_OS::printf (" /* hash value = %d, slot = %d */", links->hash_value, links->slot); putchar ('\n'); } } ACE_OS::printf ("%s%s};\n\n", indent, indent); } // Generates C code for the binary search algorithm that returns // the proper encoding for each key word int Key_List::output_binary_search_function () { ACE_OS::printf ("%s\n", include_src); // Get prototype for strncmp() and strcmp(). if (!option[SKIPSTRINGH]) ACE_OS::printf ("#include \"ace/OS_NS_string.h\"\n"); // Output type declaration now, reference it later on.... if (option[TYPE] && !option[NOTYPE]) ACE_OS::printf ("%s;\n", array_type_); output_min_max (); if (option[STRCASECMP]) output_strcasecmp (); // Class definition if -M is *not* enabled. if (option[CPLUSPLUS] && !option[SKIPCLASS]) ACE_OS::printf ("class %s {\npublic:\n" " static %s%s%s (const char *str);\n};\n\n", option.class_name (), option[CONSTANT] ? "const " : "", return_type, option.function_name ()); // Use the inline keyword to remove function overhead. if (option[INLINE]) ACE_OS::printf ("inline\n"); ACE_OS::printf ("%s%s\n", option[CONSTANT] ? "const " : "", return_type); if (option[CPLUSPLUS]) ACE_OS::printf ("%s::", option.class_name ()); ACE_OS::printf (option[ANSI] ? "%s (const char *str)\n{\n" : "%s (str)\n char *str;\n{\n", option.function_name ()); // Use the switch in place of lookup table. if (option[SWITCH]) output_switch (); // Use the lookup table, in place of switch. else { if (!option[GLOBAL]) { if (option[LENTABLE]) output_keylength_table (); output_keyword_table (); } } // Logic to handle the Binary Search. ACE_OS::printf ("int first = 0, last = 0, middle = 0;\n"); if (option[DUP] && total_duplicates > 0) { ACE_OS::printf ("%s*base = 0;\n",struct_tag); } ACE_OS::printf ("\nlast = %d;\n",total_keys - 1); ACE_OS::printf ("while (last >= first)\n"); ACE_OS::printf ("\t{\n"); ACE_OS::printf ("\t middle = (last + first) / 2;\n"); ACE_OS::printf ("\t if (ACE_OS::strcmp (wordlist[middle].%s, str) == 0)\n break;\n", option.key_name()); ACE_OS::printf ("\t if (ACE_OS::strcmp (wordlist[middle].%s, str) < 0)\n first = middle + 1;\n", option.key_name()); ACE_OS::printf ("\t else last = middle - 1;\n"); ACE_OS::printf ("\t}\n"); ACE_OS::printf ("if (last < first)\n return 0;\n"); ACE_OS::printf ("else\n return (&wordlist[middle]);\n}\n"); if (additional_code) { for (;;) { int c = getchar (); if (c == EOF) break; else putchar (c); } } ACE_OS::fflush(stdout); return 0; } // Generates C code for the linear search algorithm that returns // the proper encoding for each key word int Key_List::output_linear_search_function () { ACE_OS::printf ("%s\n", include_src); // Get prototype for strncmp() and strcmp(). if (!option[SKIPSTRINGH]) ACE_OS::printf ("#include \"ace/OS_NS_string.h\"\n"); // Output type declaration now, reference it later on.... if (option[TYPE] && !option[NOTYPE]) ACE_OS::printf ("%s;\n", array_type_); output_min_max (); if (option[STRCASECMP]) output_strcasecmp (); // Class definition if -M is *not* enabled. if (option[CPLUSPLUS] && !option[SKIPCLASS]) ACE_OS::printf ("class %s {\npublic:\n" " static %s%s%s (const char *str);\n};\n\n", option.class_name (), option[CONSTANT] ? "const " : "", return_type, option.function_name ()); // Use the inline keyword to remove function overhead. if (option[INLINE]) ACE_OS::printf ("inline\n"); ACE_OS::printf ("%s%s\n", option[CONSTANT] ? "const " : "", return_type); if (option[CPLUSPLUS]) ACE_OS::printf ("%s::", option.class_name ()); ACE_OS::printf (option[ANSI] ? "%s (const char *str)\n{\n" : "%s (str)\n char *str;\n{\n", option.function_name ()); // Use the switch in place of lookup table. if (option[SWITCH]) output_switch (); // Use the lookup table, in place of switch. else { if (!option[GLOBAL]) { if (option[LENTABLE]) output_keylength_table (); output_keyword_table (); } } // Logic to handle the Linear Search. ACE_OS::printf ("for (int i=0; i<=%d; i++)",total_keys-1); ACE_OS::printf ("\t{\n"); ACE_OS::printf ("\t if (ACE_OS::strcmp (wordlist[i].%s, str) == 0)\n", option.key_name()); ACE_OS::printf ("\t return &wordlist[i];\n"); ACE_OS::printf ("\t}\n"); ACE_OS::printf ("return 0;\n}\n"); if (additional_code) { for (;;) { int c = getchar (); if (c == EOF) break; else putchar (c); } } ACE_OS::fflush (stdout); return 0; } // Generates C code for the hash function that returns the proper // encoding for each key word. void Key_List::output_hash_function () { const int max_column = 10; int count = max_hash_value; #if ACE_STANDARD_CHARACTER_SET_SIZE == ACE_EBCDIC_SIZE // Lookup table for converting ASCII to EBCDIC. static const int ascii_to_ebcdic[ACE_ASCII_SIZE] = { 0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F, 0x16, 0x05, 0x15, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26, 0x18, 0x19, 0x3F, 0x27, 0x22, 0x1D, 0x1E, 0x1F, 0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D, 0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F, 0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xAD, 0xE0, 0xBD, 0x5F, 0x6D, 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xC0, 0x6A, 0xD0, 0xA1, 0x07}; int ebcdic_to_ascii[ACE_EBCDIC_SIZE]; int target; #endif /* ACE_STANDARD_CHARACTER_SET_SIZE == ACE_EBCDIC_SIZE */ // Calculate maximum number of digits required for MAX_HASH_VALUE. for (Key_List::field_width = 2; (count /= 10) > 0; Key_List::field_width++) continue; if (option[INLINE]) ACE_OS::printf ("inline\n"); if (option[C]) ACE_OS::printf ("static "); ACE_OS::printf ("unsigned int\n"); if (option[CPLUSPLUS]) ACE_OS::printf ("%s::", option.class_name ()); ACE_OS::printf (option[ANSI] ? "%s (const char *str, unsigned int len)\n{\n" : "%s (str, len)\n char *str;\n unsigned int len;\n{\n", option.hash_name ()); // Generate the asso_values table. ACE_OS::printf (" static %sunsigned %s asso_values[] =\n {", option[CONSTANT] ? "constexpr " : "", max_hash_value < ((int) UCHAR_MAX) ? "char" : (max_hash_value < ((int) USHRT_MAX) ? "short" : "int")); #if ACE_STANDARD_CHARACTER_SET_SIZE == ACE_EBCDIC_SIZE { for (count = 0; count < ACE_ASCII_SIZE; ++count) { if (!(count % max_column)) ACE_OS::printf ("\n "); target = ascii_to_ebcdic[count]; ACE_OS::printf ("%*d,", Key_List::field_width, Vectors::occurrences[target] ? Vectors::asso_values[target] : max_hash_value + 1); } } # else { for (count = 0; count < ACE_ASCII_SIZE; ++count) { if (!(count % max_column)) ACE_OS::printf ("\n "); ACE_OS::printf ("%*d,", Key_List::field_width, Vectors::occurrences[count] ? Vectors::asso_values[count] : max_hash_value + 1); } } #endif /* ACE_STANDARD_CHARACTER_SET_SIZE == ACE_EBCDIC_SIZE */ // Optimize special case of ``-k 1,$'' if (option[DEFAULTCHARS]) { if (option[STRCASECMP]) ACE_OS::printf ("\n };\n return %sasso_values[static_cast(charmap[str[len - 1]]]) + asso_values[static_cast(charmap[str[0]])];\n}\n\n", option[NOLENGTH] ? "" : "len + "); else ACE_OS::printf ("\n };\n return %sasso_values[static_cast(str[len - 1])] + asso_values[static_cast(str[0])];\n}\n\n", option[NOLENGTH] ? "" : "len + "); } else { int key_pos; option.reset (); // Get first (also highest) key position. key_pos = option.get (); // We can perform additional optimizations here. if (!option[ALLCHARS] && key_pos <= min_key_len) { ACE_OS::printf ("\n };\n return %s", option[NOLENGTH] ? "" : "len + "); for (; key_pos != WORD_END; ) { ACE_OS::printf (option[STRCASECMP] ? "asso_values[static_cast(charmap[str[%d]])]" : "asso_values[static_cast(str[%d])]", key_pos - 1); if ((key_pos = option.get ()) != EOS) ACE_OS::printf (" + "); else break; } ACE_OS::printf ("%s;\n}\n\n", key_pos == WORD_END ? (option[STRCASECMP] ? "asso_values[static_cast(charmap[str[len - 1]])]" : "asso_values[static_cast(str[len - 1])]") : ""); } // We've got to use the correct, but brute force, technique. else { ACE_OS::printf ("\n };\n unsigned int hval = %s;\n\n switch (%s)\n {\n default:\n", option[NOLENGTH] ? "0" : "len", option[NOLENGTH] ? "len" : "hval"); // User wants *all* characters considered in hash. if (option[ALLCHARS]) { int i; // Break these options up for speed (gee, is this misplaced efficiency or what?! if (option[STRCASECMP]) for (i = max_key_len; i > 0; i--) ACE_OS::printf (" case %d:\n hval += asso_values[static_cast(charmap[static_cast(str[%d])])];\n", i, i - 1); else for (i = max_key_len; i > 0; i--) ACE_OS::printf (" case %d:\n hval += asso_values[static_cast(str[%d])];\n", i, i - 1); ACE_OS::printf (" }\n return hval;\n}\n\n"); } else // do the hard part... { count = key_pos + 1; do { while (--count > key_pos) ACE_OS::printf (" case %d:\n", count); ACE_OS::printf (option[STRCASECMP] ? " case %d:\n hval += asso_values[static_cast(charmap[static_cast(str[%d])])];\n // Fallthrough\n" : " case %d:\n hval += asso_values[static_cast(str[%d])];\n // Fallthrough \n", key_pos, key_pos - 1); } while ((key_pos = option.get ()) != EOS && key_pos != WORD_END); ACE_OS::printf (" }\n return hval%s;\n}\n\n", key_pos == WORD_END ? (option[STRCASECMP] ? " + asso_values[static_cast(charmap[static_cast(str[len - 1])])]" : " + asso_values[static_cast(str[len - 1])]") : ""); } } } } int Key_List::count_duplicates (List_Node *link, const char *type) { int count = 0; // Count the number of "static" duplicates for this hash value. for (List_Node *ptr = link; ptr != 0; ptr = ptr->link) { count++; if (option[DEBUGGING]) ACE_DEBUG ((LM_DEBUG, "%s linked keyword = %s, slot = %d, hash_value = %d\n", type, ptr->key, ptr->slot, ptr->hash_value)); } return count; } void Key_List::update_lookup_array (int lookup_array[], int i1, int i2, Duplicate_Entry *dup_ptr, int value) { lookup_array[i1] = -dup_ptr->slot; lookup_array[i2] = -dup_ptr->count; lookup_array[dup_ptr->hash_value] = value; } // Generates the large, sparse table that maps hash values in the // smaller, contiguous range of the keyword table. int Key_List::output_lookup_array () { if (total_duplicates > 0) { const int DEFAULT_VALUE = -1; Duplicate_Entry *duplicates = 0; ACE_NEW_RETURN (duplicates, Duplicate_Entry[total_duplicates], -1); int *lookup_array = 0; ACE_NEW_RETURN (lookup_array, int[max_hash_value + 1], -1); Duplicate_Entry *dup_ptr = duplicates; int *lookup_ptr = lookup_array + max_hash_value + 1; // Initialize the lookup array to the DEFAULT_VALUE (-1). while (lookup_ptr > lookup_array) *--lookup_ptr = DEFAULT_VALUE; // Iterate through the keylist and handle the static and dynamic // duplicate entries. for (List_Node *temp = head; temp; temp = temp->next) { int hash_value = temp->hash_value; // Store the keyword's slot location into the // at the . If this is a // non-duplicate, then this value will point directly to the // keyword. lookup_array[hash_value] = temp->slot; if (option[DEBUGGING]) ACE_DEBUG ((LM_DEBUG, "keyword = %s, slot = %d, hash_value = %d, lookup_array[hash_value] = %d\n", temp->key, temp->slot, temp->hash_value, lookup_array[temp->hash_value])); if (temp->link == 0 && (temp->next == 0 || hash_value != temp->next->hash_value)) // This isn't a duplicate. Note that we know this because // we sorted the keys by their hash value. continue; else { // We'll handle the duplicates here. dup_ptr->hash_value = hash_value; dup_ptr->slot = temp->slot; dup_ptr->count = 1; // Count the number of "static" duplicates, i.e., // keywords that had the same keysig when the keyfile // was first read. dup_ptr->count += this->count_duplicates (temp->link, "static"); // Count the number of "dynamic" duplicates, i.e., // keywords that ended up with the same hash value as a // result of the contents. for (; temp->next && hash_value == temp->next->hash_value; temp = temp->next) dup_ptr->count += this->count_duplicates (temp->next, "dynamic"); dup_ptr++; } } // Compute the values in the lookup array. while (--dup_ptr >= duplicates) { if (option[DEBUGGING]) ACE_DEBUG ((LM_DEBUG, "dup_ptr[%d]: hash_value = %d, slot = %d, count = %d\n", dup_ptr - duplicates, dup_ptr->hash_value, dup_ptr->slot, dup_ptr->count)); int i; // Look to the left first. for (i = dup_ptr->hash_value; i > 0; i--) if (lookup_array[i] == DEFAULT_VALUE && lookup_array[i - 1] == DEFAULT_VALUE) { this->update_lookup_array (lookup_array, i - 1, i, dup_ptr, -(max_hash_value + (dup_ptr->hash_value - i + 1))); break; } // If we didn't find it to the left look to the right // instead... if (i == 0) { for (i = dup_ptr->hash_value; i < max_hash_value; i++) if (lookup_array[i] == DEFAULT_VALUE && lookup_array[i + 1] == DEFAULT_VALUE) { this->update_lookup_array (lookup_array, i, i + 1, dup_ptr, max_hash_value + (i - dup_ptr->hash_value)); break; } // If this happens, we can't use the output array scheme... if (i >= max_hash_value) { option = SWITCH; ACE_DEBUG ((LM_DEBUG, "GPERF: Automatically changing to -S1 switch option\n")); // Since we've already generated the keyword table // we need to use it! this->output_switch (1); delete [] duplicates; delete [] lookup_array; return 1; // 1 indicates that we've changed our mind... } } } lookup_ptr = lookup_array + max_hash_value + 1; int max = INT_MIN; while (lookup_ptr > lookup_array) { int val = abs (*--lookup_ptr); if (max < val) max = val; } const char *indent = option[GLOBAL] ? "" : " "; ACE_OS::printf ("%sstatic %ssigned %s lookup[] =\n%s%s{\n%s", indent, option[CONSTANT] ? "constexpr " : "", max <= SCHAR_MAX ? "char" : (max <= SHRT_MAX ? "short" : "int"), indent, indent, option[DEBUGGING] ? "" : " "); int count = max; // Calculate maximum number of digits required for LOOKUP_ARRAY_SIZE. for (Key_List::field_width = 2; (count /= 10) > 0; Key_List::field_width++) continue; const int max_column = 15; int column = 0; for (lookup_ptr = lookup_array; lookup_ptr < lookup_array + max_hash_value + 1; lookup_ptr++) { if (option[DEBUGGING]) ACE_OS::printf (" %*d, /* slot = %d */\n", Key_List::field_width, *lookup_ptr, (int)(lookup_ptr - lookup_array)); else ACE_OS::printf ("%*d, %s", Key_List::field_width, *lookup_ptr, ++column % (max_column - 1) ? "" : "\n "); } ACE_OS::printf ("%s%s%s};\n\n", option[DEBUGGING] ? "" : "\n", indent, indent); delete [] duplicates; delete [] lookup_array; } return 0; } // Generates C code to perform the keyword lookup. void Key_List::output_lookup_function () { if (!option[OPTIMIZE]) ACE_OS::printf (" if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)\n {\n"); ACE_OS::printf (" unsigned int const key = %s (str, len);\n\n", option.hash_name ()); if (!option[OPTIMIZE]) ACE_OS::printf (" if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE)\n"); ACE_OS::printf (" {\n"); if (option[DUP] && total_duplicates > 0) { int pointer_and_type_enabled = option[POINTER] && option[TYPE]; ACE_OS::printf (" int slot = lookup[key];\n\n" " if (slot >= 0 && slot < WORDLIST_SIZE)\n"); if (option[OPTIMIZE]) ACE_OS::printf (" return %swordlist[slot];\n", option[TYPE] && option[POINTER] ? "&" : ""); else { ACE_OS::printf (" {\n" " %schar *s = wordlist[slot]", option[CONSTANT] || pointer_and_type_enabled == 0 ? "const " : ""); if (ACE_OS::strcmp (array_type_, Key_List::default_array_type) != 0) ACE_OS::printf (".%s", option.key_name ()); ACE_OS::printf (";\n\n if (%s%s == *s && !ACE_OS::%s)\n return %s;\n }\n", option[LENTABLE] ? "len == lengthtable[key]\n && " : "", option[STRCASECMP] ? "charmap[*str]" : "*str", option[COMP] ? (option[STRCASECMP] ? "strncasecmp (str + 1, s + 1, len - 1)" : "strncmp (str + 1, s + 1, len - 1)") : (option[STRCASECMP] ? "strcasecmp (str + 1, s + 1)" : "strcmp (str + 1, s + 1)"), option[TYPE] && option[POINTER] ? "&wordlist[slot]" : "s"); ACE_OS::printf (" else if (slot < 0 && slot >= -MAX_HASH_VALUE)\n" " return 0;\n"); } ACE_OS::printf (" else\n {\n" " unsigned int offset = key + slot + (slot > 0 ? -MAX_HASH_VALUE : MAX_HASH_VALUE);\n" " %s%s*base = &wordlist[-lookup[offset]];\n" " %s%s*ptr = base + -lookup[offset + 1];\n\n" " while (--ptr >= base)\n ", option[CONSTANT] || pointer_and_type_enabled == 0 ? "const " : "", struct_tag, option[CONSTANT] || pointer_and_type_enabled == 0 ? "const " : "", struct_tag); if (ACE_OS::strcmp (array_type_, Key_List::default_array_type) != 0) { if (option[COMP]) ACE_OS::printf ("if (%s == *ptr->%s && !ACE_OS::%s (str + 1, ptr->%s + 1, len - 1", option[STRCASECMP] ? "charmap[*str]" : "*str", option.key_name (), option[STRCASECMP] ? "strncasecmp" : "strncmp", option.key_name ()); else ACE_OS::printf ("if (%s == *ptr->%s && !ACE_OS::%s (str + 1, ptr->%s + 1", option[STRCASECMP] ? "charmap[*str]" : "*str", option.key_name (), option[STRCASECMP] ? "strcasecmp" : "strcmp", option.key_name ()); } else ACE_OS::printf (option[STRCASECMP] ? "if (charmap[*str] == **ptr && !ACE_OS::%s" : "if (*str == **ptr && !ACE_OS::%s", option[COMP] ? (option[STRCASECMP] ? "strncasecmp (str + 1, *ptr + 1, len - 1" : "strncmp (str + 1, *ptr + 1, len - 1") : (option[STRCASECMP] ? "strcasecmp (str + 1, *ptr + 1" : "strcmp (str + 1, *ptr + 1")); ACE_OS::printf ("))\n return %sptr;" "\n }\n }\n %s\n}\n", ACE_OS::strcmp (array_type_, Key_List::default_array_type) == 0 ? "*" : "", option[OPTIMIZE] ? "" : "}\n return 0;"); } else { if (option[OPTIMIZE]) ACE_OS::printf (" return %swordlist[key]", option[TYPE] && option[POINTER] ? "&" : ""); else { int pointer_and_type_enabled = option[POINTER] && option[TYPE]; ACE_OS::printf (" %schar *s = wordlist[key]", option[CONSTANT] || pointer_and_type_enabled == 0 ? "const " : ""); if (ACE_OS::strcmp (array_type_, Key_List::default_array_type) != 0) ACE_OS::printf (".%s", option.key_name ()); ACE_OS::printf (";\n\n if (%s%s == *s && !ACE_OS::%s)\n return %s", option[LENTABLE] ? "len == lengthtable[key]\n && " : "", option[STRCASECMP] ? "charmap[*str]" : "*str", option[COMP] ? (option[STRCASECMP] ? "strncasecmp (str + 1, s + 1, len - 1)" : "strncmp (str + 1, s + 1, len - 1)") : (option[STRCASECMP] ? "strcasecmp (str + 1, s + 1)" : "strcmp (str + 1, s + 1)"), option[TYPE] && option[POINTER] ? "&wordlist[key]" : "s"); } ACE_OS::printf (";\n }\n %s\n}\n", option[OPTIMIZE] ? "" : "}\n return 0;"); } } // Output the table and the functions that map upper case into lower case! void Key_List::output_strcasecmp () { ACE_OS::printf ("%s", "/* This array is designed for mapping upper and lower case letter\n" " * together for a case independent comparison. The mappings are\n" " * based upon ascii character sequences.\n */" "static char charmap[] = {\n" " '\\000', '\\001', '\\002', '\\003', '\\004', '\\005', '\\006', '\\007',\n" " '\\010', '\\011', '\\012', '\\013', '\\014', '\\015', '\\016', '\\017',\n" " '\\020', '\\021', '\\022', '\\023', '\\024', '\\025', '\\026', '\\027',\n" " '\\030', '\\031', '\\032', '\\033', '\\034', '\\035', '\\036', '\\037',\n" " '\\040', '\\041', '\\042', '\\043', '\\044', '\\045', '\\046', '\\047',\n" " '\\050', '\\051', '\\052', '\\053', '\\054', '\\055', '\\056', '\\057',\n" " '\\060', '\\061', '\\062', '\\063', '\\064', '\\065', '\\066', '\\067',\n" " '\\070', '\\071', '\\072', '\\073', '\\074', '\\075', '\\076', '\\077',\n" " '\\100', '\\141', '\\142', '\\143', '\\144', '\\145', '\\146', '\\147',\n" " '\\150', '\\151', '\\152', '\\153', '\\154', '\\155', '\\156', '\\157',\n" " '\\160', '\\161', '\\162', '\\163', '\\164', '\\165', '\\166', '\\167',\n" " '\\170', '\\171', '\\172', '\\133', '\\134', '\\135', '\\136', '\\137',\n" " '\\140', '\\141', '\\142', '\\143', '\\144', '\\145', '\\146', '\\147',\n" " '\\150', '\\151', '\\152', '\\153', '\\154', '\\155', '\\156', '\\157',\n" " '\\160', '\\161', '\\162', '\\163', '\\164', '\\165', '\\166', '\\167',\n" " '\\170', '\\171', '\\172', '\\173', '\\174', '\\175', '\\176', '\\177',\n" " '\\200', '\\201', '\\202', '\\203', '\\204', '\\205', '\\206', '\\207',\n" " '\\210', '\\211', '\\212', '\\213', '\\214', '\\215', '\\216', '\\217',\n" " '\\220', '\\221', '\\222', '\\223', '\\224', '\\225', '\\226', '\\227',\n" " '\\230', '\\231', '\\232', '\\233', '\\234', '\\235', '\\236', '\\237',\n" " '\\240', '\\241', '\\242', '\\243', '\\244', '\\245', '\\246', '\\247',\n" " '\\250', '\\251', '\\252', '\\253', '\\254', '\\255', '\\256', '\\257',\n" " '\\260', '\\261', '\\262', '\\263', '\\264', '\\265', '\\266', '\\267',\n" " '\\270', '\\271', '\\272', '\\273', '\\274', '\\275', '\\276', '\\277',\n" " '\\300', '\\341', '\\342', '\\343', '\\344', '\\345', '\\346', '\\347',\n" " '\\350', '\\351', '\\352', '\\353', '\\354', '\\355', '\\356', '\\357',\n" " '\\360', '\\361', '\\362', '\\363', '\\364', '\\365', '\\366', '\\367',\n" " '\\370', '\\371', '\\372', '\\333', '\\334', '\\335', '\\336', '\\337',\n" " '\\340', '\\341', '\\342', '\\343', '\\344', '\\345', '\\346', '\\347',\n" " '\\350', '\\351', '\\352', '\\353', '\\354', '\\355', '\\356', '\\357',\n" " '\\360', '\\361', '\\362', '\\363', '\\364', '\\365', '\\366', '\\367',\n" " '\\370', '\\371', '\\372', '\\373', '\\374', '\\375', '\\376', '\\377',\n};\n\nstatic int\n"); if (option[COMP]) { ACE_OS::printf ("%s", option[ANSI] ? "strncasecmp (char *s1, char *s2, int n)" : "strncasecmp (s1, s2, n)\n char *s1, *s2;\n int n;"); ACE_OS::printf ("\n{\n char *cm = charmap;\n\n while (--n >= 0 && cm[*s1] == cm[*s2++])\n" " if (*s1++ == '\\0')\n return 0;\n" "\n return n < 0 ? 0 : cm[*s1] - cm[*--s2];\n}\n\n"); } else { ACE_OS::printf ("%s", option[ANSI] ? "strcasecmp (char *s1, char *s2)" : "strcasecmp (s1, s2)\n char *s1, *s2;"); ACE_OS::printf ("\n{\n char *cm = charmap;\n\n while (cm[*s1] == cm[*s2++])\n" " if (*s1++ == '\\0')\n return 0;\n" "\n return cm[*s1] - cm[*--s2];\n}\n\n"); } } // Generates the hash function and the key word recognizer function // based upon the user's Options. int Key_List::output () { if (option[BINARYSEARCH]) // Generate code binary search. this->output_binary_search_function (); else if (option[LINEARSEARCH]) // Generate code for linear search. this->output_linear_search_function (); else { // Generate the usual GPERF things. ACE_OS::printf ("%s\n", include_src); // Get prototype for strncmp() and strcmp(). if (!option[SKIPSTRINGH]) ACE_OS::printf ("#include \"ace/OS_NS_string.h\"\n"); // Output type declaration now, reference it later on.... if (option[TYPE] && !option[NOTYPE]) ACE_OS::printf ("%s;\n", array_type_); output_min_max (); if (option[STRCASECMP]) output_strcasecmp (); // Class definition if -M is *not* enabled. if (option[CPLUSPLUS] && !option[SKIPCLASS]) ACE_OS::printf ("class %s\n{\nprivate:\n" " static unsigned int %s (const char *str, unsigned int len);\npublic:\n" " static %s%s%s (const char *str, unsigned int len);\n};\n\n", option.class_name (), option.hash_name (), option[CONSTANT] ? "const " : "", return_type, option.function_name ()); output_hash_function (); if (option[GLOBAL]) { if (option[SWITCH]) { if (option[LENTABLE] && option[DUP]) { output_keylength_table (); } if (option[POINTER] && option[TYPE]) { output_keyword_table (); } } else { if (option[LENTABLE]) { output_keylength_table (); } output_keyword_table (); if (output_lookup_array () == -1) { ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "output_lookup_array"), -1); } } } // Use the inline keyword to remove function overhead. if (option[INLINE]) { ACE_OS::printf ("inline\n"); } int pointer_and_type_enabled = option[POINTER] && option[TYPE]; ACE_OS::printf ("%s%s\n", option[CONSTANT] || pointer_and_type_enabled == 0 ? "const " : "", return_type); if (option[CPLUSPLUS]) ACE_OS::printf ("%s::", option.class_name ()); ACE_OS::printf (option[ANSI] ? "%s (const char *str, unsigned int len)\n{\n" : "%s (str, len)\n char *str;\n unsigned int len;\n{\n", option.function_name ()); if (option[ENUM] && !option[GLOBAL]) ACE_OS::printf (" enum\n {\n" " TOTAL_KEYWORDS = %d,\n" " MIN_WORD_LENGTH = %d,\n" " MAX_WORD_LENGTH = %d,\n" " MIN_HASH_VALUE = %d,\n" " MAX_HASH_VALUE = %d,\n" " HASH_VALUE_RANGE = %d,\n" " DUPLICATES = %d,\n" " WORDLIST_SIZE = %d\n };\n\n", total_keys, min_key_len, max_key_len, min_hash_value, max_hash_value, max_hash_value - min_hash_value + 1, total_duplicates ? total_duplicates + 1 : 0, total_keys + min_hash_value); // Use the switch in place of lookup table. if (option[SWITCH]) output_switch (); // Use the lookup table, in place of switch. else { if (!option[GLOBAL]) { if (option[LENTABLE]) output_keylength_table (); output_keyword_table (); } if (!option[GLOBAL]) { switch (output_lookup_array ()) { case -1: ACE_ERROR_RETURN ((LM_DEBUG, "%p\n", "output_lookup_array"), -1); /* NOTREACHED */ case 0: output_lookup_function (); break; /* NOTREACHED */ default: break; /* NOTREACHED */ } } else output_lookup_function (); } if (additional_code) { for (;;) { int c = getchar (); if (c == EOF) break; else putchar (c); } } ACE_OS::fflush (stdout); } return 0; } // Sorts the keys by hash value. void Key_List::sort () { // By default, we sort via hashing. hash_sort = 1; occurrence_sort = 0; this->head = merge_sort (this->head); } // Sorts the keys by normal strcmp. void Key_List::string_sort () { // Flatten the equivalence class list to a linear list. List_Node *ptr; for(ptr=head;ptr;ptr=ptr->next) { List_Node *curr; if(ptr->link) { List_Node *last_node = 0; for(curr = ptr->link; curr; curr = curr->link) { // Chnage the link to next pointer. curr->next = curr->link; // Save the pointer for the last node. if (curr->link == 0) last_node = curr; } // Set the pointers, correctly. last_node->next = ptr->next; ptr->next = ptr->link; ptr = last_node; } } // Set all links to Null. for(ptr=head;ptr;ptr=ptr->next) { ptr->link = 0; } // Set the sorting options. key_sort = 1; hash_sort = 0; occurrence_sort = 0; // Sort. this->head = merge_sort (head); key_sort = 0; } // Dumps the key list to stderr stream. void Key_List::dump () { ACE_DEBUG ((LM_DEBUG, "\nDumping key list information:\ntotal non-static linked keywords = %d" "\ntotal keywords = %d\ntotal duplicates = %d\nmaximum key length = %d\n", list_len, total_keys, total_duplicates ? total_duplicates + 1 : 0, max_key_len)); u_int keysig_width = option.max_keysig_size () > ACE_OS::strlen ("keysig") ? option.max_keysig_size () : static_cast (ACE_OS::strlen ("keysig")); size_t key_length = this->max_key_length (); size_t keyword_width = key_length > ACE_OS::strlen ("keysig") ? key_length : ACE_OS::strlen ("keysig"); ACE_DEBUG ((LM_DEBUG, "\nList contents are:\n(hash value, key length, slot, %*s, %*s, duplicates):\n", keysig_width, "keysig", keyword_width, "keyword")); for (List_Node *ptr = head; ptr; ptr = ptr->next) { ACE_DEBUG ((LM_DEBUG, "%11d,%11d,%6d, %*s, %*s", ptr->hash_value, ptr->length, ptr->slot, keysig_width, ptr->keysig, keyword_width, ptr->key)); List_Node *dup = ptr->link; if (dup) { for (; dup != 0; dup = dup->link) ACE_DEBUG ((LM_DEBUG, " %s", dup->key)); } ACE_DEBUG ((LM_DEBUG, "\n")); } ACE_DEBUG ((LM_DEBUG, "End dumping list.\n\n")); } // Simple-minded constructor action here... Key_List::Key_List () : head (0), total_duplicates (0), array_type_ (dup_string (Key_List::default_array_type)), return_type (dup_string (Key_List::default_return_type)), struct_tag (dup_string (Key_List::default_array_type)), max_key_len (INT_MIN), min_key_len (INT_MAX), key_sort (0), additional_code (0), total_keys (1) { } // Returns the length of entire key list. int Key_List::keyword_list_length () { return list_len; } // Returns length of longest key read. int Key_List::max_key_length () { return max_key_len; } ace-8.0.4+dfsg.orig/apps/gperf/src/Bool_Array.cpp0000644000175000017500000000505115027201773020562 0ustar sudipsudip// -*- C++ -*- // Fast lookup table abstraction implemented as an Iteration Number Array /** * Copyright (C) 1989 Free Software Foundation, Inc. * written by Douglas C. Schmidt (d.schmidt@vanderbilt.edu) * * This file is part of GNU GPERF. * * 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 * of the License, 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. */ #include "Bool_Array.h" #include "ace/OS_NS_string.h" #include "ace/OS_Memory.h" // Prints out debugging diagnostics. Bool_Array::~Bool_Array () { if (option[DEBUGGING]) ACE_DEBUG ((LM_DEBUG, "\ndumping boolean array information\n" "size = %u\niteration number = %u\nend of array dump\n", size_, generation_number_)); delete [] this->storage_array_; } Bool_Array::Bool_Array () : storage_array_ (0), generation_number_ (0), size_ (0) { } int Bool_Array::open (u_long s) { this->generation_number_ = 1; this->size_ = s; ACE_NEW_RETURN (storage_array_, u_long[s], -1); ACE_OS::memset (storage_array_, 0, s * sizeof *storage_array_); if (option[DEBUGGING]) ACE_DEBUG ((LM_DEBUG, "\nbool array size = %u, total bytes = %u\n", size_, size_ * (int) sizeof *storage_array_)); return 0; } int Bool_Array::find (u_long slot) { if (storage_array_[slot] == generation_number_) return 1; else { storage_array_[slot] = generation_number_; return 0; } } void Bool_Array::reset () { if (++generation_number_ == 0) { if (option[DEBUGGING]) ACE_DEBUG ((LM_DEBUG, "(re-initializing bool_array)...")); this->generation_number_ = 1; ACE_OS::memset (storage_array_, 0, size_ * sizeof *storage_array_); if (option[DEBUGGING]) ACE_DEBUG ((LM_DEBUG, "done\n")); } } ace-8.0.4+dfsg.orig/apps/gperf/ace_gperf.10000644000175000017500000000134415027201773017234 0ustar sudipsudip.TH GPERF 1 "December 16, 1988" .UC 4 .SH NAME ace_gperf \- generate a perfect hash function from a key set .SH SYNOPSIS .B ace_gperf [ .B \-adghijklnoprsStv ] [ .I keyfile ] .SH DESCRIPTION \fIace_gperf\fP reads a set of ``keys'' from \fIkeyfile\fP (or, by default, from the standard input) and attempts to find a non-minimal perfect hashing function that recognizes a member of the key set in constant, i.e., O(1), time. If such a function is found the program generates a pair of \fIC\fP source code routines that perform the hashing and table lookup. All generated code is directed to the standard output. Please refer to the \fIace_gperf.texinfo\fP file for more information. This file is distributed with \fIace_gperf\fP release. ace-8.0.4+dfsg.orig/apps/gperf/ace_gperf.mpc0000644000175000017500000000014015027201773017644 0ustar sudipsudip// -*- MPC -*- project (gperf_docs) : man { Man_Files { ace_gperf.1 } custom_only=1 } ace-8.0.4+dfsg.orig/apps/gperf/COPYING0000644000175000017500000004312715027201773016277 0ustar sudipsudip GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy 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 of the License, 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 Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. ace-8.0.4+dfsg.orig/apps/gperf/ace_gperf.info0000644000175000017500000014534115027201773020035 0ustar sudipsudipThis is ../../../apps/gperf/ace_gperf.info, produced by makeinfo version 4.3 from ../../../apps/gperf/ace_gperf.texi. INFO-DIR-SECTION GNU programming tools START-INFO-DIR-ENTRY * ACE_Gperf: (ace_gperf). Perfect Hash Function Generator. END-INFO-DIR-ENTRY This file documents the features of the GNU Perfect Hash Function Generator Copyright (C) 1989 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the section entitled "GNU General Public License" is included exactly as in the original, and provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that the section entitled "GNU `gperf' General Public License" an d this permission notice may be included in translations approved by the Free Software Foundation instead of in the original English.  File: gperf.info, Node: Top, Next: Copying, Prev: (dir), Up: (dir) GNU GPERF Utility ***************** Introduction ************ This manual documents the GNU `gperf' perfect hash function generator utility, focusing on its features and how to use them, and how to report bugs. * Menu: * Copying:: GNU `gperf' General Public License says how you can copy and share `gperf'. * Contributors:: People who have contributed to `gperf'. * Motivation:: Static search structures and GNU GPERF. * Search Structures:: Static search structures and GNU `gperf' * Description:: High-level discussion of how GPERF functions. * Options:: A description of options to the program. * Bugs:: Known bugs and limitations with GPERF. * Projects:: Things still left to do. * Implementation:: Implementation Details for GNU GPERF. * Bibliography:: Material Referenced in this Report. --- The Detailed Node Listing --- High-Level Description of GNU `gperf' * Input Format:: Input Format to `gperf' * Output Format:: Output Format for Generated C Code with `gperf' Input Format to `gperf' * Declarations:: `struct' Declarations and C Code Inclusion. * Keywords:: Format for Keyword Entries. * Functions:: Including Additional C Functions.  File: gperf.info, Node: Copying, Next: Contributors, Prev: Top, Up: Top GNU GENERAL PUBLIC LICENSE ************************** Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble ======== The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 1. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 2. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 3. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: * cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and * cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). * If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. * You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 4. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: * accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, * accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, * accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 5. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 6. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 7. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 8. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 9. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 10. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 11. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs ======================================================= If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES. Copyright (C) 19YY NAME OF AUTHOR 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 1, 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. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19YY NAME OF AUTHOR Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. SIGNATURE OF TY COON, 1 April 1989 Ty Coon, President of Vice That's all there is to it!  File: gperf.info, Node: Contributors, Next: Motivation, Prev: Copying, Up: Top Contributors to GNU `gperf' Utility *********************************** * The GNU `gperf' perfect hash function generator utility was originally written in GNU C++ by Douglas C. Schmidt. It is now also available in a highly-portable "old-style" C version. The general idea for the perfect hash function generator was inspired by Keith Bostic's algorithm written in C, and distributed to net.sources around 1984. The current program is a heavily modified, enhanced, and extended implementation of Keith's basic idea, created at the University of California, Irvine. Bugs, patches, and suggestions should be reported to schmidt at ics.uci.edu. * Special thanks is extended to Michael Tiemann and Doug Lea, for providing a useful compiler, and for giving me a forum to exhibit my creation. In addition, Adam de Boor and Nels Olson provided many tips and insights that greatly helped improve the quality and functionality of `gperf'.  File: ace_gperf.info, Node: Motivation, Next: Search Structures, Prev: Contributors, Up: Top Introduction ************ `ace_gperf' is a perfect hash function generator written in C++. It transforms an _n_ element user-specified keyword set _W_ into a perfect hash function _F_. _F_ uniquely maps keywords in _W_ onto the range 0.._k_, where _k_ >= _n_. If _k = n_ then _F_ is a _minimal_ perfect hash function. `gperf' generates a 0.._k_ element static lookup table and a pair of C functions. These functions determine whether a given character string _s_ occurs in _W_, using at most one probe into the lookup table. `ace_gperf' currently generates the reserved keyword recognizer for lexical analyzers in several production and research compilers and language processing tools, including GNU C, GNU C++, GNU Pascal, GNU Modula 3, and GNU indent. Complete C++ source code for `gperf' is available via anonymous ftp from ics.uci.edu. `gperf' also is distributed along with the GNU libg++ library. A highly portable, functionally equivalent K&R C version of `gperf' is archived in comp.sources.unix, volume 20. Finally, a paper describing `gperf''s design and implementation in greater detail is available in the Second USENIX C++ Conference proceedings.  File: gperf.info, Node: Search Structures, Next: Description, Prev: Motivation, Up: Top Static search structures and GNU `gperf' **************************************** A "static search structure" is an Abstract Data Type with certain fundamental operations, _e.g._, _initialize_, _insert_, and _retrieve_. Conceptually, all insertions occur before any retrievals. In practice, `gperf' generates a `static' array containing search set keywords and any associated attributes specified by the user. Thus, there is essentially no execution-time cost for the insertions. It is a useful data structure for representing _static search sets_. Static search sets occur frequently in software system applications. Typical static search sets include compiler reserved words, assembler instruction opcodes, and built-in shell interpreter commands. Search set members, called "keywords", are inserted into the structure only once, usually during program initialization, and are not generally modified at run-time. Numerous static search structure implementations exist, _e.g._, arrays, linked lists, binary search trees, digital search tries, and hash tables. Different approaches offer trade-offs between space utilization and search time efficiency. For example, an _n_ element sorted array is space efficient, though the average-case time complexity for retrieval operations using binary search is proportional to log _n_. Conversely, hash table implementations often locate a table entry in constant time, but typically impose additional memory overhead and exhibit poor worst case performance. _Minimal perfect hash functions_ provide an optimal solution for a particular class of static search sets. A minimal perfect hash function is defined by two properties: * It allows keyword recognition in a static search set using at most _one_ probe into the hash table. This represents the "perfect" property. * The actual memory allocated to store the keywords is precisely large enough for the keyword set, and _no larger_. This is the "minimal" property. For most applications it is far easier to generate _perfect_ hash functions than _minimal perfect_ hash functions. Moreover, non-minimal perfect hash functions frequently execute faster than minimal ones in practice. This phenomena occurs since searching a sparse keyword table increases the probability of locating a "null" entry, thereby reducing string comparisons. `gperf''s default behavior generates _near-minimal_ perfect hash functions for keyword sets. However, `gperf' provides many options that permit user control over the degree of minimality and perfection. Static search sets often exhibit relative stability over time. For example, Ada's 63 reserved words have remained constant for nearly a decade. It is therefore frequently worthwhile to expend concerted effort building an optimal search structure _once_, if it subsequently receives heavy use multiple times. `gperf' removes the drudgery associated with constructing time- and space-efficient search structures by hand. It has proven a useful and practical tool for serious programming projects. Output from `gperf' is currently used in several production and research compilers, including GNU C, GNU C++, GNU Pascal, and GNU Modula 3. The latter two compilers are not yet part of the official GNU distribution. Each compiler utilizes `gperf' to automatically generate static search structures that efficiently identify their respective reserved keywords.  File: gperf.info, Node: Description, Next: Options, Prev: Search Structures, Up: Top High-Level Description of GNU `gperf' ************************************* * Menu: * Input Format:: Input Format to `gperf' * Output Format:: Output Format for Generated C Code with `gperf' The perfect hash function generator `gperf' reads a set of "keywords" from a "keyfile" (or from the standard input by default). It attempts to derive a perfect hashing function that recognizes a member of the "static keyword set" with at most a single probe into the lookup table. If `gperf' succeeds in generating such a function it produces a pair of C source code routines that perform hashing and table lookup recognition. All generated C code is directed to the standard output. Command-line options described below allow you to modify the input and output format to `gperf'. By default, `gperf' attempts to produce time-efficient code, with less emphasis on efficient space utilization. However, several options exist that permit trading-off execution time for storage space and vice versa. In particular, expanding the generated table size produces a sparse search structure, generally yielding faster searches. Conversely, you can direct `gperf' to utilize a C `switch' statement scheme that minimizes data space storage size. Furthermore, using a C `switch' may actually speed up the keyword retrieval time somewhat. Actual results depend on your C compiler, of course. In general, `gperf' assigns values to the characters it is using for hashing until some set of values gives each keyword a unique value. A helpful heuristic is that the larger the hash value range, the easier it is for `gperf' to find and generate a perfect hash function. Experimentation is the key to getting the most from `gperf'.  File: gperf.info, Node: Input Format, Next: Output Format, Prev: Description, Up: Description Input Format to `gperf' ======================= You can control the input keyfile format by varying certain command-line arguments, in particular the `-t' option. The input's appearance is similar to GNU utilities `flex' and `bison' (or UNIX utilities `lex' and `yacc'). Here's an outline of the general format: declarations %% keywords %% functions _Unlike_ `flex' or `bison', all sections of `gperf''s input are optional. The following sections describe the input format for each section. * Menu: * Declarations:: `struct' Declarations and C Code Inclusion. * Keywords:: Format for Keyword Entries. * Functions:: Including Additional C Functions.  File: gperf.info, Node: Declarations, Next: Keywords, Prev: Input Format, Up: Input Format `struct' Declarations and C Code Inclusion ------------------------------------------ The keyword input file optionally contains a section for including arbitrary C declarations and definitions, as well as provisions for providing a user-supplied `struct'. If the `-t' option _is_ enabled, you _must_ provide a C `struct' as the last component in the declaration section from the keyfile file. The first field in this struct must be a `char *' identifier called "name," although it is possible to modify this field's name with the `-K' option described below. Here is simple example, using months of the year and their attributes as input: struct months { char *name; int number; int days; int leap_days; }; %% january, 1, 31, 31 february, 2, 28, 29 march, 3, 31, 31 april, 4, 30, 30 may, 5, 31, 31 june, 6, 30, 30 july, 7, 31, 31 august, 8, 31, 31 september, 9, 30, 30 october, 10, 31, 31 november, 11, 30, 30 december, 12, 31, 31 Separating the `struct' declaration from the list of key words and other fields are a pair of consecutive percent signs, `%%', appearing left justified in the first column, as in the UNIX utility `lex'. Using a syntax similar to GNU utilities `flex' and `bison', it is possible to directly include C source text and comments verbatim into the generated output file. This is accomplished by enclosing the region inside left-justified surrounding `%{', `%}' pairs. Here is an input fragment based on the previous example that illustrates this feature: %{ #include /* This section of code is inserted directly into the output. */ int return_month_days (struct months *months, int is_leap_year); %} struct months { char *name; int number; int days; int leap_days; }; %% january, 1, 31, 31 february, 2, 28, 29 march, 3, 31, 31 ... It is possible to omit the declaration section entirely. In this case the keyfile begins directly with the first keyword line, _e.g._: january, 1, 31, 31 february, 2, 28, 29 march, 3, 31, 31 april, 4, 30, 30 ...  File: gperf.info, Node: Keywords, Next: Functions, Prev: Declarations, Up: Input Format Format for Keyword Entries -------------------------- The second keyfile format section contains lines of keywords and any associated attributes you might supply. A line beginning with `#' in the first column is considered a comment. Everything following the `#' is ignored, up to and including the following newline. The first field of each non-comment line is always the key itself. It should be given as a simple name, _i.e._, without surrounding string quotation marks, and be left-justified flush against the first column. In this context, a "field" is considered to extend up to, but not include, the first blank, comma, or newline. Here is a simple example taken from a partial list of C reserved words: # These are a few C reserved words, see the c.`gperf' file # for a complete list of ANSI C reserved words. unsigned sizeof switch signed if default for while return Note that unlike `flex' or `bison' the first `%%' marker may be elided if the declaration section is empty. Additional fields may optionally follow the leading keyword. Fields should be separated by commas, and terminate at the end of line. What these fields mean is entirely up to you; they are used to initialize the elements of the user-defined `struct' provided by you in the declaration section. If the `-t' option is _not_ enabled these fields are simply ignored. All previous examples except the last one contain keyword attributes.  File: gperf.info, Node: Functions, Prev: Keywords, Up: Input Format Including Additional C Functions -------------------------------- The optional third section also corresponds closely with conventions found in `flex' and `bison'. All text in this section, starting at the final `%%' and extending to the end of the input file, is included verbatim into the generated output file. Naturally, it is your responsibility to ensure that the code contained in this section is valid C.  File: gperf.info, Node: Output Format, Prev: Input Format, Up: Description Output Format for Generated C Code with `gperf' =============================================== Several options control how the generated C code appears on the standard output. Two C function are generated. They are called `hash' and `in_word_set', although you may modify the name for `in_word_set' with a command-line option. Both functions require two arguments, a string, `char *' STR, and a length parameter, `int' LEN. Their default function prototypes are as follows: static int hash (char *str, int len); int in_word_set (char *str, int len); By default, the generated `hash' function returns an integer value created by adding LEN to several user-specified STR key positions indexed into an "associated values" table stored in a local static array. The associated values table is constructed internally by `gperf' and later output as a static local C array called HASH_TABLE; its meaning and properties are described below. *Note Implementation::. The relevant key positions are specified via the `-k' option when running `gperf', as detailed in the _Options_ section below. *Note Options::. Two options, `-g' (assume you are compiling with GNU C and its `inline' feature) and `-a' (assume ANSI C-style function prototypes), alter the content of both the generated `hash' and `in_word_set' routines. However, function `in_word_set' may be modified more extensively, in response to your option settings. The options that affect the `in_word_set' structure are: `-p' Have function `in_word_set' return a pointer rather than a boolean. `-t' Make use of the user-defined `struct'. `-S TOTAL SWITCH STATEMENTS' Generate 1 or more C `switch' statement rather than use a large, (and potentially sparse) static array. Although the exact time and space savings of this approach vary according to your C compiler's degree of optimization, this method often results in smaller and faster code. If the `-t', `-S', and `-p' options are omitted the default action is to generate a `char *' array containing the keys, together with additional null strings used for padding the array. By experimenting with the various input and output options, and timing the resulting C code, you can determine the best option choices for different keyword set characteristics.  File: gperf.info, Node: Options, Next: Bugs, Prev: Description, Up: Top Options to the `gperf' Utility ****************************** There are _many_ options to `gperf'. They were added to make the program more convenient for use with real applications. "On-line" help is readily available via the `-h' option. Other options include: `-a' Generate ANSI Standard C code using function prototypes. The default is to use "classic" K&R C function declaration syntax. `-c' Generates C code that uses the `strncmp' function to perform string comparisons. The default action is to use `strcmp'. `-C' Makes the contents of all generated lookup tables constant, _i.e._, "readonly." Many compilers can generate more efficient code for this by putting the tables in readonly memory. `-d' Enables the debugging option. This produces verbose diagnostics to "standard error" when `gperf' is executing. It is useful both for maintaining the program and for determining whether a given set of options is actually speeding up the search for a solution. Some useful information is dumped at the end of the program when the `-d' option is enabled. `-D' Handle keywords whose key position sets hash to duplicate values. Duplicate hash values occur for two reasons: * Since `gperf' does not backtrack it is possible for it to process all your input keywords without finding a unique mapping for each word. However, frequently only a very small number of duplicates occur, and the majority of keys still require one probe into the table. * Sometimes a set of keys may have the same names, but possess different attributes. With the -D option `gperf' treats all these keys as part of an equivalence class and generates a perfect hash function with multiple comparisons for duplicate keys. It is up to you to completely disambiguate the keywords by modifying the generated C code. However, `gperf' helps you out by organizing the output. Option `-D' is extremely useful for certain large or highly redundant keyword sets, _i.e._, assembler instruction opcodes. Using this option usually means that the generated hash function is no longer perfect. On the other hand, it permits `gperf' to work on keyword sets that it otherwise could not handle. `-e KEYWORD DELIMITER LIST' Allows the user to provide a string containing delimiters used to separate keywords from their attributes. The default is ",\n". This option is essential if you want to use keywords that have embedded commas or newlines. One useful trick is to use -e'TAB', where TAB is the literal tab character. `-E' Define constant values using an enum local to the lookup function rather than with #defines. This also means that different lookup functions can reside in the same file. Thanks to James Clark (jjc at ai.mit.edu). `-f ITERATION AMOUNT' Generate the perfect hash function "fast." This decreases `gperf''s running time at the cost of minimizing generated table-size. The iteration amount represents the number of times to iterate when resolving a collision. `0' means `iterate by the number of keywords. This option is probably most useful when used in conjunction with options `-D' and/or `-S' for _large_ keyword sets. `-g' Assume a GNU compiler, _e.g._, `g++' or `gcc'. This makes all generated routines use the "inline" keyword to remove the cost of function calls. Note that `-g' does _not_ imply `-a', since other non-ANSI C compilers may have provisions for a function `inline' feature. `-G' Generate the static table of keywords as a static global variable, rather than hiding it inside of the lookup function (which is the default behavior). `-h' Prints a short summary on the meaning of each program option. Aborts further program execution. `-H HASH FUNCTION NAME' Allows you to specify the name for the generated hash function. Default name is `hash.' This option permits the use of two hash tables in the same file. `-i INITIAL VALUE' Provides an initial VALUE for the associate values array. Default is 0. Increasing the initial value helps inflate the final table size, possibly leading to more time efficient keyword lookups. Note that this option is not particularly useful when `-S' is used. Also, `-i' is overriden when the `-r' option is used. `-j JUMP VALUE' Affects the "jump value," _i.e._, how far to advance the associated character value upon collisions. JUMP VALUE is rounded up to an odd number, the default is 5. If the JUMP VALUE is 0 `gper f' jumps by random amounts. `-k KEYS' Allows selection of the character key positions used in the keywords' hash function. The allowable choices range between 1-126, inclusive. The positions are separated by commas, _e.g._, `-k 9,4,13,14'; ranges may be used, _e.g._, `-k 2-7'; and positions may occur in any order. Furthermore, the meta-character '*' causes the generated hash function to consider *all* character positions in each key, whereas '$' instructs the hash function to use the "final character" of a key (this is the only way to use a character position greater than 126, incidentally). For instance, the option `-k 1,2,4,6-10,'$'' generates a hash function that considers positions 1,2,4,6,7,8,9,10, plus the last character in each key (which may differ for each key, obviously). Keys with length less than the indicated key positions work properly, since selected key positions exceeding the key length are simply not referenced in the hash function. `-K KEY NAME' By default, the program assumes the structure component identifier for the keyword is "name." This option allows an arbitrary choice of identifier for this component, although it still must occur as the first field in your supplied `struct'. `-l' Compare key lengths before trying a string comparison. This might cut down on the number of string comparisons made during the lookup, since keys with different lengths are never compared via `strcmp'. However, using `-l' might greatly increase the size of the generated C code if the lookup table range is large (which implies that the switch option `-S' is not enabled), since the length table contains as many elements as there are entries in the lookup table. `-L GENERATED LANGUAGE NAME' Instructs `gperf' to generate code in the language specified by the option's argument. Languages handled are currently C++ and C. The default is C. `-n' Instructs the generator not to include the length of a keyword when computing its hash value. This may save a few assembly instructions in the generated lookup table. `-N LOOKUP FUNCTION NAME' Allows you to specify the name for the generated lookup function. Default name is `in_word_set.' This option permits completely automatic generation of perfect hash functions, especially when multiple generated hash functions are used in the same application. `-o' Reorders the keywords by sorting the keywords so that frequently occuring key position set components appear first. A second reordering pass follows so that keys with "already determined values" are placed towards the front of the keylist. This may decrease the time required to generate a perfect hash function for many keyword sets, and also produce more minimal perfect hash functions. The reason for this is that the reordering helps prune the search time by handling inevitable collisions early in the search process. On the other hand, if the number of keywords is _very_ large using `-o' may _increase_ `gperf''s execution time, since collisions will begin earlier and continue throughout the remainder of keyword processing. See Cichelli's paper from the January 1980 Communications of the ACM for details. `-p' Changes the return value of the generated function `in_word_set' from boolean (_i.e._, 0 or 1), to either type "pointer to user-defined struct," (if the `-t' option is enabled), or simply to `char *', if `-t' is not enabled. This option is most useful when the `-t' option (allowing user-defined structs) is used. For example, it is possible to automatically generate the GNU C reserved word lookup routine with the options `-p' and `-t'. `-r' Utilizes randomness to initialize the associated values table. This frequently generates solutions faster than using deterministic initialization (which starts all associated values at 0). Furthermore, using the randomization option generally increases the size of the table. If `gperf' has difficultly with a certain keyword set try using `-r' or `-D'. `-s SIZE-MULTIPLE' Affects the size of the generated hash table. The numeric argument for this option indicates "how many times larger or smaller" the maximum associated value range should be, in relationship to the number of keys. If the SIZE-MULTIPLE is negative the maximum associated value is calculated by _dividing_ it into the total number of keys. For example, a value of 3 means "allow the maximum associated value to be about 3 times larger than the number of input keys." Conversely, a value of -3 means "allow the maximum associated value to be about 3 times smaller than the number of input keys." Negative values are useful for limiting the overall size of the generated hash table, though this usually increases the number of duplicate hash values. If `generate switch' option `-S' is _not_ enabled, the maximum associated value influences the static array table size, and a larger table should decrease the time required for an unsuccessful search, at the expense of extra table space. The default value is 1, thus the default maximum associated value about the same size as the number of keys (for efficiency, the maximum associated value is always rounded up to a power of 2). The actual table size may vary somewhat, since this technique is essentially a heuristic. In particular, setting this value too high slows down `gperf''s runtime, since it must search through a much larger range of values. Judicious use of the `-f' option helps alleviate this overhead, however. `-S TOTAL SWITCH STATEMENTS' Causes the generated C code to use a `switch' statement scheme, rather than an array lookup table. This can lead to a reduction in both time and space requirements for some keyfiles. The argument to this option determines how many `switch' statements are generated. A value of 1 generates 1 `switch' containing all the elements, a value of 2 generates 2 tables with 1/2 the elements in each `switch', etc. This is useful since many C compilers cannot correctly generate code for large `switch' statements. This option was inspired in part by Keith Bostic's original C program. `-t' Allows you to include a `struct' type declaration for generated code. Any text before a pair of consecutive %% is consider part of the type declaration. Key words and additional fields may follow this, one group of fields per line. A set of examples for generating perfect hash tables and functions for Ada, C, and G++, Pascal, and Modula 2 and 3 reserved words are distributed with this release. `-T' Prevents the transfer of the type declaration to the output file. Use this option if the type is already defined elsewhere. `-v' Prints out the current version number. `-Z CLASS NAME' Allow user to specify name of generated C++ class. Default name is `Perfect_Hash'.  File: gperf.info, Node: Bugs, Next: Projects, Prev: Options, Up: Top Known Bugs and Limitations with `gperf' *************************************** The following are some limitations with the current release of `gperf': * The `gperf' utility is tuned to execute quickly, and works quickly for small to medium size data sets (around 1000 keywords). It is extremely useful for maintaining perfect hash functions for compiler keyword sets. Several recent enhancements now enable `gperf' to work efficiently on much larger keyword sets (over 15,000 keywords). When processing large keyword sets it helps greatly to have over 8 megs of RAM. However, since `gperf' does not backtrack no guaranteed solution occurs on every run. On the other hand, it is usually easy to obtain a solution by varying the option parameters. In particular, try the `-r' option, and also try changing the default arguments to the `-s' and `-j' options. To _guarantee_ a solution, use the `-D' and `-S' options, although the final results are not likely to be a _perfect_ hash function anymore! Finally, use the `-f' option if you want `gperf' to generate the perfect hash function _fast_, with less emphasis on making it minimal. * The size of the generate static keyword array can get _extremely_ large if the input keyword file is large or if the keywords are quite similar. This tends to slow down the compilation of the generated C code, and _greatly_ inflates the object code size. If this situation occurs, consider using the `-S' option to reduce data size, potentially increasing keyword recognition time a negligible amount. Since many C compilers cannot correctly generated code for large switch statements it is important to qualify the -S option with an appropriate numerical argument that controls the number of switch statements generated. * The maximum number of key positions selected for a given key has an arbitrary limit of 126. This restriction should be removed, and if anyone considers this a problem write me and let me know so I can remove the constraint. * The C++ source code only compiles correctly with GNU G++, version 1.36 (and hopefully later versions). Porting to AT&T cfront would be tedious, but possible (and desirable). There is also a K&R C version available now. This should compile without change on most BSD systems, but may require a bit of work to run on SYSV, since `gperf' uses ALLOCA in several places. Send mail to schmidt at ics.uci.edu for information.  File: gperf.info, Node: Projects, Next: Implementation, Prev: Bugs, Up: Top Things Still Left to Do *********************** It should be "relatively" easy to replace the current perfect hash function algorithm with a more exhaustive approach; the perfect hash module is essential independent from other program modules. Additional worthwhile improvements include: * Make the algorithm more robust. At present, the program halts with an error diagnostic if it can't find a direct solution and the `-D' option is not enabled. A more comprehensive, albeit computationally expensive, approach would employ backtracking or enable alternative options and retry. It's not clear how helpful this would be, in general, since most search sets are rather small in practice. * Another useful extension involves modifying the program to generate "minimal" perfect hash functions (under certain circumstances, the current version can be rather extravagant in the generated table size). Again, this is mostly of theoretical interest, since a sparse table often produces faster lookups, and use of the `-S' `switch' option can minimize the data size, at the expense of slightly longer lookups (note that the gcc compiler generally produces good code for `switch' statements, reducing the need for more complex schemes). * In addition to improving the algorithm, it would also be useful to generate a C++ class or Ada package as the code output, in addition to the current C routines.  File: gperf.info, Node: Implementation, Next: Bibliography, Prev: Projects, Up: Top Implementation Details of GNU `gperf' ************************************* A paper describing the high-level description of the data structures and algorithms used to implement `gperf' will soon be available. This paper is useful not only from a maintenance and enhancement perspective, but also because they demonstrate several clever and useful programming techniques, _e.g._, `Iteration Number' boolean arrays, double hashing, a "safe" and efficient method for reading arbitrarily long input from a file, and a provably optimal algorithm for simultaneously determining both the minimum and maximum elements in a list.  File: gperf.info, Node: Bibliography, Prev: Implementation, Up: Top Bibliography ************ [1] Chang, C.C.: A Scheme for Constructing Ordered Minimal Perfect Hashing Functions Information Sciences 39(1986), 187-195. [2] Cichelli, Richard J. Author's Response to "On Cichelli's Minimal Perfec t Hash Functions Method" Communications of the ACM, 23, 12(December 1980), 729. [3] Cichelli, Richard J. Minimal Perfect Hash Functions Made Simple Communications of the ACM, 23, 1(January 1980), 17-19. [4] Cook, C. R. and Oldehoeft, R.R. A Letter Oriented Minimal Perfect Hashing Function SIGPLAN Notices, 17, 9(September 1982), 18-27. [5] Cormack, G. V. and Horspool, R. N. S. and Kaiserwerth, M. Practical Perfect Hashing Computer Journal, 28, 1(January 1985), 54-58. [6] Jaeschke, G. Reciprocal Hashing: A Method for Generating Minimal Perfect Hashing Functions Communications of the ACM, 24, 12(December 1981), 829-833. [7] Jaeschke, G. and Osterburg, G. On Cichelli's Minimal Perfect Hash Functions Method Communications of the ACM, 23, 12(December 1980), 728-729. [8] Sager, Thomas J. A Polynomial Time Generator for Minimal Perfect Hash Functions Communications of the ACM, 28, 5(December 1985), 523-532 [9] Schmidt, Douglas C. GPERF: A Perfect Hash Function Generator Second USENIX C++ Conference Proceedings, April 1990. [10] Sebesta, R.W. and Taylor, M.A. Minimal Perfect Hash Functions for Reserved Word Lists SIGPLAN Notices, 20, 12(September 1985), 47-53. [11] Sprugnoli, R. Perfect Hashing Functions: A Single Probe Retrieving Method for Static Sets Communications of the ACM, 20 11(November 1977), 841-850. [12] Stallman, Richard M. Using and Porting GNU CC Free Software Foundation, 1988. [13] Stroustrup, Bjarne The C++ Programming Language. Addison-Wesley, 1986. [14] Tiemann, Michael D. User's Guide to GNU C++ Free Software Foundation, 1989.  Tag Table: Node: Top1277 Node: Copying2566 Node: Contributors15867 Node: Motivation16967 Node: Search Structures18234 Node: Description21787 Node: Input Format23607 Node: Declarations24402 Node: Keywords26709 Node: Functions28300 Node: Output Format28794 Node: Options31264 Node: Bugs44634 Node: Projects47321 Node: Implementation48898 Node: Bibliography49617  End Tag Table ace-8.0.4+dfsg.orig/apps/gperf/version.texi0000644000175000017500000000014115027201773017611 0ustar sudipsudip@set UPDATED 26 February 2002 @set UPDATED-MONTH February 2002 @set EDITION 2.0 @set VERSION 2.0 ace-8.0.4+dfsg.orig/apps/gperf/README0000644000175000017500000000216115027201773016115 0ustar sudipsudip While teaching a data structures course at University of California, Irvine, I developed a program called GPERF that generates perfect hash functions for sets of key words. A perfect hash function is: A hash function and a data structure that allows recognition of a key word in a set of words using exactly 1 probe into the data structure. The ace_gperf.texinfo file explains how the program works, the form of the input, what options are available, and hints on choosing the best options for particular key word sets. The texinfo file is readable both via the GNU emacs `info' command and is also suitable for typesetting with TeX. The enclosed Makefile creates the executable program ``ace_gperf'' and also runs the regression tests. Output from the GPERF program is used to recognize reserved words in the GNU C, GNU C++, and GNU Pascal compilers. In addition, it is used by TAO'd IDL compiler to generate operation dispatching tables. For more information on GPERF, please see http://www.dre.vanderbilt.edu/~schmidt/PDF/gperf.pdf Happy hacking! Douglas C. Schmidt d.schmidt@vanderbilt.edu ace-8.0.4+dfsg.orig/apps/apps.mwc0000644000175000017500000000003515027201773015603 0ustar sudipsudip// -*- MPC -*- workspace { } ace-8.0.4+dfsg.orig/etc/0000755000175000017500000000000015046037655013751 5ustar sudipsudipace-8.0.4+dfsg.orig/etc/index.html0000644000175000017500000001623415027201773015745 0ustar sudipsudip ACE+TAO Doxygen Documentation
DOC Laboratory

ACE+TAO Documentation


  • Documentation for the latest micro release kit is available at this site.

  • And we also have documentation for the latest stable release.


We do have the documentation for previous releases ace-8.0.4+dfsg.orig/etc/ace_rmcast.doxygen0000644000175000017500000035217115027201773017453 0ustar sudipsudip# Doxyfile 1.9.6 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. # # All text after a double hash (##) is considered a comment and is placed in # front of the TAG it is preceding. # # All text after a single hash (#) is considered a comment and will be ignored. # The format is: # TAG = value [value, ...] # For lists, items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (\" \"). # # Note: # # Use doxygen to compare the used configuration file with the template # configuration file: # doxygen -x [configFile] # Use doxygen to compare the used configuration file with the template # configuration file without replacing the environment variables or CMake type # replacement variables: # doxygen -x_noenv [configFile] #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the configuration # file that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # https://www.gnu.org/software/libiconv/ for the list of possible encodings. # The default value is: UTF-8. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded by # double-quotes, unless you are using Doxywizard) that should identify the # project for which the documentation is generated. This name is used in the # title of most generated pages and in a few other places. # The default value is: My Project. PROJECT_NAME = ACE_RMCast # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version # control system is used. PROJECT_NUMBER = Snapshot # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy # the logo to the output directory. PROJECT_LOGO = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # into which the generated documentation will be written. If a relative path is # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. OUTPUT_DIRECTORY = . # If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096 # sub-directories (in 2 levels) under the output directory of each output format # and will distribute the generated files over these directories. Enabling this # option can be useful when feeding doxygen a huge amount of source files, where # putting all generated files in the same directory would otherwise causes # performance problems for the file system. Adapt CREATE_SUBDIRS_LEVEL to # control the number of sub-directories. # The default value is: NO. CREATE_SUBDIRS = NO # Controls the number of sub-directories that will be created when # CREATE_SUBDIRS tag is set to YES. Level 0 represents 16 directories, and every # level increment doubles the number of directories, resulting in 4096 # directories at level 8 which is the default and also the maximum value. The # sub-directories are organized in 2 levels, the first level always has a fixed # number of 16 directories. # Minimum value: 0, maximum value: 8, default value: 8. # This tag requires that the tag CREATE_SUBDIRS is set to YES. CREATE_SUBDIRS_LEVEL = 8 # If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII # characters to appear in the names of generated files. If set to NO, non-ASCII # characters will be escaped, for example _xE3_x81_x84 will be used for Unicode # U+3044. # The default value is: NO. ALLOW_UNICODE_NAMES = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Bulgarian, # Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, English # (United States), Esperanto, Farsi (Persian), Finnish, French, German, Greek, # Hindi, Hungarian, Indonesian, Italian, Japanese, Japanese-en (Japanese with # English messages), Korean, Korean-en (Korean with English messages), Latvian, # Lithuanian, Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, # Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, # Swedish, Turkish, Ukrainian and Vietnamese. # The default value is: English. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member # descriptions after the members that are listed in the file and class # documentation (similar to Javadoc). Set to NO to disable this. # The default value is: YES. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief # description of a member or function before the detailed description # # Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. # The default value is: YES. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator that is # used to form the text in various listings. Each string in this list, if found # as the leading text of the brief description, will be stripped from the text # and the result, after processing the whole list, is used as the annotated # text. Otherwise, the brief description is used as-is. If left blank, the # following values are used ($name is automatically replaced with the name of # the entity):The $name class, The $name widget, The $name file, is, provides, # specifies, contains, represents, a, an and the. ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # doxygen will generate a detailed section even if there is only a brief # description. # The default value is: NO. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. # The default value is: NO. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path # before files name in the file list and in the header files. If set to NO the # shortest path that makes the file name unique will be used # The default value is: YES. FULL_PATH_NAMES = NO # The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. # Stripping is only done if one of the specified strings matches the left-hand # part of the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the path to # strip. # # Note that you can specify absolute paths here, but also relative paths, which # will be relative from the directory where doxygen is started. # This tag requires that the tag FULL_PATH_NAMES is set to YES. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which # header file to include in order to use a class. If left blank only the name of # the header file containing the class definition is used. Otherwise one should # specify the list of include paths that are normally passed to the compiler # using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but # less readable) file names. This can be useful is your file systems doesn't # support long names like on DOS, Mac, or CD-ROM. # The default value is: NO. SHORT_NAMES = YES # If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the # first line (until the first dot) of a Javadoc-style comment as the brief # description. If set to NO, the Javadoc-style will behave just like regular Qt- # style comments (thus requiring an explicit @brief command for a brief # description.) # The default value is: NO. JAVADOC_AUTOBRIEF = NO # If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line # such as # /*************** # as being the beginning of a Javadoc-style comment "banner". If set to NO, the # Javadoc-style will behave just like regular comments and it will not be # interpreted by doxygen. # The default value is: NO. JAVADOC_BANNER = NO # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first # line (until the first dot) of a Qt-style comment as the brief description. If # set to NO, the Qt-style will behave just like regular Qt-style comments (thus # requiring an explicit \brief command for a brief description.) # The default value is: NO. QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a # multi-line C++ special comment block (i.e. a block of //! or /// comments) as # a brief description. This used to be the default behavior. The new default is # to treat a multi-line C++ comment block as a detailed description. Set this # tag to YES if you prefer the old behavior instead. # # Note that setting this tag to YES also means that rational rose comments are # not recognized any more. # The default value is: NO. MULTILINE_CPP_IS_BRIEF = NO # By default Python docstrings are displayed as preformatted text and doxygen's # special commands cannot be used. By setting PYTHON_DOCSTRING to NO the # doxygen's special commands can be used and the contents of the docstring # documentation blocks is shown as doxygen documentation. # The default value is: YES. PYTHON_DOCSTRING = YES # If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the # documentation from any documented member that it re-implements. # The default value is: YES. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new # page for each member. If set to NO, the documentation of a member will be part # of the file/class/namespace that contains it. # The default value is: NO. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen # uses this value to replace tabs by spaces in code fragments. # Minimum value: 1, maximum value: 16, default value: 4. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that act as commands in # the documentation. An alias has the form: # name=value # For example adding # "sideeffect=@par Side Effects:^^" # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading # "Side Effects:". Note that you cannot put \n's in the value part of an alias # to insert newlines (in the resulting output). You can put ^^ in the value part # of an alias to insert a newline as if a physical newline was in the original # file. When you need a literal { or } or , in the value part of an alias you # have to escape them by means of a backslash (\), this can lead to conflicts # with the commands \{ and \} for these it is advised to use the version @{ and # @} or use a double escape (\\{ and \\}) ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For # instance, some of the names that are used will be different. The list of all # members will be omitted, etc. # The default value is: NO. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or # Python sources only. Doxygen will then generate output that is more tailored # for that language. For instance, namespaces will be presented as packages, # qualified scopes will look different, etc. # The default value is: NO. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources. Doxygen will then generate output that is tailored for Fortran. # The default value is: NO. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for VHDL. # The default value is: NO. OPTIMIZE_OUTPUT_VHDL = NO # Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice # sources only. Doxygen will then generate output that is more tailored for that # language. For instance, namespaces will be presented as modules, types will be # separated into more groups, etc. # The default value is: NO. OPTIMIZE_OUTPUT_SLICE = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, and # language is one of the parsers supported by doxygen: IDL, Java, JavaScript, # Csharp (C#), C, C++, Lex, D, PHP, md (Markdown), Objective-C, Python, Slice, # VHDL, Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: # FortranFree, unknown formatted Fortran: Fortran. In the later case the parser # tries to guess whether the code is fixed or free formatted code, this is the # default for Fortran type files). For instance to make doxygen treat .inc files # as Fortran files (default is PHP), and .f files as C (default is Fortran), # use: inc=Fortran f=C. # # Note: For files without extension you can use no_extension as a placeholder. # # Note that for custom extensions you also need to set FILE_PATTERNS otherwise # the files are not read by doxygen. When specifying no_extension you should add # * to the FILE_PATTERNS. # # Note see also the list of default file extension mappings. EXTENSION_MAPPING = # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable # documentation. See https://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you can # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in # case of backward compatibilities issues. # The default value is: YES. MARKDOWN_SUPPORT = YES # When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up # to that level are automatically included in the table of contents, even if # they do not have an id attribute. # Note: This feature currently applies only to Markdown headings. # Minimum value: 0, maximum value: 99, default value: 5. # This tag requires that the tag MARKDOWN_SUPPORT is set to YES. TOC_INCLUDE_HEADINGS = 0 # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can # be prevented in individual cases by putting a % sign in front of the word or # globally by setting AUTOLINK_SUPPORT to NO. # The default value is: YES. AUTOLINK_SUPPORT = YES # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should set this # tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); # versus func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. # The default value is: NO. BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. # The default value is: NO. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: # https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen # will parse them like normal C++ but will assume all classes use public instead # of private inheritance when no explicit protection keyword is present. # The default value is: NO. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate # getter and setter methods for a property. Setting this option to YES will make # doxygen to replace the get and set methods by a property in the documentation. # This will only work if the methods are indeed getting or setting a simple # type. If this is not the case, or you want to show the methods anyway, you # should set this option to NO. # The default value is: YES. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. # The default value is: NO. DISTRIBUTE_GROUP_DOC = YES # If one adds a struct or class to a group and this option is enabled, then also # any nested class or struct is added to the same group. By default this option # is disabled and one has to add nested compounds explicitly via \ingroup. # The default value is: NO. GROUP_NESTED_COMPOUNDS = NO # Set the SUBGROUPING tag to YES to allow class member groups of the same type # (for instance a group of public functions) to be put as a subgroup of that # type (e.g. under the Public Functions section). Set it to NO to prevent # subgrouping. Alternatively, this can be done per class using the # \nosubgrouping command. # The default value is: YES. SUBGROUPING = YES # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions # are shown inside the group in which they are included (e.g. using \ingroup) # instead of on a separate page (for HTML and Man pages) or section (for LaTeX # and RTF). # # Note that this feature does not work in combination with # SEPARATE_MEMBER_PAGES. # The default value is: NO. INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions # with only public data fields or simple typedef fields will be shown inline in # the documentation of the scope in which they are defined (i.e. file, # namespace, or group documentation), provided this scope is documented. If set # to NO, structs, classes, and unions are shown on a separate page (for HTML and # Man pages) or section (for LaTeX and RTF). # The default value is: NO. INLINE_SIMPLE_STRUCTS = NO # When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or # enum is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically be # useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. # The default value is: NO. TYPEDEF_HIDES_STRUCT = NO # The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This # cache is used to resolve symbols given their name and scope. Since this can be # an expensive process and often the same symbol appears multiple times in the # code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small # doxygen will become slower. If the cache is too large, memory is wasted. The # cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range # is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 # symbols. At the end of a run doxygen will report the cache usage and suggest # the optimal cache size from a speed point of view. # Minimum value: 0, maximum value: 9, default value: 0. LOOKUP_CACHE_SIZE = 0 # The NUM_PROC_THREADS specifies the number of threads doxygen is allowed to use # during processing. When set to 0 doxygen will based this on the number of # cores available in the system. You can set it explicitly to a value larger # than 0 to get more control over the balance between CPU load and processing # speed. At this moment only the input processing can be done using multiple # threads. Since this is still an experimental feature the default is set to 1, # which effectively disables parallel processing. Please report any issues you # encounter. Generating dot graphs in parallel is controlled by the # DOT_NUM_THREADS setting. # Minimum value: 0, maximum value: 32, default value: 1. NUM_PROC_THREADS = 1 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in # documentation are documented, even if no documentation was available. Private # class members and static file members will be hidden unless the # EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. # Note: This will also disable the warnings about undocumented members that are # normally produced when WARNINGS is set to YES. # The default value is: NO. EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will # be included in the documentation. # The default value is: NO. EXTRACT_PRIVATE = YES # If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual # methods of a class will be included in the documentation. # The default value is: NO. EXTRACT_PRIV_VIRTUAL = NO # If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal # scope will be included in the documentation. # The default value is: NO. EXTRACT_PACKAGE = NO # If the EXTRACT_STATIC tag is set to YES, all static members of a file will be # included in the documentation. # The default value is: NO. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined # locally in source files will be included in the documentation. If set to NO, # only classes defined in header files are included. Does not have any effect # for Java sources. # The default value is: YES. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. If set to YES, local methods, # which are defined in the implementation section but not in the interface are # included in the documentation. If set to NO, only methods in the interface are # included. # The default value is: NO. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base name of # the file that contains the anonymous namespace. By default anonymous namespace # are hidden. # The default value is: NO. EXTRACT_ANON_NSPACES = NO # If this flag is set to YES, the name of an unnamed parameter in a declaration # will be determined by the corresponding definition. By default unnamed # parameters remain unnamed in the output. # The default value is: YES. RESOLVE_UNNAMED_PARAMS = YES # If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all # undocumented members inside documented classes or files. If set to NO these # members will be included in the various overviews, but no documentation # section is generated. This option has no effect if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. If set # to NO, these classes will be included in the various overviews. This option # will also hide undocumented C++ concepts if enabled. This option has no effect # if EXTRACT_ALL is enabled. # The default value is: NO. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend # declarations. If set to NO, these declarations will be included in the # documentation. # The default value is: NO. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any # documentation blocks found inside the body of a function. If set to NO, these # blocks will be appended to the function's detailed documentation block. # The default value is: NO. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation that is typed after a # \internal command is included. If the tag is set to NO then the documentation # will be excluded. Set it to YES to include the internal documentation. # The default value is: NO. INTERNAL_DOCS = YES # With the correct setting of option CASE_SENSE_NAMES doxygen will better be # able to match the capabilities of the underlying filesystem. In case the # filesystem is case sensitive (i.e. it supports files in the same directory # whose names only differ in casing), the option must be set to YES to properly # deal with such files in case they appear in the input. For filesystems that # are not case sensitive the option should be set to NO to properly deal with # output files written for symbols that only differ in casing, such as for two # classes, one named CLASS and the other named Class, and to also support # references to files without having to specify the exact matching casing. On # Windows (including Cygwin) and MacOS, users should typically set this option # to NO, whereas on Linux or other Unix flavors it should typically be set to # YES. # Possible values are: SYSTEM, NO and YES. # The default value is: SYSTEM. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with # their full class and namespace scopes in the documentation. If set to YES, the # scope will be hidden. # The default value is: NO. HIDE_SCOPE_NAMES = NO # If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will # append additional text to a page's title, such as Class Reference. If set to # YES the compound reference will be hidden. # The default value is: NO. HIDE_COMPOUND_REFERENCE= NO # If the SHOW_HEADERFILE tag is set to YES then the documentation for a class # will show which file needs to be included to use the class. # The default value is: YES. SHOW_HEADERFILE = YES # If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of # the files that are included by a file in the documentation of that file. # The default value is: YES. SHOW_INCLUDE_FILES = YES # If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each # grouped member an include statement to the documentation, telling the reader # which file to include in order to use the member. # The default value is: NO. SHOW_GROUPED_MEMB_INC = NO # If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include # files with double quotes in the documentation rather than with sharp brackets. # The default value is: NO. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the # documentation for inline members. # The default value is: YES. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the # (detailed) documentation of file and class members alphabetically by member # name. If set to NO, the members will appear in declaration order. # The default value is: YES. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief # descriptions of file, namespace and class members alphabetically by member # name. If set to NO, the members will appear in declaration order. Note that # this will also influence the order of the classes in the class list. # The default value is: NO. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the # (brief and detailed) documentation of class members so that constructors and # destructors are listed first. If set to NO the constructors will appear in the # respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. # Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief # member documentation. # Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting # detailed member documentation. # The default value is: NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy # of group names into alphabetical order. If set to NO the group names will # appear in their defined order. # The default value is: NO. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by # fully-qualified names, including namespaces. If set to NO, the class list will # be sorted only by class name, not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the alphabetical # list. # The default value is: NO. SORT_BY_SCOPE_NAME = NO # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper # type resolution of all parameters of a function it will reject a match between # the prototype and the implementation of a member function even if there is # only one candidate or it is obvious which candidate to choose by doing a # simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still # accept a match between prototype and implementation in such cases. # The default value is: NO. STRICT_PROTO_MATCHING = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo # list. This list is created by putting \todo commands in the documentation. # The default value is: YES. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test # list. This list is created by putting \test commands in the documentation. # The default value is: YES. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug # list. This list is created by putting \bug commands in the documentation. # The default value is: YES. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) # the deprecated list. This list is created by putting \deprecated commands in # the documentation. # The default value is: YES. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional documentation # sections, marked by \if ... \endif and \cond # ... \endcond blocks. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the # initial value of a variable or macro / define can have for it to appear in the # documentation. If the initializer consists of more lines than specified here # it will be hidden. Use a value of 0 to hide initializers completely. The # appearance of the value of individual variables and macros / defines can be # controlled using \showinitializer or \hideinitializer command in the # documentation regardless of this setting. # Minimum value: 0, maximum value: 10000, default value: 30. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated at # the bottom of the documentation of classes and structs. If set to YES, the # list will mention the files that were used to generate the documentation. # The default value is: YES. SHOW_USED_FILES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. This # will remove the Files entry from the Quick Index and from the Folder Tree View # (if specified). # The default value is: YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces # page. This will remove the Namespaces entry from the Quick Index and from the # Folder Tree View (if specified). # The default value is: YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command command input-file, where command is the value of the # FILE_VERSION_FILTER tag, and input-file is the name of an input file provided # by doxygen. Whatever the program writes to standard output is used as the file # version. For an example see the documentation. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. You can # optionally specify a file name after the option, if omitted DoxygenLayout.xml # will be used as the name of the layout file. See also section "Changing the # layout of pages" for information. # # Note that if you run doxygen from a directory containing a file called # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE # tag is left empty. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool # to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. See also \cite for info how to create references. CITE_BIB_FILES = #--------------------------------------------------------------------------- # Configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated to # standard output by doxygen. If QUIET is set to YES this implies that the # messages are off. # The default value is: NO. QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are # generated to standard error (stderr) by doxygen. If WARNINGS is set to YES # this implies that the warnings are on. # # Tip: Turn warnings on while writing the documentation. # The default value is: YES. WARNINGS = YES # If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate # warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag # will automatically be disabled. # The default value is: YES. WARN_IF_UNDOCUMENTED = YES # If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as documenting some parameters in # a documented function twice, or documenting parameters that don't exist or # using markup commands wrongly. # The default value is: YES. WARN_IF_DOC_ERROR = YES # If WARN_IF_INCOMPLETE_DOC is set to YES, doxygen will warn about incomplete # function parameter documentation. If set to NO, doxygen will accept that some # parameters have no documentation without warning. # The default value is: YES. WARN_IF_INCOMPLETE_DOC = YES # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # are documented, but have no documentation for their parameters or return # value. If set to NO, doxygen will only warn about wrong parameter # documentation, but not about the absence of documentation. If EXTRACT_ALL is # set to YES then this flag will automatically be disabled. See also # WARN_IF_INCOMPLETE_DOC # The default value is: NO. WARN_NO_PARAMDOC = NO # If WARN_IF_UNDOC_ENUM_VAL option is set to YES, doxygen will warn about # undocumented enumeration values. If set to NO, doxygen will accept # undocumented enumeration values. If EXTRACT_ALL is set to YES then this flag # will automatically be disabled. # The default value is: NO. WARN_IF_UNDOC_ENUM_VAL = NO # If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when # a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS # then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but # at the end of the doxygen process doxygen will return with a non-zero status. # Possible values are: NO, YES and FAIL_ON_WARNINGS. # The default value is: NO. WARN_AS_ERROR = NO # The WARN_FORMAT tag determines the format of the warning messages that doxygen # can produce. The string should contain the $file, $line, and $text tags, which # will be replaced by the file and line number from which the warning originated # and the warning text. Optionally the format may contain $version, which will # be replaced by the version of the file (if it could be obtained via # FILE_VERSION_FILTER) # See also: WARN_LINE_FORMAT # The default value is: $file:$line: $text. WARN_FORMAT = "$file:$line: $text" # In the $text part of the WARN_FORMAT command it is possible that a reference # to a more specific place is given. To make it easier to jump to this place # (outside of doxygen) the user can define a custom "cut" / "paste" string. # Example: # WARN_LINE_FORMAT = "'vi $file +$line'" # See also: WARN_FORMAT # The default value is: at line $line of file $file. WARN_LINE_FORMAT = "at line $line of file $file" # The WARN_LOGFILE tag can be used to specify a file to which warning and error # messages should be written. If left blank the output is written to standard # error (stderr). In case the file specified cannot be opened for writing the # warning and error messages are written to standard error. When as file - is # specified the warning and error messages are written to standard output # (stdout). WARN_LOGFILE = #--------------------------------------------------------------------------- # Configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag is used to specify the files and/or directories that contain # documented source files. You may enter file names like myfile.cpp or # directories like /usr/src/myproject. Separate the files or directories with # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. INPUT = protocols/ace/RMCast # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv # documentation (see: # https://www.gnu.org/software/libiconv/) for the list of possible encodings. # See also: INPUT_FILE_ENCODING # The default value is: UTF-8. INPUT_ENCODING = UTF-8 # This tag can be used to specify the character encoding of the source files # that doxygen parses The INPUT_FILE_ENCODING tag can be used to specify # character encoding on a per file pattern basis. Doxygen will compare the file # name with each pattern and apply the encoding instead of the default # INPUT_ENCODING) if there is a match. The character encodings are a list of the # form: pattern=encoding (like *.php=ISO-8859-1). See cfg_input_encoding # "INPUT_ENCODING" for further information on supported encodings. INPUT_FILE_ENCODING = # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and # *.h) to filter out the source-files in the directories. # # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # read by doxygen. # # Note the list of default checked file patterns might differ from the list of # default file extension mappings. # # If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, # *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, # *.hh, *.hxx, *.hpp, *.h++, *.l, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, # *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C # comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, # *.vhdl, *.ucf, *.qsf and *.ice. FILE_PATTERNS = *.cpp \ *.h \ *.i \ *.inl # The RECURSIVE tag can be used to specify whether or not subdirectories should # be searched for input files as well. # The default value is: NO. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. # # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. # The default value is: NO. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # ANamespace::AClass, ANamespace::*Test # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories use the pattern */test/* EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or directories # that contain example code fragments that are included (see the \include # command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and # *.h) to filter out the source-files in the directories. If left blank all # files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude commands # irrespective of the value of the RECURSIVE tag. # The default value is: NO. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or directories # that contain images that are to be included in the documentation (see the # \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command: # # # # where is the value of the INPUT_FILTER tag, and is the # name of an input file. Doxygen will then use the output that the filter # program writes to standard output. If FILTER_PATTERNS is specified, this tag # will be ignored. # # Note that the filter must not add or remove lines; it is applied before the # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. # # Note that doxygen will use the data processed and written to standard output # for further processing, therefore nothing else, like debug statements or used # commands (so in case of a Windows batch file always use @echo OFF), should be # written to standard output. # # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: pattern=filter # (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how # filters are used. If the FILTER_PATTERNS tag is empty or if none of the # patterns match the file name, INPUT_FILTER is applied. # # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will also be used to filter the input files that are used for # producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). # The default value is: NO. FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) and # it is also possible to disable source filtering for a specific pattern using # *.ext= (so without naming a filter). # This tag requires that the tag FILTER_SOURCE_FILES is set to YES. FILTER_SOURCE_PATTERNS = # If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that # is part of the input, its contents will be placed on the main page # (index.html). This can be useful if you have a project on for instance GitHub # and want to reuse the introduction page also for the doxygen output. USE_MDFILE_AS_MAINPAGE = # The Fortran standard specifies that for fixed formatted Fortran code all # characters from position 72 are to be considered as comment. A common # extension is to allow longer lines before the automatic comment starts. The # setting FORTRAN_COMMENT_AFTER will also make it possible that longer lines can # be processed before the automatic comment starts. # Minimum value: 7, maximum value: 10000, default value: 72. FORTRAN_COMMENT_AFTER = 72 #--------------------------------------------------------------------------- # Configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will be # generated. Documented entities will be cross-referenced with these sources. # # Note: To get rid of all source code in the generated output, make sure that # also VERBATIM_HEADERS is set to NO. # The default value is: NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body of functions, # classes and enums directly into the documentation. # The default value is: NO. INLINE_SOURCES = YES # Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any # special comment blocks from generated source code fragments. Normal C, C++ and # Fortran comments will always remain visible. # The default value is: YES. STRIP_CODE_COMMENTS = NO # If the REFERENCED_BY_RELATION tag is set to YES then for each documented # entity all documented functions referencing it will be listed. # The default value is: NO. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES then for each documented function # all documented entities called/used by that function will be listed. # The default value is: NO. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set # to YES then the hyperlinks from functions in REFERENCES_RELATION and # REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will # link to the documentation. # The default value is: YES. REFERENCES_LINK_SOURCE = YES # If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the # source code will show a tooltip with additional information such as prototype, # brief description and links to the definition and documentation. Since this # will make the HTML file larger and loading of large files a bit slower, you # can opt to disable this feature. # The default value is: YES. # This tag requires that the tag SOURCE_BROWSER is set to YES. SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system # (see https://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: # - Install the latest version of global # - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file # - Make sure the INPUT points to the root of the source tree # - Run doxygen as normal # # Doxygen will invoke htags (and that will in turn invoke gtags), so these # tools must be available from the command line (i.e. in the search path). # # The result: instead of the source browser generated by doxygen, the links to # source code will now point to the output of htags. # The default value is: NO. # This tag requires that the tag SOURCE_BROWSER is set to YES. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a # verbatim copy of the header file for each class for which an include is # specified. Set to NO to disable this. # See also: Section \class. # The default value is: YES. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all # compounds will be generated. Enable this if the project contains a lot of # classes, structs, unions or interfaces. # The default value is: YES. ALPHABETICAL_INDEX = YES # The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes) # that should be ignored while generating the index headers. The IGNORE_PREFIX # tag works for classes, function and member names. The entity will be placed in # the alphabetical list under the first letter of the entity name that remains # after removing the prefix. # This tag requires that the tag ALPHABETICAL_INDEX is set to YES. IGNORE_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output # The default value is: YES. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of # it. # The default directory is: html. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_OUTPUT = html/libace-doc/rmcast # The HTML_FILE_EXTENSION tag can be used to specify the file extension for each # generated HTML page (for example: .htm, .php, .asp). # The default value is: .html. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a user-defined HTML header file for # each generated HTML page. If the tag is left blank doxygen will generate a # standard header. # # To get valid HTML the header file that includes any scripts and style sheets # that doxygen needs, which is dependent on the configuration options used (e.g. # the setting GENERATE_TREEVIEW). It is highly recommended to start with a # default header using # doxygen -w html new_header.html new_footer.html new_stylesheet.css # YourConfigFile # and then modify the file new_header.html. See also section "Doxygen usage" # for information on how to generate the default header that doxygen normally # uses. # Note: The header is subject to change so you typically have to regenerate the # default header when upgrading to a newer version of doxygen. For a description # of the possible markers and block names see the documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each # generated HTML page. If the tag is left blank doxygen will generate a standard # footer. See HTML_HEADER for more information on how to generate a default # footer and what special commands can be used inside the footer. See also # section "Doxygen usage" for information on how to generate the default footer # that doxygen normally uses. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading style # sheet that is used by each HTML page. It can be used to fine-tune the look of # the HTML output. If left blank doxygen will generate a default style sheet. # See also section "Doxygen usage" for information on how to generate the style # sheet that doxygen normally uses. # Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as # it is more robust and this tag (HTML_STYLESHEET) will in the future become # obsolete. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_STYLESHEET = # The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined # cascading style sheets that are included after the standard style sheets # created by doxygen. Using this option one can overrule certain style aspects. # This is preferred over using HTML_STYLESHEET since it does not replace the # standard style sheet and is therefore more robust against future updates. # Doxygen will copy the style sheet files to the output directory. # Note: The order of the extra style sheet files is of importance (e.g. the last # style sheet in the list overrules the setting of the previous ones in the # list). # Note: Since the styling of scrollbars can currently not be overruled in # Webkit/Chromium, the styling will be left out of the default doxygen.css if # one or more extra stylesheets have been specified. So if scrollbar # customization is desired it has to be added explicitly. For an example see the # documentation. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that the # files will be copied as-is; there are no commands or markers available. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_FILES = # The HTML_COLORSTYLE tag can be used to specify if the generated HTML output # should be rendered with a dark or light theme. # Possible values are: LIGHT always generate light mode output, DARK always # generate dark mode output, AUTO_LIGHT automatically set the mode according to # the user preference, use light mode if no preference is set (the default), # AUTO_DARK automatically set the mode according to the user preference, use # dark mode if no preference is set and TOGGLE allow to user to switch between # light and dark mode via a button. # The default value is: AUTO_LIGHT. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE = AUTO_LIGHT # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to # this color. Hue is specified as an angle on a color-wheel, see # https://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors # in the HTML output. For a value of 0 the output will use gray-scales only. A # value of 255 will produce the most vivid colors. # Minimum value: 0, maximum value: 255, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the # luminance component of the colors in the HTML output. Values below 100 # gradually make the output lighter, whereas values above 100 make the output # darker. The value divided by 100 is the actual gamma applied, so 80 represents # a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not # change the gamma. # Minimum value: 40, maximum value: 240, default value: 80. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting this # to YES can help to show when doxygen was last run and thus if the # documentation is up to date. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_TIMESTAMP = NO # If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML # documentation will contain a main index with vertical navigation menus that # are dynamically created via JavaScript. If disabled, the navigation index will # consists of multiple levels of tabs that are statically embedded in every HTML # page. Disable this option to support browsers that do not have JavaScript, # like the Qt help browser. # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_DYNAMIC_MENUS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_DYNAMIC_SECTIONS = NO # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries # shown in the various tree structured indices initially; the user can expand # and collapse entries dynamically later on. Doxygen will expand the tree to # such a level that at most the specified number of entries are visible (unless # a fully collapsed tree already exceeds this amount). So setting the number of # entries 1 will produce a full collapsed tree by default. 0 is a special value # representing an infinite number of entries and will result in a full expanded # tree by default. # Minimum value: 0, maximum value: 9999, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development # environment (see: # https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To # create a documentation set, doxygen will generate a Makefile in the HTML # output directory. Running make will produce the docset in that directory and # running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at # startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy # genXcode/_index.html for more information. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_DOCSET = NO # This tag determines the name of the docset feed. A documentation feed provides # an umbrella under which multiple documentation sets from a single provider # (such as a company or product suite) can be grouped. # The default value is: Doxygen generated docs. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_FEEDNAME = "Doxygen generated docs" # This tag determines the URL of the docset feed. A documentation feed provides # an umbrella under which multiple documentation sets from a single provider # (such as a company or product suite) can be grouped. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_FEEDURL = # This tag specifies a string that should uniquely identify the documentation # set bundle. This should be a reverse domain-name style string, e.g. # com.mycompany.MyDocSet. Doxygen will append .docset to the name. # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_BUNDLE_ID = org.doxygen.Project # The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify # the documentation publisher. This should be a reverse domain-name style # string, e.g. com.mycompany.MyDocSet.documentation. # The default value is: org.doxygen.Publisher. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. # The default value is: Publisher. # This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop # on Windows. In the beginning of 2021 Microsoft took the original page, with # a.o. the download links, offline the HTML help workshop was already many years # in maintenance mode). You can download the HTML help workshop from the web # archives at Installation executable (see: # http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo # ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe). # # The HTML Help Workshop contains a compiler that can convert all HTML output # generated by doxygen into a single compiled HTML file (.chm). Compiled HTML # files are now used as the Windows 98 help format, and will replace the old # Windows help format (.hlp) on all Windows platforms in the future. Compressed # HTML files also contain an index, a table of contents, and you can search for # words in the documentation. The HTML workshop also contains a viewer for # compressed HTML files. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_HTMLHELP = NO # The CHM_FILE tag can be used to specify the file name of the resulting .chm # file. You can add a path in front of the file if the result should not be # written to the html output directory. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_FILE = # The HHC_LOCATION tag can be used to specify the location (absolute path # including file name) of the HTML help compiler (hhc.exe). If non-empty, # doxygen will try to run the HTML help compiler on the generated index.hhp. # The file has to be specified with full path. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated # (YES) or that it should be included in the main .chm file (NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. GENERATE_CHI = NO # The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) # and project file content. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_INDEX_ENCODING = # The BINARY_TOC flag controls whether a binary table of contents is generated # (YES) or a normal table of contents (NO) in the .chm file. Furthermore it # enables the Previous and Next buttons. # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members to # the table of contents of the HTML help documentation and to the tree view. # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that # can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help # (.qch) of the generated HTML documentation. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify # the file name of the resulting .qch file. The path specified is relative to # the HTML output folder. # This tag requires that the tag GENERATE_QHP is set to YES. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace # (see: # https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual # Folders (see: # https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom # Filters (see: # https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom # Filters (see: # https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: # https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = # The QHG_LOCATION tag can be used to specify the location (absolute path # including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to # run qhelpgenerator on the generated .qhp file. # This tag requires that the tag GENERATE_QHP is set to YES. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be # generated, together with the HTML files, they form an Eclipse help plugin. To # install this plugin and make it available under the help contents menu in # Eclipse, the contents of the directory containing the HTML and XML files needs # to be copied into the plugins directory of eclipse. The name of the directory # within the plugins directory should be the same as the ECLIPSE_DOC_ID value. # After copying Eclipse needs to be restarted before the help appears. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_ECLIPSEHELP = NO # A unique identifier for the Eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have this # name. Each documentation set should have its own identifier. # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. ECLIPSE_DOC_ID = org.doxygen.Project # If you want full control over the layout of the generated HTML pages it might # be necessary to disable the index and replace it with your own. The # DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top # of each HTML page. A value of NO enables the index and the value YES disables # it. Since the tabs in the index contain the same information as the navigation # tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. DISABLE_INDEX = NO # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. If the tag # value is set to YES, a side panel will be generated containing a tree-like # index structure (just like the one that is generated for HTML Help). For this # to work a browser that supports JavaScript, DHTML, CSS and frames is required # (i.e. any modern browser). Windows users are probably better off using the # HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can # further fine tune the look of the index (see "Fine-tuning the output"). As an # example, the default style sheet generated by doxygen has an example that # shows how to put an image at the root of the tree instead of the PROJECT_NAME. # Since the tree basically has the same information as the tab index, you could # consider setting DISABLE_INDEX to YES when enabling this option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_TREEVIEW = NO # When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the # FULL_SIDEBAR option determines if the side bar is limited to only the treeview # area (value NO) or if it should extend to the full height of the window (value # YES). Setting this to YES gives a layout similar to # https://docs.readthedocs.io with more room for contents, but less room for the # project logo, title, and description. If either GENERATE_TREEVIEW or # DISABLE_INDEX is set to NO, this option has no effect. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. FULL_SIDEBAR = NO # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that # doxygen will group on one line in the generated HTML documentation. # # Note that a value of 0 will completely suppress the enum values from appearing # in the overview section. # Minimum value: 0, maximum value: 20, default value: 4. # This tag requires that the tag GENERATE_HTML is set to YES. ENUM_VALUES_PER_LINE = 4 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used # to set the initial width (in pixels) of the frame in which the tree is shown. # Minimum value: 0, maximum value: 1500, default value: 250. # This tag requires that the tag GENERATE_HTML is set to YES. TREEVIEW_WIDTH = 250 # If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to # external symbols imported via tag files in a separate window. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. EXT_LINKS_IN_WINDOW = NO # If the OBFUSCATE_EMAILS tag is set to YES, doxygen will obfuscate email # addresses. # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. OBFUSCATE_EMAILS = YES # If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg # tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see # https://inkscape.org) to generate formulas as SVG images instead of PNGs for # the HTML output. These images will generally look nicer at scaled resolutions. # Possible values are: png (the default) and svg (looks nicer but requires the # pdf2svg or inkscape tool). # The default value is: png. # This tag requires that the tag GENERATE_HTML is set to YES. HTML_FORMULA_FORMAT = png # Use this tag to change the font size of LaTeX formulas included as images in # the HTML documentation. When you change the font size after a successful # doxygen run you need to manually remove any form_*.png images from the HTML # output directory to force them to be regenerated. # Minimum value: 8, maximum value: 50, default value: 10. # This tag requires that the tag GENERATE_HTML is set to YES. FORMULA_FONTSIZE = 10 # The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands # to create new LaTeX commands to be used in formulas as building blocks. See # the section "Including formulas" for details. FORMULA_MACROFILE = # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see # https://www.mathjax.org) which uses client side JavaScript for the rendering # instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path # to it using the MATHJAX_RELPATH option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. USE_MATHJAX = NO # With MATHJAX_VERSION it is possible to specify the MathJax version to be used. # Note that the different versions of MathJax have different requirements with # regards to the different settings, so it is possible that also other MathJax # settings have to be changed when switching between the different MathJax # versions. # Possible values are: MathJax_2 and MathJax_3. # The default value is: MathJax_2. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_VERSION = MathJax_2 # When MathJax is enabled you can set the default output format to be used for # the MathJax output. For more details about the output format see MathJax # version 2 (see: # http://docs.mathjax.org/en/v2.7-latest/output.html) and MathJax version 3 # (see: # http://docs.mathjax.org/en/latest/web/components/output.html). # Possible values are: HTML-CSS (which is slower, but has the best # compatibility. This is the name for Mathjax version 2, for MathJax version 3 # this will be translated into chtml), NativeMML (i.e. MathML. Only supported # for NathJax 2. For MathJax version 3 chtml will be used instead.), chtml (This # is the name for Mathjax version 3, for MathJax version 2 this will be # translated into HTML-CSS) and SVG. # The default value is: HTML-CSS. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_FORMAT = HTML-CSS # When MathJax is enabled you need to specify the location relative to the HTML # output directory using the MATHJAX_RELPATH option. The destination directory # should contain the MathJax.js script. For instance, if the mathjax directory # is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of # MathJax from https://www.mathjax.org before deployment. The default value is: # - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2 # - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3 # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax # extension names that should be enabled during MathJax rendering. For example # for MathJax version 2 (see # https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions): # MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols # For example for MathJax version 3 (see # http://docs.mathjax.org/en/latest/input/tex/extensions/index.html): # MATHJAX_EXTENSIONS = ams # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site # (see: # http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_CODEFILE = # When the SEARCHENGINE tag is enabled doxygen will generate a search box for # the HTML output. The underlying search engine uses javascript and DHTML and # should work on any modern browser. Note that when using HTML help # (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) # there is already a search function so this one should typically be disabled. # For large projects the javascript based search engine can be slow, then # enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to # search using the keyboard; to jump to the search box use + S # (what the is depends on the OS and browser, but it is typically # , /
. */ class Sender : public ACE_Handler { public: Sender (); ~Sender (); //FUZZ: disable check_for_lack_ACE_OS ///FUZZ: enable check_for_lack_ACE_OS int open (const ACE_TCHAR *host, u_short port); protected: // These methods are called by the freamwork /// This is called when asynchronous writes from the dgram socket /// complete virtual void handle_write_dgram (const ACE_Asynch_Write_Dgram::Result &result); private: /// Network I/O handle ACE_SOCK_Dgram sock_dgram_; /// wd (write dgram): for writing to the socket ACE_Asynch_Write_Dgram wd_; const char* completion_key_; const char* act_; }; Sender::Sender () : completion_key_ ("Sender completion key"), act_ ("Sender ACT") { } Sender::~Sender () { this->sock_dgram_.close (); } int Sender::open (const ACE_TCHAR *host, u_short port) { // Initialize stuff if (this->sock_dgram_.open (ACE_INET_Addr::sap_any) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_SOCK_Dgram::open"), -1); // Initialize the asynchronous read. if (this->wd_.open (*this, this->sock_dgram_.get_handle (), this->completion_key_, ACE_Proactor::instance ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Write_Dgram::open"), -1); // We are using scatter/gather to send the message header and // message body using 2 buffers // create a message block for the message header ACE_Message_Block* msg = 0; ACE_NEW_RETURN (msg, ACE_Message_Block (100), -1); const char raw_msg [] = "To be or not to be."; // Copy buf into the Message_Block and update the wr_ptr (). msg->copy (raw_msg, ACE_OS::strlen (raw_msg) + 1); // create a message block for the message body ACE_Message_Block* body = 0; ACE_NEW_RETURN (body, ACE_Message_Block (100), -1); ACE_OS::memset (body->wr_ptr (), 'X', 100); body->wr_ptr (100); // always remember to update the wr_ptr () // set body as the cont of msg. This associates the 2 message blocks so // that a send will send the first block (which is the header) up to // length (), and use the cont () to get the next block to send. You can // chain up to IOV_MAX message block using this method. msg->cont (body); // do the asynch send size_t number_of_bytes_sent = 0; ACE_INET_Addr serverAddr (port, host); int res = this->wd_.send (msg, number_of_bytes_sent, 0, serverAddr, this->act_); switch (res) { case 0: // this is a good error. The proactor will call our handler when the // send has completed. break; case 1: // actually sent something, we will handle it in the handler callback ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes sent immediately", number_of_bytes_sent)); ACE_DEBUG ((LM_DEBUG, "********************\n")); res = 0; break; case -1: // Something else went wrong. ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Write_Dgram::recv")); // the handler will not get called in this case so lets clean up our msg msg->release (); break; default: // Something undocumented really went wrong. ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Write_Dgram::recv")); msg->release (); break; } return res; } void Sender::handle_write_dgram (const ACE_Asynch_Write_Dgram::Result &result) { ACE_DEBUG ((LM_DEBUG, "handle_write_dgram called\n")); ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_write", result.bytes_to_write ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "flags", result.flags ())); ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "act", result.act ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "completion_key", result.completion_key ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "Sender completed\n")); // No need for this message block anymore. result.message_block ()->release (); // Note that we are done with the test. done++; } static int parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("h:p:")); int c; while ((c = get_opt ()) != EOF) switch (c) { case 'h': host = get_opt.opt_arg (); break; case 'p': port = ACE_OS::atoi (get_opt.opt_arg ()); break; default: ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "usage :\n" "-h \n"), -1); } return 0; } int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { if (parse_args (argc, argv) == -1) return -1; Sender sender; Receiver receiver; // If passive side if (host == 0) { if (receiver.open_addr (ACE_INET_Addr (port)) == -1) return -1; } // If active side else if (sender.open (host, port) == -1) return -1; for (int success = 1; success > 0 && !done; ) // Dispatch events via Proactor singleton. success = ACE_Proactor::instance ()->handle_events (); return 0; } #else /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS*/ int ACE_TMAIN (int, ACE_TCHAR *[]) { ACE_DEBUG ((LM_DEBUG, "This example does not work on this platform.\n")); return 1; } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ ace-8.0.4+dfsg.orig/examples/Reactor/Proactor/test_aiocb.cpp0000644000175000017500000001405115027201773023016 0ustar sudipsudip //============================================================================= /** * @file test_aiocb.cpp * * Checkout $ACE_ROOT/examples/Reactor/Proactor/test_aiocb_ace.cpp, * which is the ACE'ified version of this program. * * = COMPILE and RUN * % CC -g -o test_aiocb -lrt test_aiocb.cpp * % ./test_aiocb * * @author Alexander Babu Arulanthu */ //============================================================================= //FUZZ: disable check_for_lack_ACE_OS //FUZZ: disable check_for_improper_main_declaration #include #include #include #include #include #include #include #include #include #include class Test_Aio { public: /// Default constructor. Test_Aio (); /// Initting the output file and the buffer. int init (); /// Doing the testing stuff. int do_aio (); /// Destructor. ~Test_Aio (); private: /// Output file descriptor. int out_fd_; /// For writing to the file. struct aiocb *aiocb_write_; /// Reading stuff from the file. struct aiocb *aiocb_read_; /// The buffer to be written to the out_fd. char *buffer_write_; /// The buffer to be read back from the file. char *buffer_read_; }; Test_Aio::Test_Aio () : aiocb_write_ (new struct aiocb), aiocb_read_ (new struct aiocb), buffer_write_ (0), buffer_read_ (0) { } Test_Aio::~Test_Aio () { delete aiocb_write_; delete aiocb_read_; delete buffer_write_; delete [] buffer_read_; } // Init the output file and init the buffer. int Test_Aio::init () { // Open the output file. this->out_fd_ = open ("test_aio.log", O_RDWR | O_CREAT | O_TRUNC, 0666); if (this->out_fd_ == 0) { cout << "Error : Opening file" << endl; return -1; } // Init the buffers. this->buffer_write_ = strdup ("Welcome to the world of AIO... AIO Rules !!!"); cout << "The buffer : " << this->buffer_write_ << endl; this->buffer_read_ = new char [strlen (this->buffer_write_) + 1]; return 0; } // Set the necessary things for the AIO stuff. // Write the buffer asynchly.hmm Disable signals. // Go on aio_suspend. Wait for completion. // Print out the result. int Test_Aio::do_aio () { // = Write to the file. // Setup AIOCB. this->aiocb_write_->aio_fildes = this->out_fd_; this->aiocb_write_->aio_offset = 0; this->aiocb_write_->aio_buf = this->buffer_write_; this->aiocb_write_->aio_nbytes = strlen (this->buffer_write_); this->aiocb_write_->aio_reqprio = 0; this->aiocb_write_->aio_sigevent.sigev_notify = SIGEV_NONE; //this->this->aiocb_.aio_sigevent.sigev_signo = SIGRTMAX; this->aiocb_write_->aio_sigevent.sigev_value.sival_ptr = (void *) this->aiocb_write_; // Fire off the aio write. if (aio_write (this->aiocb_write_) != 0) { perror ("aio_write"); return -1; } // = Read from that file. // Setup AIOCB. this->aiocb_read_->aio_fildes = this->out_fd_; this->aiocb_read_->aio_offset = 0; this->aiocb_read_->aio_buf = this->buffer_read_; this->aiocb_read_->aio_nbytes = strlen (this->buffer_write_); this->aiocb_read_->aio_reqprio = 0; this->aiocb_read_->aio_sigevent.sigev_notify = SIGEV_NONE; //this->this->aiocb_.aio_sigevent.sigev_signo = SIGRTMAX; this->aiocb_read_->aio_sigevent.sigev_value.sival_ptr = (void *) this->aiocb_read_; // Fire off the aio write. If it doesnt get queued, carry on to get // the completion for the first one. if (aio_read (this->aiocb_read_) < 0) perror ("aio_read"); // Wait for the completion on aio_suspend. struct aiocb *list_aiocb[2]; list_aiocb [0] = this->aiocb_write_; list_aiocb [1] = this->aiocb_read_; // Do suspend till all the aiocbs in the list are done. int done = 0; int return_val = 0; while (!done) { return_val = aio_suspend (list_aiocb, 2, 0); cerr << "Return value :" << return_val << endl; // Analyze return and error values. if (list_aiocb[0] != 0) { if (aio_error (list_aiocb [0]) != EINPROGRESS) { if (aio_return (list_aiocb [0]) == -1) { perror ("aio_return"); return -1; } else { // Successful. Store the pointer somewhere and make the // entry NULL in the list. this->aiocb_write_ = list_aiocb [0]; list_aiocb [0] = 0; } } else cout << "AIO write in progress" << endl; } if (list_aiocb[1] != 0) { if (aio_error (list_aiocb [1]) != EINPROGRESS) { int read_return = aio_return (list_aiocb[1]); if (read_return == -1) { perror ("aio_return"); return -1; } else { // Successful. Store the pointer somewhere and make the // entry NULL in the list. this->aiocb_read_ = list_aiocb [1]; list_aiocb [1] = 0; this->buffer_read_[read_return] = '\0'; } } else cout << "AIO read in progress" << endl; } // Is it done? if ((list_aiocb [0] == 0) && (list_aiocb [1] == 0)) done = 1; } cout << "Both the AIO operations done." << endl; cout << "The buffer is :" << this->buffer_read_ << endl; return 0; } int main (int argc, char **argv) { Test_Aio test_aio; if (test_aio.init () != 0) { printf ("AIOCB test failed:\n" "ACE_POSIX_AIOCB_PROACTOR may not work in this platform\n"); return -1; } if (test_aio.do_aio () != 0) { printf ("AIOCB test failed:\n" "ACE_POSIX_AIOCB_PROACTOR may not work in this platform\n"); return -1; } printf ("AIOCB test successful:\n" "ACE_POSIX_AIOCB_PROACTOR should work in this platform\n"); return 0; } ace-8.0.4+dfsg.orig/examples/Reactor/Proactor/test_cancel.h0000644000175000017500000000202615027201773022632 0ustar sudipsudip/* ** */ #ifndef _TEST_CANCEL_H #define _TEST_CANCEL_H #include "ace/Asynch_IO.h" class Receiver : public ACE_Service_Handler { // = TITLE // // Receiver // // = DESCRIPTION // // The class will be created by ACE_Asynch_Acceptor when new // connections arrive. This class will then receive data from // the network connection and dump it to a file. public: Receiver (); ~Receiver (); virtual void open (ACE_HANDLE handle, ACE_Message_Block &message_block); // This is called after the new connection has been accepted. protected: // These methods are called by the framework virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result); // This is called when asynchronous read from the socket complete private: ACE_Asynch_Read_Stream rs_; // rs (read stream): for reading from a socket ACE_Message_Block mb_; // Message block to read from the stream. ACE_HANDLE handle_; // Handle for IO to remote peer }; #endif /* _TEST_CANCEL_H */ ace-8.0.4+dfsg.orig/examples/Reactor/Proactor/Aio_Platform_Test_C.cpp0000644000175000017500000000651315027201773024523 0ustar sudipsudip//============================================================================= /** * @file Aio_Platform_Test_C.cpp * * Testing the platform for POSIX Asynchronous I/O. This is the C * version of the $ACE_ROOT/tests/Aio_Platform_Test.cpp. Useful * to send bug reports. * * @author Programming for the Real World. Bill O. GallMeister. Modified by Alexander Babu Arulanthu */ //============================================================================= #include #include #include #include #include #include #include #include #include #include int do_sysconf (); int have_asynchio (); static int file_handle = -1; char mb1 [BUFSIZ + 1]; char mb2 [BUFSIZ + 1]; aiocb aiocb1, aiocb2; sigset_t completion_signal; // For testing the stuff. int test_aio_calls (); int issue_aio_calls (); int query_aio_completions (); int setup_signal_delivery (); int do_sysconf (); int have_asynchio (); int do_sysconf () { // Call sysconf to find out runtime values. errno = 0; #if defined (_SC_LISTIO_AIO_MAX) printf ("Runtime value of LISTIO_AIO_MAX is %d, errno = %d\n", sysconf(_SC_LISTIO_AIO_MAX), errno); #else printf ("Runtime value of AIO_LISTIO_MAX is %d, errno = %d\n", sysconf(_SC_AIO_LISTIO_MAX), errno); #endif errno = 0; printf ("Runtime value of AIO_MAX is %d, errno = %d\n", sysconf (_SC_AIO_MAX), errno); errno = 0; printf ("Runtime value of _POSIX_ASYNCHRONOUS_IO is %d, errno = %d\n", sysconf (_SC_ASYNCHRONOUS_IO), errno); errno = 0; printf ("Runtime value of _POSIX_REALTIME_SIGNALS is %d, errno = %d\n", sysconf (_SC_REALTIME_SIGNALS), errno); errno = 0; printf ("Runtime value of RTSIG_MAX %d, Errno = %d\n", sysconf (_SC_RTSIG_MAX), errno); errno = 0; printf ("Runtime value of SIGQUEUE_MAX %d, Errno = %d\n", sysconf (_SC_SIGQUEUE_MAX), errno); return 0; } int have_asynchio () { #if defined (_POSIX_ASYNCHRONOUS_IO) // POSIX Asynch IO is present in this system. #if defined (_POSIX_ASYNC_IO) // If this is defined and it is not -1, POSIX_ASYNCH is supported // everywhere in the system. #if _POSIX_ASYNC_IO == -1 printf ("_POSIX_ASYNC_IO = -1.. ASYNCH IO NOT supported at all\n"); return -1; #else /* Not _POSIX_ASYNC_IO == -1 */ printf ("_POSIX_ASYNC_IO = %d\n ASYNCH IO is supported FULLY\n", _POSIX_ASYNC_IO); #endif /* _POSIX_ASYNC_IO == -1 */ #else /* Not defined _POSIX_ASYNC_IO */ printf ("_POSIX_ASYNC_IO is not defined.\n"); printf ("AIO might *not* be supported on some paths\n"); #endif /* _POSIX_ASYNC_IO */ // System defined POSIX Values. printf ("System claims to have POSIX_ASYNCHRONOUS_IO\n"); printf ("_POSIX_AIO_LISTIO_MAX = %d\n", _POSIX_AIO_LISTIO_MAX); printf ("_POSIX_AIO_MAX = %d\n", _POSIX_AIO_MAX); // Check and print the run time values. do_sysconf (); return 0; #else /* Not _POSIX_ASYNCHRONOUS_IO */ printf ("No support._POSIX_ASYNCHRONOUS_IO itself is not defined\n"); return -1; #endif /* _POSIX_ASYNCHRONOUS_IO */ } int ACE_TMAIN (int, ACE_TCHAR *[]) { if (have_asynchio () == 0) printf ("Test successful\n"); else printf ("Test not successful\n"); return 0; } ace-8.0.4+dfsg.orig/examples/Reactor/Proactor/test_aiosig_ace.cpp0000644000175000017500000002630315027201773024027 0ustar sudipsudip //============================================================================= /** * @file test_aiosig_ace.cpp * * This program helps you to test the calls on a * platform. * Before running this test, make sure the platform can * support POSIX calls, using ACE_ROOT/tests/Aio_Plaform_Test.cpp * This program tests the Signal based completion approach which * uses for completion querying. * If this test is successful, ACE_POSIX_SIG_PROACTOR * can be used on this platform. * This program is a ACE version of the * $ACE_ROOT/examples/Reactor/Proactor/test_aiosig.cpp, with * ACE_DEBUGs and Message_Blocks. * This test does the following: * Issue two s. * Assign SIGRTMIN as the notification signal. * Mask these signals from delivery. * Receive this signal by doing . * Wait for two completions (two signals) * make * ./test_aiosig_ace * @author Programming for the Real World. Bill O. GallMeister. Modified by Alexander Babu Arulanthu */ //============================================================================= #include "ace/Message_Block.h" #include "ace/Log_Msg.h" #include "ace/os_include/os_aio.h" #include "ace/OS_NS_signal.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_fcntl.h" #include "ace/Asynch_IO.h" // for ACE_INFINITE static ACE_HANDLE file_handle = ACE_INVALID_HANDLE; static ACE_Message_Block mb1 (BUFSIZ + 1); static ACE_Message_Block mb2 (BUFSIZ + 1); static aiocb aiocb1; static aiocb aiocb2; static aiocb aiocb3; static sigset_t completion_signal; // Function prototypes. static int setup_signal_delivery (); static int issue_aio_calls (); static int query_aio_completions (); static int test_aio_calls (); static void null_handler (int signal_number, siginfo_t *info, void *context); static int setup_signal_handler (int signal_number); static int setup_signal_delivery () { // = Mask all the signals. sigset_t full_set; // Get full set. if (ACE_OS::sigfillset (&full_set) != 0) ACE_ERROR_RETURN ((LM_ERROR, "Error:(%P | %t):%p\n", "sigfillset failed"), -1); // Mask them. if (ACE_OS::pthread_sigmask (SIG_SETMASK, &full_set, 0) != 0) ACE_ERROR_RETURN ((LM_ERROR, "Error:(%P | %t):%p\n", "pthread_sigmask failed"), -1); // = Make a mask with SIGRTMIN only. We use only that signal to // issue 's. if (ACE_OS::sigemptyset (&completion_signal) == -1) ACE_ERROR_RETURN ((LM_ERROR, "Error: %p\n", "Couldnt init the RT completion signal set"), -1); if (ACE_OS::sigaddset (&completion_signal, SIGRTMIN) == -1) ACE_ERROR_RETURN ((LM_ERROR, "Error: %p\n", "Couldnt init the RT completion signal set"), -1); // Set up signal handler for this signal. return setup_signal_handler (SIGRTMIN); } static int setup_signal_handler (int signal_number) { ACE_UNUSED_ARG (signal_number); // Setting up the handler(!) for these signals. struct sigaction reaction; ACE_OS::sigemptyset (&reaction.sa_mask); // Nothing else to mask. reaction.sa_flags = SA_SIGINFO; // Realtime flag. #if defined (SA_SIGACTION) // Lynx says, it is better to set this bit to be portable. reaction.sa_flags &= SA_SIGACTION; #endif /* SA_SIGACTION */ reaction.sa_sigaction = null_handler; // Null handler. int sigaction_return = ACE_OS::sigaction (SIGRTMIN, &reaction, 0); if (sigaction_return == -1) ACE_ERROR_RETURN ((LM_ERROR, "Error: %p\n", "Proactor couldnt do sigaction for the RT SIGNAL"), -1); return 0; } static int issue_aio_calls () { // Setup AIOCB. aiocb1.aio_fildes = file_handle; aiocb1.aio_offset = 0; aiocb1.aio_buf = mb1.wr_ptr (); aiocb1.aio_nbytes = BUFSIZ; aiocb1.aio_reqprio = 0; aiocb1.aio_sigevent.sigev_notify = SIGEV_SIGNAL; aiocb1.aio_sigevent.sigev_signo = SIGRTMIN; aiocb1.aio_sigevent.sigev_value.sival_ptr = (void *) &aiocb1; // Fire off the aio read. if (aio_read (&aiocb1) == -1) // Queueing failed. ACE_ERROR_RETURN ((LM_ERROR, "Error: %p\n", "Asynch_Read_Stream: aio_read queueing failed"), -1); // Setup AIOCB. aiocb2.aio_fildes = file_handle; aiocb2.aio_offset = BUFSIZ + 1; aiocb2.aio_buf = mb2.wr_ptr (); aiocb2.aio_nbytes = BUFSIZ; aiocb2.aio_reqprio = 0; aiocb2.aio_sigevent.sigev_notify = SIGEV_SIGNAL; aiocb2.aio_sigevent.sigev_signo = SIGRTMIN; aiocb2.aio_sigevent.sigev_value.sival_ptr = (void *) &aiocb2; // Fire off the aio read. if (aio_read (&aiocb2) == -1) // Queueing failed. ACE_ERROR_RETURN ((LM_ERROR, "Error: %p\n", "Asynch_Read_Stream: aio_read queueing failed"), -1); // Setup sigval. aiocb3.aio_fildes = ACE_INVALID_HANDLE; aiocb3.aio_offset = 0; aiocb3.aio_buf = 0; aiocb3.aio_nbytes = 0; aiocb3.aio_reqprio = 0; aiocb3.aio_sigevent.sigev_notify = SIGEV_SIGNAL; aiocb3.aio_sigevent.sigev_signo = SIGRTMIN; aiocb3.aio_sigevent.sigev_value.sival_ptr = (void *) &aiocb3; sigval value; value.sival_ptr = reinterpret_cast (&aiocb3); // Queue this one for completion right now. if (sigqueue (ACE_OS::getpid (), SIGRTMIN, value) == -1) // Queueing failed. ACE_ERROR_RETURN ((LM_ERROR, "Error: %p\n", "sigqueue"), -1); return 0; } static int query_aio_completions () { for (size_t number_of_compleions = 0; number_of_compleions < 3; number_of_compleions ++) { // Wait for amount of time. @@ Assigning // to tv_sec. timespec timeout; timeout.tv_sec = ACE_INFINITE; timeout.tv_nsec = 0; // To get back the signal info. siginfo_t sig_info; // Await the RT completion signal. int sig_return = ACE_OS::sigtimedwait (&completion_signal, &sig_info, &timeout); // Error case. // If failure is coz of timeout, then return *0* but set // errno appropriately. This is what the WinNT proactor // does. if (sig_return == -1) ACE_ERROR_RETURN ((LM_ERROR, "Error: %p\n", "Error waiting for RT completion signals"), -1); //FUZZ: disable check_for_lack_ACE_OS // RT completion signals returned. if (sig_return != SIGRTMIN) ACE_ERROR_RETURN ((LM_ERROR, "Unexpected signal (%d) has been received while waiting for RT Completion Signals\n", sig_return), -1); //FUZZ: enble check_for_lack_ACE_OS // @@ Debugging. ACE_DEBUG ((LM_DEBUG, "Sig number found in the sig_info block : %d\n", sig_info.si_signo)); // Is the signo returned consistent? if (sig_info.si_signo != sig_return) ACE_ERROR_RETURN ((LM_ERROR, "Inconsistent signal number (%d) in the signal info block\n", sig_info.si_signo), -1); // @@ Debugging. ACE_DEBUG ((LM_DEBUG, "Signal code for this signal delivery : %d\n", sig_info.si_code)); // Is the signal code an aio completion one? if ((sig_info.si_code != SI_ASYNCIO) && (sig_info.si_code != SI_QUEUE)) ACE_ERROR_RETURN ((LM_DEBUG, "Unexpected signal code (%d) returned on completion querying\n", sig_info.si_code), -1); // Retrive the aiocb. aiocb* aiocb_ptr = (aiocb *) sig_info.si_value.sival_ptr; if (aiocb_ptr == &aiocb3) { ACE_ASSERT (sig_info.si_code == SI_QUEUE); ACE_DEBUG ((LM_DEBUG, "sigqueue caught... good\n")); } else { // Analyze error and return values. Return values are // actually 's associated with the call // corresponding to aiocb_ptr. int error_code = aio_error (aiocb_ptr); if (error_code == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "Invalid control block was sent to for completion querying"), -1); if (error_code != 0) // Error occurred in the call. Return the errno // corresponding to that call. ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "An AIO call has failed"), error_code); // No error occurred in the AIO operation. int nbytes = aio_return (aiocb_ptr); if (nbytes == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "Invalid control block was send to "), -1); if (number_of_compleions == 0) { // Print the buffer. ACE_DEBUG ((LM_DEBUG, "\n Number of bytes transferred : %d\n", nbytes)); // Note... the dumps of the buffers are disabled because they // may easily overrun the ACE_Log_Msg output buffer. If you need // to turn the on for some reason, be careful of this. #if 0 ACE_DEBUG ((LM_DEBUG, "The buffer : %s\n", mb1.rd_ptr ())); #endif /* 0 */ } else { // Print the buffer. ACE_DEBUG ((LM_DEBUG, "\n Number of bytes transferred : %d\n", nbytes)); #if 0 ACE_DEBUG ((LM_DEBUG, "The buffer : %s\n", mb2.rd_ptr ())); #endif /* 0 */ } } } return 0; } static int test_aio_calls () { // Set up the input file. // Open file (in SEQUENTIAL_SCAN mode) file_handle = ACE_OS::open ("test_aiosig_ace.cpp", O_RDONLY); if (file_handle == ACE_INVALID_HANDLE) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_OS::open"), -1); if (setup_signal_delivery () == -1) return -1; if (issue_aio_calls () == -1) return -1; if (query_aio_completions () == -1) return -1; return 0; } static void null_handler (int signal_number, siginfo_t */* info */, void * /* context */) { ACE_ERROR ((LM_ERROR, "Error:%s:Signal number %d\n" "Mask all the RT signals for this thread", "ACE_POSIX_SIG_Proactor::null_handler called", signal_number)); } int ACE_TMAIN (int, ACE_TCHAR *[]) { if (test_aio_calls () == 0) ACE_OS::printf ("RT SIG test successful:\n" "ACE_POSIX_SIG_PROACTOR should work in this platform\n"); else ACE_OS::printf ("RT SIG test failed:\n" "ACE_POSIX_SIG_PROACTOR may not work in this platform\n"); return 0; } ace-8.0.4+dfsg.orig/examples/Reactor/Proactor/test_aiosig.cpp0000644000175000017500000001701315027201773023215 0ustar sudipsudip//============================================================================= /** * @file test_aiosig.cpp * * Check out test_aiosig_ace.cpp, the ACE'ified version of this * program. This program may not be uptodate. * CC -g -o test_aiosig -lrt test_aiosig.cpp * ./test_aiosig * * @author Programming for the Real World. Bill O. GallMeister. Modified by Alexander Babu Arulanthu */ //============================================================================= //FUZZ: disable check_for_lack_ACE_OS //FUZZ: disable check_for_improper_main_declaration #include #include #include #include #include #include #include #include #include #include #include int file_handle = -1; char mb1 [BUFSIZ + 1]; char mb2 [BUFSIZ + 1]; aiocb aiocb1, aiocb2; sigset_t completion_signal; // Function prototypes. int setup_signal_delivery (); int issue_aio_calls (); int query_aio_completions (); int test_aio_calls (); int setup_signal_handler (); int setup_signal_handler (int signal_number); int setup_signal_delivery () { // Make the sigset_t consisting of the completion signal. if (sigemptyset (&completion_signal) == -1) { perror ("Error:Couldnt init the RT completion signal set\n"); return -1; } if (sigaddset (&completion_signal, SIGRTMIN) == -1) { perror ("Error:Couldnt init the RT completion signal set\n"); return -1; } // Mask them. if (pthread_sigmask (SIG_BLOCK, &completion_signal, 0) == -1) { perror ("Error:Couldnt maks the RT completion signals\n"); return -1; } return setup_signal_handler (SIGRTMIN); } int issue_aio_calls () { // Setup AIOCB. aiocb1.aio_fildes = file_handle; aiocb1.aio_offset = 0; aiocb1.aio_buf = mb1; aiocb1.aio_nbytes = BUFSIZ; aiocb1.aio_reqprio = 0; aiocb1.aio_sigevent.sigev_notify = SIGEV_SIGNAL; aiocb1.aio_sigevent.sigev_signo = SIGRTMIN; aiocb1.aio_sigevent.sigev_value.sival_ptr = (void *) &aiocb1; // Fire off the aio write. if (aio_read (&aiocb1) == -1) { // Queueing failed. perror ("Error:Asynch_Read_Stream: aio_read queueing failed\n"); return -1; } // Setup AIOCB. aiocb2.aio_fildes = file_handle; aiocb2.aio_offset = BUFSIZ + 1; aiocb2.aio_buf = mb2; aiocb2.aio_nbytes = BUFSIZ; aiocb2.aio_reqprio = 0; aiocb2.aio_sigevent.sigev_notify = SIGEV_SIGNAL; aiocb2.aio_sigevent.sigev_signo = SIGRTMIN; aiocb2.aio_sigevent.sigev_value.sival_ptr = (void *) &aiocb2; // Fire off the aio write. if (aio_read (&aiocb2) == -1) { // Queueing failed. perror ("Error:Asynch_Read_Stream: aio_read queueing failed\n"); return -1; } return 0; } int query_aio_completions () { size_t number_of_compleions = 0; for (number_of_compleions = 0; number_of_compleions < 2; number_of_compleions ++) { // Wait for amount of time. // @@ Assigning to tv_sec. timespec timeout; timeout.tv_sec = INT_MAX; timeout.tv_nsec = 0; // To get back the signal info. siginfo_t sig_info; // Await the RT completion signal. int sig_return = sigtimedwait (&completion_signal, &sig_info, &timeout); // Error case. // If failure is coz of timeout, then return *0* but set // errno appropriately. This is what the WinNT proactor // does. if (sig_return == -1) { perror ("Error:Error waiting for RT completion signals\n"); return -1; } // RT completion signals returned. if (sig_return != SIGRTMIN) { printf ("Unexpected signal (%d) has been received while waiting for RT Completion Signals\n", sig_return); return -1; } // @@ Debugging. printf ("Sig number found in the sig_info block : %d\n", sig_info.si_signo); // Is the signo returned consistent? if (sig_info.si_signo != sig_return) { printf ("Inconsistent signal number (%d) in the signal info block\n", sig_info.si_signo); return -1; } // @@ Debugging. printf ("Signal code for this signal delivery : %d\n", sig_info.si_code); // Is the signal code an aio completion one? if ((sig_info.si_code != SI_ASYNCIO) && (sig_info.si_code != SI_QUEUE)) { printf ("Unexpected signal code (%d) returned on completion querying\n", sig_info.si_code); return -1; } // Retrive the aiocb. aiocb* aiocb_ptr = (aiocb *) sig_info.si_value.sival_ptr; // Analyze error and return values. Return values are // actually 's associated with the call // corresponding to aiocb_ptr. int error_code = aio_error (aiocb_ptr); if (error_code == -1) { perror ("Error:Invalid control block was sent to for compleion querying\n"); return -1; } if (error_code != 0) { // Error occurred in the call. Return the errno // corresponding to that call. printf ("Error:An AIO call has failed:Error code = %d\n", error_code); return -1; } // No error occurred in the AIO operation. int nbytes = aio_return (aiocb_ptr); if (nbytes == -1) { perror ("Error:Invalid control block was send to \n"); return -1; } if (number_of_compleions == 0) // Print the buffer. printf ("Number of bytes transferred : %d\n The buffer : %s\n", nbytes, mb1); else // Print the buffer. printf ("Number of bytes transferred : %d\n The buffer : %s\n", nbytes, mb2); } return 0; } int test_aio_calls () { // Set up the input file. // Open file (in SEQUENTIAL_SCAN mode) file_handle = open ("test_aiosig.cpp", O_RDONLY); if (file_handle == -1) { perror ("Error:Opening the inputfile"); return -1; } if (setup_signal_delivery () < 0) return -1; if (issue_aio_calls () < 0) return -1; if (query_aio_completions () < 0) return -1; return 0; } void null_handler (int /* signal_number */, siginfo_t * /* info */, void * /* context */) { } int setup_signal_handler (int signal_number) { // Setting up the handler(!) for these signals. struct sigaction reaction; sigemptyset (&reaction.sa_mask); // Nothing else to mask. reaction.sa_flags = SA_SIGINFO; // Realtime flag. #if defined (SA_SIGACTION) // Lynx says, it is better to set this bit to be portable. reaction.sa_flags &= SA_SIGACTION; #endif /* SA_SIGACTION */ reaction.sa_sigaction = null_handler; // Null handler. int sigaction_return = sigaction (SIGRTMIN, &reaction, 0); if (sigaction_return == -1) { perror ("Error:Proactor couldnt do sigaction for the RT SIGNAL"); return -1; } return 0; } int main (int, char *[]) { if (test_aio_calls () == 0) printf ("RT SIG test successful:\n" "ACE_POSIX_SIG_PROACTOR should work in this platform\n"); else printf ("RT SIG test failed:\n" "ACE_POSIX_SIG_PROACTOR may not work in this platform\n"); return 0; } ace-8.0.4+dfsg.orig/examples/Reactor/Proactor/post_completions.cpp0000644000175000017500000002002215027201773024276 0ustar sudipsudip//============================================================================= /** * @file post_completions.cpp * * This program demonstrates how to post fake completions to The * Proactor. It also shows the how to specify the particular * real-time signals to post completions. The Real-time signal * based completion strategy is implemented with * ACE_POSIX_SIG_PROACTOR. * (So, it can be used only if both ACE_HAS_AIO_CALLS and * ACE_HAS_POSIX_REALTIME_SIGNALS are defined.) * Since it is faking results, you have to pay by knowing and * using platform-specific implementation objects for Asynchronous * Result classes. * This example shows using an arbitrary result class for faking * completions. You can also use the predefined Result classes for * faking. The factory methods in the Proactor class create the * Result objects. * make * ./post_completions * * @author Alexander Babu Arulanthu */ //============================================================================= #include "ace/OS_NS_unistd.h" #include "ace/OS_main.h" #include "ace/Proactor.h" #include "ace/Task.h" #include "ace/WIN32_Proactor.h" #include "ace/POSIX_Proactor.h" #include "ace/Atomic_Op.h" #include "ace/Thread_Mutex.h" // Keep track of how many completions are still expected. static ACE_Atomic_Op Completions_To_Go; #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) // This only works on Win32 platforms and on Unix platforms supporting // POSIX aio calls. #if defined (ACE_HAS_AIO_CALLS) #define RESULT_CLASS ACE_POSIX_Asynch_Result #elif defined (ACE_HAS_WIN32_OVERLAPPED_IO) #define RESULT_CLASS ACE_WIN32_Asynch_Result #endif /* ACE_HAS_AIO_CALLS */ /** * @class My_Result * * @brief Result Object that we will post to the Proactor. */ class My_Result : public RESULT_CLASS { public: My_Result (ACE_Handler &handler, const void *act, int signal_number, size_t sequence_number) : RESULT_CLASS (handler.proxy (), act, ACE_INVALID_HANDLE, 0, // Offset 0, // OffsetHigh 0, // Priority signal_number), sequence_number_ (sequence_number) {} // Constructor. virtual ~My_Result () {} // Destructor. /** * This is the method that will be called by the Proactor for * dispatching the completion. This method generally calls one of * the call back hood methods defined in the ACE_Handler * class. But, we will just handle the completions here. */ void complete (size_t, int success, const void *completion_key, u_long error) { this->success_ = success; this->completion_key_ = completion_key; this->error_ = error; size_t to_go = --Completions_To_Go; // Print the completion details. ACE_DEBUG ((LM_DEBUG, "(%t) Completion sequence number %d, success : %d, error : %d, signal_number : %d, %u more to go\n", this->sequence_number_, this->success_, this->error_, this->signal_number (), to_go)); // Sleep for a while. ACE_OS::sleep (4); } private: /// Sequence number for the result object. size_t sequence_number_; }; /** * @class My_Handler * * @brief Handler class for faked completions. */ class My_Handler : public ACE_Handler { public: /// Constructor. My_Handler () {} /// Destructor. virtual ~My_Handler () {} }; /** * @class My_Task: * * @brief Contains thread functions which execute event loops. Each * thread waits for a different signal. */ class My_Task: public ACE_Task { public: /// Constructor. My_Task () {} /// Destructor. virtual ~My_Task () {} //FUZZ: disable check_for_lack_ACE_OS int open (void *proactor) { //FUZZ: enable check_for_lack_ACE_OS // Store the proactor. this->proactor_ = (ACE_Proactor *) proactor; // Activate the Task. this->activate (THR_NEW_LWP, 5); return 0; } int svc () { // Handle events for 13 seconds. ACE_Time_Value run_time (13); ACE_DEBUG ((LM_DEBUG, "(%t):Starting svc routine\n")); if (this->proactor_->handle_events (run_time) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t):%p.\n", "Worker::svc"), -1); ACE_DEBUG ((LM_DEBUG, "(%t) work complete\n")); return 0; } private: /// Proactor for this task. ACE_Proactor *proactor_; }; int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { ACE_UNUSED_ARG (argc); ACE_UNUSED_ARG (argv); ACE_DEBUG ((LM_DEBUG, "(%P | %t):Test starts\n")); // = Get two POSIX_SIG_Proactors, one with SIGRTMIN and one with // SIGRTMAX. ACE_Proactor proactor1; // Proactor1. SIGRTMIN Proactor. (default). // = Proactor2. SIGRTMAX Proactor. #if defined (ACE_HAS_AIO_CALLS) && defined (ACE_HAS_POSIX_REALTIME_SIGNALS) ACE_DEBUG ((LM_DEBUG, "Using ACE_POSIX_SIG_Proactor\n")); sigset_t signal_set; // Signal set that we want to mask. // Clear the signal set. if (ACE_OS::sigemptyset (&signal_set) == -1) ACE_ERROR_RETURN ((LM_ERROR, "Error:%p\n", "sigemptyset failed"), 1); // Add the SIGRTMAX to the signal set. if (ACE_OS::sigaddset (&signal_set, ACE_SIGRTMAX) == -1) ACE_ERROR_RETURN ((LM_ERROR, "Error:%p\n", "sigaddset failed"), 1); // Make the POSIX Proactor. ACE_POSIX_SIG_Proactor posix_proactor (signal_set); // Get the Proactor interface out of it. ACE_Proactor proactor2 (&posix_proactor); #else /* ACE_HAS_AIO_CALLS && ACE_HAS_POSIX_REALTIME_SIGNALS */ ACE_Proactor proactor2; #endif /* ACE_HAS_AIO_CALLS && ACE_HAS_POSIX_REALTIME_SIGNALS */ // = Create Tasks. One pool of threads to handle completions on // SIGRTMIN and the other one to handle completions on SIGRTMAX. My_Task task1, task2; task1.open (&proactor1); task2.open (&proactor2); // Handler for completions. My_Handler handler; // = Create a few MyResult objects and post them to Proactor. const size_t NrCompletions (10); My_Result *result_objects [NrCompletions]; int signal_number = ACE_SIGRTMAX; size_t ri = 0; Completions_To_Go = NrCompletions; // Creation. for (ri = 0; ri < NrCompletions; ri++) { // Use RTMIN and RTMAX proactor alternatively, to post // completions. if (ri % 2) signal_number = ACE_SIGRTMIN; else signal_number = ACE_SIGRTMAX; // Create the result. ACE_NEW_RETURN (result_objects [ri], My_Result (handler, 0, signal_number, ri), 1); } ACE_OS::sleep(5); // Post all the result objects. ACE_Proactor *proactor; for (ri = 0; ri < NrCompletions; ri++) { // Use RTMIN and RTMAX Proactor alternatively, to post // completions. if (ri % 2) proactor = &proactor1; else proactor = &proactor2; if (result_objects [ri]->post_completion (proactor->implementation ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, "Test failed\n"), 1); } ACE_Thread_Manager::instance ()->wait (); int status = 0; size_t to_go = Completions_To_Go.value (); if (size_t (0) != to_go) { ACE_ERROR ((LM_ERROR, "Fail! Expected all completions to finish but %u to go\n", to_go)); status = 1; } ACE_DEBUG ((LM_DEBUG, "(%P | %t):Test ends\n")); return status; } #else /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ int ACE_TMAIN (int, ACE_TCHAR *[]) { ACE_DEBUG ((LM_DEBUG, "This example cannot work with AIOCB_Proactor.\n")); return 1; } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ ace-8.0.4+dfsg.orig/examples/Reactor/Proactor/test_multiple_loops.cpp0000644000175000017500000000703415027201773025013 0ustar sudipsudip //============================================================================= /** * @file test_multiple_loops.cpp * * This example application shows how to write programs that * combine the Proactor and Reactor event loops. This is possible * only on WIN32 platform. * * @author Irfan Pyarali */ //============================================================================= #include "ace/Task.h" #include "ace/Proactor.h" #include "ace/WIN32_Proactor.h" #include "ace/Atomic_Op.h" #include "ace/OS_NS_unistd.h" #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) /** * @class Timeout_Handler * * @brief Generic timeout handler. */ class Timeout_Handler : public ACE_Handler, public ACE_Event_Handler { public: Timeout_Handler () { } // This is called by the Proactor. This is declared in ACE_Handler. virtual void handle_time_out (const ACE_Time_Value &tv, const void *arg) { // Print out when timeouts occur. ACE_DEBUG ((LM_DEBUG, "(%t) %d timeout occurred for %s @ %d.\n", ++count_, (char *) arg, tv.sec ())); // Since there is only one thread that can do the timeouts in // Reactor, lets keep the handle_timeout short for that // thread. if (ACE_OS::strcmp ((char *) arg, "Proactor") == 0) // Sleep for a while ACE_OS::sleep (1); } // This method is declared in ACE_Event_Handler. virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg) { this->handle_time_out (tv, arg); return 0; } private: ACE_Atomic_Op count_; }; class Worker : public ACE_Task { public: // Thread fuction. int svc () { ACE_DEBUG ((LM_DEBUG, "(%t) Worker started\n")); // Handle events for 13 seconds. ACE_Time_Value run_time (13); // Try to become the owner ACE_Reactor::instance ()->owner (ACE_Thread::self ()); if (ACE_Reactor::run_event_loop (run_time) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "Worker::svc"), -1); else ACE_DEBUG ((LM_DEBUG, "(%t) work complete\n")); return 0; } }; int ACE_TMAIN (int, ACE_TCHAR *[]) { Timeout_Handler handler; ACE_WIN32_Proactor win32_proactor (0, 1); ACE_Proactor proactor (&win32_proactor, 0, 0); ACE_Reactor::instance ()->register_handler (proactor.implementation ()); // Register a 2 second timer. ACE_Time_Value foo_tv (2); if (proactor.schedule_timer (handler, (void *) "Proactor", ACE_Time_Value::zero, foo_tv) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); // Register a 3 second timer. ACE_Time_Value bar_tv (3); if (ACE_Reactor::instance ()->schedule_timer (&handler, (void *) "Reactor", ACE_Time_Value::zero, bar_tv) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); Worker worker; if (worker.activate (THR_NEW_LWP, 10) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "main"), -1); ACE_Thread_Manager::instance ()->wait (); // Remove from reactor ACE_Reactor::instance ()->remove_handler (&proactor, ACE_Event_Handler::DONT_CALL); return 0; } #else int ACE_TMAIN (int, ACE_TCHAR *[]) { return 0; } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO */ ace-8.0.4+dfsg.orig/examples/Reactor/Proactor/test_cancel.cpp0000644000175000017500000001447415027201773023177 0ustar sudipsudip //============================================================================= /** * @file test_cancel.cpp * * This program tests cancelling an Asynchronous Operation in the * Proactor framework. * * This tests accepts a connection and issues an Asynchronous Read * Stream. It reads (option -s) number of bytes and * when this operation completes, it issues another Asynchronous * Read Stream to and immediately calls to * cancel the operation and so the program exits closing the * connection. * * Works fine on NT. LynxOS has a good implementation. It works * fine. * * = RUN * ./test_cancel -p * Then telnet to this port and send bytes and your * connection should get closed down. * * @author Irfan Pyarali (irfan@cs.wustl.edu) */ //============================================================================= #include "ace/OS_main.h" #include "ace/Service_Config.h" #include "ace/Proactor.h" #include "ace/Asynch_IO.h" #include "ace/Asynch_IO_Impl.h" #include "ace/Asynch_Acceptor.h" #include "ace/INET_Addr.h" #include "ace/SOCK_Connector.h" #include "ace/SOCK_Acceptor.h" #include "ace/SOCK_Stream.h" #include "ace/Message_Block.h" #include "ace/Get_Opt.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_sys_socket.h" #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) // This only works on Win32 platforms and on Unix platforms supporting // POSIX aio calls. #include "test_cancel.h" static u_short port = ACE_DEFAULT_SERVER_PORT; static int done = 0; static int read_size = 2; Receiver::Receiver () : mb_ (read_size + 1), handle_ (ACE_INVALID_HANDLE) { } Receiver::~Receiver () { ACE_DEBUG ((LM_DEBUG, "Receiver: Closing down Remote connection:%d\n", this->handle_)); ACE_OS::closesocket (this->handle_); } void Receiver::open (ACE_HANDLE handle, ACE_Message_Block &) { // New connection, initiate stuff ACE_DEBUG ((LM_DEBUG, "%N:%l:Receiver::open called\n")); // Cache the new connection this->handle_ = handle; // Initiate ACE_Asynch_Read_Stream if (this->rs_.open (*this, this->handle_) == -1) { ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Read_Stream::open")); return; } // Try to read bytes from the stream. ACE_DEBUG ((LM_DEBUG, "Receiver::open: Issuing Asynch Read of (%d) bytes from the stream\n", read_size)); if (this->rs_.read (this->mb_, read_size) == -1) ACE_ERROR ((LM_ERROR, "%p\n", "Receiver::open: Failed to issue the read")); } void Receiver::handle_read_stream (const ACE_Asynch_Read_Stream::Result &result) { ACE_DEBUG ((LM_DEBUG, "handle_read_stream called\n")); // Reset pointers result.message_block ().rd_ptr ()[result.bytes_transferred ()] = '\0'; ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_read", result.bytes_to_read ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (uintptr_t) result.act ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (uintptr_t) result.completion_key ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block", result.message_block ().rd_ptr ())); if (result.success () && !result.error ()) { // Successful read: No error. // Set the pointers back in the message block. result.message_block ().wr_ptr (result.message_block ().rd_ptr ()); // Issue another read, but immediately cancel it. // Issue the read. ACE_DEBUG ((LM_DEBUG, "Issuing Asynch Read of (%d) bytes from the stream\n", read_size)); if (this->rs_.read (this->mb_, read_size) == -1) ACE_ERROR ((LM_ERROR, "%p\n", "Receiver::handle_read_stream: Failed to issue the read")); // Cancel the read. ACE_DEBUG ((LM_DEBUG, "Cacelling Asynch Read ")); int ret_val = this->rs_.cancel (); if (ret_val == -1) ACE_ERROR ((LM_ERROR, "%p\n", "Receiver::handle_read_stream: Failed to cancel the read")); ACE_DEBUG ((LM_DEBUG, "Asynch IO : Cancel : Result = %d\n", ret_val)); } else { done = 1; ACE_DEBUG ((LM_DEBUG, "Receiver completed\n")); // Print the error message if any. if (result.error () != 0) { errno = result.error (); ACE_ERROR ((LM_ERROR, "%p\n", "Asynch Read Stream Error: ")); } } } static int parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("p:s:")); int c; while ((c = get_opt ()) != EOF) switch (c) { case 'p': port = ACE_OS::atoi (get_opt.opt_arg ()); break; case 's': read_size = ACE_OS::atoi (get_opt.opt_arg ()); break; default: ACE_ERROR ((LM_ERROR, "%p.\n", "usage :\n" "-p \n" "-s \n")); return -1; } return 0; } int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { if (parse_args (argc, argv) == -1) return -1; // Note: acceptor parameterized by the Receiver ACE_Asynch_Acceptor acceptor; // Listening passively. if (acceptor.open (ACE_INET_Addr (port), read_size, 1) == -1) ACE_ERROR_RETURN ((LM_ERROR, "ACE:acceptor::open failed\n"), 1); int success = 1; while (success > 0 && !done) // dispatch events success = ACE_Proactor::instance ()->handle_events (); return 0; } #else /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ int ACE_TMAIN (int, ACE_TCHAR *[]) { ACE_DEBUG ((LM_DEBUG, "This example does not work on this platform.\n")); return 1; } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ ace-8.0.4+dfsg.orig/examples/Reactor/Proactor/test_proactor.cpp0000644000175000017500000005113115027201773023572 0ustar sudipsudip //============================================================================= /** * @file test_proactor.cpp * * This program illustrates how the can be used to * implement an application that does various asynchronous * operations. * * @author Irfan Pyarali */ //============================================================================= #include "ace/OS_NS_string.h" #include "ace/OS_main.h" #include "ace/Service_Config.h" #include "ace/Proactor.h" #include "ace/Asynch_IO.h" #include "ace/Asynch_IO_Impl.h" #include "ace/Asynch_Acceptor.h" #include "ace/INET_Addr.h" #include "ace/SOCK_Connector.h" #include "ace/SOCK_Acceptor.h" #include "ace/SOCK_Stream.h" #include "ace/Message_Block.h" #include "ace/Get_Opt.h" #include "ace/Log_Msg.h" #include "ace/Truncate.h" #include "ace/OS_NS_sys_stat.h" #include "ace/OS_NS_sys_socket.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_fcntl.h" #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) // This only works on Win32 platforms and on Unix platforms supporting // POSIX aio calls. #include "test_proactor.h" // Host that we're connecting to. static ACE_TCHAR *host = 0; // Port that we're receiving connections on. static u_short port = ACE_DEFAULT_SERVER_PORT; // File that we're sending. static const ACE_TCHAR *file = ACE_TEXT("test_proactor.cpp"); // Name of the output file. static const ACE_TCHAR *dump_file = ACE_TEXT("output"); // Keep track of when we're done. static int done = 0; // Size of each initial asynchronous operation. static int initial_read_size = BUFSIZ; Receiver::Receiver () : dump_file_ (ACE_INVALID_HANDLE), handle_ (ACE_INVALID_HANDLE) { } Receiver::~Receiver () { ACE_OS::close (this->dump_file_); ACE_OS::closesocket (this->handle_); } void Receiver::open (ACE_HANDLE handle, ACE_Message_Block &message_block) { ACE_DEBUG ((LM_DEBUG, "%N:%l:Receiver::open called\n")); // New connection, so initiate stuff. // Cache the new connection this->handle_ = handle; // File offset starts at zero this->file_offset_ = 0; // Open dump file (in OVERLAPPED mode) this->dump_file_ = ACE_OS::open (dump_file, O_CREAT | O_RDWR | O_TRUNC | \ FILE_FLAG_OVERLAPPED); if (this->dump_file_ == ACE_INVALID_HANDLE) { ACE_ERROR ((LM_ERROR, "%p\n", "ACE_OS::open")); return; } // Initiate . if (this->wf_.open (*this, this->dump_file_) == -1) { ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Write_File::open")); return; } // Initiate . if (this->rs_.open (*this, this->handle_) == -1) { ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Read_Stream::open")); return; } // Fake the result and make the get // called. But, not, if there is '0' is transferred. if (message_block.length () != 0) { // Duplicate the message block so that we can keep it around. ACE_Message_Block &duplicate = *message_block.duplicate (); // Fake the result so that we will get called back. ACE_Asynch_Read_Stream_Result_Impl *fake_result = ACE_Proactor::instance ()->create_asynch_read_stream_result (this->proxy (), this->handle_, duplicate, initial_read_size, 0, ACE_INVALID_HANDLE, 0, 0); size_t bytes_transferred = message_block.length (); // for Accept would have already moved the // forward. Update it to the beginning position. duplicate.wr_ptr (duplicate.wr_ptr () - bytes_transferred); // This will call the callback. fake_result->complete (message_block.length (), 1, 0); // Zap the fake result. delete fake_result; } else // Otherwise, make sure we proceed. Initiate reading the socket // stream. if (this->initiate_read_stream () == -1) return; } int Receiver::initiate_read_stream () { // Create a new . Note that this message block will // be used both to data asynchronously from the socket and to // data asynchronously to the file. ACE_Message_Block *mb = 0; ACE_NEW_RETURN (mb, ACE_Message_Block (BUFSIZ + 1), -1); // Inititiate read if (this->rs_.read (*mb, mb->size () - 1) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Read_Stream::read"), -1); return 0; } void Receiver::handle_read_stream (const ACE_Asynch_Read_Stream::Result &result) { ACE_DEBUG ((LM_DEBUG, "handle_read_stream called\n")); // Reset pointers. result.message_block ().rd_ptr ()[result.bytes_transferred ()] = '\0'; ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_read", result.bytes_to_read ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (uintptr_t) result.act ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (uintptr_t) result.completion_key ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); ACE_DEBUG ((LM_DEBUG, "********************\n")); #if 0 // This can overrun the ACE_Log_Msg buffer and do bad things. // Re-enable it at your risk. ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block", result.message_block ().rd_ptr ())); #endif /* 0 */ if (result.success () && result.bytes_transferred () != 0) { // Successful read: write the data to the file asynchronously. // Note how we reuse the for the writing. // Therefore, we do not delete this buffer because it is handled // in . if (this->wf_.write (result.message_block (), result.bytes_transferred (), this->file_offset_) == -1) { ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Write_File::write")); return; } // Initiate new read from the stream. if (this->initiate_read_stream () == -1) return; } else { ACE_DEBUG ((LM_DEBUG, "Receiver completed\n")); // No need for this message block anymore. result.message_block ().release (); // Note that we are done with the test. done = 1; // We are done: commit suicide. delete this; } } void Receiver::handle_write_file (const ACE_Asynch_Write_File::Result &result) { ACE_DEBUG ((LM_DEBUG, "handle_write_file called\n")); ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_write", result.bytes_to_write ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (uintptr_t) result.act ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (uintptr_t) result.completion_key ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); ACE_DEBUG ((LM_DEBUG, "********************\n")); result.message_block ().release (); if (result.success ()) // Write successful: Increment file offset this->file_offset_ += ACE_Utils::truncate_cast (result.bytes_transferred ()); // This code is not robust enough to deal with short file writes // (which hardly ever happen) ;-) ACE_ASSERT (result.bytes_to_write () == result.bytes_transferred ()); } /** * @class Sender * * @brief The class will be created by
. After connecting to the * host, this class will then read data from a file and send it * to the network connection. */ class Sender : public ACE_Handler { public: Sender (); ~Sender (); //FUZZ: disable check_for_lack_ACE_OS ///FUZZ: enable check_for_lack_ACE_OS int open (const ACE_TCHAR *host, u_short port); ACE_HANDLE handle () const; void handle (ACE_HANDLE); protected: // These methods are called by the freamwork /** * This is called when asynchronous transmit files complete * This is called when asynchronous writes from the socket complete * This is called when asynchronous reads from the socket complete */ virtual void handle_transmit_file (const ACE_Asynch_Transmit_File::Result &result); virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result); virtual void handle_read_file (const ACE_Asynch_Read_File::Result &result); private: /// Transmit the entire file in one fell swoop. int transmit_file (); /// Initiate an asynchronous file read. int initiate_read_file (); /// Network I/O handle ACE_SOCK_Stream stream_; /// ws (write stream): for writing to the socket ACE_Asynch_Write_Stream ws_; /// rf (read file): for writing from the file ACE_Asynch_Read_File rf_; /// Transmit file. ACE_Asynch_Transmit_File tf_; /// File to read from ACE_HANDLE input_file_; /// Current file offset u_long file_offset_; /// File size u_long file_size_; /// Welcome message ACE_Message_Block welcome_message_; /// Header and trailer which goes with transmit_file ACE_Asynch_Transmit_File::Header_And_Trailer header_and_trailer_; /// These flags help to determine when to close down the event loop int stream_write_done_; int transmit_file_done_; }; Sender::Sender () : input_file_ (ACE_INVALID_HANDLE), file_offset_ (0), file_size_ (0), stream_write_done_ (0), transmit_file_done_ (0) { // Moment of inspiration... :-) static const char *data = "Welcome to Irfan World! Irfan RULES here !!\n"; this->welcome_message_.init (data, ACE_OS::strlen (data)); this->welcome_message_.wr_ptr (ACE_OS::strlen (data)); } Sender::~Sender () { this->stream_.close (); } ACE_HANDLE Sender::handle () const { return this->stream_.get_handle (); } void Sender::handle (ACE_HANDLE handle) { this->stream_.set_handle (handle); } int Sender::open (const ACE_TCHAR *host, u_short port) { // Initialize stuff // Open input file (in OVERLAPPED mode) this->input_file_ = ACE_OS::open (file, GENERIC_READ | FILE_FLAG_OVERLAPPED); if (this->input_file_ == ACE_INVALID_HANDLE) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_OS::open"), -1); // Find file size this->file_size_ = ACE_OS::filesize (this->input_file_); // Connect to remote host ACE_INET_Addr address (port, host); ACE_SOCK_Connector connector; if (connector.connect (this->stream_, address) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_SOCK_Connector::connect"), -1); // Open ACE_Asynch_Write_Stream if (this->ws_.open (*this) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Write_Stream::open"), -1); // Open ACE_Asynch_Read_File if (this->rf_.open (*this, this->input_file_) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Read_File::open"), -1); // Start an asynchronous transmit file if (this->transmit_file () == -1) return -1; // Start an asynchronous read file if (this->initiate_read_file () == -1) return -1; return 0; } int Sender::transmit_file () { // Open file (in SEQUENTIAL_SCAN mode) ACE_HANDLE file_handle = ACE_OS::open (file, GENERIC_READ | FILE_FLAG_SEQUENTIAL_SCAN); if (file_handle == ACE_INVALID_HANDLE) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_OS::open"), -1); // Open ACE_Asynch_Transmit_File if (this->tf_.open (*this) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Transmit_File::open"), -1); // Header and trailer data for the file. // @@ What happens if header and trailer are the same? this->header_and_trailer_.header_and_trailer (&this->welcome_message_, this->welcome_message_.length (), &this->welcome_message_, this->welcome_message_.length ()); // Send the entire file in one fell swoop! if (this->tf_.transmit_file (file_handle, &this->header_and_trailer_) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Transmit_File::transmit_file"), -1); return 0; } void Sender::handle_transmit_file (const ACE_Asynch_Transmit_File::Result &result) { ACE_DEBUG ((LM_DEBUG, "handle_transmit_file called\n")); ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "socket", result.socket ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "file", result.file ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_write", result.bytes_to_write ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_per_send", result.bytes_per_send ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "flags", result.flags ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (uintptr_t) result.act ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (uintptr_t) result.completion_key ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); ACE_DEBUG ((LM_DEBUG, "********************\n")); // Done with file ACE_OS::close (result.file ()); this->transmit_file_done_ = 1; if (this->stream_write_done_) done = 1; } int Sender::initiate_read_file () { // Create a new . Note that this message block will // be used both to data asynchronously from the file and to // data asynchronously to the socket. ACE_Message_Block *mb = 0; ACE_NEW_RETURN (mb, ACE_Message_Block (BUFSIZ + 1), -1); // Inititiate an asynchronous read from the file if (this->rf_.read (*mb, mb->size () - 1, this->file_offset_) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Read_File::read"), -1); return 0; } void Sender::handle_read_file (const ACE_Asynch_Read_File::Result &result) { ACE_DEBUG ((LM_DEBUG, "handle_read_file called\n")); result.message_block ().rd_ptr ()[result.bytes_transferred ()] = '\0'; ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_read", result.bytes_to_read ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (uintptr_t) result.act ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (uintptr_t) result.completion_key ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); ACE_DEBUG ((LM_DEBUG, "********************\n")); //ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block", result.message_block ().rd_ptr ())); if (result.success ()) { // Read successful: increment offset and write data to network. // Note how we reuse the for the writing. // Therefore, we do not delete this buffer because it is handled // in . this->file_offset_ += ACE_Utils::truncate_cast (result.bytes_transferred ()); if (this->ws_.write (result.message_block (), result.bytes_transferred ()) == -1) { ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Write_Stream::write")); return; } if (this->file_size_ > this->file_offset_) { // Start an asynchronous read file. if (initiate_read_file () == -1) return; } } } void Sender::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result) { ACE_DEBUG ((LM_DEBUG, "handle_write_stream called\n")); // Reset pointers. result.message_block ().rd_ptr (result.message_block ().rd_ptr () - result.bytes_transferred ()); ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_write", result.bytes_to_write ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (uintptr_t) result.act ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (uintptr_t) result.completion_key ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); ACE_DEBUG ((LM_DEBUG, "********************\n")); #if 0 ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block", result.message_block ().rd_ptr ())); #endif if (result.success ()) { // Partial write to socket int unsent_data = ACE_Utils::truncate_cast ( result.bytes_to_write () - result.bytes_transferred ()); if (unsent_data != 0) { // Reset pointers result.message_block ().rd_ptr (result.bytes_transferred ()); // Duplicate the message block and retry remaining data if (this->ws_.write (*result.message_block ().duplicate (), unsent_data) == -1) { ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Write_Stream::write")); return; } } else if (!(this->file_size_ > this->file_offset_)) { this->stream_write_done_ = 1; if (this->transmit_file_done_) done = 1; } } // Release message block. result.message_block ().release (); } static int parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("h:p:f:d:")); int c; while ((c = get_opt ()) != EOF) switch (c) { case 'h': host = get_opt.opt_arg (); break; case 'p': port = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'f': file = get_opt.opt_arg (); break; case 'd': dump_file = get_opt.opt_arg (); break; default: ACE_ERROR ((LM_ERROR, "%p.\n", "usage :\n" "-h \n" "-p \n" "-f \n")); return -1; } return 0; } int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { if (parse_args (argc, argv) == -1) return -1; Sender sender; // Note: acceptor parameterized by the Receiver. ACE_Asynch_Acceptor acceptor; // If passive side if (host == 0) { if (acceptor.open (ACE_INET_Addr (port), initial_read_size, 1) == -1) return -1; } // If active side else if (sender.open (host, port) == -1) return -1; int success = 1; while (success > 0 && !done) // Dispatch events via Proactor singleton. success = ACE_Proactor::instance ()->handle_events (); return 0; } #else /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ int ACE_TMAIN (int, ACE_TCHAR *[]) { ACE_DEBUG ((LM_DEBUG, "This example does not work on this platform.\n")); return 1; } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ ace-8.0.4+dfsg.orig/examples/Reactor/Proactor/Proactor.mpc0000644000175000017500000000227615027201773022476 0ustar sudipsudip// -*- MPC -*- project(*cancel) : aceexe, avoids_ace_for_tao { exename = test_cancel Source_Files { test_cancel.cpp } } project(*end_event_loops) : aceexe, avoids_ace_for_tao { exename = test_end_event_loop Source_Files { test_end_event_loop.cpp } } project(*multiple_loops) : aceexe, avoids_ace_for_tao { exename = test_multiple_loops Source_Files { test_multiple_loops.cpp } } project(*post_completions) : aceexe, avoids_ace_for_tao { exename = test_post_completions Source_Files { post_completions.cpp } } project(*proactor) : aceexe, avoids_ace_for_tao { exename = test_proactor Source_Files { test_proactor.cpp } } // project(*proactor2) : aceexe, avoids_ace_for_tao { // exename = test_proactor2 // Source_Files { // test_proactor2.cpp // } // } // project(*proactor3) : aceexe, avoids_ace_for_tao { // exename = test_proactor3 // Source_Files { // test_proactor3.cpp // } // } project(*timeout) : aceexe, avoids_ace_for_tao { exename = test_timeout Source_Files { test_timeout.cpp } } project(*udp_proactor) : aceexe, avoids_ace_for_tao { exename = test_udp_proactor Source_Files { test_udp_proactor.cpp } } ace-8.0.4+dfsg.orig/examples/Reactor/Proactor/test_end_event_loop.cpp0000644000175000017500000001066115027201773024744 0ustar sudipsudip//============================================================================= /** * @file test_end_event_loop.cpp * * This program tests the event loop mechanism of the * Proactor. To end the event loop, threads that are blocked in * waiting for completions are woken up and the event loop comes * to the end. This is tested in this program. * Threads are doing with/without time_out * values and the main thread calls . * make * ./test_end_event_loop * * @author Alexander Babu Arulanthu */ //============================================================================= #include "ace/OS_NS_unistd.h" #include "ace/Proactor.h" #include "ace/Task.h" #include "ace/WIN32_Proactor.h" #include "ace/POSIX_Proactor.h" #include "ace/OS_main.h" #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) // This only works on Win32 platforms and on Unix platforms supporting // POSIX aio calls. /** * @class My_Task: * * @brief Contains thread functions which execute event loops. Each * thread waits for a different signal. */ class My_Task: public ACE_Task { public: // Constructor. My_Task () : time_flag_ (0) {} /// Destructor. virtual ~My_Task () {} //FUZZ: disable check_for_lack_ACE_OS // If time_flag is zero do the eventloop indefinitely, otherwise do // it for finite amount of time (13secs!!!). int open (void *timed_event_loop) { //FUZZ: enble check_for_lack_ACE_OS // Set the local variable. if (timed_event_loop == 0) this->time_flag_ = 0; else this->time_flag_ = 1; // Spawn the threads. if (this->activate (THR_NEW_LWP, 5) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%N:%l:%p\n", "My_Task:open: failed"), -1); return 0; } // Thread function. int svc () { ACE_DEBUG ((LM_DEBUG, "(%P|%t):Starting svc routine\n")); if (this->time_flag_) { ACE_DEBUG ((LM_DEBUG, "(%P|%t):Going to do *timed* \n")); ACE_Time_Value run_time (13); if (ACE_Proactor::instance ()->run_event_loop (run_time) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t):%p.\n", " failed"), -1); } else { ACE_DEBUG ((LM_DEBUG, "(%P|%t):Going to do *indefinite* \n")); if (ACE_Proactor::instance ()->run_event_loop () == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t):%p.\n", " failed"), -1); } return 0; }; private: /// If zero, indefinite event loop, otherwise timed event loop. int time_flag_; }; int ACE_TMAIN (int argc, ACE_TCHAR *argv []) { ACE_UNUSED_ARG (argc); ACE_UNUSED_ARG (argv); ACE_DEBUG ((LM_DEBUG, "(%P | %t):Test starts\n")); // Let us get the singleton proactor created here. This is very // important. This will mask the signal used in the Proactor masked // for the main thread (and all the threads). ACE_Proactor *proactor = ACE_Proactor::instance (); ACE_UNUSED_ARG (proactor); My_Task task1, task2; // Test the indefinite run event loop. if (task1.open (0) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%N:%l:(%P | %t):Failed to the task\n"), 1); // Test the indefinite run event loop. Just pass a non-zero. if (task2.open ((void *)&task2) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%N:%l:(%P | %t):Failed to the task\n"), 1); // Give a gap. ACE_OS::sleep (3); // End the event loop. if (ACE_Proactor::instance ()->end_event_loop () == -1) ACE_ERROR_RETURN ((LM_ERROR, "%N:%l:(%P | %t):Failed to \n"), 1); ACE_Thread_Manager::instance ()->wait (); ACE_DEBUG ((LM_DEBUG, "(%P | %t):Test ends\n")); return 0; } #else /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ int ACE_TMAIN (int, ACE_TCHAR *[]) { ACE_DEBUG ((LM_DEBUG, "This example cannot work with AIOCB_Proactor.\n")); return 1; } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ ace-8.0.4+dfsg.orig/examples/Reactor/Proactor/test_proactor2.cpp0000644000175000017500000005106215027201773023657 0ustar sudipsudip //============================================================================= /** * @file test_proactor2.cpp * * Alexander Libman modified * and made this test. Instead of writing received * data to the file, the receiver sends them back to the * sender,i.e. ACE_Asynch_Write_File wf_ has been changed to * ACE_Asynch_Write_Stream wf_. * * @author Irfan Pyarali and Alexander Libman . */ //============================================================================= #include "ace/Signal.h" #include "ace/Service_Config.h" #include "ace/Proactor.h" #include "ace/Asynch_IO.h" #include "ace/Asynch_IO_Impl.h" #include "ace/Asynch_Acceptor.h" #include "ace/INET_Addr.h" #include "ace/SOCK_Connector.h" #include "ace/SOCK_Acceptor.h" #include "ace/SOCK_Stream.h" #include "ace/Message_Block.h" #include "ace/Get_Opt.h" // FUZZ: disable check_for_streams_include #include "ace/streams.h" #include "ace/Task.h" #include "ace/OS_main.h" #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) // This only works on Win32 platforms and on Unix platforms supporting // POSIX aio calls. #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) #include "ace/WIN32_Proactor.h" #elif defined (ACE_HAS_AIO_CALLS) #include "ace/POSIX_Proactor.h" #endif // Some debug helper functions int DisableSignal ( int SigNum ); int PrintSigMask (); #define COUT(X) cout << X ; cout.flush (); // Host that we're connecting to. static ACE_TCHAR *host = 0; // duplex mode: ==0 half-duplex // !=0 full duplex static int duplex = 0 ; // number threads in the Proactor thread pool static int nThreads = 1; // Port that we're receiving connections on. static u_short port = ACE_DEFAULT_SERVER_PORT; // Size of each initial asynchronous operation. static int initial_read_size = BUFSIZ; #define MyMutex ACE_Recursive_Thread_Mutex //#define MyMutex ACE_Thread_Mutex //#define MyMutex ACE_Null_Mutex //-------------------------------------------------------------------------- // MyTask plays role for Proactor threads pool //-------------------------------------------------------------------------- class MyTask: public ACE_Task { public: int svc () ; }; int MyTask::svc () { ACE_DEBUG ((LM_DEBUG, "(%t) MyTask started\n")); while ( ACE_Proactor::event_loop_done () == 0 ) { ACE_Proactor::run_event_loop (); } ACE_DEBUG ((LM_DEBUG, "(%t) MyTask finished\n")); return 0 ; } //----------------------------------------------------------- // Receiver //----------------------------------------------------------- class Receiver : public ACE_Service_Handler { public: Receiver (); ~Receiver (); //FUZZ: disable check_for_lack_ACE_OS /// This is called after the new connection has been accepted. ///FUZZ: enable check_for_lack_ACE_OS virtual void open (ACE_HANDLE handle, ACE_Message_Block &message_block); protected: // These methods are called by the framework /// This is called when asynchronous operation from the socket /// complete. virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result); /// This is called when an asynchronous to the file /// completes. virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result); private: int initiate_read_stream (); int initiate_write_stream (ACE_Message_Block & mb, int nBytes ); bool check_destroy () ; ACE_Asynch_Read_Stream rs_; ACE_Asynch_Write_Stream ws_; ACE_HANDLE handle_; MyMutex m_Mtx ; long nIOCount ; static long nSessions ; }; long Receiver::nSessions = 0 ; Receiver::Receiver () : handle_ (ACE_INVALID_HANDLE), nIOCount ( 0 ) { ACE_GUARD (MyMutex, locker, m_Mtx); nSessions ++ ; ACE_DEBUG ((LM_DEBUG, "Receiver Ctor nSessions=%d\n", nSessions )); } Receiver::~Receiver () { ACE_GUARD (MyMutex, locker, m_Mtx); nSessions -- ; ACE_OS::closesocket (this->handle_); ACE_DEBUG ((LM_DEBUG, "~Receiver Dtor nSessions=%d\n", nSessions )); } //--------------------------------------------------------------------- // return true if we alive, false we commited suicide // //--------------------------------------------------------------------- bool Receiver::check_destroy () { { ACE_GUARD_RETURN (MyMutex, locker, m_Mtx, false); if ( nIOCount > 0 ) { return true ; } } delete this ; return false ; } void Receiver::open (ACE_HANDLE handle, ACE_Message_Block &) { ACE_DEBUG ((LM_DEBUG, "%N:%l:Receiver::open called\n")); this->handle_ = handle; if (this->ws_.open (*this, this->handle_ ) == -1) { ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Write_Stream::open")); } else if (this->rs_.open (*this, this->handle_) == -1) { ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Read_Stream::open")); } else { initiate_read_stream (); } check_destroy (); } int Receiver::initiate_read_stream () { ACE_GUARD_RETURN (MyMutex, locker, m_Mtx, -1); // Create a new . Note that this message block will // be used both to data asynchronously from the socket and to // data asynchronously to the file. ACE_DEBUG ((LM_DEBUG, "initiate_read_stream called\n")); ACE_Message_Block *mb = 0; ACE_NEW_RETURN (mb, ACE_Message_Block (BUFSIZ + 1), -1); // Inititiate read if (this->rs_.read (*mb, mb->size ()- 1) == -1) { mb->release () ; ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Read_Stream::read"), -1); } nIOCount++ ; return 0; } int Receiver::initiate_write_stream (ACE_Message_Block & mb, int nBytes ) { ACE_GUARD_RETURN (MyMutex, locker, m_Mtx, -1); if (this->ws_.write (mb , nBytes ) == -1) { mb.release (); ACE_ERROR_RETURN((LM_ERROR, "%p\n", "ACE_Asynch_Write_File::write"), -1); } nIOCount++ ; return 0; } void Receiver::handle_read_stream (const ACE_Asynch_Read_Stream::Result &result) { ACE_DEBUG ((LM_DEBUG, "handle_read_stream called\n")); // Reset pointers. result.message_block ().rd_ptr ()[result.bytes_transferred ()] = '\0'; ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_read", result.bytes_to_read ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (u_long) result.act ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (u_long) result.completion_key ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block", result.message_block ().rd_ptr ())); if ( result.success () && result.bytes_transferred () != 0) { // Successful read: write the data to the file asynchronously. // Note how we reuse the for the writing. // Therefore, we do not delete this buffer because it is handled // in . if(this->initiate_write_stream (result.message_block (), result.bytes_transferred () ) == 0 ) { if ( duplex != 0 ) { // Initiate new read from the stream. this->initiate_read_stream () ; } } } else { result.message_block ().release (); ACE_DEBUG ((LM_DEBUG, "Receiver completed\n")); } { ACE_GUARD (MyMutex, locker, m_Mtx); --nIOCount; } check_destroy () ; } void Receiver::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result) { ACE_DEBUG ((LM_DEBUG, "handle_write_stream called\n")); ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_write", result.bytes_to_write ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (u_long) result.act ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (u_long) result.completion_key ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); ACE_DEBUG ((LM_DEBUG, "********************\n")); result.message_block ().release (); if (result.success ()) { // This code is not robust enough to deal with short file writes // (which hardly ever happen) ;-) //ACE_ASSERT (result.bytes_to_write () == result.bytes_transferred ()); if ( duplex == 0 ) { initiate_read_stream () ; } } { ACE_GUARD (MyMutex, locker, m_Mtx); --nIOCount; } check_destroy () ; } //------------------------------------------------------------------------- // Sender: sends indefinetely welcome message // and recieves it back //------------------------------------------------------------------------ class Sender : public ACE_Handler { public: Sender (); ~Sender (); //FUZZ: disable check_for_lack_ACE_OS ///FUZZ: enable check_for_lack_ACE_OS int open (const ACE_TCHAR *host, u_short port); void close (); ACE_HANDLE handle () const; void handle (ACE_HANDLE); protected: // These methods are called by the freamwork /// This is called when asynchronous reads from the socket complete virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result); /// This is called when asynchronous writes from the socket complete virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result); private: int initiate_read_stream (); int initiate_write_stream (); /// Network I/O handle ACE_SOCK_Stream stream_; /// ws (write stream): for writing to the socket ACE_Asynch_Write_Stream ws_; /// rs (read file): for reading from the socket ACE_Asynch_Read_Stream rs_; /// Welcome message ACE_Message_Block welcome_message_; MyMutex m_Mtx ; long nIOCount ; }; static const char *data = "Welcome to Irfan World! Irfan RULES here !!\n"; Sender::Sender () :nIOCount ( 0 ) { // Moment of inspiration... :-) this->welcome_message_.init (data, ACE_OS::strlen (data)); } Sender::~Sender () { this->close (); } void Sender::close () { this->stream_.close (); } ACE_HANDLE Sender::handle () const { return this->stream_.get_handle (); } void Sender::handle (ACE_HANDLE handle) { this->stream_.set_handle (handle); } int Sender::open (const ACE_TCHAR *host, u_short port) { // Initialize stuff // Connect to remote host ACE_INET_Addr address (port, host); ACE_SOCK_Connector connector; if (connector.connect (this->stream_, address) == -1) { ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_SOCK_Connector::connect"), -1); } // Open ACE_Asynch_Write_Stream if (this->ws_.open (*this) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Write_Stream::open"), -1); // Open ACE_Asynch_Read_Stream if (this->rs_.open (*this) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Read_File::open"), -1); // Start an asynchronous transmit file if ( this->initiate_write_stream () == -1) return -1; if ( duplex != 0 ) { // Start an asynchronous read file if (this->initiate_read_stream () == -1) return -1; } return 0; } int Sender::initiate_write_stream () { ACE_GUARD_RETURN (MyMutex, locker, m_Mtx, -1); welcome_message_.rd_ptr( welcome_message_.base ()); welcome_message_.wr_ptr( welcome_message_.base ()); welcome_message_.wr_ptr (ACE_OS::strlen (data)); if (this->ws_.write (welcome_message_, welcome_message_.length () ) == -1) { ACE_ERROR_RETURN((LM_ERROR, "%p\n", "ACE_Asynch_Write_File::write"), -1); } nIOCount++ ; return 0; } int Sender::initiate_read_stream () { ACE_GUARD_RETURN (MyMutex, locker, m_Mtx, -1); // Create a new . Note that this message block will // be used both to data asynchronously from the socket and to // data asynchronously to the file. ACE_DEBUG ((LM_DEBUG, "initiate_read_stream called\n")); ACE_Message_Block *mb = 0; ACE_NEW_RETURN (mb, ACE_Message_Block (BUFSIZ + 1), -1); // Inititiate read if (this->rs_.read (*mb, mb->size ()- 1) == -1) { mb->release () ; ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Read_Stream::read"), -1); } nIOCount++ ; return 0; } void Sender::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result) { ACE_DEBUG ((LM_DEBUG, "handle_write_stream called\n")); // Reset pointers. result.message_block ().rd_ptr (result.message_block ().rd_ptr () - result.bytes_transferred ()); ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_write", result.bytes_to_write ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (u_long) result.act ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (u_long) result.completion_key ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block", result.message_block ().rd_ptr ())); // Simplify just for Test if (result.success () && result.bytes_transferred () != 0) { if ( duplex != 0 ) // full duplex, continue write { initiate_write_stream () ; } else // half-duplex read reply, after read we will start // write { initiate_read_stream () ; } } { ACE_GUARD_RETURN (MyMutex, locker, m_Mtx); --nIOCount; } } void Sender::handle_read_stream (const ACE_Asynch_Read_Stream::Result &result) { ACE_DEBUG ((LM_DEBUG, "handle_read_stream called\n")); // Reset pointers. result.message_block ().rd_ptr ()[result.bytes_transferred ()] = '\0'; ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_read", result.bytes_to_read ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (u_long) result.act ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (u_long) result.completion_key ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block", result.message_block ().rd_ptr ())); result.message_block().release (); if ( result.success () && result.bytes_transferred () != 0) { // Successful read: write the data to the file asynchronously. // Note how we reuse the for the writing. // Therefore, we do not delete this buffer because it is handled // in . if ( duplex != 0 ) // full duplex, continue read { initiate_read_stream () ; } else // half-duplex writey, after write we will start read { initiate_write_stream () ; } } { ACE_GUARD (MyMutex, locker, m_Mtx); --nIOCount; } } //-------------------------------------------------------------------------- static int parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("n:p:d:h:")); int c; while ((c = get_opt ()) != EOF) switch (c) { case 'h': host = get_opt.opt_arg (); break; case 'n': nThreads = ACE_OS::atoi (get_opt.opt_arg ()) ; break; case 'p': port = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'd': duplex = ACE_OS::atoi (get_opt.opt_arg ()); break; default: ACE_ERROR ((LM_ERROR, "%p.\n", "usage :\n" "-h for Sender mode\n" "-d \n" "-p \n" "-n \n")); return -1; } return 0; } int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { ACE_UNUSED_ARG (initial_read_size); if (parse_args (argc, argv) == -1) return -1; #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) ACE_WIN32_Proactor * pImpl = new ACE_WIN32_Proactor; #elif defined (ACE_HAS_AIO_CALLS) // ACE_POSIX_AIOCB_Proactor * pImpl = new ACE_POSIX_AIOCB_Proactor; ACE_POSIX_SIG_Proactor * pImpl = new ACE_POSIX_SIG_Proactor; #endif ACE_Proactor Proactor ( pImpl ,1 ); ACE_Proactor::instance( & Proactor ); MyTask Task1 ; if (Task1.activate (THR_NEW_LWP, nThreads ) == -1) { ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "main"), -1); } Sender sender; ACE_Asynch_Acceptor acceptor; int Rc = -1 ; if ( host == 0 ) // Acceptor { // Simplify , initial read with zero size Rc = acceptor.open (ACE_INET_Addr (port),0,1); } else { Rc = sender.open (host, port); } if ( Rc == 0 ) { char c ; cout << "Press any key to stop and exit=>\n" << flush ; cin.clear (); cin >> c ; } ACE_Proactor::end_event_loop () ; if ( host != 0 ) // we are sender { sender.close () ; // disconnect to get reciever error !!! } ACE_Thread_Manager * pTM = ACE_Thread_Manager::instance(); pTM->wait_task ( & Task1 ) ; ACE_Proactor::instance( ( ACE_Proactor* )0 ); return 0; } //-------------------------------------------------------------------- // //-------------------------------------------------------------------- int DisableSignal ( int SigNum ) { #ifndef ACE_WIN32 sigset_t signal_set; if ( ACE_OS::sigemptyset (&signal_set) == - 1 ) { ACE_ERROR ((LM_ERROR, "Error:(%P | %t):%p\n", "sigemptyset failed")); } ACE_OS::sigaddset (&signal_set, SigNum); // Put the . if (ACE_OS::pthread_sigmask (SIG_BLOCK, &signal_set, 0) != 0) { ACE_ERROR ((LM_ERROR, "Error:(%P | %t):%p\n", "pthread_sigmask failed")); } #else ACE_UNUSED_ARG(SigNum); #endif return 1; } //-------------------------------------------------------------------- // Get the back from the OS. //-------------------------------------------------------------------- int PrintSigMask () { #ifndef ACE_WIN32 sigset_t mask ; int member = 0; COUT ( "\n=============Signal Mask==========" ) if (ACE_OS::pthread_sigmask (SIG_SETMASK, 0, & mask ) != 0) { ACE_ERROR ((LM_ERROR, "Error:(%P | %t):%p\n", "ACE_OS::pthread_sigmask failed")); } else for (int i = 1 ; i < 1000; i++) { member = ACE_OS::sigismember (&mask,i); COUT ( "\nSig " ) COUT ( i ) COUT ( " is " ) COUT (member ) if (member == -1) { break ; } } #endif return 0; } #else /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ int ACE_TMAIN (int, ACE_TCHAR *[]) { ACE_DEBUG ((LM_DEBUG, "This example does not work on this platform.\n")); return 1; } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ ace-8.0.4+dfsg.orig/examples/Reactor/Proactor/test_timeout_st.cpp0000644000175000017500000000512315027201773024135 0ustar sudipsudip //============================================================================= /** * @file test_timeout_st.cpp * * This example application shows how to write event loops that * handle events for some fixed amount of time. This is the single * threaded version of the test_timeout.cpp application. * * @author Irfan Pyarali and Alexander Babu Arulanthu */ //============================================================================= #include "ace/Proactor.h" #include "ace/OS_main.h" #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) // This only works on Win32 platforms and on Unix platforms supporting // POSIX aio calls. /** * @class Timeout_Handler * * @brief Generic timeout handler. */ class Timeout_Handler : public ACE_Handler { public: Timeout_Handler () : count_ (0), start_time_ (ACE_OS::gettimeofday ()) { } virtual void handle_time_out (const ACE_Time_Value &tv, const void *arg) { // Print out when timeouts occur. ACE_DEBUG ((LM_DEBUG, "(%t) %d timeout occurred for %s @ %d.\n", ++count_, (char *) arg, (tv - this->start_time_).sec ())); } private: /// Sequence number for the timeouts. int count_; /// Starting time of the test. ACE_Time_Value start_time_; }; int ACE_TMAIN (int, ACE_TCHAR *[]) { Timeout_Handler handler; // Register a 2 second timer. ACE_Time_Value foo_tv (2); if (ACE_Proactor::instance ()->schedule_timer (handler, (void *) "Foo", ACE_Time_Value::zero, foo_tv) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); // Register a 3 second timer. ACE_Time_Value bar_tv (3); if (ACE_Proactor::instance ()->schedule_timer (handler, (void *) "Bar", ACE_Time_Value::zero, bar_tv) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); // Handle events for 13 seconds. ACE_Time_Value run_time (13); ACE_DEBUG ((LM_DEBUG, "Starting event loop\n")); // Run the event loop. if (ACE_Proactor::run_event_loop(run_time) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t):%p.\n", "Worker::svc"), 1); ACE_DEBUG ((LM_DEBUG, "Ending event loop\n")); return 0; } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ ace-8.0.4+dfsg.orig/examples/Reactor/Proactor/simple_test_proactor.cpp0000644000175000017500000001666515027201773025160 0ustar sudipsudip //============================================================================= /** * @file simple_test_proactor.cpp * * Very simple version of test_proactor.cpp. * * @author Alexander Babu Arulanthu (alex@cs.wustl.edu) */ //============================================================================= #include "ace/Service_Config.h" #include "ace/Proactor.h" #include "ace/Asynch_IO.h" #include "ace/Asynch_IO_Impl.h" #include "ace/Message_Block.h" #include "ace/Get_Opt.h" #include "ace/OS_main.h" #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) // This only works on Win32 platforms and on Unix platforms supporting // POSIX aio calls. static ACE_TCHAR *file = ACE_TEXT("simple_test_proactor.cpp"); static ACE_TCHAR *dump_file = ACE_TEXT("simple_output"); /** * @class Simple_Tester * * @brief Simple_Tester * * The class will be created by main(). This class reads a block * from the file and write that to the dump file. */ class Simple_Tester : public ACE_Handler { public: /// Constructor. Simple_Tester (); ~Simple_Tester (); //FUZZ: disable check_for_lack_ACE_OS /// Open the operations and initiate read from the file. ///FUZZ: enble check_for_lack_ACE_OS int open (); protected: // = These methods are called by the freamwork. /// This is called when asynchronous reads from the socket complete. virtual void handle_read_file (const ACE_Asynch_Read_File::Result &result); /// This is called when asynchronous writes from the socket complete. virtual void handle_write_file (const ACE_Asynch_Write_File::Result &result); private: int initiate_read_file (); /// rf (read file): for writing from the file. ACE_Asynch_Read_File rf_; /// ws (write File): for writing to the file. ACE_Asynch_Write_File wf_; /// File to read from. ACE_HANDLE input_file_; /// File for dumping data. ACE_HANDLE dump_file_; // u_long file_offset_; // Current file offset // u_long file_size_; // File size }; Simple_Tester::Simple_Tester () : input_file_ (ACE_INVALID_HANDLE), dump_file_ (ACE_INVALID_HANDLE) { } Simple_Tester::~Simple_Tester () { ACE_OS::close (this->input_file_); ACE_OS::close (this->dump_file_); } int Simple_Tester::open () { // Initialize stuff // Open input file (in OVERLAPPED mode) this->input_file_ = ACE_OS::open (file, GENERIC_READ | FILE_FLAG_OVERLAPPED); if (this->input_file_ == ACE_INVALID_HANDLE) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_OS::open"), -1); // Open dump file (in OVERLAPPED mode) this->dump_file_ = ACE_OS::open (dump_file, O_CREAT | O_RDWR | O_TRUNC | FILE_FLAG_OVERLAPPED, 0644); if (this->dump_file_ == ACE_INVALID_HANDLE) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_OS::open"), -1); // Open ACE_Asynch_Read_File if (this->rf_.open (*this, this->input_file_) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Read_File::open"), -1); // Open ACE_Asynch_Write_File if (this->wf_.open (*this, this->dump_file_) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Write_File::open"), -1); ACE_DEBUG ((LM_DEBUG, "Simple_Tester::open: Files and Asynch Operations opened successfully\n")); // Start an asynchronous read file if (this->initiate_read_file () == -1) return -1; return 0; } int Simple_Tester::initiate_read_file () { // Create Message_Block ACE_Message_Block *mb = 0; ACE_NEW_RETURN (mb, ACE_Message_Block (BUFSIZ + 1), -1); // Inititiate an asynchronous read from the file if (this->rf_.read (*mb, mb->size () - 1) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Read_File::read"), -1); ACE_DEBUG ((LM_DEBUG, "Simple_Tester:initiate_read_file: Asynch Read File issued successfully\n")); return 0; } void Simple_Tester::handle_read_file (const ACE_Asynch_Read_File::Result &result) { ACE_DEBUG ((LM_DEBUG, "handle_read_file called\n")); result.message_block ().rd_ptr ()[result.bytes_transferred ()] = '\0'; ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_read", result.bytes_to_read ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (u_long) result.act ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (u_long) result.completion_key ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); ACE_DEBUG ((LM_DEBUG, "********************\n")); // Watch out if you need to enable this... the ACE_Log_Record::MAXLOGMSGLEN // value controls to max length of a log record, and a large output // buffer may smash it. #if 0 ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block", result.message_block ().rd_ptr ())); #endif /* 0 */ if (result.success ()) { // Read successful: write this to the file. if (this->wf_.write (result.message_block (), result.bytes_transferred ()) == -1) { ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Write_File::write")); return; } } } void Simple_Tester::handle_write_file (const ACE_Asynch_Write_File::Result &result) { ACE_DEBUG ((LM_DEBUG, "handle_write_File called\n")); // Reset pointers result.message_block ().rd_ptr (result.message_block ().rd_ptr () - result.bytes_transferred ()); result.message_block ().rd_ptr ()[result.bytes_transferred ()] = '\0'; ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_write", result.bytes_to_write ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (u_long) result.act ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (u_long) result.completion_key ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); ACE_DEBUG ((LM_DEBUG, "********************\n")); // Watch out if you need to enable this... the ACE_Log_Record::MAXLOGMSGLEN // value controls to max length of a log record, and a large output // buffer may smash it. #if 0 ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block", result.message_block ().rd_ptr ())); #endif /* 0 */ ACE_Proactor::end_event_loop (); } static int parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("f:d:")); int c; while ((c = get_opt ()) != EOF) switch (c) { case 'f': file = get_opt.opt_arg (); break; case 'd': dump_file = get_opt.opt_arg (); break; default: ACE_ERROR ((LM_ERROR, "%p.\n", "usage :\n" "-d \n" "-f \n")); return -1; } return 0; } int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { if (parse_args (argc, argv) == -1) return -1; Simple_Tester Simple_Tester; if (Simple_Tester.open () == -1) return -1; int success = 1; // dispatch events success = !(ACE_Proactor::run_event_loop () == -1); return success ? 0 : 1; } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ ace-8.0.4+dfsg.orig/examples/Reactor/Proactor/test_proactor.h0000644000175000017500000000254615027201773023245 0ustar sudipsudip/* ** */ #ifndef _TEST_PROACTOR_H #define _TEST_PROACTOR_H #include "ace/Asynch_IO.h" class Receiver : public ACE_Service_Handler { // = TITLE // The class will be created by when new // connections arrive. This class will then receive data from // the network connection and dump it to a file. public: Receiver (); ~Receiver (); virtual void open (ACE_HANDLE handle, ACE_Message_Block &message_block); // This is called after the new connection has been accepted. protected: // These methods are called by the framework virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result); // This is called when asynchronous operation from the socket // complete. virtual void handle_write_file (const ACE_Asynch_Write_File::Result &result); // This is called when an asynchronous to the file // completes. private: int initiate_read_stream (); // Initiate an asynchronous operation on the socket. ACE_Asynch_Read_Stream rs_; // rs (read stream): for reading from a socket. ACE_HANDLE dump_file_; // File for dumping data. ACE_Asynch_Write_File wf_; // wf (write file): for writing to a file. u_long file_offset_; // Offset for the file. ACE_HANDLE handle_; // Handle for IO to remote peer. }; #endif /* _TEST_PROACTOR_H */ ace-8.0.4+dfsg.orig/examples/Reactor/Proactor/test_timeout.cpp0000644000175000017500000000655415027201773023440 0ustar sudipsudip //============================================================================= /** * @file test_timeout.cpp * * This example application shows how to write event loops that * handle events for some fixed amount of time. Note that any * thread in the Proactor thread pool can call back the handler. On * POSIX4 systems, this test works only with POSIX_SIG_Proactor, * which can work with multiple threads. * * @author Irfan Pyarali and Alexander Babu Arulanthu */ //============================================================================= #include "ace/Proactor.h" #include "ace/Task.h" #include "ace/Atomic_Op.h" #include "ace/OS_NS_sys_time.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_main.h" #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) // This only works on Win32 platforms and on Unix platforms supporting // POSIX aio calls. /** * @class Timeout_Handler * * @brief Generic timeout handler. */ class Timeout_Handler : public ACE_Handler { public: Timeout_Handler () : start_time_ (ACE_OS::gettimeofday ()) { } virtual void handle_time_out (const ACE_Time_Value &tv, const void *arg) { // Print out when timeouts occur. ACE_DEBUG ((LM_DEBUG, "(%t) %d timeout occurred for %s @ %d.\n", ++count_, (char *) arg, (tv - this->start_time_).sec ())); // Sleep for a while ACE_OS::sleep (4); } private: /// Number of the timer event. ACE_Atomic_Op count_; /// Starting time of the test. ACE_Time_Value start_time_; }; class Worker : public ACE_Task { public: int svc () { // Handle events for 13 seconds. ACE_Time_Value run_time (13); ACE_DEBUG ((LM_DEBUG, "(%t):Starting svc routine\n")); if (ACE_Proactor::run_event_loop(run_time) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t):%p.\n", "Worker::svc"), -1); ACE_DEBUG ((LM_DEBUG, "(%t) work complete\n")); return 0; } }; int ACE_TMAIN (int, ACE_TCHAR *[]) { Timeout_Handler handler; // Register a 2 second timer. ACE_Time_Value foo_tv (2); if (ACE_Proactor::instance ()->schedule_timer (handler, (void *) "Foo", ACE_Time_Value::zero, foo_tv) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); // Register a 3 second timer. ACE_Time_Value bar_tv (3); if (ACE_Proactor::instance ()->schedule_timer (handler, (void *) "Bar", ACE_Time_Value::zero, bar_tv) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); Worker worker; if (worker.activate (THR_NEW_LWP, 10) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "main"), -1); ACE_Thread_Manager::instance ()->wait (); return 0; } #else /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ int ACE_TMAIN (int, ACE_TCHAR *[]) { ACE_DEBUG ((LM_DEBUG, "This example is multithreaded version of test_timeout_st.cpp\n" "This doesnt work on this platform !!!\n")); return 1; } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ ace-8.0.4+dfsg.orig/examples/Reactor/Proactor/README0000644000175000017500000000545315027201773021064 0ustar sudipsudip This README file lists all the example applications for the Proactor framework. Test/Example Applications for Proactor: ========================================= The following tests are available. o $ACE_ROOT/tests/Aio_Platform_Test.cpp : Tests basic limits pertaining to the POSIX features o $ACE_ROOT/examples/Reactor/Proactor/test_aiocb.cpp : This is a C++ program for testing the AIOCB (AIO Control Blocks) based completion approach which uses for completion querying. o $ACE_ROOT/examples/Reactor/Proactor/test_aiosig.cpp : This is a C++ program for testing the Signal based completion approach that uses for completion querying. o $ACE_ROOT/examples/Reactor/Proactor/test_aiocb_ace.cpp: Portable version of test_aiocb.cpp. (Same as test_aiocb.cpp, but uses ACE_DEBUGs instead of printf's and ACE_Message_Blocks instead of char*'s. o $ACE_ROOT/examples/Reactor/Proactor/test_aiosig_ace.cpp: Portable version of test_aiosig.cpp. (Same as test_aiosig.cpp, but uses ACE_DEBUGs instead of printf's and ACE_Message_Blocks instead of char*'s. o test_proactor.cpp (with ACE_POSIX_AIOCB_Proactor) : Test for ACE_Proactor which uses AIOCB (AIO Control Blocks) based completions strategy Proactor. (#define ACE_POSIX_AIOCB_PROACTOR in the config file, but this is the default option) o test_proactor.cpp (with ACE_POSIX_SIG_Proactor) : Test for ACE_Proactor which uses real time signal based completion strategy proactor. (#define ACE_POSIX_SIG_PROACTOR in the config file) o test_multiple_loops.cpp : This example application shows how to write programs that combine the Proactor and Reactor event loops. This is possible only on WIN32 platform. o test_timeout.cpp : Multithreaded application testing the Timers mechanism of the Proactor. o test_timeout_st.cpp : Single-threaded version of test_timeout.cpp. o post_completions.cpp : Tests the completion posting mechanism of the Proactor. o test_end_event_loop.cpp : Tests the event loop mechanism of the Proactor. o test_cancel.cpp : Tests interface of the Asynch_Operation class. Behavior of POSIX AIO of various platforms: ========================================== Sun 5.6 : POSIX4 Real-Time signals implementation is broken in this platform. Only POSIX AIOCB Proactor works in this platform. Therefore, it is not possible to use multiple threads with in the framework. Sun 5.7 : AIOCB and SIG Proactors work fine. LynxOS 3.0.0 : is not available in this platform. So, only AIOCB Proactor works here. ace-8.0.4+dfsg.orig/examples/Reactor/Proactor/test_proactor3.cpp0000644000175000017500000005522315027201773023663 0ustar sudipsudip //============================================================================= /** * @file test_proactor3.cpp * * This program illustrates how the can be used to * implement an application that does various asynchronous * operations. * * @author Irfan Pyarali modified by Alexander Libman from original test_proactor.cpp */ //============================================================================= #include "ace/Signal.h" #include "ace/Service_Config.h" #include "ace/Proactor.h" #include "ace/Asynch_IO.h" #include "ace/Asynch_IO_Impl.h" #include "ace/Asynch_Acceptor.h" #include "ace/INET_Addr.h" #include "ace/Manual_Event.h" #include "ace/SOCK_Connector.h" #include "ace/SOCK_Acceptor.h" #include "ace/SOCK_Stream.h" #include "ace/Message_Block.h" #include "ace/Get_Opt.h" // FUZZ: disable check_for_streams_include #include "ace/streams.h" #include "ace/Task.h" #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) // This only works on Win32 platforms and on Unix platforms // supporting POSIX aio calls. #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) #include "ace/WIN32_Proactor.h" #elif defined (ACE_HAS_AIO_CALLS) #include "ace/POSIX_Proactor.h" #endif /* ACE_HAS_WIN32_OVERLAPPED_IO */ // Some debug helper functions static int disable_signal (int sigmin, int sigmax); #if 0 static int print_sigmask (); #endif #define COUT(X) cout << X; cout.flush (); // Proactor Type (UNIX only, Win32 ignored) 0-default, 1 -AIOCB, // 2-SIG, 3-SUN static int proactor_type = 0; // POSIX : > 0 max number aio operations proactor, static int max_aio_operations = 0; // Host that we're connecting to. static ACE_TCHAR *host = 0; // number of Senders instances static int senders = 1; static const int MaxSenders = 100; // duplex mode: ==0 half-duplex // !=0 full duplex static int duplex = 0; // number threads in the Proactor thread pool static int threads = 1; // Port that we're receiving connections on. static u_short port = ACE_DEFAULT_SERVER_PORT; /** * @class MyTask: * * @brief MyTask plays role for Proactor threads pool */ class MyTask: public ACE_Task { public: MyTask () : threads_ (0), proactor_ (0) {} int svc (); void waitready () { event_.wait (); } private: ACE_Recursive_Thread_Mutex mutex_; int threads_; ACE_Proactor *proactor_; ACE_Manual_Event event_; void create_proactor (); void delete_proactor (); }; void MyTask::create_proactor () { ACE_GUARD (ACE_Recursive_Thread_Mutex, locker, mutex_); if (threads_ == 0) { #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) ACE_WIN32_Proactor *proactor = new ACE_WIN32_Proactor; ACE_DEBUG ((LM_DEBUG,"(%t) Create Proactor Type=WIN32")); #elif defined (ACE_HAS_AIO_CALLS) ACE_POSIX_Proactor *proactor = 0; switch (proactor_type) { case 1: proactor = new ACE_POSIX_AIOCB_Proactor (max_aio_operations); ACE_DEBUG ((LM_DEBUG,"(%t) Create Proactor Type=AIOCB\n")); break; case 2: proactor = new ACE_POSIX_SIG_Proactor; ACE_DEBUG ((LM_DEBUG,"(%t) Create Proactor Type=SIG\n")); break; default: proactor = new ACE_POSIX_SIG_Proactor; ACE_DEBUG ((LM_DEBUG,"(%t) Create Proactor Type=SIG\n")); break; } #endif proactor_ = new ACE_Proactor (proactor, 1); ACE_Proactor::instance(proactor_); event_.signal (); } threads_++; } void MyTask::delete_proactor () { ACE_GUARD (ACE_Recursive_Thread_Mutex, locker, mutex_); if (--threads_ == 0) { ACE_DEBUG ((LM_DEBUG, "(%t) Delete Proactor\n")); ACE_Proactor::instance ((ACE_Proactor *) 0); delete proactor_; proactor_ = 0; } } int MyTask::svc () { ACE_DEBUG ((LM_DEBUG, "(%t) MyTask started\n")); create_proactor (); disable_signal (ACE_SIGRTMIN, ACE_SIGRTMAX); while (ACE_Proactor::event_loop_done () == 0) ACE_Proactor::run_event_loop (); delete_proactor (); ACE_DEBUG ((LM_DEBUG, "(%t) MyTask finished\n")); return 0; } class Receiver : public ACE_Service_Handler { public: Receiver (); ~Receiver (); //FUZZ: disable check_for_lack_ACE_OS /// This is called after the new connection has been accepted. ///FUZZ: enable check_for_lack_ACE_OS virtual void open (ACE_HANDLE handle, ACE_Message_Block &message_block); static long get_number_sessions () { return sessions_; } protected: // These methods are called by the framework /// This is called when asynchronous operation from the socket /// complete. virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result); /// This is called when an asynchronous to the file /// completes. virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result); private: int initiate_read_stream (); int initiate_write_stream (ACE_Message_Block & mb, int nBytes); int check_destroy (); ACE_Asynch_Read_Stream rs_; ACE_Asynch_Write_Stream ws_; ACE_HANDLE handle_; ACE_Recursive_Thread_Mutex mutex_; long io_count_; static long sessions_; }; long Receiver::sessions_ = 0; Receiver::Receiver () : handle_ (ACE_INVALID_HANDLE), io_count_ (0) { ACE_GUARD (ACE_Recursive_Thread_Mutex, locker, mutex_); sessions_++; ACE_DEBUG ((LM_DEBUG, "Receiver Ctor sessions_=%d\n", sessions_)); } Receiver::~Receiver () { ACE_GUARD (ACE_Recursive_Thread_Mutex, locker, mutex_); sessions_--; ACE_OS::closesocket (this->handle_); ACE_DEBUG ((LM_DEBUG, "~Receiver Dtor sessions_=%d\n", sessions_)); } // return true if we alive, false we commited suicide int Receiver::check_destroy () { { ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, locker, mutex_, -1); if (io_count_ > 0) return 1; } delete this; return 0; } void Receiver::open (ACE_HANDLE handle, ACE_Message_Block &) { ACE_DEBUG ((LM_DEBUG, "%N:%l:Receiver::open called\n")); this->handle_ = handle; if (this->ws_.open (*this, this->handle_) == -1) ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Write_Stream::open")); else if (this->rs_.open (*this, this->handle_) == -1) ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Asynch_Read_Stream::open")); else initiate_read_stream (); check_destroy (); } int Receiver::initiate_read_stream () { ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, locker, mutex_, -1); ACE_Message_Block *mb = 0; ACE_NEW_RETURN (mb, ACE_Message_Block (BUFSIZ + 1), -1); // Inititiate read if (this->rs_.read (*mb, mb->size ()- 1) == -1) { mb->release (); ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Read_Stream::read"), -1); } io_count_++; return 0; } int Receiver::initiate_write_stream (ACE_Message_Block &mb, int nbytes) { ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, locker, mutex_, -1); if (nbytes <= 0) { mb.release (); ACE_ERROR_RETURN((LM_ERROR, "ACE_Asynch_Write_Stream::write nbytes <0 "), -1); } if (this->ws_.write (mb, nbytes) == -1) { mb.release (); ACE_ERROR_RETURN((LM_ERROR, "%p\n", "ACE_Asynch_Write_Stream::write"), -1); } io_count_++; return 0; } void Receiver::handle_read_stream (const ACE_Asynch_Read_Stream::Result &result) { // Reset pointers. result.message_block ().rd_ptr ()[result.bytes_transferred ()] = '\0'; if (result.bytes_transferred () == 0 || result.error () != 0) { ACE_DEBUG ((LM_DEBUG, "handle_read_stream called\n")); ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_read", result.bytes_to_read ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (u_long) result.act ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (u_long) result.completion_key ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block", result.message_block ().rd_ptr ())); } if (result.success () && result.bytes_transferred () != 0) { // Successful read: write the data to the file asynchronously. // Note how we reuse the for the writing. // Therefore, we do not delete this buffer because it is handled // in . if(this->initiate_write_stream (result.message_block (), result.bytes_transferred ()) == 0) { if (duplex != 0) { // Initiate new read from the stream. this->initiate_read_stream (); } } } else { result.message_block ().release (); ACE_DEBUG ((LM_DEBUG, "Receiver completed\n")); } { ACE_GUARD (ACE_Recursive_Thread_Mutex, locker, mutex_); --io_count_; } check_destroy (); } void Receiver::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result) { if (result.bytes_transferred () == 0 || result.error () != 0) { ACE_DEBUG ((LM_DEBUG, "handle_write_stream called\n")); ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_write", result.bytes_to_write ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (u_long) result.act ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (u_long) result.completion_key ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); ACE_DEBUG ((LM_DEBUG, "********************\n")); } result.message_block ().release (); if (result.success () && result.bytes_transferred () != 0) { // This code is not robust enough to deal with short file writes // (which hardly ever happen);-) // ACE_ASSERT (result.bytes_to_write () == result.bytes_transferred ()); if (duplex == 0) initiate_read_stream (); } { ACE_GUARD (ACE_Recursive_Thread_Mutex, locker, mutex_); --io_count_; } check_destroy (); } /** * @class Sender * * @brief Sends welcome messages receives them back. */ class Sender : public ACE_Handler { public: Sender (); ~Sender (); //FUZZ: disable check_for_lack_ACE_OS ///FUZZ: enable check_for_lack_ACE_OS int open (const ACE_TCHAR *host, u_short port); void close (); ACE_HANDLE handle () const; virtual void handle (ACE_HANDLE); protected: // These methods are called by the freamwork /// This is called when asynchronous reads from the socket complete virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result); /// This is called when asynchronous writes from the socket complete virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result &result); private: int initiate_read_stream (); int initiate_write_stream (); /// Network I/O handle ACE_SOCK_Stream stream_; /// ws (write stream): for writing to the socket ACE_Asynch_Write_Stream ws_; /// rs (read file): for reading from the socket ACE_Asynch_Read_Stream rs_; /// Welcome message ACE_Message_Block welcome_message_; ACE_Recursive_Thread_Mutex mutex_; long io_count_; }; static const char *data = "Welcome to Irfan World! Irfan RULES here !!\n"; Sender::Sender () : io_count_ (0) { // Moment of inspiration... :-) this->welcome_message_.init (data, ACE_OS::strlen (data)); } Sender::~Sender () { this->close (); } void Sender::close () { this->stream_.close (); } ACE_HANDLE Sender::handle () const { return this->stream_.get_handle (); } void Sender::handle (ACE_HANDLE handle) { this->stream_.set_handle (handle); } int Sender::open (const ACE_TCHAR *host, u_short port) { // Initialize stuff // Connect to remote host ACE_INET_Addr address (port, host); ACE_SOCK_Connector connector; if (connector.connect (this->stream_, address) == -1) { ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_SOCK_Connector::connect"), -1); } // Open ACE_Asynch_Write_Stream if (this->ws_.open (*this) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Write_Stream::open"), -1); // Open ACE_Asynch_Read_Stream if (this->rs_.open (*this) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Read_Stream::open"), -1); // Start an asynchronous transmit file if (this->initiate_write_stream () == -1) return -1; if (duplex != 0) // Start an asynchronous read file if (this->initiate_read_stream () == -1) return -1; return 0; } int Sender::initiate_write_stream () { ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, locker, mutex_, -1); welcome_message_.rd_ptr(welcome_message_.base ()); welcome_message_.wr_ptr(welcome_message_.base ()); welcome_message_.wr_ptr (ACE_OS::strlen (data)); if (this->ws_.write (welcome_message_, welcome_message_.length ()) == -1) ACE_ERROR_RETURN((LM_ERROR, "%p\n", "ACE_Asynch_Write_Stream::write"), -1); io_count_++; return 0; } int Sender::initiate_read_stream () { ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, locker, mutex_, -1); // Create a new . Note that this message block will // be used both to data asynchronously from the socket and to // data asynchronously to the file. ACE_DEBUG ((LM_DEBUG, "initiate_read_stream called\n")); ACE_Message_Block *mb = 0; ACE_NEW_RETURN (mb, ACE_Message_Block (BUFSIZ + 1), -1); // Inititiate read if (this->rs_.read (*mb, mb->size ()- 1) == -1) { mb->release (); ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Asynch_Read_Stream::read"), -1); } io_count_++; return 0; } void Sender::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result) { if (result.bytes_transferred () == 0 || result.error () != 0) { ACE_DEBUG ((LM_DEBUG, "handle_write_stream called\n")); // Reset pointers. result.message_block ().rd_ptr (result.message_block ().rd_ptr () - result.bytes_transferred ()); ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_write", result.bytes_to_write ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (u_long) result.act ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (u_long) result.completion_key ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block", result.message_block ().rd_ptr ())); } // Simplify just for Test if (result.success () && result.bytes_transferred () != 0) { if (duplex != 0) // full duplex, continue write initiate_write_stream (); else // half-duplex read reply, after read we will start write initiate_read_stream (); } { ACE_GUARD (ACE_Recursive_Thread_Mutex, locker, mutex_); --io_count_; } } void Sender::handle_read_stream (const ACE_Asynch_Read_Stream::Result &result) { if (result.bytes_transferred () == 0 || result.error () != 0) { ACE_DEBUG ((LM_DEBUG, "handle_read_stream called\n")); // Reset pointers. result.message_block ().rd_ptr ()[result.bytes_transferred ()] = '\0'; ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_read", result.bytes_to_read ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (u_long) result.act ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (u_long) result.completion_key ())); ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ())); ACE_DEBUG ((LM_DEBUG, "********************\n")); ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block", result.message_block ().rd_ptr ())); } result.message_block().release (); if (result.success () && result.bytes_transferred () != 0) { // Successful read: write the data to the file asynchronously. // Note how we reuse the for the writing. // Therefore, we do not delete this buffer because it is handled // in . if (duplex != 0) // full duplex, continue read initiate_read_stream (); else // half-duplex writey, after write we will start read initiate_write_stream (); } { ACE_GUARD (ACE_Recursive_Thread_Mutex, locker, mutex_); --io_count_; } } static int set_proactor_type (const char *ptype) { if (!ptype) return false; switch (ACE_OS::ace_toupper (*ptype)) { case 'D' : proactor_type = 0; return true; case 'A' : proactor_type = 1; return true; case 'I' : proactor_type = 2; return true; } return false; } static int parse_args (int argc, ACE_TCHAR *argv[]) { ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("t:o:n:p:d:h:s:u")); int c; while ((c = get_opt ()) != EOF) switch (c) { case 'd': // duplex duplex = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'h': // host for sender host = get_opt.opt_arg (); break; case 'p': // port number port = ACE_OS::atoi (get_opt.opt_arg ()); break; case 'n': // thread pool size threads = ACE_OS::atoi (get_opt.opt_arg ()); break; case 's': // number of senders senders = ACE_OS::atoi (get_opt.opt_arg ()); if (senders > MaxSenders) senders = MaxSenders; break; case 'o': // max number of aio for proactor max_aio_operations = ACE_OS::atoi (get_opt.opt_arg ()); break; case 't': // Proactor Type if (set_proactor_type (get_opt.opt_arg ())) break; case 'u': default: ACE_ERROR ((LM_ERROR, "%p.", "\nusage:" "\n-o " "\n-t UNIX-only, Win32-default always:" "\n a AIOCB" "\n i SIG" "\n s SUN" "\n d default" "\n-d " "\n-h for Sender mode" "\n-n " "\n-p " "\n-s " "\n-u show this message" "\n")); return -1; } return 0; } int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { if (parse_args (argc, argv) == -1) return -1; disable_signal (ACE_SIGRTMIN, ACE_SIGRTMAX); MyTask task1; if (task1.activate (THR_NEW_LWP, threads) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "main"), -1); // wait for creation of Proactor task1.waitready (); Sender * send_list[MaxSenders]; ACE_Asynch_Acceptor acceptor; int rc = -1; int i; char c; if (host == 0) // Acceptor { // Simplify, initial read with zero size if (acceptor.open (ACE_INET_Addr (port),0,1) == 0) rc = 1; } else { for (i = 0; i < senders; ++i) send_list[i] = new Sender; for (i = 0; i < senders; ++i) if (send_list[i]->open (host, port) == 0) rc++; } if (rc > 0) { cout << "Press any key to stop=>" << flush; cin.clear (); cin >> c; } ACE_Proactor::end_event_loop (); if (host != 0) // we are sender { for (i = 0; i < senders; ++i) send_list[i]->close (); } ACE_Thread_Manager *tm = ACE_Thread_Manager::instance(); tm->wait_task (&task1); cout << "\nNumber of Receivers objects=" << Receiver::get_number_sessions () << flush; for (i = 0; i < senders; ++i) { delete (send_list[i]); send_list[i] = 0; } return 0; } static int disable_signal (int sigmin, int sigmax) { #ifndef ACE_WIN32 sigset_t signal_set; if (ACE_OS::sigemptyset (&signal_set) == - 1) ACE_ERROR ((LM_ERROR, "Error:(%P | %t):%p\n", "sigemptyset failed")); for (int i = sigmin; i <= sigmax; i++) ACE_OS::sigaddset (&signal_set, i); // Put the . if (ACE_OS::pthread_sigmask (SIG_BLOCK, &signal_set, 0) != 0) ACE_ERROR ((LM_ERROR, "Error:(%P | %t):%p\n", "pthread_sigmask failed")); #else ACE_UNUSED_ARG (sigmin); ACE_UNUSED_ARG (sigmax); #endif /* ACE_WIN32 */ return 1; } // Get the back from the OS. #if 0 static int print_sigmask () { #ifndef ACE_WIN32 sigset_t mask; int member = 0; COUT ("\n=============Signal Mask==========") if (ACE_OS::pthread_sigmask (SIG_SETMASK, 0, & mask) != 0) ACE_ERROR ((LM_ERROR, "Error:(%P | %t):%p\n", "ACE_OS::pthread_sigmask failed")); else for (int i = 1; i < 1000; i++) { member = ACE_OS::sigismember (&mask,i); COUT ("\nSig ") COUT (i) COUT (" is ") COUT (member) if (member == -1) break; } #endif /* ACE_WIN32 */ return 0; } #endif /* 0 */ #else /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ int ACE_TMAIN (int, ACE_TCHAR *[]) { ACE_DEBUG ((LM_DEBUG, "This example does not work on this platform.\n")); return 1; } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ ace-8.0.4+dfsg.orig/examples/Reactor/Proactor/test_aiocb_ace.cpp0000644000175000017500000001554015027201773023632 0ustar sudipsudip //============================================================================= /** * @file test_aiocb_ace.cpp * * This program helps you to test the calls on a * platform. * * Before running this test, make sure the platform can * support POSIX calls, using * ACE_ROOT/tests/Aio_Platform_Test. * * This program tests the AIOCB (AIO Control Blocks) based * completion approach which uses for completion * querying. * * If this test is successful, ACE_POSIX_AIOCB_PROACTOR * can be used on this platform. * * = COMPILE and RUN * % make * % ./test_aiocb_ace * * @author Alexander Babu Arulanthu */ //============================================================================= #include "ace/ACE.h" #include "ace/Log_Msg.h" #include "ace/os_include/os_aio.h" #include "ace/OS_NS_string.h" class Test_Aio { public: /// Default constructor. Test_Aio (); /// Initting the output file and the buffer. int init (); /// Doing the testing stuff. int do_aio (); /// Destructor. ~Test_Aio (); private: /// Output file descriptor. int out_fd_; /// For writing to the file. struct aiocb *aiocb_write_; /// Reading stuff from the file. struct aiocb *aiocb_read_; /// The buffer to be written to the out_fd. char *buffer_write_; /// The buffer to be read back from the file. char *buffer_read_; }; Test_Aio::Test_Aio () : aiocb_write_ (0), aiocb_read_ (0), buffer_write_ (0), buffer_read_ (0) { ACE_NEW (this->aiocb_write_, struct aiocb); ACE_NEW (this->aiocb_read_, struct aiocb); } Test_Aio::~Test_Aio () { delete aiocb_write_; delete aiocb_read_; delete buffer_write_; delete buffer_read_; } // Init the output file and init the buffer. int Test_Aio::init () { // Open the output file. this->out_fd_ = ACE_OS::open ("test_aio.log", O_RDWR | O_CREAT | O_TRUNC, 0666); if (this->out_fd_ == 0) ACE_ERROR_RETURN ((LM_ERROR, "Error: Opening file\n"), -1); // Init the buffers. this->buffer_write_ = ACE::strnew ("Welcome to the world of AIO... AIO Rules !!!"); ACE_DEBUG ((LM_DEBUG, "The buffer : %s\n", this->buffer_write_)); // Allocate memory for the read buffer. ACE_NEW_RETURN (this->buffer_read_, char [ACE_OS::strlen (this->buffer_write_)], -1); return 0; } // Set the necessary things for the AIO stuff. // Write the buffer asynchly.hmm Disable signals. // Go on aio_suspend. Wait for completion. // Print out the result. int Test_Aio::do_aio () { // = Write to the file. // Setup AIOCB. this->aiocb_write_->aio_fildes = this->out_fd_; this->aiocb_write_->aio_offset = 0; this->aiocb_write_->aio_buf = this->buffer_write_; this->aiocb_write_->aio_nbytes = ACE_OS::strlen (this->buffer_write_); this->aiocb_write_->aio_reqprio = 0; this->aiocb_write_->aio_sigevent.sigev_notify = SIGEV_NONE; //this->this->aiocb_.aio_sigevent.sigev_signo = SIGRTMAX; this->aiocb_write_->aio_sigevent.sigev_value.sival_ptr = (void *) this->aiocb_write_; // Fire off the aio write. if (aio_write (this->aiocb_write_) != 0) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "aio_write"), -1); // = Read from that file. // Setup AIOCB. this->aiocb_read_->aio_fildes = this->out_fd_; this->aiocb_read_->aio_offset = 0; this->aiocb_read_->aio_buf = this->buffer_read_; this->aiocb_read_->aio_nbytes = ACE_OS::strlen (this->buffer_write_); this->aiocb_read_->aio_reqprio = 0; this->aiocb_read_->aio_sigevent.sigev_notify = SIGEV_NONE; //this->this->aiocb_.aio_sigevent.sigev_signo = SIGRTMAX; this->aiocb_read_->aio_sigevent.sigev_value.sival_ptr = (void *) this->aiocb_read_; // Fire off the aio write. If it doesnt get queued, carry on to get // the completion for the first one. if (aio_read (this->aiocb_read_) < 0) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "aio_read"), -1); // Wait for the completion on aio_suspend. struct aiocb *list_aiocb[2]; list_aiocb [0] = this->aiocb_write_; list_aiocb [1] = this->aiocb_read_; // Do suspend till all the aiocbs in the list are done. int to_finish = 2; int return_val = 0; while (to_finish > 0) { return_val = aio_suspend (list_aiocb, to_finish, 0); ACE_DEBUG ((LM_DEBUG, "Result of : %d\n", return_val)); // Analyze return and error values. if (to_finish > 1) { if (aio_error (list_aiocb [1]) != EINPROGRESS) { if (aio_return (list_aiocb [1]) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "aio_return, item 1"), -1); else { // Successful. Remember we have one less thing to finish. --to_finish; list_aiocb [1] = 0; } } else ACE_DEBUG ((LM_DEBUG, "aio_error says aio 1 is in progress\n")); } if (aio_error (list_aiocb [0]) != EINPROGRESS) { if (aio_return (list_aiocb [0]) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "aio_return, item 0"), -1); else { // Successful. Store the pointer somewhere and bump the // read entry up to the front, if it is still not done. --to_finish; list_aiocb [0] = this->aiocb_read_; } } else ACE_DEBUG ((LM_DEBUG, "aio_error says aio 0 is in progress\n")); } ACE_DEBUG ((LM_DEBUG, "Both the AIO operations done.\n" "The buffer is : %s\n", this->buffer_read_)); return 0; } int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { ACE_UNUSED_ARG (argc); ACE_UNUSED_ARG (argv); Test_Aio test_aio; if (test_aio.init () != 0) ACE_ERROR_RETURN ((LM_ERROR, "AIOCB test failed:\n" "ACE_POSIX_AIOCB_PROACTOR may not work in this platform\n"), -1); if (test_aio.do_aio () != 0) ACE_ERROR_RETURN ((LM_ERROR, "AIOCB test failed:\n" "ACE_POSIX_AIOCB_PROACTOR may not work in this platform\n"), -1); ACE_DEBUG ((LM_DEBUG, "AIOCB test successful:\n" "ACE_POSIX_AIOCB_PROACTOR should work in this platform\n")); return 0; } ace-8.0.4+dfsg.orig/examples/Bounded_Packet_Relay/0000755000175000017500000000000015046037655021017 5ustar sudipsudipace-8.0.4+dfsg.orig/examples/Bounded_Packet_Relay/BPR_Drivers.h0000644000175000017500000002031415027201773023302 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file BPR_Drivers.h * * This code builds abstractions to factor out common code from * the different possible implementations of the Timer_Queue based * bounded packet relay example. * * @author Chris Gill and Douglas C. Schmidt Based on the Timer Queue Test example written by Carlos O'Ryan and Douglas C. Schmidt and Sergio Flores-Gaitan */ //============================================================================= #ifndef _BPR_DRIVERS_H_ #define _BPR_DRIVERS_H_ #include "ace/Functor.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Reactor.h" #include "ace/Task.h" // forward declarations class Input_Device_Wrapper_Base; class Output_Device_Wrapper_Base; /** * @class Bounded_Packet_Relay * * @brief This class defines a packet relay abstraction for a * transmission bounded external commands to start and end the * transmission. The transmission may be bounded by the number * of packets to send, the dration of the transmission, or any * other factors. * * The relay abstraction implemented by this class registers a * callback command with an input device wrapper, and relays * input to an output device at a pace specified in the start * transmission call. */ class Bounded_Packet_Relay { public: // = Enumerates possible status values for a transmission. enum Transmission_Status { UN_INITIALIZED, STARTED, COMPLETED, TIMED_OUT, CANCELLED, ERROR_DETECTED }; enum Queue_Defaults { DEFAULT_HWM = 0x7FFFFFFF, DEFAULT_LWM = 0x7FFFFFFF }; /// Command entry point type definition. typedef int (Bounded_Packet_Relay::*ACTION) (void *); /// Constructor. Bounded_Packet_Relay (ACE_Thread_Manager *input_task_mgr, Input_Device_Wrapper_Base *input_wrapper, Output_Device_Wrapper_Base *output_wrapper); /// Destructor. virtual ~Bounded_Packet_Relay (); /// Requests output be sent to output device. int send_input (); /// Requests a transmission be started. int start_transmission (u_long packet_count, u_long arrival_period, int logging_level); /// Requests a transmission be ended. int end_transmission (Transmission_Status status); /// Requests a report of statistics from the last transmission. int report_statistics (); // = Command accessible entry points. /// Public entry point to which to push input. int receive_input (void *); // = Accessors and mutators for relay settings /// Get high water mark for relay queue. ACE_UINT32 queue_hwm (); /// Set high water mark for relay queue. void queue_hwm (ACE_UINT32 hwm); /// Get low water mark for relay queue. ACE_UINT32 queue_lwm (); /// Set low water mark for relay queue. void queue_lwm (ACE_UINT32 lwm); private: // = Concurrency Management. /// flag for whether or not a transmission is active int is_active_; /// Thread manager for the input device task. ACE_Thread_Manager * input_task_mgr_; /// Pointer to the input device wrapper. Input_Device_Wrapper_Base * input_wrapper_; /// Pointer to the output device wrapper. Output_Device_Wrapper_Base * output_wrapper_; /// Queue used to buffer input messages. ACE_Message_Queue queue_; /// High water mark for relay queue. ACE_UINT32 queue_hwm_; /// Low water mark for relay queue. ACE_UINT32 queue_lwm_; /// Lock for thread-safe synchronization of transmission startup and /// termination. ACE_SYNCH_MUTEX transmission_lock_; // = Transmission Statistics /// Returns string corresponding to current status. const char *status_msg (); /// Number of transmissions sent. u_long transmission_number_; /// Count of packets sent in the most recent transmission. u_long packets_sent_; /// Status of the current or most recent transmission. Transmission_Status status_; /// Start time of the most recent transmission. ACE_Time_Value transmission_start_; /// Ending time of the most recent transmission. ACE_Time_Value transmission_end_; }; /** * @class Input_Device_Wrapper_Base * * @brief This class defines an abstract base class for an input device * wrapper that hides the details of the specific device and * provides a consistent message passing interface without * knowing anything about the implementation of the input device * or the message receiver. * The abstract base class ctor takes a command template object * that is instantiated with the correct receiver and action * types. This command object is used to send newly created input * messages to the receiver. * The abstract base class is designed to operate in an active * "push" mode, sending input data to the receiver whenever the * data is ready. The underlying device may be active, notifying * the wrapper when data is ready, or may be passive in which * case the wrapper must rely on a reactive and/or polling * mechanism. * * Derived classes are responsible for filling in concrete * definitions for the abstract message creation method and the * svc method. */ class Input_Device_Wrapper_Base : public ACE_Task_Base { public: /// Constructor. Input_Device_Wrapper_Base (ACE_Thread_Manager *input_task_mgr); /// Destructor. virtual ~Input_Device_Wrapper_Base (); /// Sets send input message command in the input device driver /// object. int set_send_input_msg_cmd (ACE_Command_Base *send_input_msg_cmd); /// Sets period (in usecs) between when inputs are created. int set_input_period (u_long input_period); /// Sets count of messages to send. int set_send_count (long count); /** * Requests that the input device stop sending messages and * terminate its thread. Should return 1 if it will do so, 0 if it * has already done so, or -1 if there is a problem doing so. */ int request_stop (); /// This method runs the input device loop in the new thread. virtual int svc (); /// Provides an abstract interface to allow modifying device /// settings. virtual int modify_device_settings (void *) = 0; protected: /// Creates a new message block, carrying data read from the /// underlying input device. virtual ACE_Message_Block *create_input_message () = 0; /** * Sends a newly created message block, carrying data read from the * underlying input device, by passing a pointer to the message * block to its command execution. */ virtual int send_input_message (ACE_Message_Block *); /// Send newly created input message. ACE_Command_Base *send_input_msg_cmd_; /// Period between when input values are produced (usecs). u_long input_period_; /// Reactor used to multiplex input streams, timeouts. ACE_Reactor reactor_; /// Flag to indicate whether or not input object is /// (and should remain) active. int is_active_; /// Count of messages to send before stopping (-1 indicates the /// device should not stop). long send_count_; /// Currently remaining count of messages to send before stopping /// (-1 indicates the device should not stop). long current_count_; }; /** * @class Output_Device_Wrapper_Base * * @brief This class defines an abstract base class for an output device * wrapper that hides the details of the specific device and * provides a consistent write method interface without knowing * anything about the implementation. * * The abstract methods write_output_message () and * modify_device_settings () are defined in derived classes to * write the contents of the passed message out the underlying * output device, and update device settings, respectively. */ class Output_Device_Wrapper_Base { public: virtual ~Output_Device_Wrapper_Base (); /// Writes contents of the passed message block out to the underlying /// output device. virtual int write_output_message (void *) = 0; /// Provides an abstract interface to allow modifying device /// settings. virtual int modify_device_settings (void *) = 0; }; // include the templates #include "BPR_Drivers_T.h" #endif /* _BPR_DRIVERS_H_ */ ace-8.0.4+dfsg.orig/examples/Bounded_Packet_Relay/Bounded_Packet_Relay.mpc0000644000175000017500000000014715027201773025516 0ustar sudipsudip// -*- MPC -*- project : aceexe { exename = bpr_thread macros += ACE_HAS_DEFERRED_TIMER_COMMANDS } ace-8.0.4+dfsg.orig/examples/Bounded_Packet_Relay/BPR_Drivers_T.h0000644000175000017500000001112615027201773023566 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file BPR_Drivers_T.h * * This code factors out common class templates for use in * the different possible implementations of the Timer_Queue * based bounded packet relay example. * * @author Chris Gill and Douglas C. Schmidt Based on the Timer Queue Test example written by Carlos O'Ryan and Douglas C. Schmidt and Sergio Flores-Gaitan */ //============================================================================= #ifndef _BPR_DRIVERS_T_H_ #define _BPR_DRIVERS_T_H_ #include "ace/Functor.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ // Forward declarations. class Input_Device_Wrapper_Base; class Output_Device_Wrapper_Base; /** * @class Bounded_Packet_Relay_Driver * * @brief This abstract base class provides a simple abstraction for a * test driver for the bounded packet relay example. * * This is the place where the common code to test the different * implementations of the timer queue resides. This class has * the logic for the parse_commands () method, the run (), * read_input () and get_next_request () methods. Subclasses can * override these methods if there is some logic that is specific * to that implementation. */ template class Bounded_Packet_Relay_Driver { public: /// Constructor. Bounded_Packet_Relay_Driver (); /// Destructor. virtual ~Bounded_Packet_Relay_Driver (); /// Breaks up the input string buffer into pieces and executes the /// appropriate method to handle that operation. virtual int parse_commands (const char *buf); /** * This is the main entry point for the driver. The user of the * class should normally invoke this method. Returns 0 when * successful, or 0 otherwise. */ virtual int run (); /// This internal method gets the next request from the user. /// Returns -1 when user wants to exit. Returns 0 otherwise. virtual int get_next_request (); /** * Reads input from the user into the buffer with a maximum of * bytes. Returns the amount of bytes actually read * Otherwise, a -1 is returned and errno is set to indicate the * error. */ virtual ssize_t read_input (char *buf, size_t bufsiz); /// Prints the user interface for the driver to STDERR. virtual int display_menu () = 0; /// Initializes values and operations for the driver. virtual int init () = 0; /// Get count of packets to send in a transmission. u_long packet_count (); /// Set count of packets to send in a transmission. void packet_count (u_long pc); /// Get rate at which input packets are to arrive. u_long arrival_period (); /// Set rate at which input packets are to arrive. void arrival_period (u_long ap); /// Get rate at which packets are to be relayed (usec). u_long send_period (); /// Set rate at which packets are to be relayed (usec). void send_period (u_long sp); /// Get limit on the duration of the transmission (usec). u_long duration_limit (); /// Set limit on the duration of the transmission (usec). void duration_limit (u_long dl); /// Get logging level. int logging_level (); /// Set logging level. void logging_level (int ll); protected: // = Major Driver Mechanisms /// Timer queue for transmission timeouts. TQ timer_queue_; // = Set of commands to be executed. /// Set packet count command. ACE_Command_Base *packet_count_cmd_; /// Set arrival period command. ACE_Command_Base *arrival_period_cmd_; /// Set transmit period command. ACE_Command_Base *transmit_period_cmd_; /// Set duration limit command. ACE_Command_Base *duration_limit_cmd_; /// Set logging level command. ACE_Command_Base *logging_level_cmd_; /// Run transmission command. ACE_Command_Base *run_transmission_cmd_; /// Cancel transmission command. ACE_Command_Base *cancel_transmission_cmd_; /// Report statistics command. ACE_Command_Base *report_stats_cmd_; /// Shut down the driver. ACE_Command_Base *shutdown_cmd_; private: /// Count of packets to send in a transmission. u_long packet_count_; /// Rate at which input packets are to arrive. u_long arrival_period_; /// Rate at which packets are to be relayed (usec). u_long send_period_; /// Limit on the duration of the transmission (usec). u_long duration_limit_; /// Logging level. int logging_level_; }; #include "BPR_Drivers_T.cpp" #endif /* _BPR_DRIVERS_T_H_ */ ace-8.0.4+dfsg.orig/examples/Bounded_Packet_Relay/BPR_Drivers.cpp0000644000175000017500000003322415027201773023641 0ustar sudipsudip //============================================================================= /** * @file BPR_Drivers.cpp * * This code builds an abstraction to factor out common code for * the different implementations of the Timer_Queue. * * @author Chris Gill and Douglas C. Schmidt Based on the Timer Queue Test example written by Carlos O'Ryan and Douglas C. Schmidt and Sergio Flores-Gaitan */ //============================================================================= #include "ace/OS_NS_sys_time.h" #include "BPR_Drivers.h" // Constructor. Input_Device_Wrapper_Base::Input_Device_Wrapper_Base (ACE_Thread_Manager *input_task_mgr) : ACE_Task_Base (input_task_mgr), send_input_msg_cmd_ (0), input_period_ (ACE_ONE_SECOND_IN_USECS), is_active_ (0), send_count_ (0) { } // Destructor. Input_Device_Wrapper_Base::~Input_Device_Wrapper_Base () { } // Sets send input message command in the input device driver object. int Input_Device_Wrapper_Base::set_send_input_msg_cmd (ACE_Command_Base *send_input_msg_cmd) { // Set the new command. Input device is not responsible // for deleting the old command, if any. send_input_msg_cmd_ = send_input_msg_cmd; return 0; } // Sets period between when input messages are produced. int Input_Device_Wrapper_Base::set_input_period (u_long input_period) { input_period_ = input_period; return 0; } // Sets count of messages to send. int Input_Device_Wrapper_Base::set_send_count (long count) { send_count_ = count; return 0; } // Request that the input device stop sending messages // and terminate its thread. Should return 1 if it will do so, 0 // if it has already done so, or -1 if there is a problem doing so. int Input_Device_Wrapper_Base::request_stop () { if (is_active_) { is_active_ = 0; return 1; } return 0; } // This method runs the input device loop in the new thread. int Input_Device_Wrapper_Base::svc () { ACE_Time_Value timeout; ACE_Message_Block *message; // Set a flag to indicate we're active. is_active_ = 1; // Start with the total count of messages to send. for (current_count_ = send_count_; // While we're still marked active, and there are packets to send. (is_active_) && (current_count_ != 0); ) { // Create an input message to send. message = create_input_message (); if (message == 0) { if (is_active_) { is_active_ = 0; ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n", "Failed to create input message object"), -1); } break; } // Make sure there is a send command object. if (send_input_msg_cmd_ == 0) { delete message; if (is_active_) { is_active_ = 0; ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n", "send message command object not instantiated"), -1); } break; } // Send the input message. if (send_input_msg_cmd_->execute ((void *) message) < 0) { delete message; if (is_active_) { is_active_ = 0; ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n", "Failed executing send message command object"), -1); } break; } // If all went well, decrement count of messages to send, and // run the reactor event loop unti we get a timeout or something // happens in a registered upcall. if (current_count_ > 0) --current_count_; timeout = ACE_Time_Value (0, input_period_); reactor_.run_event_loop (timeout); } is_active_ = 0; return 0; } // Sends a newly created message block, carrying data read from the // underlying input device, by passing a pointer to the message block // to its command execution. int Input_Device_Wrapper_Base::send_input_message (ACE_Message_Block *amb) { if (send_input_msg_cmd_) return send_input_msg_cmd_->execute ((void *) amb); else { if (is_active_) ACE_ERROR ((LM_ERROR, "%t %p\n", "Input_Device_Wrapper_Base::send_input_message: " "command object not instantiated")); return -1; } } Output_Device_Wrapper_Base::~Output_Device_Wrapper_Base () { } // Constructor. Bounded_Packet_Relay::Bounded_Packet_Relay (ACE_Thread_Manager *input_task_mgr, Input_Device_Wrapper_Base *input_wrapper, Output_Device_Wrapper_Base *output_wrapper) : is_active_ (0), input_task_mgr_ (input_task_mgr), input_wrapper_ (input_wrapper), output_wrapper_ (output_wrapper), queue_ (Bounded_Packet_Relay::DEFAULT_HWM, Bounded_Packet_Relay::DEFAULT_LWM), queue_hwm_ (Bounded_Packet_Relay::DEFAULT_HWM), queue_lwm_ (Bounded_Packet_Relay::DEFAULT_LWM), transmission_number_ (0), packets_sent_ (0), status_ (Bounded_Packet_Relay::UN_INITIALIZED), transmission_start_ (ACE_Time_Value::zero), transmission_end_ (ACE_Time_Value::zero) { if (input_task_mgr_ == 0) input_task_mgr_ = ACE_Thread_Manager::instance (); } // Destructor. Bounded_Packet_Relay::~Bounded_Packet_Relay () { // Reactivate the queue, and then clear it. queue_.activate (); while (! queue_.is_empty ()) { ACE_Message_Block *msg; queue_.dequeue_head (msg); delete msg; } } // Requests output be sent to output device. int Bounded_Packet_Relay::send_input () { // Don't block, return immediately if queue is empty. ACE_Message_Block *item; // Using a separate (non-const) time value // is necessary on some platforms ACE_Time_Value immediate (ACE_Time_Value::zero); if (queue_.dequeue_head (item, &immediate) < 0) return 1; // If a message block was dequeued, send it to the output device. if (output_wrapper_->write_output_message ((void *) item) < 0) { if (is_active_) ACE_ERROR ((LM_ERROR, "%t %p\n", "failed to write to output device object")); return -1; } // If all went OK, increase count of packets sent. ++packets_sent_; return 0; } // Requests a transmission be started. int Bounded_Packet_Relay::start_transmission (u_long packet_count, u_long arrival_period, int logging_level) { // Serialize access to start and end transmission calls, statistics // reporting calls. ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->transmission_lock_, -1); // If a transmission is already in progress, just return. if (is_active_) return 1; // Set transmission in progress flag true. is_active_ = 1; // Update statistics for a new transmission. ++transmission_number_; packets_sent_ = 0; status_ = STARTED; transmission_start_ = ACE_OS::gettimeofday (); // Reactivate the queue, and then clear it. queue_.activate (); while (! queue_.is_empty ()) { ACE_Message_Block *msg; queue_.dequeue_head (msg); delete msg; } // Initialize the output device. if (output_wrapper_->modify_device_settings ((void *) &logging_level) < 0) { status_ = ERROR_DETECTED; transmission_end_ = ACE_OS::gettimeofday (); is_active_ = 0; ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n", "failed to initialize output device object"), -1); } // Initialize the input device. if (input_wrapper_->modify_device_settings ((void *) &logging_level) < 0) { status_ = ERROR_DETECTED; transmission_end_ = ACE_OS::gettimeofday (); is_active_ = 0; ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n", "failed to initialize output device object"), -1); } else if (input_wrapper_->set_input_period (arrival_period) < 0) { status_ = ERROR_DETECTED; transmission_end_ = ACE_OS::gettimeofday (); is_active_ = 0; ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n", "failed to initialize input device object"), -1); } else if (input_wrapper_->set_send_count (packet_count) < 0) { status_ = ERROR_DETECTED; transmission_end_ = ACE_OS::gettimeofday (); is_active_ = 0; ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n", "failed to initialize input device object"), -1); } // Activate the input device. else if (input_wrapper_->activate () < 0) { status_ = ERROR_DETECTED; transmission_end_ = ACE_OS::gettimeofday (); is_active_ = 0; ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n", "failed to activate input device object"), -1); } // If all went well, print a startup message and return success. ACE_DEBUG ((LM_DEBUG, "\n\nTransmission %u started\n\n", transmission_number_)); return 0; } // Requests a transmission be ended. int Bounded_Packet_Relay::end_transmission (Transmission_Status status) { // Serialize access to start and end transmission calls, // statistics reporting calls. ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->transmission_lock_, -1); // If a transmission is not already in progress, just return. if (! is_active_) return 1; // Set transmission in progress flag false. is_active_ = 0; // Ask the the input thread to stop. if (input_wrapper_->request_stop () < 0) { status_ = ERROR_DETECTED; transmission_end_ = ACE_OS::gettimeofday (); ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n", "failed asking input device thread to stop"), -1); } // Deactivate the queue, allowing all waiting threads to continue. queue_.deactivate (); // Wait for input thread to stop. input_task_mgr_->wait_task (input_wrapper_); // Reactivate the queue, and then clear it. queue_.activate (); while (! queue_.is_empty ()) { ACE_Message_Block *msg; queue_.dequeue_head (msg); delete msg; } // If all went well, set passed status, stamp end time, print a // termination message, and return success. status_ = status; transmission_end_ = ACE_OS::gettimeofday (); ACE_DEBUG ((LM_DEBUG, "\n\nTransmission %u ended with status: %s\n\n", transmission_number_, status_msg ())); return 0; } // Requests a report of statistics from the last transmission. int Bounded_Packet_Relay::report_statistics () { // Serialize access to start and end transmission calls, // statistics reporting calls. ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->transmission_lock_, -1); // If a transmission is already in progress, just return. if (is_active_) return 1; // Calculate duration of trasmission. ACE_Time_Value duration (transmission_end_); duration -= transmission_start_; // Report transmission statistics. ACE_DEBUG ((LM_DEBUG, "\n\nStatisics for transmission %u:\n\n" "Transmission status: %s\n" "Start time: %d (sec) %d (usec)\n" "End time: %d (sec) %d (usec)\n" "Duration: %d (sec) %d (usec)\n" "Packets relayed: %u\n\n", transmission_number_, status_msg (), transmission_start_.sec (), transmission_start_.usec (), transmission_end_.sec (), transmission_end_.usec (), duration.sec (), duration.usec (), packets_sent_)); return 0; } // Public entry point to which to push input. int Bounded_Packet_Relay::receive_input (void * arg) { if (! arg) { if (is_active_) ACE_ERROR ((LM_ERROR, "%t %p\n", "Bounded_Packet_Relay::receive_input: " "null argument")); return -1; } ACE_Message_Block *message = static_cast (arg); if (queue_.enqueue_tail (message) < 0) { if (is_active_) ACE_ERROR ((LM_ERROR, "%t %p\n", "Bounded_Packet_Relay::receive_input failed")); return -1; } return 0; } // Get high water mark for relay queue. ACE_UINT32 Bounded_Packet_Relay::queue_hwm () { return queue_lwm_; } // Set high water mark for relay queue. void Bounded_Packet_Relay::queue_hwm (ACE_UINT32 hwm) { queue_hwm_ = hwm; } // Get low water mark for relay queue. ACE_UINT32 Bounded_Packet_Relay::queue_lwm () { return queue_lwm_; } // Set low water mark for relay queue. void Bounded_Packet_Relay::queue_lwm (ACE_UINT32 lwm) { queue_lwm_ = lwm; } // Returns string corresponding to current status. const char * Bounded_Packet_Relay::status_msg () { const char *status_msg; switch (status_) { case UN_INITIALIZED: status_msg = "uninitialized"; break; case STARTED: status_msg = "in progress"; break; case COMPLETED: status_msg = "completed with all packets sent"; break; case TIMED_OUT: status_msg = "terminated by transmission duration timer"; break; case CANCELLED: status_msg = "cancelled by external control"; break; case ERROR_DETECTED: status_msg = "error was detected"; break; default: status_msg = "unknown transmission status"; break; } return status_msg; } ace-8.0.4+dfsg.orig/examples/Bounded_Packet_Relay/BPR_Drivers_T.cpp0000644000175000017500000002077315027201773024131 0ustar sudipsudip //============================================================================= /** * @file BPR_Drivers_T.cpp * * This code builds an abstraction to factor out common code for * the different implementations of the Timer_Queue. * * @author Chris Gill and Douglas C. Schmidt Based on the Timer Queue Test example written by Carlos O'Ryan and Douglas C. Schmidt and Sergio Flores-Gaitan */ //============================================================================= #ifndef _BPR_DRIVER_T_CPP_ #define _BPR_DRIVER_T_CPP_ // #include BPR_Drivers.h instead of BPR_Drivers_T.h // to avoid problems with circular includes #include "BPR_Drivers.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" // Constructor. template Bounded_Packet_Relay_Driver::Bounded_Packet_Relay_Driver () : packet_count_cmd_ (0), arrival_period_cmd_ (0), transmit_period_cmd_ (0), duration_limit_cmd_ (0), logging_level_cmd_ (0), run_transmission_cmd_ (0), cancel_transmission_cmd_ (0), report_stats_cmd_ (0), shutdown_cmd_ (0), packet_count_ (1000), arrival_period_ (10000), send_period_ (10000), duration_limit_ (20000000), logging_level_ (0) { } // Destructor. template Bounded_Packet_Relay_Driver::~Bounded_Packet_Relay_Driver () { // delete all instantiated command objects delete packet_count_cmd_; delete arrival_period_cmd_; delete transmit_period_cmd_; delete duration_limit_cmd_; delete logging_level_cmd_; delete run_transmission_cmd_; delete cancel_transmission_cmd_; delete report_stats_cmd_; delete shutdown_cmd_; } // Parse the input and execute the corresponding command. template int Bounded_Packet_Relay_Driver::parse_commands (const char *buf) { int option; if (::sscanf (buf, "%d", &option) <= 0) // If there was an error reading the option simply try on the next // line. return 0; switch (option) { case 1: // set packet count { u_long count; // We just reread the option, this simplies parsing (since // sscanf can do it for us). if (::sscanf (buf, "%d %lu", &option, &count) < 2) // If there was not enough information on the line, ignore // option and try the next line. return 0; if (packet_count_cmd_->execute ((void *) &count) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n", "set packet count failed"), -1); break; } case 2: // Set the arrival period. { u_long usec; // We just reread the option, this simplies parsing (since // sscanf can do it for us). if (::sscanf (buf, "%d %lu", &option, &usec) < 2) // If there was not enough information on the line, ignore // option and try the next line. return 0; if (arrival_period_cmd_->execute ((void *) &usec) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n", "set arrival period failed"), -1); break; } case 3: // Set transmit period. { u_long usec; // We just reread the option, this simplies parsing (since // sscanf can do it for us). if (::sscanf (buf, "%d %lu", &option, &usec) < 2) // If there was not enough information on the line, ignore // option and try the next line. return 0; if (transmit_period_cmd_->execute ((void *) &usec) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n", "set transmit period failed"), -1); break; } case 4: // Set duration limit. { u_long usec; // We just reread the option, this simplies parsing (since // sscanf can do it for us). if (::sscanf (buf, "%d %lu", &option, &usec) < 2) // If there was not enough information on the line, ignore // option and try the next line. return 0; if (duration_limit_cmd_->execute ((void *) &usec) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n", "\nSet duration limit failed."), -1); break; } case 5: // Set logging level. { int level; // We just reread the option, this simplies parsing (since // sscanf can do it for us). if ((::sscanf (buf, "%d %d", &option, &level) < 2) || (level < 0) || (level > 7)) { // If there was not enough information on the line, or the // passed value was invalid, ignore and try again. return 0; } if (logging_level_cmd_->execute ((void *) &level) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n", "set logging level failed"), -1); break; } case 6: // Run one transmission. return run_transmission_cmd_->execute (0); /* NOTREACHED */ case 7: // Cancel current transmission. return cancel_transmission_cmd_->execute (0); /* NOTREACHED */ case 8: // Report statistics. return report_stats_cmd_->execute (0); /* NOTREACHED */ case 9: // Shut down the driver. return shutdown_cmd_->execute (0); /* NOTREACHED */ default: // Display an error message. ACE_ERROR_RETURN ((LM_ERROR, "invalid input %s\n", buf), 0); ACE_NOTREACHED (break); /* NOTREACHED */ } /* ENDSWITCH */ return 0; } // Runs the test. template int Bounded_Packet_Relay_Driver::run () { this->init (); // Process all the incoming events. for (;;) if (this->get_next_request () == -1) return -1; ACE_NOTREACHED (return 0); } // Gets the next request from the user input. template int Bounded_Packet_Relay_Driver::get_next_request () { char buf[BUFSIZ]; this->display_menu (); // Reads input from the user. if (this->read_input (buf, sizeof buf) <= 0) return -1; // Parse and run the command. return this->parse_commands (buf); } // Reads input from the user from ACE_STDIN into the buffer specified. template ssize_t Bounded_Packet_Relay_Driver::read_input (char *buf, size_t bufsiz) { ACE_OS::memset (buf, 0, bufsiz); // Wait for user to type commands. This call is automatically // restarted when SIGINT or SIGALRM signals occur. return ACE_OS::read (ACE_STDIN, buf, bufsiz); } // Get count of packets to send in a transmission. template u_long Bounded_Packet_Relay_Driver::packet_count () { return packet_count_; } // Set count of packets to send in a transmission. template void Bounded_Packet_Relay_Driver::packet_count (u_long pc) { packet_count_ = pc; } // Get rate at which input packets are to arrive. template u_long Bounded_Packet_Relay_Driver::arrival_period () { return arrival_period_; } // Set rate at which input packets are to arrive. template void Bounded_Packet_Relay_Driver::arrival_period (u_long ap) { arrival_period_ = ap; } // Get rate at which packets are to be relayed (usec). template u_long Bounded_Packet_Relay_Driver::send_period () { return send_period_; } // Set rate at which packets are to be relayed (usec). template void Bounded_Packet_Relay_Driver::send_period (u_long sp) { send_period_ = sp; } // Get limit on the duration of the transmission (usec). template u_long Bounded_Packet_Relay_Driver::duration_limit () { return duration_limit_; } // Set limit on the duration of the transmission (usec). template void Bounded_Packet_Relay_Driver::duration_limit (u_long dl) { duration_limit_ = dl; } // Get logging level. template int Bounded_Packet_Relay_Driver::logging_level () { return logging_level_; } // Set logging level. template void Bounded_Packet_Relay_Driver::logging_level (int ll) { logging_level_ = ll; } #endif /* _BPR_DRIVER_T_CPP_ */ ace-8.0.4+dfsg.orig/examples/Bounded_Packet_Relay/Thread_Bounded_Packet_Relay.h0000644000175000017500000002624615027201773026465 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Thread_Bounded_Packet_Relay.h * * This code provides a thread based implementation * of the bounded packet relay example. * * @author Chris Gill and Douglas C. Schmidt Based on the Timer Queue Test example written by Carlos O'Ryan and Douglas C. Schmidt and Sergio Flores-Gaitan */ //============================================================================= #ifndef _THREAD_BOUNDED_PACKET_RELAY_H_ #define _THREAD_BOUNDED_PACKET_RELAY_H_ #include "ace/Functor_T.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Task.h" #include "ace/Timer_Heap_T.h" #include "ace/Timer_Queue_Adapters.h" #include "ace/Event_Handler_Handle_Timeout_Upcall.h" #include "BPR_Drivers.h" // These typedefs ensure that we use the minimal amount of locking // necessary. typedef ACE_Event_Handler_Handle_Timeout_Upcall Upcall; typedef ACE_Timer_Heap_T Timer_Heap; typedef ACE_Timer_Heap_Iterator_T Timer_Heap_Iterator; typedef ACE_Thread_Timer_Queue_Adapter Thread_Timer_Queue; // Forward declaration. class Thread_Bounded_Packet_Relay_Driver; /** * @class Text_Input_Device_Wrapper * * @brief Defines a wrapper for a simple active looping text input * pseudo-device. * * The wrapper is an active object, running in its own thread, * and uses a reactor to generate timeouts. When a timeout * occurs, the wrapper calls its concrete message creation * method. The wrapper then calls its base class message send * method to forward the message to the receiver. * A more sophisticated version of this class would use the * reactive capabilities as well as the timeout generating * capabilities of the reactor, multiplexing several input * streams. Comments to this effect appear in the definition of * the event loop method. */ class Text_Input_Device_Wrapper : public Input_Device_Wrapper_Base { public: // = Enumerated logging level flags enum Logging_Flags {NO_LOGGING = 0, LOG_MSGS_CREATED = 1}; /// Constructor. Text_Input_Device_Wrapper (ACE_Thread_Manager *input_task_mgr, size_t read_length, const char* text, int logging = 0); /// Destructor. virtual ~Text_Input_Device_Wrapper (); /** * Modifies device settings based on passed pointer to a u_long. * Turns logging on if u_long is non-zero, off if u_long is zero, * and does nothing if the pointer is null. */ virtual int modify_device_settings (void *logging); protected: /// Creates a new message block, carrying data read from the /// underlying input device. virtual ACE_Message_Block *create_input_message (); private: /// Length of the buffer into which to "read". size_t read_length_; /// Text to "read" into the buffer. const char *text_; /// Index into the string. size_t index_; /// This value is 0 if logging is turned off, non-zero otherwise int logging_; /// This value holds a count of packets created. u_long packet_count_; }; /** * @class Text_Output_Device_Wrapper * * @brief Implements a simple wrapper for a output pseudo-device. * * Data from the passed output message is printed to the standard * output stream, if logging is turned on. */ class Text_Output_Device_Wrapper : public Output_Device_Wrapper_Base { public: // = Enumerated logging level flags enum Logging_Flags {NO_LOGGING = 0, LOG_MSGS_RCVD = 2, PRINT_MSGS_RCVD = 4}; /// Default constructor. Text_Output_Device_Wrapper (int logging = 0); // = Command Accessible Entry Points /// Consumes and possibly prints out the passed message. virtual int write_output_message (void *message); /** * Modifies device settings based on passed pointer to a u_long. * Turns logging on if u_long is non-zero, off if u_long is zero, * and does nothing if the pointer is null. */ virtual int modify_device_settings (void *logging); private: /// This value holds the logging level. int logging_; /// This value holds a count of packets received. u_long packet_count_; }; /** * @class User_Input_Task * * @brief Read user actions on the Timer_Queue from stdin. * * This class reads user input from stdin. The commands allow * the control of a Timer_Queue, which is dispatched by another * thread. */ class User_Input_Task : public ACE_Task_Base { public: // = Trait for command accessible entry points. typedef int (User_Input_Task::*ACTION) (void *); /// Constructor. User_Input_Task (Bounded_Packet_Relay *relay, Thread_Timer_Queue *queue, Thread_Bounded_Packet_Relay_Driver &timer_queue_driver); /// Destructor. virtual ~User_Input_Task (); /// This method runs the event loop in the new thread. virtual int svc (); // = Some helper methods. /// Sets the number of packets for the next transmission. int set_packet_count (void *); /// Sets the input device packet arrival period (usecs) for the next /// transmission. int set_arrival_period (void *); /// Sets the period between output device sends (usecs) for the next /// transmission. int set_send_period (void *); /// Sets a limit on the transmission duration (usecs). int set_duration_limit (void *); /// Sets logging level (0 or 1) for output device for the next /// transmission. int set_logging_level (void *); /// Runs the next transmission (if one is not in progress). int run_transmission (void *); /// Ends the current transmission (if one is in progress). int end_transmission (void *); /// Reports statistics for the previous transmission (if one is not /// in progress). int report_stats (void *); /// Shuts down the task. int shutdown (void *); /// Helper method: clears all timers. int clear_all_timers (); private: /// How many microseconds are in a second. const int usecs_; /// The bounded packet relay. Bounded_Packet_Relay *relay_; /// The timer queue implementation. Thread_Timer_Queue *queue_; /// The thread timer queue test driver. Thread_Bounded_Packet_Relay_Driver &driver_; }; /** * @class BPR_Handler_Base * * @brief Base event handler class for bounded packet relay example. * * The base class provides a helper method that derived classes * can register as a deferred execution callback that will cancel * all timers in the underlying timer queue, and then delete "this". */ class BPR_Handler_Base : public ACE_Event_Handler { public: // = Trait for command accessible entry points. typedef int (BPR_Handler_Base::*ACTION) (void *); /// Constructor. BPR_Handler_Base (Bounded_Packet_Relay &relay, Thread_Timer_Queue &queue); /// Destructor. virtual ~BPR_Handler_Base (); // = Command accessible entry points. /// Helper method: clears all timers. virtual int clear_all_timers (void *); protected: /// Stores a reference to the relay object on which to invoke /// the appropritate calls when the timer expires. Bounded_Packet_Relay &relay_; /// Store a reference to the timer queue, in which to re-register /// the send timer and handler if there are still sends to perform. Thread_Timer_Queue &queue_; }; class Send_Handler; /** * @class Send_Handler * * @brief Event handler for message send timeout events. * * The hook method calls the relay's send * method and decrements its count of messages to send. * If there are still messages to send, it re-registers itself * with the timer queue. Otherwise it calls the relay's end * transmission method, and registers a deferred execution * callback to clear the timer queue, and then delete "this". */ class Send_Handler : public BPR_Handler_Base { public: // = Trait for command accessible entry points. typedef int (Send_Handler::*ACTION) (void *); /// Constructor. Send_Handler (u_long send_count, const ACE_Time_Value &duration, Bounded_Packet_Relay &relay, Thread_Timer_Queue &queue, Thread_Bounded_Packet_Relay_Driver &driver); /// Destructor. virtual ~Send_Handler (); /// Call back hook. virtual int handle_timeout (const ACE_Time_Value ¤t_time, const void *arg); /// Cancellation hook. virtual int cancelled (); // = Command accessible entry points. /// Helper method: re-registers this handler. virtual int reregister (void *timeout); private: /// Count of the number of messages to send from the /// relay object to the output device object. u_long send_count_; /// Stores the expected duration until expiration, and is used to /// re-register the handler if there are still sends to perform. ACE_Time_Value duration_; /// Reference to the driver that will redisplay the user input menu. Thread_Bounded_Packet_Relay_Driver &driver_; }; /** * @class Termination_Handler * * @brief Event handler for end transmission timeout events. * * The hook method calls the relay's end * transmission method, then registers a deferred execution * callback to clear all timers and then delete "this". */ class Termination_Handler : public BPR_Handler_Base { public: /// Constructor. Termination_Handler (Bounded_Packet_Relay &relay, Thread_Timer_Queue &queue, Thread_Bounded_Packet_Relay_Driver &driver); /// Destructor. virtual ~Termination_Handler (); /// Call back hook. virtual int handle_timeout (const ACE_Time_Value ¤t_time, const void *arg); /// Cancellation hook. virtual int cancelled (); private: /// Reference to the driver that will redisplay the user input menu. Thread_Bounded_Packet_Relay_Driver &driver_; }; /** * @class Thread_Bounded_Packet_Relay_Driver * * @brief Implements an example application that exercises * timer queue. * * This class implements a simple test driver for the * . The hook method is * called from the base class to print a menu specific to the * thread implementation of the timer queue. */ class Thread_Bounded_Packet_Relay_Driver : public Bounded_Packet_Relay_Driver { public: // = Trait for commands issued from this driver typedef ACE_Command_Callback MYCOMMAND; /// Constructor. Thread_Bounded_Packet_Relay_Driver (Bounded_Packet_Relay *relay); /// Destructor. virtual ~Thread_Bounded_Packet_Relay_Driver (); /// Displays the user menu. virtual int display_menu (); /// Initializes the driver. virtual int init (); /// Run the driver. virtual int run (); private: /// User input task, subclassed from ACE_Task. User_Input_Task input_task_; }; #endif /* _THREAD_BOUNDED_PACKET_RELAY_H_ */ ace-8.0.4+dfsg.orig/examples/Bounded_Packet_Relay/Thread_Bounded_Packet_Relay.cpp0000644000175000017500000005271515027201773027020 0ustar sudipsudip //============================================================================= /** * @file Thread_Bounded_Packet_Relay.cpp * * Method definitions for the threaded-bounded packet relay class. * * @author Chris Gill and Douglas C. Schmidt Based on the Timer Queue Test example written by Carlos O'Ryan and Douglas C. Schmidt and Sergio Flores-Gaitan */ //============================================================================= #include "ace/OS_NS_string.h" #include "ace/OS_NS_sys_time.h" #include "ace/Condition_T.h" #include "ace/Null_Mutex.h" #include "Thread_Bounded_Packet_Relay.h" typedef Thread_Bounded_Packet_Relay_Driver::MYCOMMAND DRIVER_CMD; typedef ACE_Command_Callback HANDLER_CMD; typedef ACE_Command_Callback SEND_HANDLER_CMD; // Constructor. Text_Input_Device_Wrapper::Text_Input_Device_Wrapper (ACE_Thread_Manager *input_task_mgr, size_t read_length, const char* text, int logging) : Input_Device_Wrapper_Base (input_task_mgr), read_length_ (read_length), text_ (text), index_ (0), logging_ (logging), packet_count_ (0) { } // Destructor. Text_Input_Device_Wrapper::~Text_Input_Device_Wrapper () { } // Modifies device settings based on passed pointer to a u_long. int Text_Input_Device_Wrapper::modify_device_settings (void *logging) { packet_count_ = 0; if (logging) logging_ = *static_cast (logging); else ACE_ERROR_RETURN ((LM_ERROR, "Text_Input_Device_Wrapper::modify_device_settings: " "null argument"), -1); return 0; } // Creates a new message block, carrying data // read from the underlying input device. ACE_Message_Block * Text_Input_Device_Wrapper::create_input_message () { // Construct a new message block to send. ACE_Message_Block *mb = 0; ACE_NEW_RETURN (mb, ACE_Message_Block (read_length_), 0); // Zero out a "read" buffer to hold data. char read_buf [BUFSIZ]; ACE_OS::memset (read_buf, 0, BUFSIZ); // Loop through the text, filling in data to copy into the read // buffer (leaving room for a terminating zero). for (size_t i = 0; i < read_length_ - 1; ++i) { read_buf [i] = text_ [index_]; index_ = (index_ + 1) % ACE_OS::strlen (text_); } // Copy buf into the Message_Block and update the wr_ptr (). if (mb->copy (read_buf, read_length_) < 0) { delete mb; ACE_ERROR_RETURN ((LM_ERROR, "read buffer copy failed"), 0); } // log packet creation if logging is turned on if (logging_ & Text_Input_Device_Wrapper::LOG_MSGS_CREATED) { ++packet_count_; ACE_DEBUG ((LM_DEBUG, "input message %d created\n", packet_count_)); } return mb; } // Constructor. Text_Output_Device_Wrapper::Text_Output_Device_Wrapper (int logging) : logging_ (logging) { } // Consume and possibly print out the passed message. int Text_Output_Device_Wrapper::write_output_message (void *message) { if (message) { ++packet_count_; if (logging_ & Text_Output_Device_Wrapper::LOG_MSGS_RCVD) ACE_DEBUG ((LM_DEBUG, "output message %d received\n", packet_count_)); if (logging_ & Text_Output_Device_Wrapper::PRINT_MSGS_RCVD) ACE_DEBUG ((LM_DEBUG, "output message %d:\n[%s]\n", packet_count_, static_cast (message)->rd_ptr ())); delete static_cast (message); return 0; } ACE_ERROR_RETURN ((LM_ERROR, "Text_Output_Device_Wrapper::" "write_output_message: null argument"), -1); } // Modifies device settings based on passed pointer to a u_long. int Text_Output_Device_Wrapper::modify_device_settings (void *logging) { packet_count_ = 0; if (logging) logging_ = *static_cast (logging); else ACE_ERROR_RETURN ((LM_ERROR, "Text_Output_Device_Wrapper::modify_device_settings: " "null argument"), -1); return 0; } // Constructor. User_Input_Task::User_Input_Task (Bounded_Packet_Relay *relay, Thread_Timer_Queue *queue, Thread_Bounded_Packet_Relay_Driver &tbprd) : ACE_Task_Base (ACE_Thread_Manager::instance ()), usecs_ (ACE_ONE_SECOND_IN_USECS), relay_ (relay), queue_ (queue), driver_ (tbprd) { } // Destructor. User_Input_Task::~User_Input_Task () { this->clear_all_timers (); } // Runs the main event loop. int User_Input_Task::svc () { for (;;) // Call back to the driver's implementation of how to read and // parse input. if (this->driver_.get_next_request () == -1) break; // We are done. this->relay_->end_transmission (Bounded_Packet_Relay::CANCELLED); this->queue_->deactivate (); ACE_DEBUG ((LM_DEBUG, "terminating user input thread\n")); this->clear_all_timers (); return 0; } // Sets the number of packets for the next transmission. int User_Input_Task::set_packet_count (void *argument) { if (argument) { driver_.packet_count (*static_cast (argument)); return 0; } ACE_ERROR_RETURN ((LM_ERROR, "User_Input_Task::set_packet_count: null argument"), -1); } // Sets the input device packet arrival period (usecs) for the next // transmission. int User_Input_Task::set_arrival_period (void *argument) { if (argument) { driver_.arrival_period (*static_cast (argument)); return 0; } ACE_ERROR_RETURN ((LM_ERROR, "User_Input_Task::set_arrival_period: null argument"), -1); } // Sets the period between output device sends (usecs) for the next // transmission. int User_Input_Task::set_send_period (void *argument) { if (argument) { driver_.send_period (*static_cast (argument)); return 0; } ACE_ERROR_RETURN ((LM_ERROR, "User_Input_Task::set_send_period: null argument"), -1); } // Sets a limit on the transmission duration (usecs). int User_Input_Task::set_duration_limit (void *argument) { if (argument) { driver_.duration_limit (*static_cast (argument)); return 0; } ACE_ERROR_RETURN ((LM_ERROR, "User_Input_Task::set_duration_limit: null argument"), -1); } // Sets logging level (0 or 1) for output device for the next // transmission. int User_Input_Task::set_logging_level (void *argument) { if (argument) { driver_.logging_level (*static_cast (argument)); return 0; } ACE_ERROR_RETURN ((LM_ERROR, "User_Input_Task::set_logging_level: null argument"), -1); } // Runs the next transmission (if one is not in progress). int User_Input_Task::run_transmission (void *) { if (relay_) { switch (relay_->start_transmission (driver_.packet_count (), driver_.arrival_period (), driver_.logging_level ())) { case 1: ACE_DEBUG ((LM_DEBUG, "\nRun transmission: " " Transmission already in progress\n")); return 0; /* NOTREACHED */ case 0: { ACE_Time_Value now = ACE_OS::gettimeofday (); ACE_Time_Value send_every (0, driver_.send_period ()); ACE_Time_Value send_at (send_every + now); Send_Handler *send_handler; ACE_NEW_RETURN (send_handler, Send_Handler (driver_.packet_count (), send_every, *relay_, *queue_, driver_), -1); if (queue_->schedule (send_handler, 0, send_at) < 0) { delete send_handler; ACE_ERROR_RETURN ((LM_ERROR, "User_Input_Task::run_transmission: " "failed to schedule send handler"), -1); } if (driver_.duration_limit ()) { ACE_Time_Value terminate_at (0, driver_.duration_limit ()); terminate_at += now; Termination_Handler *termination_handler; termination_handler = new Termination_Handler (*relay_, *queue_, driver_); if (! termination_handler) { this->clear_all_timers (); ACE_ERROR_RETURN ((LM_ERROR, "User_Input_Task::run_transmission: " "failed to allocate termination " "handler"), -1); } if (queue_->schedule (termination_handler, 0, terminate_at) < 0) { delete termination_handler; this->clear_all_timers (); ACE_ERROR_RETURN ((LM_ERROR, "User_Input_Task::run_transmission: " "failed to schedule termination " "handler"), -1); } } return 0; } /* NOTREACHED */ default: return -1; /* NOTREACHED */ } } ACE_ERROR_RETURN ((LM_ERROR, "User_Input_Task::run_transmission: " "relay not instantiated"), -1); } // Ends the current transmission (if one is in progress). int User_Input_Task::end_transmission (void *) { if (relay_) { switch (relay_->end_transmission (Bounded_Packet_Relay::CANCELLED)) { case 1: ACE_DEBUG ((LM_DEBUG, "\nEnd transmission: " "no transmission in progress\n")); ACE_FALLTHROUGH; case 0: // Cancel any remaining timers. this->clear_all_timers (); return 0; /* NOTREACHED */ default: return -1; /* NOTREACHED */ } } ACE_ERROR_RETURN ((LM_ERROR, "User_Input_Task::end_transmission: " "relay not instantiated"), -1); } // Reports statistics for the previous transmission // (if one is not in progress). int User_Input_Task::report_stats (void *) { if (relay_) { switch (relay_->report_statistics ()) { case 1: ACE_DEBUG ((LM_DEBUG, "\nRun transmission: " "\ntransmission already in progress\n")); return 0; /* NOTREACHED */ case 0: this->clear_all_timers (); return 0; /* NOTREACHED */ default: return -1; /* NOTREACHED */ } } ACE_ERROR_RETURN ((LM_ERROR, "User_Input_Task::report_stats: " "relay not instantiated"), -1); } // Shut down the task. int User_Input_Task::shutdown (void *) { // Clear any outstanding timers. this->clear_all_timers (); #if !defined (ACE_LACKS_PTHREAD_CANCEL) // Cancel the thread timer queue task "preemptively." ACE_Thread::cancel (this->queue_->thr_id ()); #else // Cancel the thread timer queue task "voluntarily." this->queue_->deactivate (); #endif /* ACE_LACKS_PTHREAD_CANCEL */ // -1 indicates we are shutting down the application. return -1; } // Helper method: clears all timers. int User_Input_Task::clear_all_timers () { // loop through the timers in the queue, cancelling each one for (ACE_Timer_Node_T *node; (node = queue_->timer_queue ()->get_first ()) != 0; ) queue_->timer_queue ()->cancel (node->get_timer_id (), 0, 0); return 0; } // Constructor. BPR_Handler_Base::BPR_Handler_Base (Bounded_Packet_Relay &relay, Thread_Timer_Queue &queue) : relay_ (relay), queue_ (queue) { } // Destructor. BPR_Handler_Base::~BPR_Handler_Base () { } // Helper method: clears all timers. int BPR_Handler_Base::clear_all_timers (void *) { // Loop through the timers in the queue, cancelling each one. for (ACE_Timer_Node_T *node; (node = queue_.timer_queue ()->get_first ()) != 0; ) queue_.timer_queue ()->cancel (node->get_timer_id (), 0, 0); // queue_.cancel (node->get_timer_id (), 0); // Invoke the handler's (virtual) destructor delete this; return 0; } // Constructor. Send_Handler::Send_Handler (u_long send_count, const ACE_Time_Value &duration, Bounded_Packet_Relay &relay, Thread_Timer_Queue &queue, Thread_Bounded_Packet_Relay_Driver &driver) : BPR_Handler_Base (relay, queue), send_count_ (send_count), duration_ (duration), driver_ (driver) { } // Destructor. Send_Handler::~Send_Handler () { } // Call back hook. int Send_Handler::handle_timeout (const ACE_Time_Value &, const void *) { switch (relay_.send_input ()) { case 0: // Decrement count of packets to relay. --send_count_; ACE_FALLTHROUGH; case 1: if (send_count_ > 0) { // Enqueue a deferred callback to the reregister command. SEND_HANDLER_CMD *re_register_callback_; ACE_NEW_RETURN (re_register_callback_, SEND_HANDLER_CMD (*this, &Send_Handler::reregister), -1); return queue_.enqueue_command (re_register_callback_); } else { // All packets are sent, time to end the transmission, redisplay // the user menu, cancel any other timers, and go away. relay_.end_transmission (Bounded_Packet_Relay::COMPLETED); driver_.display_menu (); // Enqueue a deferred callback to the clear_all_timers command. HANDLER_CMD *clear_timers_callback_; ACE_NEW_RETURN (clear_timers_callback_, HANDLER_CMD (*this, &BPR_Handler_Base::clear_all_timers), -1); return queue_.enqueue_command (clear_timers_callback_); } /* NOTREACHED */ default: return -1; } } // Cancellation hook. int Send_Handler::cancelled () { delete this; return 0; } // Helper method: re-registers this timer int Send_Handler::reregister (void *) { // Re-register the handler for a new timeout. if (queue_.schedule (this, 0, duration_ + ACE_OS::gettimeofday ()) < 0) ACE_ERROR_RETURN ((LM_ERROR, "Send_Handler::reregister: " "failed to reschedule send handler"), -1); return 0; } // Constructor. Termination_Handler::Termination_Handler (Bounded_Packet_Relay &relay, Thread_Timer_Queue &queue, Thread_Bounded_Packet_Relay_Driver &driver) : BPR_Handler_Base (relay, queue), driver_ (driver) { } // Destructor. Termination_Handler::~Termination_Handler () { } // Call back hook. int Termination_Handler::handle_timeout (const ACE_Time_Value &, const void *) { // Transmission timed out, so end the transmission, display the user // menu, and register a callback to clear the timer queue and then // make this object go away. relay_.end_transmission (Bounded_Packet_Relay::TIMED_OUT); driver_.display_menu (); // Enqueue a deferred callback to the clear_all_timers command. HANDLER_CMD *clear_timers_callback_; ACE_NEW_RETURN (clear_timers_callback_, HANDLER_CMD (*this, &BPR_Handler_Base::clear_all_timers), -1); return queue_.enqueue_command (clear_timers_callback_); } // Cancellation hook int Termination_Handler::cancelled () { delete this; return 0; } // Constructor. Thread_Bounded_Packet_Relay_Driver::Thread_Bounded_Packet_Relay_Driver (Bounded_Packet_Relay *relay) : input_task_ (relay, &timer_queue_, *this) { } // Destructor. Thread_Bounded_Packet_Relay_Driver::~Thread_Bounded_Packet_Relay_Driver () { } // Display the user menu. int Thread_Bounded_Packet_Relay_Driver::display_menu () { static char menu[] = "\n\n Options:\n" " ----------------------------------------------------------------------\n" " 1 \n" " min = 1 packet.\n" " 2 \n" " min = 1.\n" " 3 \n" " min = 1.\n" " 4 \n" " min = 1, no limit = 0.\n" " 5 \n" " no logging = 0,\n" " log packets created by input device = 1,\n" " log packets consumed by output device = 2,\n" " logging options 1,2 = 3,\n" " print contents of packets consumed by output put device = 4,\n" " logging options 1,4 = 5,\n" " logging options 2,4 = 6,\n" " logging options 1,2,4 = 7.\n" " ----------------------------------------------------------------------\n" " 6 - runs a transmission using the current settings\n" " 7 - cancels a transmission (if there is one running)\n" " 8 - reports statistics from the most recent transmission\n" " 9 - quits the program\n" " ----------------------------------------------------------------------\n" " Please enter your choice: "; ACE_DEBUG ((LM_DEBUG, menu, this->packet_count (), this->arrival_period (), this->send_period (), this->duration_limit (), this->logging_level ())); return 0; } // Initialize the driver. int Thread_Bounded_Packet_Relay_Driver::init () { // Initialize the objects with their corresponding // methods from . ACE_NEW_RETURN (packet_count_cmd_, DRIVER_CMD (input_task_, &User_Input_Task::set_packet_count), -1); ACE_NEW_RETURN (arrival_period_cmd_, DRIVER_CMD (input_task_, &User_Input_Task::set_arrival_period), -1); ACE_NEW_RETURN (transmit_period_cmd_, DRIVER_CMD (input_task_, &User_Input_Task::set_send_period), -1); ACE_NEW_RETURN (duration_limit_cmd_, DRIVER_CMD (input_task_, &User_Input_Task::set_duration_limit), -1); ACE_NEW_RETURN (logging_level_cmd_, DRIVER_CMD (input_task_, &User_Input_Task::set_logging_level), -1); ACE_NEW_RETURN (run_transmission_cmd_, DRIVER_CMD (input_task_, &User_Input_Task::run_transmission), -1); ACE_NEW_RETURN (cancel_transmission_cmd_, DRIVER_CMD (input_task_, &User_Input_Task::end_transmission), -1); ACE_NEW_RETURN (report_stats_cmd_, DRIVER_CMD (input_task_, &User_Input_Task::report_stats), -1); ACE_NEW_RETURN (shutdown_cmd_, DRIVER_CMD (input_task_, &User_Input_Task::shutdown), -1); if (this->input_task_.activate () == -1) ACE_ERROR_RETURN ((LM_ERROR, "cannot activate input task"), -1); else if (this->timer_queue_.activate () == -1) ACE_ERROR_RETURN ((LM_ERROR, "cannot activate timer queue"), -1); else if (ACE_Thread_Manager::instance ()->wait () == -1) ACE_ERROR_RETURN ((LM_ERROR, "wait on Thread_Manager failed"), -1); return 0; } // Run the driver int Thread_Bounded_Packet_Relay_Driver::run () { this->init (); return 0; } ace-8.0.4+dfsg.orig/examples/Bounded_Packet_Relay/bpr_thread.cpp0000644000175000017500000000716515027201773023637 0ustar sudipsudip //============================================================================= /** * @file bpr_thread.cpp * * Exercises drivers for a bounded packet relay, based on threaded timer queues. * * @author Chris Gill * @author Douglas C. Schmidt * * Based on the Timer Queue Test example written by Carlos O'Ryan * and Douglas C. Schmidt and Sergio Flores-Gaitan */ //============================================================================= #include "Thread_Bounded_Packet_Relay.h" #include typedef Bounded_Packet_Relay_Driver THREAD_BOUNDED_PACKET_RELAY_DRIVER; typedef ACE_Command_Callback INPUT_CALLBACK; // A snippet from Andrew Marvell (Oliver Cromwell's poet laureate) static const char input_text [] = "But ever at my back I hear\n" " Time's winged chariot hurrying near."; int ACE_TMAIN (int, ACE_TCHAR *[]) { // Construct a new thread manager for the input device task. Auto // ptr ensures memory is freed when we exit this scope. ACE_Thread_Manager *input_task_mgr; ACE_NEW_RETURN (input_task_mgr, ACE_Thread_Manager, -1); std::unique_ptr mgr (input_task_mgr); // Construct a new input device wrapper. Auto ptr ensures memory is // freed when we exit this scope. Text_Input_Device_Wrapper *input_device; ACE_NEW_RETURN (input_device, Text_Input_Device_Wrapper (input_task_mgr, sizeof (input_text), input_text), -1); std::unique_ptr input (input_device); // Construct a new output device wrapper. Auto ptr ensures memory // is freed when we exit this scope. Text_Output_Device_Wrapper *output_device = 0; ACE_NEW_RETURN (output_device, Text_Output_Device_Wrapper, -1); std::unique_ptr output (output_device); // Construct a new bounded packet relay. Auto ptr ensures memory is // freed when we exit this scope. Bounded_Packet_Relay *packet_relay = 0; ACE_NEW_RETURN (packet_relay, Bounded_Packet_Relay (input_task_mgr, input_device, output_device), -1); std::unique_ptr relay (packet_relay); // Construct a receive input callback command for the relay, and register // it with the input device. Auto ptr ensures memory is freed when we exit // this scope. INPUT_CALLBACK *input_callback = 0; ACE_NEW_RETURN (input_callback, INPUT_CALLBACK (*packet_relay, &Bounded_Packet_Relay::receive_input), -1); std::unique_ptr callback (input_callback); if (input_device->set_send_input_msg_cmd (input_callback) < 0) { ACE_ERROR_RETURN ((LM_ERROR, "failed to register input callback"), -1); } // Construct a new bounded packet relay driver. Auto ptr ensures // memory is freed when we exit this scope. THREAD_BOUNDED_PACKET_RELAY_DRIVER *tbprd = 0; ACE_NEW_RETURN (tbprd, Thread_Bounded_Packet_Relay_Driver (packet_relay), -1); std::unique_ptr driver (tbprd); return driver->run (); // All dynamically allocated memory is released when main() returns. } ace-8.0.4+dfsg.orig/examples/Bounded_Packet_Relay/README0000644000175000017500000002076515027201773021702 0ustar sudipsudip 1. INTRODUCTION This directory contains an example that illustrates how to use both threaded and reactive concurrency mechanisms in ACE. The example application schedules and processes heterogenerous user input and timer-based events in the context of a bounded packet relay mechanism. In this example, a transmission begins, packets arrive from an input device object, and are transferred to an output device object by a relay object at a specified pace. The transfer continues until all packets have been relayed, a duration limit expires, or the transmission is cancelled. User input is handled concurrently with a running transmission. You can run a transmission, cancel a transmission, change transmission parameters, view statistics from the most recent transmission, or exit the program, using selections from an interactive text-based menu. In addition, the example program can be run in batch mode, with the appropriate commands piped to the program's standard input stream. Transmission parameters are intialized to default values. Transmission parameter values persist until/unless they are subsequently modified by an appropriate command. If an invalid value for a command is given, or a run or report command is issued while a transmission is in progress, the offending command has no effect, and an error message is generated. 2. USER INTERFACE Commands that can be given to the program include the following: Settings commands: 1 Minimum value is 1 packet, defaults to 1000 packets. 2 Minimum value is 1 usec, defaults to 10000 usec (10 msec). 3 Minimum value is 1 usec, defaults to 10000 usec (10 msec). 4 Minimum value is 1 usec, defaults to 20000000 usec (20 sec). A value of 0 is also a valid input, in which case no limit will be placed on the duration of the transmission (it will end when all packets have been relayed from the input device to the output device). 5 0 - does no logging 1 - logs packets created by the input device 2 - logs packets consumed by the output device 4 - prints contents of packets consumed by the output device To set several flags, pass their sum as the logging level value: e.g., a logging level value of 7 turns on all possible logging. Action commands: 6 - runs a transmission using the current settings 7 - cancels a transmission if there is one running 8 - reports statistics from the most recent transmission 9 - quits the program 3. APPLICATION DESIGN 3.1. KEY COMPONENTS The design of this example application consists of four main components: the driver object, the relay object, the input device object, and the output device object. The driver object is responsible for receiving user input and overall handling of user input commands. The driver object is active, with separate threads for receiving user input and managing its transmission timer queue. This allows the user to issue commands while a transmission is in progress. The driver object uses an ACE_Thread_Timer_Queue_Adapter, which is derived from ACE_Task_Base. The driver object starts another active object, called User_Input_Task, which is also derived from ACE_Task_Base. This allows both the timer queue and the user input object to be made active, running in their own threads of control. The relay object is passive, managing a message queue and necessary locks to allow safe access from multiple threads. It provides methods to receive and enqueue a mesage from the input device, dequeue a message and send it to the output device, and to start or end a transmission. It uses ACE_Message_Queue (which contains ACE_Message_Block objects) and ACE_Thread_Mutex objects to implement this functionality. The input object is active, managing timeouts and input events in its own thread. The input object is also reactive, using an ACE_Reactor to allow response to multiple input handles as well as to do polling at specific timeouts. The input pseudo-device wrapper in this example does not make use of input handles and only does timed polling, but extending this only requires registering the appropriate input handles and handlers with the reactor. The input object is derived from ACE_Task_Base, and is activated by the relay object when a new transmission starts. The input object packages each data packet in an ACE_Message_Block before sending it to the relay object. The output object is passive. If logging is turned on, it will report the arrival time, relative to the start of the transmission, of each output message, and the contents of that message. The output object will also "consume" each ACE_Message_Block passed to it, calling delete on the passed pointer. 3.2. RUN-TIME CHARACTERSITICS When the user initiates a transmission, the appropriate settings are passed by the driver to the relay object's start transmission method. The relay object tries to start a new transmission. If another transmission is in progress, the method returns an error. Otherwise, the relay object's start transmission method initializes itself and the input and output device objects, activates the input device object, and stores the handle for the new input device thread. The driver then constructs a timeout handler with a count of the number of messages to relay and a send timeout value, and pushes a timer with this handler onto the timer queue. If there is a limit on the duration of the transmission, the driver constructs a different handler for end-of-transmission, and pushes a timer for the end of the transmission with this handler onto the timer queue as well. When the user issues a cancel transmission command, the driver calls the relay's end transmission method. When a send timeout expires, the handler (running in the timer queue thread) calls the send method of the relay. If there are any enqueued messages from the input device object in its queue, the relay object's send method will dequeue a message, pass it to the output device object, and return success. If there are no messages in the queue, the relay object's send method will return failure. If the send was successful, the handler will decrement its count of remaining messages. If the count is greater than zero, the handler will register a new send timer for itself and exit. If the count is zero, then the handler will call the relay's end transmission method, clear the timer queue, and mark itself inactive before exiting. Similarly, if the end-of-transmission timer expires before all packets have been sent, that handler will call the relay's end transmission method, clear the timer queue, release the semaphore, and then exit. When the relay's end transmission method is called, it marks the relay itself inactive, and calls the input device's deactivate method, which sets the input device's activity flag to inactive (see below). The relay's end transmission method then waits until the input device thread exits, before returning. While it is still active, the input device thread blocks on a reactor timeout for the duration it was given by the relay. When the timeout expires, the input device checks a flag to see if it is still active. If the flag says the input device is inactive, the thread simply exits. This allows cancellation of the input device when a transmission has ended. If the flag says it is still active, the thread builds a new character buffer, and wraps this with a new ACE_Message_Block. The input device passes this message block to the execution method of the send input message command object with which it was constructed. This level of indirection allows the input device to be used with arbitrary types, so that it could for example be connected directly to an output device. The input device also maintains a count of the number of messages it has sent. Once the input device has sent all its messages, it marks itself inactive, and its thread simply exits. 4. ACCESSING THE SOURCE CODE The files for this example are located in $ACE_ROOT/examples/Bounded_Packet_Relay in the latest release of ACE, which is located at https://github.com/DOCGroup/ACE_TAO Source Files: Thread_Bounded_Packet_Relay.h Thread_Bounded_Packet_Relay.cpp BPR_Driver.h BPR_Driver.cpp BPR_Driver_T.h BPR_Driver_T.cpp bpr_thread.cpp Make file: Makefile Doc file: README (this file) Executable: bpr_thread ace-8.0.4+dfsg.orig/NEWS0000644000175000017500000031377215027201773013703 0ustar sudipsudipUSER VISIBLE CHANGES BETWEEN ACE-8.0.3 and ACE-8.0.4 ==================================================== . Fixed compile errors in the ACE core when compiled without thread support (only core of ACE compiled and not tested) USER VISIBLE CHANGES BETWEEN ACE-8.0.2 and ACE-8.0.3 ==================================================== . Deprecated ACE_Copy_Disabled in favor of deleted copy/assignment . Replaced usage of ACE_MIN and ACE_MAX with std::min/std::max . Add support for abstract paths to ACE_UNIX_ADDR . Improve support for 64bit file sizes . Minor fixes to ACE logging classes . Use C++11 default for more classes . GCC versions less than 9 and Clang versions less than 12 are no longer tested in GitHub Actions CI . Dropped support for Embarcadero C++ Builder bcc32c and bcc64 compilers . Updated support for Green Hills INTEGRITY and INTEGRITY-178 tuMP RTOS. Tested on INTEGRITY 11.4.6 and INTEGRITY-178 5.0.0. . Thread names given to ACE_OS::thr_create are now passed down to the OS on Windows and on INTEGRITY. USER VISIBLE CHANGES BETWEEN ACE-8.0.1 and ACE-8.0.2 ==================================================== . Removed ACE_make_checked_array_iterator that used deprecated stdext::checked_array_iterator . Embarcadero C++ Builder bcc64x compiler support has been updated to match the C++Builder 12.2 release . Added support for Linux platforms that use musl-libc instead of glibc . Improved QNX support . Add support for std::string_view to CDR classes . Define ACE_HAS_CPP23 when we have a C++23 capable C++ compiler USER VISIBLE CHANGES BETWEEN ACE-8.0.0 and ACE-8.0.1 ==================================================== . When using the Embarcadero C++ Builder bcc64x compiler now bcc64x is used as linker instead of ld.lld USER VISIBLE CHANGES BETWEEN ACE-7.1.4 and ACE-8.0.0 ==================================================== . ACE/TAO now require C++17 or newer . Add support for Embarcadero C++ Builder bcc64x compiler . Removed ace/Auto_Ptr.*, with C++17 std::auto_ptr is not available anymore . New Latest_ACE8TAO4_Micro, Latest_ACE8TAO4_Minor, and Latest_ACE8TAO4_Major branches USER VISIBLE CHANGES BETWEEN ACE-7.1.3 and ACE-7.1.4 ==================================================== . With g++ versions < 11 we default to C++17 as minimum C++ standards level USER VISIBLE CHANGES BETWEEN ACE-7.1.2 and ACE-7.1.3 ==================================================== . Fixed possible race conditions in extreme use case in the barrier and future implementations . Improve support for QNX 7.1 and FreeBSD . Integrated debian packaging changes USER VISIBLE CHANGES BETWEEN ACE-7.1.1 and ACE-7.1.2 ==================================================== . C++17 removed std::auto_ptr, updated ACE/TAO to not use std::auto_ptr anymore and also not provide our own auto_ptr. With C++17 ACE doesn't provide ACE_Auto_Ptr, ACE_Auto_Basic_Ptr, ACE_Auto_Basic_Array_Ptr, ACE_Auto_Array_Ptr, and ACE_auto_ptr_reset anymore, just use std::unique_ptr . Add c++std which can be used in the platform_macros.GNU to set the C++ revision to be used (results in -std= flag) . Improve support for QNX 7.1 . Embarcadero C++ Builder enhancements USER VISIBLE CHANGES BETWEEN ACE-7.1.0 and ACE-7.1.1 ==================================================== . Fixed shared memory leak by ACE_Shared_Memory_Pool . Fixed ACE_INET_Addr::set when ACE_LACKS_GETSERVBYNAME has been defined USER VISIBLE CHANGES BETWEEN ACE-7.0.11 and ACE-7.1.0 ===================================================== . Removed support for Windows CE, OpenVMS, HPUX, AIX, RTEMS, Pharlap, Solaris, and Visual Studio 2015 . ACE/TAO now require C++14 or newer USER VISIBLE CHANGES BETWEEN ACE-7.0.10 and ACE-7.0.11 ====================================================== . Fixed some compiler warnings given by newer compilers . Make use of noexcept instead of throw() . Fixed a bug in ACE_Configuration_Heap with uses_wchar=1 builds USER VISIBLE CHANGES BETWEEN ACE-7.0.9 and ACE-7.0.10 ===================================================== . Add missing resource files for several DLLs on Windows . VxWorks runtime fixes . Various cleanup and using more C++11 features . Embarcadero C++ Builder 11.2 fixes USER VISIBLE CHANGES BETWEEN ACE-7.0.8 and ACE-7.0.9 ==================================================== . Compile fixes for VxWorks 22.03 . Various cleanup . Minor fixes USER VISIBLE CHANGES BETWEEN ACE-7.0.7 and ACE-7.0.8 ==================================================== . Minor changes USER VISIBLE CHANGES BETWEEN ACE-7.0.6 and ACE-7.0.7 ==================================================== . Minor changes USER VISIBLE CHANGES BETWEEN ACE-7.0.5 and ACE-7.0.6 ==================================================== . Various cleanup and using more C++11 features . Various packaging related fixes USER VISIBLE CHANGES BETWEEN ACE-7.0.4 and ACE-7.0.5 ==================================================== . Initial not tested support for Visual Studio 2022 . Fixed compile errors when using Visual Studio 2019 with C++17 or C++20 support enabled . Various cleanup and using more C++11 features USER VISIBLE CHANGES BETWEEN ACE-7.0.3 and ACE-7.0.4 ==================================================== . Add support for Embarcadero C++ Builder 11.0 Alexandria using the bcc32c compiler . Allow ACE_Module and ACE_SOCK_Dgram_Mcast to be sub-classed . Add ACE_SWAP_LONG_LONG byte swap macro for ACE_UINT64 . Improved ACE_Atomic implementation for g++ . Various cleanup and using more C++11 features USER VISIBLE CHANGES BETWEEN ACE-7.0.2 and ACE-7.0.3 ==================================================== . The macro ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS has been renamed to ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS, update your code accordingly . MinGW 2 has been deprecated . ACE CDR supports (u)int8 . Use more C++11 features including using std alternatives . Various cleanup . Fix SocketConnect::ip_check() Concurrency and Too-Early Request Issues for Windows . Make install: use relative links in prefix/share USER VISIBLE CHANGES BETWEEN ACE-7.0.1 and ACE-7.0.2 ==================================================== . Fixed various warnings given by newer compilers . Use more C++11 features . Various cleanup USER VISIBLE CHANGES BETWEEN ACE-7.0.0 and ACE-7.0.1 ==================================================== . Cleanup of ACE_* macros which are not used anymore . Removed support for LynxOS 4 which has gcc3 . Make sure C++11 is enabled on MacOSX USER VISIBLE CHANGES BETWEEN ACE-6.5.12 and ACE-7.0.0 ===================================================== . C++11 is now a mandatory compiler feature which is required for ACE. Cleaned up part of the support for compilers that lack C++11 support . When valgrind is enabled we don't disable dlclose anymore, this reduces the amount of leaks reported related to dlclose. When you unload your shared libraries before the end of your program you can use `--keep-debuginfo=yes` as valgrind options as alternative or you can disable dlclose yourself by adding `#define ACE_LACKS_DLCLOSE` to your ace/config.h file . Removed `ACE_OS::readdir_r`. `readdir_r` was marked as depracated in glibc and FreeBSD libc. Also removed `ACE_Dirent::read (ACE_DIRENT *, ACE_DIRENT **)` which used it. `ACE_LACKS_READDIR_R` will now always be defined. . Modernized part of the code using clang-type, added override, use nullptr, use unique_ptr, remove redundant void, use bool, simplify boolean expressions, make use of std::atomic, use using . New Latest_ACE7TAO3_ branches which can be used to always checkout the latest ACE7/TAO3 micro/minor release . Android Support: . `gnuace` no longer supports Android NDKs before r18. This means only clang is now supported when building for Android. . Support for building with the Android NDK r19 or later directly instead of having to use a generated standalone toolchain. See `ACE-INSTALL.html` for details. Using a standalone toolchain is still supported. . Made it easier to use `gnuace`-built libraries in as imported libraries in CMake-based Android Studio native projects. . Removed support for old `ANDROID_ARCH` make variable. Replaced `ANDROID_ABI` with `android_abi`, but kept the former as an alias of the later for compatibility. Also will no longer default to 32-bit ARM, so `android_abi` or `ANDROID_ABI` must be defined. . As recommend by Google, building with neon support is now the default when `android_abi` is `armeabi-v7a`. If support for these processors without NEON extensions is needed, put `androind_neon := 0` in `platform_macros.GNU`. . As recommend by Google, `gnuace` will start using LLD, the LLVM linker, instead of the default GNU linkers. If the NDK being used doesn't default to LLD and you want to use the GNU linkers, put `androind_set_lld := 0` in `platform_macros.GNU`. . Removed support for the Alpha CPU USER VISIBLE CHANGES BETWEEN ACE-6.5.11 and ACE-6.5.12 ====================================================== . Fixed some C++11 warnings . Fixed compile problem on AIX . Removed c++0x and c++1y as GNU make variables, use c++11 and c++14 as alternatives . Moved all CI builds to github actions . Added ACE_GCC_NO_RETURN to fix fall through warnings . Fix ACE_Thread_Manager::join memory leak and potential deadlock USER VISIBLE CHANGES BETWEEN ACE-6.5.10 and ACE-6.5.11 ====================================================== . Latest_{Major,Minor,Micro,Beta} tags have been replaced with branches because tags are not intended to move where branches are . Removed emulated operations in ACE_OS which are not used anymore . Resolved some compile warnings when using C++11 or newer . Integrated debian packaging changes . Visual Studio 2015 solutions are not part of the release packaging anymore. When you require these you need to generate them locally using MPC . Improve multicast join by interface name on Windows . Fixed ACE_INT64_FORMAT_SPECIFIER (and similar) preprocessor macros on macOS (Apple-clang) with -std=c++11 or higher . On Windows, use unnamed kernel objects (Events and Semaphores) for thread-scoped reader-write mutexes in ACE_OS::rwlock_init USER VISIBLE CHANGES BETWEEN ACE-6.5.9 and ACE-6.5.10 ===================================================== . Add support for Embarcadero C++ Builder 10.4 Sydney using the classic compiler. ACE/TAO compile with the new 32/64 bit clang compilers but runtime tests show several runtime problems which makes them not safe to use . Make a change in the ACE Process Manager to resolve an internal compiler error with Visual Studio 2019 16.5.x compilers . Android enhancements for if_nameindex USER VISIBLE CHANGES BETWEEN ACE-6.5.8 and ACE-6.5.9 ==================================================== . On Windows, ACE no longer defines _WIN32_WINNT. ACE wrappers for if_nametoindex and if_indextoname are available if the version of the Windows SDK supports them. . IPv6 extended datagram receive info now supported on macOS. . ACE_(U)INT8/16/32/64 map to (u)int8/16/32/64_t when C++11 has been enabled. . CDR_Base uses ACE_INT64 for LongLong, all old emulated support has been removed . Updated debian and rpm packaging support USER VISIBLE CHANGES BETWEEN ACE-6.5.7 and ACE-6.5.8 ==================================================== . Added instructions to ACE-INSTALL.html for building ACE/TAO for Android on Windows. . Embarcadero C++ Builder Rio fixes . Renamed `VERSION` file to `VERSION.txt` to avoid conflicting with the `version` standard header. USER VISIBLE CHANGES BETWEEN ACE-6.5.6 and ACE-6.5.7 ==================================================== . Fixed compile problem with glibc 2.30 and newer . gnuace makefiles: Updated handling of generated files and use requires/avoids to make postbuild steps conditional . Removed references to the ACE_LACKS_MONOTONIC_TIME preprocessor macro because it was equivalent to ACE_LACKS_CLOCK_MONOTONIC. . Exposed support status of monotonic times features using preprocessor macros. See "Testing for Monotonic Time Support" in docs/ACE-monotonic-timer.html for details. . Added support for ARM and ARM64 stack traces with Microsoft Visual C++. . The "optional argument for the receive address in ACE_SOCK_Dgram::recv" feature from ACE-6.5.5 is now supported on Windows. This includes enhanced support for sendmsg/recvmsg on Windows. USER VISIBLE CHANGES BETWEEN ACE-6.5.5 and ACE-6.5.6 ==================================================== . On Linux, the ACE_Log_Msg format specifier `%t` is now replaced with the system thread id provided by gettid(), instead of the much longer pthread id. . Added support for MQX . Enhanced Android support USER VISIBLE CHANGES BETWEEN ACE-6.5.4 and ACE-6.5.5 ==================================================== . Fixed several broken links due to the removal of Douglas Schmidt website at WashU . On Android: . ACE_Log_Msg (and therefore ACE_DEBUG and ACE_ERROR) now uses Android's logging system (aka Logcat) by default in addition to stderr because stdout and stderr are discarded under normal circumstances. To disable this at runtime, run: ACE_LOG_MSG->clr_flags (ACE_Log_Msg::SYSLOG) To disable this at compile time include these lines in config.h: #define ACE_DEFAULT_LOG_FLAGS ACE_Log_Msg::STDERR #define ACE_DEFAULT_LOG_BACKEND_FLAGS 0 . When statically linking to OpenSSL, prevent usage of the preloaded and unpredictable system SSL library when using ace_openssl. . minizip has been moved from ACE to DANCE . Add initial support for Visual Studio 2019 . Validated ACE for usage SLES15.0 x86_64 using 32bit g++ compiler . Add optional argument for the receive address in ACE_SOCK_Dgram::recv USER VISIBLE CHANGES BETWEEN ACE-6.5.3 and ACE-6.5.4 ==================================================== . Fix ACE_Vector::end(), which now correctly represents the end of the elements of the vector instead of the end of the base array. USER VISIBLE CHANGES BETWEEN ACE-6.5.2 and ACE-6.5.3 ==================================================== . Enhance Android support . Fix AIX and Solaris linking rpath errors . Add support for SSL_INCDIR/SSL_LIBDIR and XERCESC_INCDIR/XERCESC_LIBDIR to specify a custom include/lib dir as required for vcpkg versions of openssl/xercesc USER VISIBLE CHANGES BETWEEN ACE-6.5.1 and ACE-6.5.2 ==================================================== . Enhanced C++Builder XE2 support . ACE_QtReactor can be built with Qt version 5 using the qt5 MPC feature USER VISIBLE CHANGES BETWEEN ACE-6.5.0 and ACE-6.5.1 ==================================================== . At the moment C++11 or newer is enabled ACE_Strong_Bound_Ptr doesn't provide the convenience functions to use a std::auto_ptr anymore . Optimized CDR std::(w)string insertion and extraction when C++11 or newer is enabled . Solved Visual Studio 2017 solution loading due to duplicate files generated in a project file USER VISIBLE CHANGES BETWEEN ACE-6.4.8 and ACE-6.5.0 ==================================================== . The ACE core libraries now use std::unique_ptr instead of std::auto_ptr when C++11 or newer is enabled USER VISIBLE CHANGES BETWEEN ACE-6.4.7 and ACE-6.4.8 ==================================================== . Enhanced Embarcadero C++ Builder support . ACE XML_Utils enhancements . Debian packaging enhancements . Support for clang6 and gcc8 . Enhanced Android support . Remove addr_any restriction from ipv6_only UDP USER VISIBLE CHANGES BETWEEN ACE-6.4.6 and ACE-6.4.7 ==================================================== . Added a new, optional argument named ipv6_only to: ACE_Acceptor::ACE_Acceptor ACE_Acceptor::open ACE_SOCK_Dgram::ACE_SOCK_Dgram ACE_SOCK_Dgram::open If ipv6_only is 0/false (the default) the socket will accept both IPv6 and IPv4 connections/datagrams. If ipv6_only is 1/true the socket will only accept IPv6. This behavior only applies when ACE_HAS_IPV6 is true and the local-side IP address is the generic localhost IP address. . Integrated some changes from XSC into XML Utils . Enable ACE_HAS_CPP11 when we have clang with C++11 enabled . Added support for cross compiling using MinGW on a Linux host . Added support for FreeBSD 11 . Fixed issue ACE_Singleton was broken after ACE::fini, ACE::init (GitHub #554) USER VISIBLE CHANGES BETWEEN ACE-6.4.5 and ACE-6.4.6 ==================================================== . Fixed some Codacy and C++ Core guidelines reported issues . VxWorks 7 (SR0510) support . Support make install on newer Apple MacOS versions USER VISIBLE CHANGES BETWEEN ACE-6.4.4 and ACE-6.4.5 ==================================================== . Add support for OpenSSL 1.1. ACE users on Windows have to add openssl11=1 to their default.features file so that the correct OpenSSL library names are used. USER VISIBLE CHANGES BETWEEN ACE-6.4.3 and ACE-6.4.4 ==================================================== . Enhanced support for Embarcadero C++ Builder 10.2 (Tokyo). Support for bcc32/bcc64/bcc32c has been enhanced and by default the clang based versions are used. When the old bcc32 has to be used set the CLASSIC environment variable to 1. At this moment runtime test results for bcc64/bcc32c show some structural problems . Add support for Oracle Studio 12.5 . Removed usage of ACE_REGISTER and register keyword because they trigger deprecated warnings with newer gcc and clang versions . Add support for gcc 7 . Enhanced Android support . Fix ACE_INET_Addr::set(domain_name, AF_UNSPEC) to be set to IPv4 address when IPv6 is enabled and the domain_name could be resolved to IPv4 address. USER VISIBLE CHANGES BETWEEN ACE-6.4.2 and ACE-6.4.3 ==================================================== . Enhancements for Visual Studio 2017 . Enhancements for Android USER VISIBLE CHANGES BETWEEN ACE-6.4.1 and ACE-6.4.2 ==================================================== . Added support for Mac OS X on x86_64 to get the network adapter address in ACE_OS::getmacaddress(). . Added support for the December 2016 updates to VxWorks 7. USER VISIBLE CHANGES BETWEEN ACE-6.4.0 and ACE-6.4.1 ==================================================== . The ACE_DEBUG environment variable can again be used to set the internal debug flag. This used to work but was mistakenly changed in an earlier release. . Corrected usage of ACE_Singleton and template instantation to be valid C++ (GCC cross-compiler arm-linux-gnueabihf-g++ requires it). . Added support for detecting the Mac OS X version when configured with ace/config-macosx.h and include/makeinclude/platform_macosx.GNU. Also on 10.11 El Capitan, use rpath to avoid a problem with SIP. . Added support for Android NDK r12b (Platform API 24) and improved cross compilation support USER VISIBLE CHANGES BETWEEN ACE-6.3.4 and ACE-6.4.0 ==================================================== . Added support for obtaining the micro version number . Reduced include of ace/Auto_Ptr.h in header files USER VISIBLE CHANGES BETWEEN ACE-6.3.3 and ACE-6.3.4 ==================================================== . ACE_SSL_Context::set_mode() can no longer be used to select a specific SSL/TLS protocol version, use ACE_SSL_Context::filter_versions() for that. This follows general advice by the OpenSSL project to go through SSL_CTX_set_options() to limit the list of protocols available. The purpose of ACE_SSL_Context::set_mode() is now limited to explicitly restricting behaviour to client or server (defaults to both). . Improve Oracle Studio support . CIAO and DAnCE are forked to their own github repositories and are not part anymore of the ACE+TAO release packages . Fixed several Coverity reported issues . Added ACE configuration for FACE safety profiles (see config-face-safety.h). FACE, or Future Airborne Capability Environment http://www.opengroup.org/face, specifies a restricted subset of OS functions and rules for controlling dynamic memory allocation. When built in this configuration on a platform that supports it, ACE conforms to the FACE requirements. . ACE uses new netdb.h functions (getaddrinfo/getnameinfo) if they are available, in place of deprecated functions (gethostbyname/addr). USER VISIBLE CHANGES BETWEEN ACE-6.3.2 and ACE-6.3.3 ==================================================== . Visual Studio 2015 has adequate C++11 support, because of this ACE_HAS_CPP11 is now defined with this compiler. A large amount of warnings given by this new compiler have been fixed . As part of the release script we generate vc12 and vc14 solution files which are packaged as part of the release . Added support for VxWorks 7 (kernel mode and RTP). See the comments in include/makeinclude/platform_vxworks7.0.GNU for details. . Ended daily maintenance for OpenVMS . Fixed a defect in ACE_INET_Addr when there is a non-empty interface address list and set_port_number() is called. USER VISIBLE CHANGES BETWEEN ACE-6.3.1 and ACE-6.3.2 ==================================================== . Added support for std::chrono to ACE_Time_Value. It's now possible to construct an ACE_Time_Value with a std::duration. Also streaming, adding and substracting an ACE_Time_Value to and from a std::duration is supported. Please see tests/Chrono_Test.cpp for more details. . Allow ACE_INET_Addr to hold all addresses associated with a hostname. The set of addresses always has a "current" address which is accessed by the usual "get"-type methods on the class. Two new methods are added to deal with multiple addresses: - bool next (void): makes the next available address the "current" one. Returns false if there are no more addresses. - void reset (void): resets the iteration mechanism to be able to examine all of the addresses again. ACE_Multihomed_INET_Addr has also been enhanced so that the get_addresses() methods copy all available addresses related to each name. . The ACE_Addr::set_addr (void*, int) signature was changed to ACE_Addr::set_addr (const void*, int). All classes that inherit from ACE_Addr also have the same change. This affects ACE_ATM_Addr, ACE_Addr, ACE_INET_Addr, ACE_MEM_Addr, ACE_Netlink_Addr, ACE_SPIPE_Addr, ACE_UNIX_Addr. Any user-written classes derived from ACE_Addr will also need to change to match the new signature for virtual method dispatch to continue working properly in all cases. . Added the class ACE_CDR::Fixed (CDR_Base.h) for CDR's fixed-point decimal data type which stores up to 31 decimal digits and a sign bit. USER VISIBLE CHANGES BETWEEN ACE-6.3.0 and ACE-6.3.1 ==================================================== . ACE is now hosted on github (https://github.com/DOCGroup/ATCD). As part of the release process we now generate a ChangeLog for each release which is stored in the ChangeLogs directory . ACE has been ported to OpenBSD 5.6. Old versions of OpenBSD are no longer supported. USER VISIBLE CHANGES BETWEEN ACE-6.2.8 and ACE-6.3.0 ==================================================== . ACE now supports Oracle Solaris Studio 12.4 on Solaris. . New config macros were added: ACE_DISABLE_MKTEMP: Disables the availability of ACE_OS::mktemp(). ACE_DISABLE_TEMPNAM: Disables the availability of ACE_OS::tempnam(). These can be added to your $ACE_ROOT/ace/config.h to disable these wrappers which are considered to be a potential security risk. Disabling one or both will also disable the following: - ACE_FILE_Addr::set () with the 'any' address specified. - ACE_MMAP_Memory_Pool use of the 'unique' option. . Reduced size of all doxygen documentation by changing the type of diagrams shown . Removed Windows specific workarounds from ACE_OS::setsockopt, as a result SO_REUSEPORT is not defined anymore on Windows and SO_REUSEADDR is passed directly to the OS . By adding a 'specific' section to a MPC (base) project it is now possible to have object file output directories per project for GNUACE projects. The following should be added to MPC projects (bugzilla #3868): specific(gnuace) { build_dir_per_project=1 } . ACE_Asynch_Write_File will now correctly accept non-socket (file, TTY ..) handles (bugzilla #3762 and #3992) . Fixes for VxWorks 6.9 USER VISIBLE CHANGES BETWEEN ACE-6.2.7 and ACE-6.2.8 ==================================================== . Add new ACE::make_event_handler() which is similar to std::make_shared but than for allocation of ACE event handlers. This template method is only enabled when ACE_HAS_CPP11 has been defined, which is set automatically when a C++ compiler with adequate C++11 support is used. Also ACE_Event_Handler_var is extended with some C++11 specific operations . For all reactor types calling cancel_timer with a nullptr is now allowed, will result in a return of 0 . ACE_DLL and ACE_DLL_Manager have been extended with the support to retrieve any dynamic loader errors USER VISIBLE CHANGES BETWEEN ACE-6.2.6 and ACE-6.2.7 ==================================================== . Added configuration files for Microsoft Visual Studio 2014 . Added configuration files for MacOSX Yosemite . Added configuration files for IBM AIX XL C++ 12.1 USER VISIBLE CHANGES BETWEEN ACE-6.2.5 and ACE-6.2.6 ==================================================== . Resolved several data races reported by Intel Inspector XE . Added optional socket connection optimization for Windows . Improve functionality and stability of running tests on Android Virtual Device (AVD). USER VISIBLE CHANGES BETWEEN ACE-6.2.4 and ACE-6.2.5 ==================================================== . Added the ability to build RPMs for just ACE, using an ACE-src tarball. To do this add "--without tao" to the rpmbuild command line. . Added support for Embarcadero C++Builder XE5 using bcc32 in debug and release mode . Added support for Embarcadero C++Builder XE6 using bcc32 in debug and release mode . When Intel C++ 2013 SP1 Update 2 is used with C++11 enabled as compiler feature now also ACE_HAS_CPP11 will be defined, this compiler is now able to compile all our C++11 feature tests . Fixed several boundary bugs in the ACE RLE Compressor USER VISIBLE CHANGES BETWEEN ACE-6.2.3 and ACE-6.2.4 ==================================================== . Added support for FC20 and ended maintenance for FC19 . Extended C++11 feature test suite . Improved support for MingW64 . Improvements to IPv6 support on Windows USER VISIBLE CHANGES BETWEEN ACE-6.2.2 and ACE-6.2.3 ==================================================== . The ACE_OS::thr_join() method will detect if the thread to be waited on is the calling thread and avert that deadlock. The support needed for this method is available at Vista/Windows Server 2003 and higher; to enable the deadlock prevention, compile ACE with _WIN32_WINNT=0x0502 or higher. . Ended maintenance and support for FC12 CEEL . Further improvements of the Android port: Added new define ACE_HAS_EXPLICIT_TEMPLATE_CLASS_INSTANTIATION and related macros ACE_SINGLETON_TEMPLATE_INSTANTIATION and ACE_SINGLETON_TEMPLATE_INSTANTIATE providing a cleaner way to support explicit template (static member or class) instantiation. ' Improvements of the test framework for running tests in a mixed environment where different targets run on different physiscal devices (possibly having different OS). USER VISIBLE CHANGES BETWEEN ACE-6.2.1 and ACE-6.2.2 ==================================================== . The max_len argument to ACE_Process::command_line_buf changed from int* to size_t*. This corrects a mismatch between the argument type and the data member in ACE_Process from which the value comes. . Removed some include files from ACE.h. These were not required for ACE. The removed includes are OS_NS_math, Flag_Manip, Handle_Ops, Lib_Find, Init_ACE, Sock_Connect.h. You may have to explicitly add one of these in your own code to restore compiling. . Further improvements of the Android port, still work in progress. USER VISIBLE CHANGES BETWEEN ACE-6.2.0 and ACE-6.2.1 ==================================================== . Added support for Fedora 19, ended daily maintenance for Fedora 17 and 18 . Added support for Embarcadero C++BuilderXE4 using bcc32 in debug and release mode . Improved support for Android USER VISIBLE CHANGES BETWEEN ACE-6.1.9 and ACE-6.2.0 ==================================================== . None USER VISIBLE CHANGES BETWEEN ACE-6.1.8 and ACE-6.1.9 ==================================================== . Added MinGW64 as supported platform . Added support for GCC 4.8.0 USER VISIBLE CHANGES BETWEEN ACE-6.1.7 and ACE-6.1.8 ==================================================== . Small bug fixes USER VISIBLE CHANGES BETWEEN ACE-6.1.6 and ACE-6.1.7 ==================================================== . Integrated several patches to simplify Debian/Ubuntu packaging USER VISIBLE CHANGES BETWEEN ACE-6.1.5 and ACE-6.1.6 ==================================================== . Added new event and sema initialization methods to OS_NS_Thread to allow passing pre-initialized condition attributes providing basic support for using time policies in ACE Event classes. . Added TIME_POLICY support to ACE_Event classes to allow for monotonic timer support for ACE Events. . Added new regression test: Monotonic_Manual_Event_Test USER VISIBLE CHANGES BETWEEN ACE-6.1.4 and ACE-6.1.5 ==================================================== . When a ACE_Event_Handler registered for signals is unregistered, whether by unregistering, returning -1 from handle_signal(), or by the reactor closing, the ACE_Event_Handler::handle_close() hook will be called. The close_mask passed will be ACE_Event_Handler::SIGNAL_MASK. In previous versions, handle_close() would only be called when the handle_signal() callback returned -1. This resolves Bugzilla #2368. . Some initial ACE unit tests to validate the C++11 support of various compilers . Added support for OpenSuSE 12.2 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 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, 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 ==================================================== . Two new methods were added to ACE_Pipe: close_read() and close_write(). These methods can be used to close individual pipe handles. . The ACE::handle_ready() family of methods was changed to prefer using poll() over select() on platforms where poll() is available. 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. . Added a simple helper ACE::is_equal() which compares equality of two objects without using operator==. This is useful for comparing floating point values. . Removed all deprecated methods, arguments, files, classes, macros and anything else we kept for years. . Removed Irix/Tru64/SCO/Uniware/Cray support . ACE_Pair has been removed. Users should now use std::pair. . This is the last micro release that will work with GCC < 3, after x.8.3 support for GCC < 3 will be removed USER VISIBLE CHANGES BETWEEN ACE-5.8.1 and ACE-5.8.2 ==================================================== . Added support for the Microsoft Visual Studio 2010 IDE (vc10) . Removed complete support for emulated C++ exceptions USER VISIBLE CHANGES BETWEEN ACE-5.8.0 and ACE-5.8.1 ==================================================== . Added support for Microsoft Visual Studio 2010 using nmake . Reduced the amount of doxygen pages generated, the original settings caused a doxygen generated html package of 1.4GB which was way too large . Extended ACE INet addon library with: * HTTP Basic Authentication * SSL/HTTPS support. * Proxy CONNECT tunneling. USER VISIBLE CHANGES BETWEEN ACE-5.7.9 and ACE-5.8.0 ==================================================== . There are two new ACE_Time_Value methods for getting and setting millisecond values to/from ACE_UINT64 values: ACE_UINT64 ACE_Time_Value::get_msec () const void ACE_Time_Value::set_msec (const ACE_UINT64 &ms) The former is a replacement for the existing msec(ACE_UINT64&) methods that are "getter" methods whose signatures look confusingly like "setters". See Bugzilla #3336 for the history behind this change. The latter is for consistency and clarity. . Added ACE INet addon library for Inet protocol clients (and possibly servers at some point) like http://, ftp:// etc. The library implements standard C++ iostream wrapper classes for ACE Svc_Handler and Reactor based input/output handling, URL classes and protocol handler classes. NOTE: This is work in progress! There is no guarentee that the API won't change in the next few releases. Protocol handling is currently restricted to client side download requests for HTTP and FTP. Handling for upload requests should be added in the near future as well as HTTP Basic Authentication. USER VISIBLE CHANGES BETWEEN ACE-5.7.8 and ACE-5.7.9 ==================================================== . ACE's default makefiles (traditional ACE/GNU, not autoconf/automake) now support installation with "make install". Please see the ACE-INSTALL.html file for instructions. . Support for the ARCH make variable has been enhanced to apply to executables (in addition to libraries and object files), and the ARCH feature has been integrated into the MPC-generated makefiles (to work with MPC's requires and avoids features). USER VISIBLE CHANGES BETWEEN ACE-5.7.7 and ACE-5.7.8 ==================================================== . ACE now uses GCC builtin Atomic instructions for short, unsigned short, long, unsigned long, int, unsigned int, and bool. This makes our Atomic_Op around 7 times faster . ACE Service Configuration Framework now process first service configuration files and then command-line directives. Thus if application uses both service configuration files and command-line directives then the command-line directives may override results of directives in the configuration files. At the same time if the application uses only the default svc.conf file and command-line directives then the directives from svc.conf can not override results of the user provided command-line directives. . ACE_Dev_Poll_Reactor now dispatches notifications in only one thread at a time. This brings notification handling more in line with behavior in other Reactor implementations. USER VISIBLE CHANGES BETWEEN ACE-5.7.6 and ACE-5.7.7 ==================================================== . Integrated fix for bug 3104 and regression test for interval timers. . Added support for GCC builtin Atomic instructions which are enabled with GCC >= 4.1 for PPC32/PPC64/IA64 . Improved autoconf support for debian . Added support for -mcpu and -mtune. Add TCPU=.. to your environment/platform_macros.GNU to specify you cpu and than add cpumodelflag=1 and/or tunemodelflag=1. Using this with IBM Cell increased the performance significantly USER VISIBLE CHANGES BETWEEN ACE-5.7.5 and ACE-5.7.6 ==================================================== . Added support for iPhone/iPod Touch/iPad. The following environment variables are needed: IPHONE_TARGET, should be set to either SIMULATOR or HARDWARE. Set to HARDWARE if you want to deploy on the iPhone/iPod Touch/iPad device. IPHONE_VERSION, should be set to 3.1.2 or 3.2. One can set the version to any future or past versions, but only 3.1.2 and 3.2 have been tried. Note that one has to compile ACE/TAO statically as it is believed that the iPhone OS does not support dynamic loading of external libraries. The usual procedure of cross compiling ACE/TAO applies (such as setting HOST_ROOT environment variable). . Added support for Embarcadero C++ Builder 2010 . Added option to print a given ACE_Time_Value in the log message instead of system supplied timestamp as in %T and %D. The option is implemented as a variant of the %D/%T options by using the '#' flag character like '%#D' or '%#T'. When using this flag an ACE_Time_Value pointer is expected in the argument list supplied with the log message. This fixed Bugzilla #3221. . Fixed problems with ACE_INET_Addr::is_multicast() on little endian platforms. This fixed bugzilla #3729. . Added compilation support for VxWorks 6.8, no runtime testing has been performed USER VISIBLE CHANGES BETWEEN ACE-5.7.4 and ACE-5.7.5 ==================================================== . Added MacOSX Snow Leopard support . Added strsignal() wrapper . Improved LynxOS support . Updated Interix port . Fixed MinGW compilation problems USER VISIBLE CHANGES BETWEEN ACE-5.7.3 and ACE-5.7.4 ==================================================== . ACE_CDR::consolidate now returns an int, 0 is ok, -1 is failure . Fixed a bug in the realclean feature of the GNU makefiles . Improved Sun Studio for Linux support . Improved OpenBSD support USER VISIBLE CHANGES BETWEEN ACE-5.7.2 and ACE-5.7.3 ==================================================== . C++ Builder 2009 Update 3 is the only C++Builder that is supported, older and newer compilers are not supported anymore . Made final changes for the CEGCC port . Added a set of tests to validate C++ compiler and the stl implementation they ship. . HP-UX PARISC aCC < 3.80 are deprecated and can't be used anymore. Upgrade to aCC 3.80 or newer USER VISIBLE CHANGES BETWEEN ACE-5.7.1 and ACE-5.7.2 ==================================================== . Borland C++ makefiles aren't shipped anymore as part of the release but have to be generated by the user . Refactored gperf to have its own shared library so that we can reuse that in TAO . Added support for SuSE Enterprise 10 . ACE_Configuration_Heap::open() now returns -1 with errno EBUSY if it is called multiple times. Previous versions would allow multiple calls to open() but leak resources. USER VISIBLE CHANGES BETWEEN ACE-5.7.0 and ACE-5.7.1 ==================================================== . Added support for Sun Studio 12 Update Pack 1 . Fixed compile problems when using Windows CE x86 release mode . Fixed compile problems for FreeBSD USER VISIBLE CHANGES BETWEEN ACE-5.6.9 and ACE-5.7.0 ==================================================== . Added support for the VxWorks vxAtomicLib which is available with VxWorks 6.6 and newer. If you don't want to use this library undef ACE_HAS_VXATOMICLIB in your config.h file . Added support for C++ Builder 2009 Update 3 . Added support for ACE/TAO using the CEGCC project . Added support for upcoming Fedora 11 and OpenSuSE Factory USER VISIBLE CHANGES BETWEEN ACE-5.6.8 and ACE-5.6.9 ==================================================== . Removed Borland/CodeGear C++ Builder 2007 support. If you'd like to fund this support please let us know. . Removed VxWorks 5.5.x, 6.2, and 6.3 support. If you'd like to fund this support please let us know. . Improved Unicode support. . Added support for the native Windows Vista and Windows Server 2008 condition variables. These has to be enabled at compile time, and when enabled the application can only run on Vista or Server 2008. Add ACE_HAS_WTHREADS_CONDITION_VARIABLE to your config.h file to enable these . Fixed a bug when trying to read a file of 1 byte when unicode is enabled . Improved the Windows CE port . Fixed several Klocwork reported issues . Added support for MinGW 3.15 . Added support for Incredibuild, which is an MSVC++ feature that optimizes compiles via distributing builds. USER VISIBLE CHANGES BETWEEN ACE-5.6.7 and ACE-5.6.8 ==================================================== . Added a new function ACE::isdotdir() which determines if a specified pathname is "dot dir" (ie. "." or ".."). ACE::isdotdir() is significantly faster than pair of strcmp() calls. . Last micro release that is maintained for Borland/CodeGear C++ Builder 2007 and Intel C++ on Windows. . Fixed crash when ACE thread tries to inherit the logging attributes from non ACE threads. . Fixed many small compile and test errors that occur on some platforms. . Fixed log output formatting on some platforms. . Bugs fixed: 2748, 3164, 3480, 3494, 3502, 3541, 3542, 3544, 3557. USER VISIBLE CHANGES BETWEEN ACE-5.6.6 and ACE-5.6.7 ==================================================== . Changed the automake build's feature test for a "usable" config to warn on failure instead of exiting with an error. This should make it easier to diagnose configure failures, as the script will now generate a config.h file even when the test fails. . Removed borland MPC template, use the bmake template from now . Added Windows Mobile 6 support and improved the WinCE port . Removed BCB6 and BCB2006 support . Added BCB2009 MPC template . Updated stat struct on Windows CE to match the stat struct on other platforms so that application code can be written portable . Added new ACE_OS wrappers: raise, atof, atol, isblank, isascii, isctype, and iswctype . Added ACE_OS wrapper for narrow-char version of strtoll. . ACE_OS wrappers for wide-char versions of strtol, strtoul, strtoll, and strtoll. . Added Visual Studio 2010 (vc10) support . Added a new feature for the "Traditional Make" build facility to allow building for multiple architectures out of a single source directory. To use this facility, set the ARCH make variable. The ARCH value will be used to add a subdirectory layer below the source directory where the traditional .shobj, .obj, etc. directories will be placed. . Added support for HP-UX 11iv3 on Integrity using aC++ . ACE (and TAO) can now be built using GNU make and the Microsoft Visual C++ compiler and linker. See include/makeinclude/platform_win32_msvc.GNU for more details. . Added support for FC10 USER VISIBLE CHANGES BETWEEN ACE-5.6.5 and ACE-5.6.6 ==================================================== . Added an option to the ACE_Process_Options class to use a wchar_t environment buffer on Windows. . A new configure option, --enable-rcsid, was added to the autoconf build. This is used to embed RCS IDs in object files. . A new method was added: void ACE_Time_Value::msec (ACE_UINT64&) This method, like the existing msec(ACE_UINT64&)const method, obtains the time value in milliseconds and stores it in the passed ACE_UINT64 object. This method was added so that msec(ACE_UINT64&) can be called on both const and non-const ACE_Time_Value objects without triggering compile errors. Fixes Bugzilla #3336. . Added ACE_Stack_Trace class to allow users to obtain a stack trace within their application on supported platforms. A new conversion character, the question mark, was added to ACE_Log_Msg for stack trace logging. . Added iterator support to ACE_Message_Queue_Ex class. The resulted in the addition of ACE_Message_Queue_Ex_Iterator class and ACE_Message_Queue_Ex_Reverse_Iterator class. . Renamed gperf to ace_gperf to prevent clashes with the regular gperf tool that is available in linux distributions . Added support for FC9 . Added support for OpenSuSE 11.0 . Improved support for GCC 4.2 and 4.3 . Added support for CodeGear C++ Builder 2009 USER VISIBLE CHANGES BETWEEN ACE-5.6.4 and ACE-5.6.5 ==================================================== . Added new Monitoring lib that can be used to store and retrieve counters. This is disabled by default because it is not 100% finished yet, with the next release it will be enabled by default . Fixed bug in ACE_Service_Config when it was used from a thread not spawned by ACE . Add VxWorks 6.x kernel mode with shared library support to ACE . Extended the implementation of Unbounded_Set, which has been renamed Unbounded_Set_Ex, to accept a second parameter which is a comparator that implements operator() which returns true if the items are equivalent. Unbounded_Set has been reimplemented in terms of Unbounded_Set_Ex using a comparator that uses operator==, which captures the previous behavior. . Added support for Intel C++ on MacOSX USER VISIBLE CHANGES BETWEEN ACE-5.6.3 and ACE-5.6.4 ==================================================== . Reworked the relationship between ACE_Service_Config and ACE_Service_Gestalt . Improved autoconf support . Improved AIX with gcc support . Improved OpenVMS support . Improved VxWorks support USER VISIBLE CHANGES BETWEEN ACE-5.6.2 and ACE-5.6.3 ==================================================== . Deprecated Visual Age 5 and older . Closed a rare race condition hole whereby ACE_Atomic_Op<> function pointers would not be fully initialized prior to use. See bugzilla 3185 for details. . Tweaks to support MacOS X Leopard (10.5 and 10.5.1) on Intel . Fixed compile problems with MinGW with GCC 4.2. Do note that we do see much more test failures then when using GCC 3.4. . Changed to use synchronous exception handling with msvc 8/9 which is the default. Asynchrous exception handling does catch access violations but it leads to lower performance and other problems. See also bugzilla 3169 . Make ace_main extern C with VxWorks so that it doesn't get mangled . Fixed compile errors and warnings for VxWorks 6.6 . Added an MPC generator for the WindRiver Workbench 2.6 which is shipped with VxWorks 6.4 . Added support for CodeGear C++ Builder 2007 with December 2007 update installed . Added support for VxWorks 5.5.1 . Implemented the const reverse iterator for ACE_Hash_Map_Manager_Ex . Increased support for using ACE_Hash_Map_Manager_Ex with STL functions based on latest standard C++ draft USER VISIBLE CHANGES BETWEEN ACE-5.6.1 and ACE-5.6.2 ==================================================== . ACE-ified the UUID class, which will change user applications slightly. . Added support for Sun Studio 12 . Added support for Intel C++ 10.1 . Fixed runtime problems with VxWorks 6.x in kernel mode, several improvements have been made to ACE, but also some problems in the VxWorks kernel have been found for which WindRiver has made patches. . Added support for VxWorks 6.5 kernel mode . Added support for MacOS 10.5 . Support for MacOS 10.4 is now deprecated. . Added support for OpenSuSE 10.3 . Added support for RedHat 5.1 . Added support for Microsoft Visual Studio 2008 . Added support for Fedora Core 8 . Added support for Ubuntu 7.10 . With Ubuntu 7.04 and 7.10 we can't use visibility, that results in unresolved externals when building some tests. With lsb_release we now detect Ubuntu 7.04 and 7.10 automatically and then we disable visibility . Removed deprecated (un)subscribe methods from ACE_SOCK_Dgram_Mcast . Added an additional replace() method to ACE_OuptutCDR for replacing a ACE_CDR::Short value. Also added write_long_placeholder() and write_short_placeholder() to properly align the stream's write pointer, write a placeholder value and return the placeholder's pointer. The pointer can later be used in a call to replace() to replace the placeholder with a different value. . Initial support for VxWorks 6.6 . Removed support for pthread draft 4, 6, & 7. This makes the ACE threading code much cleaner . Improved autoconf support . Fixed TSS emulation problems . Changed ACE_thread_t and ACE_hthread_t to int for VxWorks kernel mode. All thread creation methods do have an additional const char* argument to specify the task name, this now also works with pthread support enabled . Use bool in much more interfaces where this is possible . Added support for Debian Etch . Fixed ACE CDR LongDouble support on VxWorks 6.x . Added Microsoft Visual Studio 2008 project files to the release packages . Fixed a few bugs in the ACE_Vector template USER VISIBLE CHANGES BETWEEN ACE-5.6 and ACE-5.6.1 ==================================================== . Added support for CodeGear RAD Studio 2007 . Added support for CodeGear C++ Builder 2007 Update 3 . Modified the definiton of ACE_DEFAULT_THREAD_KEYS on Windows so it is based on the version of the OS as defined by Microsoft in this web page: http://tinyurl.com/2jqcmd This fixes bugzilla #2753 USER VISIBLE CHANGES BETWEEN ACE-5.5.10 and ACE-5.6 ==================================================== . OpenVMS 8.3 on IA64 port . Added autoconf support for Intel C++ 10.0 . Improved autoconf support on Linux, Solaris, NetBSD and HPUX . CodeGear C++ Builder 2007 Update 2 support . The netsvcs's client logging daemon has a new configuration option, -llocal-ip[:local-port], which can be used to specify the local IP address and port number for the client logging daemon's connection to the server logging daemon. If the -l option is specified with an IP address but not a port number, an unused port number is selected. . A new ACE+TAO port to LabVIEW RT 8.2 with Pharlap ETS. The host build environment is Windows with Microsoft Visual Studio .NET 2003 (VC7.1). Please see the ACE-INSTALL.html file for build instructions. USER VISIBLE CHANGES BETWEEN ACE-5.5.9 and ACE-5.5.10 ==================================================== . The ACE_utsname struct, used in the ACE_OS::uname() function when the platform doesn't provide the standard utsname struct, was changed. It defines a number of text fields and their types were changed from ACE_TCHAR[] to char[] in order to be consistent with all other platforms. This removes the need to write different code for platforms where ACE_LACKS_UTSNAME_T is set and that have wide characters (most probably Windows). Fixes Bugzilla #2665. . The ACE::daemonize() "close_all_handles" parameter was changed from an "int" to a "bool" to better reflect how it is used. . VxWorks 6.5 support. Compilation of the core libraries has been validated but no runtime testing has been performed. . CodeGear C++ Builder 2007 support. . The FaCE utility was moved from the ACE_wrappers/apps directory to ACE_wrappers/contrib. It is used for testing ACE+TAO apps on WinCE. See the ACE_wrappers/contrib/FaCE/README file for more information. . ACE_INET_Addr::set (u_short port, char *host_name, ...) now favors IPv6 addresses when compiled with ACE_HAS_IPV6 defined and the supplied address family is AF_UNSPEC. This means that if host_name has an IPv6 address in DNS or /etc/hosts, that will be used over an IPv4 address. If no IPv6 address exists for host_name, then its IPv4 address will be used. . Intel C++ 10.0 support . Support for the version of vc8 for 64-bit (AMD64) shipped with the Microsoft Platform SDK. . Fixed ACE_Vector::swap() (bugzilla #2951). . Make use of the Atomic_Op optimizations on Intel EM64T processors. The Atomic_Op is now several times faster on EM64T then with previous versions of ACE USER VISIBLE CHANGES BETWEEN ACE-5.5.8 and ACE-5.5.9 ==================================================== . Use Intel C++ specific optimizations for Linux on IA64 . Improved support for ACE_OS::fgetc. Added support for ACE_OS::fputc, ACE_OS::getc, ACE_OS::putc and ACE_OS::ungetc. . Added support for ACE_OS::log2(double) and improved support for ACE::log2(u_long). . Shared library builds on AIX now produce a libxxx.so file instead of the previous practice of producing libxxx.a(shr.o). . GCC 4.1.2 that comes with Fedora 7 seems to have a fix for the visibility attribute we use for the singletons. F7 users will therefore need to define the following in your config.h file. ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS 1 . Fixed (rare) problem in TP_Reactor where incorrect event handler was resumed. . Reduced footprint on some platforms, particularly those that use g++ >= 3.3. USER VISIBLE CHANGES BETWEEN ACE-5.5.7 and ACE-5.5.8 ==================================================== . Extended ACE_Event constructor with optional LPSECURITY_ATTRIBUTES argument . Added support for QT4 . Added support to integrate with the FOX Toolkit (www.fox-toolkit.org) . Added support for Microsoft Visual Studio Code Name "Orcas", which is the msvc9 beta . Added ability to provide an optional priority when calling ACE_Message_Queue_Ex::enqueue_prio(). There was previously no way to specify a priority for queueing. . Removed support for Visual Age on Windows. . ACE will compile once again with ACE_LACKS_CDR_ALIGNMENT #defined. . ACE_Process_Manager::terminate() no longer removes the process from the process descriptor table; the pid remains available in order to call ACE_Process_Manager::wait(). USER VISIBLE CHANGES BETWEEN ACE-5.5.6 and ACE-5.5.7 ==================================================== . ACE 5.5 contained a set of pragmas which prevented Visual Studio 2005 (VC8) from issuing warnings where C run-time functions are used but a more secure alternative is available. For more information on the C run-time issues and Microsoft's response, please see the following MSDN page: http://msdn2.microsoft.com/en-us/library/8ef0s5kh(VS.80).aspx. In this beta, the pragmas which prevented the warnings have been removed. The ACE library has been reviewed and most of the use of "unsafe" functions has been fixed where possible. Since not all of the warnings emanating from ACE are situations that can or should be fixed, the ACE VC8 projects will prevent the warnings while building the ACE kit and its contained examples, tests, etc. The warnings are disabled by adding Microsoft-specified macros to the compile line via MPC. If desired, the warnings can be re-enabled by regenerating the project files with different MPC features. Note, however, that while ACE without warnings caused by the new C run-time functions, your application builds may trigger these warnings either by use of the "unsafe" C run-time functions or via use of an inlined ACE_OS method which uses it. If the warning is caused by an ACE_OS method, there is a more safe alternate available, probably located by appending _r to the method name (e.g., instead of using ACE_OS::ctime(), use ACE_OS::ctime_r()). There are other cases where the compiler may have issued warnings and ACE prevented this via a #pragma. These #pragmas have been removed as well. This may cause your application builds to trigger more warnings from VC8 than past ACE versions. You should review your code and either correct the code or disable the warnings locally, as appropriate. . The "release" argument to a number of ACE_String_Base<> methods was changed from int to bool to more accurately reflect its purpose. The following methods were changed: ACE_String_Base (const CHAR *s, ACE_Allocator *the_allocator = 0, int release = 1); to ACE_String_Base (const CHAR *s, ACE_Allocator *the_allocator = 0, bool release = true); ACE_String_Base (const CHAR *s, size_type len, ACE_Allocator *the_allocator = 0, int release = 1); to ACE_String_Base (const CHAR *s, size_type len, ACE_Allocator *the_allocator = 0, bool release = true); void set (const CHAR * s, int release = 1); to void set (const CHAR * s, bool release = true); void set (const CHAR * s, size_type len, int release); to void set (const CHAR * s, size_type len, bool release); void clear (int release = 0); to void clear (bool release = false); Since ACE_String_Base forms the basis of the ACE_CString and ACE_TString classes, this may ripple out to user application code. If you encounter errors in this area while building your applications, replace the int argument you are passing to the method now with either true or false. . Solutions for the eVC3/4 platform have been removed from this release. Note that we package WinCE projects/workspaces for use with VC8. . There were 3 new ACE_Log_Msg logging format specifiers added to make logging easier for types that may change sizes across platforms. These all take one argument, and the new formats are: %b - format a ssize_t value %B - format a size_t value %: - format a time_t value . The ace/Time_Request_Reply.h and ace/Time_Request_Reply.cpp files were moved from $ACE_ROOT/ace to $ACE_ROOT/netsvcs/lib. The time arguments in the public API to ACE_Time_Request were changed from ACE_UINT32 to time_t and the portions of the on-wire protocol that contains time was changed from ACE_UINT32 to ACE_UINT64. Thus, code that uses the ACE_Time_Request class to transfer time information will not interoperate properly with prior ACE versions. This will affect uses of the netsvcs time clerk/server. . The portion of the ACE_Name_Request class that carries the on-wire seconds portion of a timeout value was changed from ACE_UINT32 to ACE_UINT64. This means that Name server/clients at ACE 5.5.7 and higher will not interoperate properly with previous ACE versions' name servers/clients. . In the ACE_Log_Record (ACE_Log_Priority, long, long) constructor, the second argument, long time_stamp, was changed to be of type time_t. This aligns the type with the expected value, a time stamp such as that returned from ACE_OS::time(). . Added support for VxWorks 6.x cross compilation using a Windows host system . Added support for VxWorks 6.x using the diab compiler . The destructor of ACE_Event_Handler no longer calls purge_pending_notifications(). Please see bugzilla #2845 for the full rationale. (http://deuce.doc.wustl.edu/bugzilla/show_bug.cgi?id=2845) USER VISIBLE CHANGES BETWEEN ACE-5.5.5 and ACE-5.5.6 ==================================================== . The ACE_TYPENAME macro has been added to those that are not available when the ACE_LACKS_DEPRECATED_MACROS config option is set (it is not set by default). You are encouraged to replace the use of ACE_TYPENAME with the C++ typename keyword before the ACE_TYPENAME macros is removed from ACE in the future. . A new script, rm_exception_macros.pl, has been added to help users remove the use of the ACE exception macros from their own code. USER VISIBLE CHANGES BETWEEN ACE-5.5.4 and ACE-5.5.5 ==================================================== . The prebuild MPC keyword is now supported by the gnuace project type. This fixes Bugzilla #2713. . Support for Windows earlier than NT 4 SP2 was removed. ACE will not build for Windows 95, 98, Me, etc. out of the box any longer. . Reformat stringified IPv6 addresses to use [addr]:port when printing addresses that contain ':' such as "::1". . Added method to ACE_INET_Addr to determine if address is IPv6 or IPv4 multicast. . Fixed a bug in ACE_Async_Timer_Adapter_Timer_Queue_Adapter where the gettimeofday function of the timer queue was ignored when setting the alarm. . Fixed a problem where, on Solaris 9 onwards, calling ACE_OS::thr_create(THR_NEW_LWP) more than 2^15 (65535) times in a process will fail. See changelog entry from "Wed Jan 3 22:31:05 UTC 2007 Chris Cleeland " for more information. . Fixed a bug in ACE_QtReactor where the two select() calls in that function might select on different handler sets. . ACE_SOCK_IO::recvv(iovec[], size_t, const ACE_Time_Value* = 0) and ACE_SOCK_IO::sendv (const iovec[], size_t, const ACE_Time_Value* = 0) methods were changed to specify the iovec count argument as int instead of size_t since it gets reduced to int in the underlying OS calls (usually). . The following deprecated methods were removed: ssize_t ACE_SOCK_IO::recv (iovec iov[], size_t n, const ACE_Time_Value *timeout = 0) const; ssize_t ACE_SOCK_IO::recv (iovec *io_vec, const ACE_Time_Value *timeout = 0) const; ssize_t ACE_SOCK_IO::send (const iovec iov[], size_t n, const ACE_Time_Value *timeout = 0) const; These were previously replaced with more specific recvv() and sendv() methods. . The ACE_Service_Repository::find(const ACE_TCHAR name[], const ACE_Service_Type **srp = 0, int ignore_suspended = true) const method's 'ignore_suspended' parameter was changed from int to bool to reflect it's purpose as a yes/no indicator. . Added --enable-ace-reactor-notification-queue configure script option to the autoconf build for enabling the Reactor's userspace notification queue (defines ACE_HAS_REACTOR_NOTIFICATION_QUEUE in config.h). . The int ACE_OutputCDR::consolidate(void) method was contributed by Howard Finer at Sonus Networks. This method consolidates any continuation blocks used by an ACE_OutputCDR object into a single block. It's useful for situations which require access to a single memory area containing the encoded stream, regardless of its length, when the length cannot be known in advance. . There are a number of new methods defined on ACE_String_Base: size_t capacity (void) const: This method returns the number of allocated CHAR units in the string object. void fast_resize (size_t): This method manage the sizing/reallocating of the string, but doesn't do the memory setting of resize(). bool operator!= (const CHAR *) const bool operator== (const CHAR *) const: These methods compare the string with a nul-terminated CHAR* string. nonmember functions operator== and operator!= where also added that compare const ACE_String_Base and const CHAR*; these make it possible to switch ACE_String and CHAR* on either side of the operator. Thank you to Kelly Hickel for these additions. . There are 2 new build options on the traditional make command: dmalloc and mtrace. When specified at build time (e.g. make mtrace=1) the PLATFORM_DMALLOC_CPPFLAGS and/or PLATFORM_MTRACE_CPPFLAGS values are added to CPPFLAGS. For dmalloc, the PLATFORM_DMALLOC_LDFLAGS and PLATFORM_DMALLOC_LIBS are added to LDFLAGS and LIBS, respectively. Thank you to Howard Finer for supplying these additions. . Added the ability to specify additional purify and quantify command-line options by setting PLATFORM_PURIFY_OPTIONS and PLATFORM_QUANTIFY_OPTIONS, respectively. Thank you to Howard Finer for supplying these additions. . Added the ability to use trio (http://sourceforge.net/projects/ctrio/) if platform lacks decent support for vsnprintf. trio support is enabled by defining trio=1 in plaform_macros.GNU . Removed Irix 5, DGUX, and m88k support . Improved LynxOS 4.2 support . VxWorks 6.4 support . Added support for FC6. Because the GCC 4.1.1 version that gets shipped has a fix for the visibility attribute we use for the singletons you will need to define the following in your config.h file. This can't be done automatically because SuSE 10.2 gets shipped with GCC 4.1.2 but doesn't have the same fix ACE_GCC_HAS_TEMPLATE_INSTANTIATION_VISIBILITY_ATTRS 1 . RTEMS port USER VISIBLE CHANGES BETWEEN ACE-5.5.3 and ACE-5.5.4 ==================================================== . Added appropriate intptr_t and uintptr_t typedefs on platforms that don't provide them (i.e. when ACE_LACKS_INTPTR_T is defined). . Added ability to explicitly choose support for 32 bit or 64 bit file offsets on all platforms. Define the _FILE_OFFSET_BITS preprocessor symbol to either 32 or 64 to choose the desired number of file offset bits. This preprocessor symbol is supported natively by most UNIX and UNIX-like operating systems, and supported by ACE on Windows. Use the new ACE_OFF_T typedef to refer to file offsets across UNIX and Windows portably. . 64-bit file offsets are now enabled by default in Win64 configurations. . Improved support for 64 bit platforms (64 bit addresses, etc). . Added STL-style traits, iterators and a swap() method to the ACE_Array_Base<> class template. . Added STL-style traits and iterator accessors to the ACE_Hash_Map_Manager_Ex<> class template, as well as new find() and unbind() methods that return (as an "out" parameter) and accept iterators, respectively. . Greatly improved event handler dispatch performance in select()-based reactors (e.g. ACE_Select_Reactor and ACE_TP_Reactor) for large handle sets on Windows. Previous event handler search were linear, and are now constant on average. . Addressed a number of Coverity errors (CHECKED_RETURN, DEADCODE, LOCK, USE_AFTER_FREE, RESOURCE_LEAK, FORWARD_NULL). . Added STL-style "element_type" trait to all ACE auto_ptr class templates. . Removed support for LynxOS 3.x. . Resolved Bugzilla #2701 to ensure fini() is called for all Service Objects upon calling ACE_Service_Config::close() . VxWorks 5.5.2 has been tested, for ACE the support is exactly the same as for VxWorks 5.5.1. No specific defines or flags have to be used. USER VISIBLE CHANGES BETWEEN ACE-5.5.2 and ACE-5.5.3 ==================================================== . Added the base projects for executionmanager_stub and plan_generator. . Added the ACE_Hash_MultiMap_Manager class and its test file. . Changed the ACE_Synch_Options::operator[] method to return bool rather than int. The value returned is a yes/no indication of whether or not the specified option(s) are set in the object. . Changed the prototype(s) for ACE::debug () to return (and take) a bool. This is consistent with the original intent for this feature. If you have been using it like 'ACE::debug () > 0' or 'ACE::debug (1)', you may have to rebuild ACE. The value of the ACE_DEBUG environment variable can be used to specify the initial value for ACE::debug(), at the process start up. . An assembler (within a C source file) based implementation for SPARC of atomic operations suitable for use with the ACE_Atomic_Op and ACE_Atomic_Op specializations has been added. Currently, it can only be enabled by setting the atomic_ops_sparc make macro to 1 when using the GNUACE build system with the Solaris SunCC compiler. It should be noted that this requires the -xarch=v8plus (or higher) be added to the CFLAGS make macro or the assembler code will not compile. . The ACE_Message_Queue_Ex_N class is new, contributed by Guy Peleg . ACE_Message_Queue_Ex_N is similar to ACE_Message_Queue_Ex in that the object queued is a template parameter. However, ACE_Message_Queue_Ex_N allows the enqueueing and dequeueing of multiple chained objects at once. This wasn't added to ACE_Message_Queue_Ex because the chained object functionality requires the ACE_MESSAGE_TYPE class to have a ACE_MESSAGE_TYPE *next (void) const method, analogous to ACE_Message_Block::next(), to follow the chain and this would probably break existing applications using ACE_Message_Queue_Ex. The ACE_wrappers/tests/Message_Queue_Test_Ex.cpp test has an example of how to use the new class. . The selector and comparator function pointer arguments to ACE_OS::scandir() and ACE_Dirent_Selector are now marked as extern "C" to enforce their use with a C RTL function. User code that defines functions which are passed as the selector or comparator arguments which are not declared extern "C" may generate compile warnings. To resolve this, add extern "C" to the function's signature. See ACE_wrappers/tests/Dirent_Test.cpp for an example. . To address a problem in the ACE string interface that prevented substring or character searches in very large strings (e.g. greater than the maximum value of an ssize_t type) from being correctly reported to the caller, the find(), rfind() and strstr() methods now return an unsigned integer (size_t) instead of a signed one (ssize_t). Affected classes include: * ACE_CString * ACE_WString * ACE_TString * ACE_NS_WString Unless you have been explicitly using -1 instead of npos when comparing the return value of find(), rfind() and strstr(), and/or assigning the return value to ssize_t you should not see any difference. A new size_type typedef has been added to the ACE string class to aid developers. This typedef is analogous to the standard C++ string::size_type typedef. The ACE_String_Base<>::strstr() documentation and the default rfind() argument erroneously referred to -1 instead of npos. Those instances have been corrected. To summarize, a "no position" condition is denoted using the npos constant, not -1. It can be referred directly by scoping it with the appropriate string class (e.g. ACE_CString::npos, ACE_WString::npos, etc). . Changing the shared library extension for hpux ia64 to ".so". On HP-UX 11i Version 1.5 the naming scheme is lib*.sl for PA and lib*.so on IPF. . The ACE_Refcounted_Auto_Ptr reset() and release() methods were changed per Bugzilla #1925. They will both now detach from the underlying ACE_Refcounted_Auto_Ptr_Rep object; reset() will create a new one for the new pointer specified as its argument. This change may cause referenced objects to be deleted in cases where previous ACE versions would not have. . The return type of "ACE_Refcounted_Auto_Ptr::null (void) const" changed from int to bool. It's possible values, true and false, have not changed. . TTY_IO now accepts "none" as a valid parity value. Due to this change 'parityenb' member is now deprecated and will be removed in the future. The users of TTY_IO class should change their code to use only 'paritymode' member for parity control and leave 'parityenb' unchanged (it is enabled by default in class constructor). . Support for Intel C++ 9.1 on Windows and Linux . VxWorks 6.3 support . Fixed Bugzilla #2648 to make sure ACE_Service_Object::fini() is called iff ACE_Service_Object::init() succeeded, as per C++NPv2. . Added preliminary support for Mac OS X 10.4 on Intel CPU's. . Fixed Bugzilla #2602 to re-enable XML Service Configurator file support. USER VISIBLE CHANGES BETWEEN ACE-5.5.1 and ACE-5.5.2 ==================================================== . Added support for: - VxWorks 6.2 for the rtp model using pthread support - OpenVMS 8.2 for Alpha . Removed code and configurations that provided support for: - Visual C++ 6.0 and 7.0 - Chorus - pSOS - KAI C++ on all platforms . Explicit template instantiation support has been removed. This effectively removes support for Sun Forte 6 and 7 which required explicit template instantiation to build ACE reliably. . Added support for multiple independent Service Repositories through configuration contexts called "Gestalt". Full backwards compatibility is maintained through the existing ACE_Service_Config static methods, while direct individual repository access is enabled through instances of the new ACE_Service_Gestalt class. ACE_Service_Config has changed to a specialization of ACE_Service_Gestalt and is only responsible for the process-wide configuration. . To support dynamically-sized ACE_Log_Record messages, the netsvcs logging components now use ACE CDR encoding and transfer mechanisms inspired by the examples in Chapter 4 of the C++NPv1 book. The client and server logging daemons in ACE 5.5.2 and forward will not interoperate with those in previous ACE versions. . Added a wrapper for the sendfile API (ACE_OS::sendfile()). . Added support for netlink sockets on Linux. . Added a new method, ACE_Task::last_thread(). This method returns the thread ID (ACE_thread_t) of the last thread to exit from the ACE_Task object. Users checking to see if a thread is the last one out (for example, to know when to perform cleanup operations) should compare the current thread ID to the return value from last_thread(). This is a change from the previously recommended practice (C++NPv2, page 189) of comparing the return value of thr_count() with 0. . Changed the first argument to ACE_OS::strptime() to be 'const' which matches its usual usage in POSIX strptime(). This change allows users to pass const strings in - a common use case. . Made part of the file support in ACE 64bit but we have some places where 32bit types are used, this could lead to some conversion warnings which will be addressed in the near future, but getting everything 64bit compliant is a lot of work. USER VISIBLE CHANGES BETWEEN ACE-5.5 and ACE-5.5.1 ==================================================== . Added support for the --enable-symbol-visibility configure option to the autoconf build infrastructure instead of solely relying on feature tests to enable/disable symbol visibility support. This avoids build problems with icc, etc. . Added support for the --enable-fl-reactor configure option to the autoconf build infrastructure to build the ACE_FlReactor library. . Added support for the --enable-qt-reactor configure option to the autoconf build infrastructure to build the ACE_QtReactor library. . Added support for the --enable-xt-reactor configure option to the autoconf build infrastructure to build the ACE_XtReactor library. . Fixed a bug that would cause timer IDs from ACE_Timer_Heap to be improperly duplicated under certain conditions (Bugzilla #2447). . Fixed ACE_SSL_Context::private_key(), context(), and dh_params() methods to allow retrying a file load after a failed call. . Fixed ACE_SSL_Asynch_Stream so it can be instantiated; also moved the declarations for ACE_SSL_Asynch_Read_Stream_Result, ACE_SSL_Asynch_Write_Stream_Result, and ACE_SSL_Asynch_Result classes to the ace/SSL/SSL_Asynch_Stream.h file so applications can see them. USER VISIBLE CHANGES BETWEEN ACE-5.4.10 and ACE-5.5 ==================================================== . Added a platform macros option "templates=manual", currently only applies to AIX 5.3 with XL 7 compiler. It allows the user to tell the compiler to set -qnotempinc and -qnotemplateregistry and works well in static builds. . ACE and its tests compile error free with GCC 4.1 pre release. . ACE_Recursive_Thread_Mutex::get_nesting_level() fixed for 64-bit Windows XP on amd64/EM64T hardware. . Many build-time fixes for Windows Mobile 5 and Windows PocketPC 2003 using Visual Studio .NET 2005 (VC8). . Added support for the --enable-tk-reactor configure option to the autoconf build infrastructure to build the ACE_TkReactor library. USER VISIBLE CHANGES BETWEEN ACE-5.4.9 and ACE-5.4.10 ==================================================== . Fixed a bug in ACE_Timer_Heap_T::cancel(). . Improved ACE_Time_Value support for boundary conditions. . Fixed problems with operator placement delete on certain C++ compilers. . Fixed a bug with the ACE_SPIPE_Acceptor on Windows. . Correctly set sockaddr_in.sin_len and sockaddr_in6.sin6_len on platforms that have these fields. . Avoided problems with namespace pollution for max() macros. . Many fixes for ACE_LACKS* and ACE_HAS* macros for autoconfig. USER VISIBLE CHANGES BETWEEN ACE-5.4.8 and ACE-5.4.9 ==================================================== . Added dozens of new ACE_LACKS and ACE_HAS defines which are used to simplify the ACE_OS layer . Constructors of ACE_Time_Value have been made explicit to prevent implicit conversions. . Added a shutdown() method to ACE_Barrier. The new method aborts the wait by all threads. . Changed the behavior of ACE_Message_Queue::enqueue_head() and enqueue_tail(). If the enqueued message block has other blocks chained to it via its next() pointer, the entire chain of blocks will be enqueued at once. . Improved the support for high-resolution timers with ACE_Timer_Queue_Adapter. . Make it possible to disable file caching in JAWS. . Improved ACE_Pipe implementation so that it uses localhost to avoid firewall problems. . Added Unicode support to the Service Configurator. USER VISIBLE CHANGES BETWEEN ACE-5.4.7 and ACE-5.4.8 ==================================================== . Improved IPv6 support . Improved 64bit portability . TTY_IO overhaul - Improved documentation. - It is now possible to request infinite timeout in portable manner. This can be achieved by setting negative value to readtimeoutmsec. - Various bugs fixed and portability issues resolved. . Subset ACE for TAO and TAO Services . Support for Intel C++ 9.0 on Windows and Linux . Support for Microsoft Visual Studio 2005 (aka VC8) for Win32 as well as the Windows CE platforms Pocket PC 2003 and Windows Mobile 5. Solution/project files are generated with an appended "_vc8" for Win32 and "_WinCE" for the CE platforms. See ACE_wrappers/docs/CE-status.txt for more information. . Completed implementation of ACE_Dev_Poll_Reactor using the Linux epoll facility; tested on Red Hat Enterprise Linux 4. . The in-memory size of an ACE_RB_Tree will be smaller due to rearranged placement of pointers. . Added an optimization to CDR stream to ignores alignment when marshaling data. Use this new ACE_LACKS_CDR_ALIGNMENT compile-time option only when the ACE_DISABLE_SWAP_ON_READ macro is enabled. This new option requires ACE CDR engine to do both marshaling and demarshaling, and when this option is enabled the encoded streams are no longer compliant with the CORBA CDR specification. . Developed Feature Oriented Customizer (FOCUS) tool to enable specialization of middleware frameworks such as Reactor and Protocol framework. FOCUS provides an XML based transformation engine, where the transformations to specialize the components are captured in XML file and a weaver specializes the code. . Added support for unrolling ACE_OS::memcpy copy loop where applicable to improve performance. Autoconf tests empirically determine whether loop unrolling is at least 10% better than default version. . Added support for an ACE "versioned" namespace. When enabled, ACE library sources will be placed within a namespace of the user's choice or a namespace of the form ACE_5_4_7 by default, where "5_4_7" is the ACE major, minor and beta versions. The default may be overridden by defining the ACE_VERSIONED_NAMESPACE_NAME preprocessor symbol. Enable overall versioned namespace support by adding "versioned_namespace=1" to your MPC default.features file. USER VISIBLE CHANGES BETWEEN ACE-5.4.6 and ACE-5.4.7 ==================================================== . Support for shared libraries with VxWorks . Support for Solaris 10 on x86 with Sun Studio 10 (C++ 5.7). . Extended ACE_OS::event_xxx implementation to support platforms having either PThread support with Process Shared condition variables or POSIX semaphores with named (process shared) semaphore support or using the new FIFO based semaphores. . ACE_OS::closesocket() no longer calls ACE_OS::shutdown() on any platform while closing the socket. It previously called ACE_OS::shutdown() on HP-UX. Removing this call fixes the fork-and-close programming paradigm that's common to many networked applications. . RMCast - Support for message fragmentation. This will allow for messages larger than 64K. - Support for flow control. - Timed recv() in RMCast::Socket. - Per-instance configurable protocol parameters (e.g., message retention time, NAK timeout, etc). USER VISIBLE CHANGES BETWEEN ACE-5.4.5 and ACE-5.4.6 ==================================================== . Updated RMCast to include - Reactor-compatible interface. - Message unavailability reporting. - Protocol documentation. . Added support for 64bit Visual Age on AIX . Improved g++ 4.0 support. A number of RTTI related problems have been fixed. . Smaller footprint. . Fixed memory leaks ACE_DLL and ACE_Log_Msg classes. . The ACE::ICMP_Socket and ACE::Ping_Socket classes were moved out of the ACE namespace and "flattened" to ACE_ICMP_Socket and ACE_Ping_Socket to be consistent with the rest of ACE. . ACE_INET_Addr::set_address() - fixed a possible struct member alignment issue when building an IPv4-mapped IPv6 address. . Added a new ACE::wild_match() function to match a string based on wildcards. . Added efficient overloads for string concatenation to the ACE_String_Base class. . Added support for the use of pthread_getschedparam on MacOS X. . Fixed an issue with static initialization of TSS related classes on static builds for Windows. USER VISIBLE CHANGES BETWEEN ACE-5.4.4 and ACE-5.4.5 ==================================================== . Remove special handling in the Thread Specific Storage(TSS) code that released the TSS key for ACE_TSS. ACE_TSS has been changed to explicitly free the TSS key when necessary. . On Win32 systems: detect thread termination via a hook in DLLMain for ACE.dll. This allows cleanup of TSS objects for non-ACE threads that use ACE functions. The most common case was threads that used ACE logging. Formerly any TSS objects created by these threads would be leaked. . Added support for GNU G++ 4.0. The x.4.5 beta takes advantage of g++ 4.0's symbol visibility. This feature is conceptually similar to MS Windows "__declspec(dllexport)" DLL functionality. Using this new g++ feature results in substantially improved ACE/TAO/CIAO shared library binaries. A subset of the improvements include the following: * The number of unnecessarily exported DSO/DLL symbols is greatly reduced, resulting in faster program start times. * Smaller footprint. * Improved performance since run-time indirection of internal symbols is no longer needed. No changes to the ACE/TAO sources were necessary to support this feature since the required visibility attributes were hidden behind the various "*_Export" macros (formerly only useful for MS Windows DLLs) used throughout ACE/TAO. . The ACE_Reactor destructor will now call close() on the referenced reactor implementation. This assures that all handlers are notified before the ACE_Reactor object that's most likely referenced in these handlers is invalid. Although this should not be a user-visible change, it did catch some ACE tests off guard destroying reactor implementations and ACE_Reactor interfaces in the wrong order, so it may come up in the field as well. When using dynamically allocated reactor implementations, do not destroy the implementation object before the ACE_Reactor interface object. Use of the ACE_Reactor constructor's delete_implementation argument (with a value of 1) is recommended when dynamically allocating reactor implementations. . Improved performance of HTBP by not requiring a lookup of peer hostname. . Added new ACE_SizeCDR stream which allows one to calculate size of the representation without writing anything. . Number of improvements in RMCast, reliable multicast implementation. USER VISIBLE CHANGES BETWEEN ACE-5.4.3 and ACE-5.4.4 ==================================================== . The ace-config script has been replaced by pkg-config metadata files which are installed in ${prefix}/lib/pkgconfig by the automake build. . Remove ACE_OS::gets() implementation. While this ACE implementation of gets() did not contain the security holes that all standard gets() implementations have, keeping it around only serves to foster confusion since (1) some may incorrectly assume that this ACE-specific gets() implementation has the same holes as standard ones, and (2) invoking it with a default size argument so that it looks like a standard gets() call results in behavior that is different from the standard. Use ACE_OS::fgets() instead. . Removed ACE_Unbounded_Set_Ex, this gave the false idea that it had thread safe iterators. Use ACE_Unbounded_Set instead . Improved VxWorks support for static libraries. Shared libraries do cause several known problems which will be fixed in the x.4.5 release. . Removed the usage of the ACE_x_cast macros, we are using the C++ casts from now on. The ACE_x_cast macros are deprecated and will be removed after the x.5.1 release . Some improvements in autoconf support; better detection of available OS and compiler features. . Fixed bugs in ACE TSS emulation USER VISIBLE CHANGES BETWEEN ACE-5.4.2 and ACE-5.4.3 ==================================================== . Improved Cygwin 1.5.12 support, 90% of the tests now succeed . Improved OpenVMS support. . Added ability to use fltk with Cygwin/MinGW . Added ACE_INT64 that defines a native 64 bit type. . Added 'q' as usable specifier for ACE_Log_Msg to print out int64 bit number. . Added better support for Intel C++ compilers. . Improved HPUX support. . Added a new directory ("ACE_wrappers/protocols/ace") for new protocols that are not directly components of ACE, but are relate to ACE and defined a new protocol, HTBP (Hypertext Tunneling, Bidirectional Protocol) providing ACE_Acceptor/Connector/Stream semantics over a connection owned by an HTTP proxy. Test cases in ACE_wrappers/tests/HTBP provide examples of use. . Performace enhancement in TP_Reactor's handle_timer_events method [Bug 1971]. . Various changes to permit ACE to execute on HP NonStop platform (e.g support for its pthreads version). . Updated HP NonStop configuration files (config-tandem-nsk). . The "ACE" pseudo-namespace is now a true C++ namespace. Transitional pseudo-namespaces that were only meant to be used internally by ACE, such as "ACE_Sock_Connect", no longer exist. . ACE_CDR::Boolean type is now a true C++ "bool" on all platforms except MSVC++ 6. We plan to deprecate MSVC++ 6 support sometime after the x.5 release of ACE+TAO+CIAO, so we recommend you start migrating to a later version of MSVC++. . More GNU g++ 3.4.x fixes. . Added ICMP and "ping" socket support. . Added mkstemp() emulation. . Fixed problem on Linux < 2.5.47 platforms where equality comparison of two logically equal sockaddr_in structure instances would incorrectly fail. . Support for wide characters has been improved on non-Windows platforms. . A number of Windows CE problems have been fixed. . ACE's loading of DLLs (for example, as a result of loading synamic services) has been changed to use the native OS's facilities for locating the DLL instead of searching LD_LIBRARY_PATH (or its equivalent) then loading the DLL using a full pathname. This restores enforcement of a platform's loading and security policy. To use the old DLL locating method, add ACE_MUST_HELP_DLOPEN_SEARCH_PATH to your config.h file before building ACE. . A number of errors in the APG example programs have been corrected. . Select_Reactor and Priority_Reactor performance improved. [Bug 1890] . Wide-char functionality on POSIX (Linux, etc.) . TSS memory leak fixes [Bug 1542] . Ported to HPUX 11i v2 on Itanium . Added code to ACE for platform RedHat AS 3.0 on Opteron. . Changed ACE::crc32() family of functions to NOT fold in the length of the string/buffer/iovec into the CRC. USER VISIBLE CHANGES BETWEEN ACE-5.4.1 and ACE-5.4.2 ==================================================== . Support for g++ 3.4.1. . All ACE Makefiles, project files, etc, are now generated by OCI's "MakeProjectCreator" (MPC) tool. Makefiles and project files for commonly used configurations have been pre-generated and distributed with the beta(s). Please see: $ACE_ROOT/ACE-INSTALL.html for information on how to use MPC with ACE. . Improved Doxygen documentation. . Reduced header file dependencies, which should speedup compilation and help minimize static footprint. . ACE now requires support for the following standard C++ features: - "bool" keyword - "mutable" keyword - "explicit" keyword - C++ casts (e.g. static_cast<>, reinterpret_cast<>, dynamic_cast<> and const_cast<>) If you're using a compiler that does NOT support these features please contact Steve Huston for support. . Changed the select()-based reactor implementations to scan for broken handles to remove based on the registered handles, not on event handlers. This allows for bad handles to be removed from the reactor even if the event handler doesn't implement get_handle() the way we expect. . Support for Pthreads native recursive mutexes was added. This capability is specified to ACE_OS::mutex_init() as an optional argument, lock_type. To fix confusion from an earlier attempt to add this functionality, the meaning of the old 'type' argument to ACE_OS::thread_mutex_init() is changed. It previously combined the scope and type. Now it is just the type (e.g. recursive), as the scope is inherent in the method used. For clarification on ACE_HAS_RECURSIVE_MUTEXES, it means that the platform is capable of them, not that they always are, as one would expect. However, before Pthreads had recursion added, it was never optional. Now it is. . Initial support for new Linux sys_epoll() interface in Dev_Poll_Reactor. The obsolete Linux /dev/epoll interface is no longer supported. . Improved Cygwin support. - Threading works without problems. - Problems with shared memory, process shared mutexes, multicast and some other small things still exist. . New OpenVMS port. - This is for the latest version of OpenVMS with all available ECOs applied. Basic stuff works without problems. Advanced features still need some work. . Usage of ASYS_INLINE is deprecated in ACE. Use ACE_INLINE instead. . All inline source files now end in ".inl". The previous ".i" extension is generally used for preprocessed C sources. . Autoconf support has been improved and fixed on a number of platforms, including the BSD variants (e.g. FreeBSD). It is still not the preferred way to configure most platforms, but it is ready for wider testing. Please report any problems found to ace-bugs@cs.wustl.edu. . A number of fixes were made to quiet compile errors and warnings on 64-bit Windows. . For builds on AIX using Visual Age C++, the make rtti option default was changed to 1, enabling RTTI by default. . ACE_Service_Repository::remove() has a new, optional argument that can receive the service record pointer for the removed service. If the pointer is returned to the caller, it is not deleted. If the pointer is not returned to the caller (the default) it is deleted (this is the historic behavior). . The tutorials in ACE_wrappers/docs have been removed. They were not being maintained and caused confusion in a number of cases. Now that there are complete examples that match the printed books (C++NPv1, C++NPv2, APG), the older tutorials are no longer useful. Please see $ACE_ROOT/examples/C++NPv1/ $ACE_ROOT/examples/C++NPv2/ $ACE_ROOT/examples/APG/ for the source code of the examples in those books. . ACE_String_Base::fast_clear() is a new method which sets the string length to 0. Doesn't release string-allocated memory, but if the memory was externally supplied, it is no longer referenced from the string object. . A true C++ "bool" is now used as the CDR stream boolean type, if supported by the compiler. . Renamed AIX 5L configuration header from config-aix5.1.h to config-aix-5.x.h. . All C++ equality, relational and logical operators now return bool instead of int, as is the norm for modern C++. . Added new ACE_OS::realpath() implementation. Contributed by Olli Savia USER VISIBLE CHANGES BETWEEN ACE-5.4 and ACE-5.4.1 ==================================================== ACE --- . Fixed "make install" support in ACE+autoconf configurations. . Fixed autoconf support on Solaris. . Corrected invalid `aux' directory (on MS Windows) found in ACE distribution. . ACE/TAO build now without problems with MinGW and all ACE tests run now without problems . Added some more support for the new CBuilderX Preview compiler, this is not 100% ready yet because the compiler is still a preview and has its own problems. . Added Visual SlickEdit 8.1 MPC template . Added workaround for compile problems in Borland Release builds . Cygwin 1.5.9 is now supported . Tests for IPV6 have been added . Implement lstat() so that it'll use stat() on platforms that don't support lstat(). . Problems related to ACE_Event_Handler usage in WFMO_Reactor was fixed. . A wrapper for rmdir () has been added. . Threads spawned in thread-per-connection mode never inherited the priority. This problem was fixed and this fix is consistent with the C++ NPV* books. . Fixed memory leaks with ACE_String_Base::resize () . Enable the usage of native recursive mutexes for the implementation of ACE recursive mutexes on Linux. . The ACE Proactor framework can now be enabled for AIX 5.2. Since AIO functionality is not run-time enabled by default on AIX 5.2, the ACE Proactor code is not built by default on AIX. To enable it, the config.h file must contain #define ACE_HAS_AIO_CALLS before including the config-aix-5.1.h file. . The ACE_POSIX_CB_Proactor implementation is now built on all platforms except LynxOS. USER VISIBLE CHANGES BETWEEN ACE-5.3.6 and ACE-5.4 ================================================== ACE: --- . Added a new makefile commandline flag, static_link, that can be used to force static linking when static_libs_only is turned on. It uses the new STATIC_LINK_FLAG variable and is currently only implemented for for GNU ld, i.e., it adds the "-static" option to LDFLAGS. It's turned off by default since using it causes the footprint to go up by almost 1 MB on Linux, since it links all the system and compiler .a files, but can be turned on if users want/need to use it, by enabling both static_libs_only and static_link. . Added macros ACE_USES_GPROF which enables users to use gprof in a multithreaded environment with ACE libs. . Added a new functor template class, ACE_Malloc_Lock_Adapter_T, that's used by ACE_Malloc_T as a factory for the ACE_LOCK template parameter, and allows the use of locking strategy classes, like ACE_Process_Semaphore and ACE_Thread_Semaphore that don't have a satisfactory ctor taking a single required ACE_TCHAR* parameter, to be adapted to work with ACE_Malloc_T. . The source code examples from "The ACE Programmer's Guide" book by Huston, Syyid, and Johnston, are now located in $ACE_ROOT/examples/APG. . Support for GNU autoconf is now in ACE. Please see ACE-INSTALL.html for details. . Fixed problems that prevented ACE from being compiled on LynxOS 4.0.0. . Fixed compilation error which prevented ACE from being compiled when ACE_COMPILE_TIMEPROBES was set to 1. . Preliminary support for Tandem NSK has been added. . Lots of bug fixes with TLI and XPG5. Please see $ACE_ROOT/ChangeLog for details. . Fixed ACE_OS::event_timedwait() and ACE_OS::event_wait() so that they use a while loop around the ACE_OS::cond_[timed]wait() calls to avoid problems with spurious wakeups, etc. . ACE's wrapper around getipnodebyname() and getipnodebyaddr () has been made go through the IPv4-only case on ACE_WIN32. Since Windows IPv6 implementation doesn't offer support (at thistime) for getipnodebyname() the code has been changed to use the IPV4 part of the code. . Install with Borland C++ of ACE library fixed ACEXML: ------- . Fixed memory leak in ACEXML parser. . Fixed implementations of rewind() in all the CharStreams. They were broken previously. . Fixed bugs in the parser associated with incorrect handling of PE References for keywords. ace-8.0.4+dfsg.orig/ACE-INSTALL.html0000644000175000017500000040550115027201772015555 0ustar sudipsudip Building and Installing ACE and Its Auxiliary Libraries and Services

Building and Installing ACE and Its Auxiliary Libraries and Services

Synopsis

The file explains how to build and install ACE, its Network Services, test suite and examples on the various OS platforms and compilers that it has been ported to. Please consult the NEWS and ChangeLogs files to see whether any recent changes to the release will affect your code. In addition, you should check out our development process. As you start working with ACE, we suggest you get copies of the C++NPv1, C++NPv2, and APG books to help guide you after you've built and installed ACE. You should also consult the ACE Frequently Made Mistakes page. If you encounter any problems or would like to request an enhancement, then use github to submit an issue in accordance with our bug report process.

Document Index


Platforms, C++ Compilers, and Support

ACE has been ported to a large number of platforms using many different compilers over the years. The DOC group, Riverace, OCI, Remedy IT, and members of the ACE user community have all contributed ports to make ACE the successful and far-reaching toolkit it is today. Any UNIX/POSIX/Windows variation is probably an easy target platform for ACE. If you have porting questions or have a problem compiling the ACE source distribution, please contact one of the commercial support companies, or create a github issue or discussion using the PROBLEM-REPORT-FORM, located in the ACE_wrappers directory. The DOC groups at Washington University, UC Irvine, and Vanderbilt University provide only "best effort" support for non-sponsors for the latest release, as described in docs/ACE-bug-process.html. Thus, if you need more "predictable" help, or help with earlier versions of ACE, it's recommend that you check out the list of commercial support companies for additional assistance.

The responsibility for maintaining ACE across the wide range of supported platforms is divided among a few different groups:

  • The DOC group maintains platforms used in the course of their research and sponsored work
  • Companies that provide support (Riverace, OCI, and Remedy IT), maintain platforms they support in the course of their various service offerings
  • The ACE user community maintains any other desired platforms.
The build scoreboard records the current status of build and regression testing during development by all of the above groups. It is available to all users wishing to provide build results. Members of the ACE community that maintain ACE on platforms not maintained by the DOC group, Riverace, OCI, or Remedy IT are encouraged to provide build and regression test results for the scoreboard to ensure that all in-use platforms are represented. See the autobuild README for more information about how to set up a build; contact one of the above groups to inquire about how to get your build results recorded on the scoreboard.

Because older platforms that are not maintained tend to fall into a broken state and clutter the ACE sources with code that is no longer used, the development team reserves the right to remove ACE configuration files and source code specific to inactive platform configurations that are not listed on the scoreboard.

The table below summarizes each group's role and where you can get more detailed information. For information on TAO's platform coverage and support, please also see TAO's install document.

Groups Involved in ACE Development and Support
Group Platforms For more information
DOC Group DOC sites at ISIS, UCI and Washington University
Riverace Offers ACE training, support and consulting services for many platforms including AIX, HP-UX, Linux, Solaris, and Windows. Riverace's ACE Support page.
OCI Maintains ACE on certain platforms required for their TAO software and service offerings. OCI's web site, TAO page, and the TAO install document
Remedy IT Maintains ACE on many platforms required for their ACE and TAO service offerings. We support AIX, Embarcadero C++ Builder, MinGW, Microsoft Visual C++, GCC, Cygwin, VxWorks 6.x (kernel and rtp), BlueCAT Linux, RedHat Linux, Fedora, MacOSX, Solaris, SuSE Linux on IA32/EM64T/IA64, QNX, LynxOS, and Android. The Intel C++ compiler is supported on Windows 32/64bit, Linux IA32/EM64T/IA64, MacOSX. Remedy IT web site and the TAO install document
PrismTech Maintains ACE on certain platforms required for their TAO software and service offerings, including LynxOS. PrismTech's web site
ACE user community Responsible for continued maintenance and testing of platforms to which ACE has been ported, but aren't supported by the above groups. These include Digital UNIX (Compaq Tru64) 4.0 and 5.0; IRIX 6.x; UnixWare 7.1.0; Linux on PPC; OpenMVS; Tandem; SCO; FreeBSD; NetBSD; OpenBSD; Macintosh OS X; OS/9; PharLap ETS 13; QNX RTP and Neutrino 2.0
Not maintained The following platforms have been ported to in the past but are no longer maintained and may be removed from ACE at any time. If you want to have support for these environments contact one of the commercial support organisations. The platforms include: Chorus; DG/UX; HP-UX 9, 10 and 11.00; pSOS; SunOS 4.x and Solaris with SunC++ 4.x; VxWorks 5.4 and earlier; Microsoft Visual C++ 5, 6, and 7.0; Borland C++ Builder 4, 5, 6, and 2006. For up-to-date listings on platform that are deprecated and pending removal from ACE, please see the NEWS file.

Although the DOC group has provided outstanding support for ACE over the years, ACE's success has greatly increased the amount of effort required to keep up with its maintenance, answer users' questions, and give design guidance. Riverace offers world-class commercial services to support ACE users. OCI, PrismTech, and Remedy offer similar services for ACE and TAO, allowing the DOC group's primary focus to shift back to their main goal: research. The DOC group is fundamentally focused on (and funded by) advanced R&D projects. The group continues to be intimately involved in ACE+TAO development and maintenance, but with revised priorities for maintenance. The bug fixing policies followed by the DOC group are designed to strike a balance between their many research projects and their commitment to the ACE+TAO user community. Naturally, we will be happy to accept well-tested patches from the ACE+TAO user community for any platforms that aren't supported by the DOC group, Riverace, OCI or Remedy IT.


Installation prerequisites

ACE (as well as TAO) use MPC (MakeProjectCreator) to generate files used by all supported build tools (such as GNUmakefiles for UNIX based platforms, sln and vcproj files for Visual Studio and Embarcadero makefiles) on various platforms. To help new users to bootstrap quickly the release bundles of ACE (as well as TAO) include all needed files to use the build instructions in this document.

If it is necessary to generate files for build tools for other compilers, one must run MPC to generate the appropriate files. Please see USAGE, README, and README for ACE files for details. The options that have been used to generate the above build files can be found in global.features file.


Building and Installing ACE

The following sections explain how to build ACE on:

General Rules

  • Many features in ACE can be modified by defining some macros in $ACE_ROOT/ace/config.h. These macros should always appear before including your platform specific config file.

  • However, if you want to undefine/redefine macros defined in the platform specific config file, these #undef should come after the config file.

  • If you're planning to build ACE on multiple platforms, you may want to consider cloning the source tree before you start.


Building and Installing ACE on UNIX

As of ACE 6.0.6, you can building ACE on UNIX with:
  1. Traditional ACE/GNU Make Configuration
The build process for Windows is different from the UNIX methods.

Using the Traditional ACE/GNU Configuration

Here's what you need to do to build ACE using GNU Make and ACE's traditional per-platform configuration method:

  1. Install GNU make 3.79.1 or greater on your system (available via http anonymous ftp from ftp.gnu.org in the pub/gnu/make/ directory). You must use GNU make when using ACE's traditional per-platform configuration method or ACE won't compile.
  2. Add an environment variable called ACE_ROOT that contains the name of the root of the directory where you keep the ACE wrapper source tree. The ACE recursive Makefile scheme needs this information. There are several ways to set the ACE_ROOT variable. For example:
    TCSH/CSH: setenv ACE_ROOT /home/cs/faculty/schmidt/ACE_wrappers
    BASH or Bourne Shell: export ACE_ROOT=/home/cs/faculty/schmidt/ACE_wrappers

    If you're building a number of versions of ACE, however, (e.g., for different OS platforms or for different releases of ACE) you might use the following approach (assuming TCSH/CSH):

    setenv ACE_ROOT $cwd
  3. Create a configuration file, $ACE_ROOT/ace/config.h, that includes the appropriate platform/compiler-specific header configurations from the ACE source directory. For example:
    #include "ace/config-linux.h"
    The platform/compiler-specific configuration file contains the #defines that are used throughout ACE to indicate which features your system supports. See the $ACE_ROOT/ace/README file for a description of these macro settings. If you desire to add some site-specific or build-specific changes, you can add them to your config.h file; place them before the inclusion of the platform-specific header file.

    There are config files for most versions of UNIX. If there isn't a version of this file that matches your platform/compiler, you'll need to make one. Please open an issue at our github project if you get it working so it can be added to the master ACE release.

  4. Create a build configuration file, $ACE_ROOT/include/makeinclude/platform_macros.GNU, that contains the appropriate platform/compiler-specific Makefile configurations, e.g.,
    include $(ACE_ROOT)/include/makeinclude/platform_linux.GNU
    This file contains the compiler and Makefile directives that are platform/compiler-specific. If you'd like to add make options, you can add them before including the platform-specific configuration.

    NOTE! There really is not a # character before 'include' in the platform_macros.GNU file. # is a comment character.

  5. If you wish to install ACE (using "make install"), set the installation prefix in platform_macros.GNU.
    INSTALL_PREFIX = /usr/local
    Headers will be installed to $INSTALL_PREFIX/include, executables to $INSTALL_PREFIX/bin, documentation and build system files to $INSTALL_PREFIX/share and libraries to $INSTALL_PREFIX/lib. The library directory can be customized by setting INSTALL_LIB (for example, INSTALL_LIB=lib64). With INSTALL_PREFIX set, RPATH will be enabled for all executables and shared libraries. To disable RPATH (for example, if $INSTALL_PREFIX/$INSTALL_LIB is already a system-known location for shared libraries such as those listed in /etc/ld.so.conf), set the make macro install_rpath to 0 by adding install_rpath=0 to platform_macros.GNU.
  6. Note that because ACE builds shared libraries, you'll need to set LD_LIBRARY_PATH (or equivalent for your platform) to the directory where binary version of the ACE library is built into. For example, you probably want to do something like the following:
    % setenv LD_LIBRARY_PATH $ACE_ROOT/lib:$LD_LIBRARY_PATH
    or
    % export LD_LIBRARY_PATH=$ACE_ROOT/lib:$LD_LIBRARY_PATH
  7. When all this is done, hopefully all you'll need to do is type:
    % make
    at the ACE_ROOT directory. This will build the ACE library, tests, the examples, and the sample applications. Building the entire ACE release can take a long time and consume lots of disk space, however. Therefore, you might consider cd'ing into the $ACE_ROOT/ace directory and running make there to build just the ACE library. As a sanity check, you might also want to build and run the automated "one-button" tests in $ACE_ROOT/tests. Finally, if you're also planning on building TAO, you should build the gperf perfect hash function generator application in $ACE_ROOT/apps/gperf.
  8. If you've set the INSTALL_PREFIX before building, now run
    % make install

    An alternative to directly running make install is to use $ACE_ROOT/bin/install_proj.sh which will only install projects that are built (instead of trying to build each one during make install).

  9. If you need to regenerate the ace/Svc_Conf_y.cpp file, you'll need to get GNU Bison. However, you should rarely, if ever, need to do this.

Building and Installing ACE on Windows

This section contains instructions for building ACE on Microsoft Windows with a variety of compilers and development environments.

First, if you are upgrading from an older release, the recommended practice is to start with a clean directory. Unpacking the newer release over an older one will not clean up any old files, and trying to use the environment's "Clean" command will probably not account for all existing files.

For using MPC and our perl based test framework we recommend our windows users to use Active State Perl or Strawberry Perl


Building and Installing ACE on Windows with Microsoft Visual Studio

ACE contains project files for Visual Studio 2017 (vc141), and Visual Studio 2019 (vc142). Visual Studio 2015/2017/2019 use different file formats but the same file suffixes (.sln and .vcproj). To support both environments, ACE supplies files with different names for the different development and target platforms. The platform/name mapping is shown below. All solution files have a .sln suffix and all project files have a .vcproj suffix.

Mapping of Platform to Solution/Project File Name
Platform File Name
Visual Studio 2017 name_vs2017
Visual Studio 2019 name_vs2019

The VC++ compiler and linker can now be invoked from GNU make just like most UNIX builds. Follow the instructions in the ACE/GNU Configuration sections and see the additional information in the comments of platform_win32_msvc.GNU.

If you happen to open an older file Visual Studio solution from a newer one, it will offer to convert the file to the newer format for you

  1. Uncompress the ACE distribution into a directory, where it will create a ACE_wrappers directory containing the distribution. The ACE_wrappers directory will be referred to as ACE_ROOT in the following steps -- so ACE_ROOT\ace would be C:\ACE_wrappers\ace if you uncompressed into the root directory.

  2. Create a file called config.h in the ACE_ROOT\ace directory that contains:

    #include "ace/config-win32.h"

  3. The static, DLL and MFC library builds are kept in different workspaces. Files with names *_Static contain project files for static builds. Workspaces for static and DLL builds will be available through the stock release at DOC group's website. The workspaces for MFC are not available and have to be generated using MPC. Please see MPC's README for details.

  4. Now load the solution file for ACE (ACE_ROOT/ACE.sln).

  5. Make sure you are building the configuration (i.e, Debug/Release) the one you'll use (for example, the debug tests need the debug version of ACE, and so on). All these different configurations are provided for your convenience. You can either adopt the scheme to build your applications with different configurations, or use ace/config.h to tweak with the default settings on NT.
    Note: If you use the dynamic libraries, make sure you include ACE_ROOT\lib in your PATH whenever you run programs that uses ACE. Otherwise you may experience problems finding ace.dll or aced.dll.

  6. To use ACE with MFC libraries, also add the following to your config.h file. Notice that if you want to spawn a new thread with CWinThread, make sure you spawn the thread with THR_USE_AFX flag set.

    #define ACE_HAS_MFC 1

    By default, all of the ACE projects use the DLL versions of the MSVC run-time libraries. You can still choose use the static (LIB) versions of ACE libraries regardless of run-time libraries. The reason we chose to link only the dynamic run-time library is that almost every NT box has these library installed and to save disk space. If you prefer to link MFC as a static library into ACE, you can do this by defining ACE_USES_STATIC_MFC in your config.h file. However, if you would like to link everything (including the MSVC run-time libraries) statically, you'll need to modify the project files in ACE yourself.

  7. Static version of ACE libraries are built with ACE_AS_STATIC_LIBS
    defined. This macro should also be used in application projects that link to static ACE libraries

    Optionally you can also add the line

    #define ACE_NO_INLINE

    before the #include statement in ACE_ROOT\ace\config.h to disable inline function and reduce the size of static libraries (and your executables.)

  8. ACE DLL and LIB naming scheme:

    We use the following rules to name the DLL and LIB files in ACE when using MSVC.

    "Library/DLL name" + (Is static library ? "s" : "") + (Is Debugging enable ? "d" : "") + {".dll"|".lib"}

More information for ACE/TAO on MSVC can be found here. The doxygen version of this document is available under Related Topics in the ACE Library.

ACE TESTS

The tests are located in ACE_ROOT\tests. There is also a solution in that directory to build all the tests (tests.sln)

Once you build all the tests (Batch Build works well for this), you can run perl script run_test.pl in the tests directory to try all the tests.

BUILDING ACE ON A WIN32 MACHINE THAT LACKS A NETWORK CARD

You may want to run ACE on a non-networked machine. To do so, you must install TCP/IP and configure it to ignore the absence of a network card. This is one method:

  1. Run Control Panel
  2. Choose Network from Control Panel
  3. Add Adapter: MS Loopback Adapter
  4. Configure MS Loopback Adapter with 802.3 (default)
  5. Add Protocol: TCP/IP Protocol
  6. Configure TCP/IP Protocol with a valid IP address and subnet mask. Leave everything else at the default settings.
  7. Add Service: Workstation
  8. Exit and Restart System
  9. Run Control Panel again
  10. Choose Services from Control Panel
  11. The following services are not necessary and may be set to Disabled Startup:
    Alerter
    Computer Browser
    Net logon
    Messanger
  12. Choose Network from Control Panel
  13. Confirm the following setup. This is all you need to run ACE:
    Installed Software:
    Computer Browser
    MS Loopback Adapter Driver
    TCP/IP Protocol
    Workstation
    Installed Adapter Cards:
    MS Loopback Adapter


 

Building and Installing ACE on Windows with Embarcadero C++

If you are building for a machine without a network card, you may want to check here first.

  1. Uncompress the ACE distribution into a directory, where it will create an ACE_wrappers directory containing the source. The ACE_wrappers directory will be referred to as ACE_ROOT in the following steps -- so ACE_ROOT\ace would be C:\ACE_wrappers\ace when you uncompressed into the root directory.

  2. Create a file called config.h in the ACE_ROOT\ace directory that contains at least:

    #include "ace/config-win32.h"

  3. Open a RAD Studio Command Prompt.

  4. Set the ACE_ROOT environment variable to point to the ACE_wrappers directory. For example:

    set ACE_ROOT=C:\ACE_wrappers

  5. Add ACE_wrappers\lib and ACE_wrappers\bin to the PATH environment variable:

    set PATH=%ACE_ROOT%\lib;%ACE_ROOT%\bin;%PATH%

  6. Change to the ACE_ROOT\ace directory.

    cd %ACE_ROOT%\ace

  7. Generate the bmake makefiles using MPC. Use the bmake project type for C++ Builder:

    %ACE_ROOT%\bin\mwc.pl -type bmake

  8. You can build several different versions of ACE by setting the following optional environment variables before you run make:

    Set the environment variable below to build a debug version of ACE
    set DEBUG=1

    Set the environment variable below to build a unicode version of ACE
    set UNICODE=1

    Set the environment variable below to build a version of ACE with Codeguard support. Should only be used when DEBUG is also set
    set CODEGUARD=1

    Set one of the following environment variable to 1 to select which Embarcadero C++ compiler has to be used. Valid environment variables are BCC32C, BCC64, and BCC64X.
    set BCC64X=1

    You can then start the build with the command
    make -f Makefile.bmak all

    You may also enable the options by passing them as command line options to make, for example:
    make -f Makefile.bmak -DDEBUG all

  9. Build ACE by doing:

    make -f Makefile.bmak all

Note that when you run make in a sub directory you give make -f Makefile.bmak all. The all is needed to make sure the complete project is build.

The C++ Builder port has been done by Jody Hagins, Christopher Kohlhoff and Johnny Willemsen.

ACE TESTS

Before you can build the tests you need to build the protocols directory. Change the directory to ACE_ROOT\protocols and start:

%ACE_ROOT%\bin\mwc.pl -type bmake
make -f Makefile.bmak all

The tests are located in ACE_ROOT\tests, change to this directory. You build then the tests with the following commands:

%ACE_ROOT%\bin\mwc.pl -type bmake
make -f Makefile.bmak all

Once you build all the tests, you can run the automated test script using:

perl run_test.pl

in the tests directory to try all the tests. You need to make sure the ACE bin and lib directory (in this case %ACE_ROOT%\bin and %ACE_ROOT%\lib) are on the path before you try to run the tests. If your executables are compiled into a subdirectory, add -ExeSubDir subdirname to the command.


Building and Installing ACE on Win32 with MinGW/ MSYS

If you are building for a machine without a network card, you may want to check here first.

Building and installing ACE on MinGW uses a mix of a UNIX building process and Win32 configuration files. Also, as MinGW uses GNU g++, you may want to take a look at the Compiling ACE with GNU g++ section.

You will need the MinGW build tools and libraries, downloable from http://www.mingw.org.
For our build we require the packages MinGW and MSYS.

  1. Install the MinGW tools (including the MinGW Development toolkit) into a common directory, say c:/mingw.

  2. Install the MSYS tools into a common directory, say c:/msys.

  3. Open a MSYS shell. Set your PATH environment variable so your MinGW's bin directory is first:
           % export PATH=/c/mingw/bin:$PATH
           
  4. Add an ACE_ROOT environment variable pointing to the root of your ACE wrappers source tree:
           % export ACE_ROOT=/c/work/mingw/ACE_wrappers
           
    From now on, we will refer to the root directory of the ACE source tree as $ACE_ROOT.

  5. Create a file called config.h in the $ACE_ROOT/ace directory that contains:
           #include "ace/config-win32.h"
           
  6. Create a file called platform_macros.GNU in the $ACE_ROOT/include/makeinclude directory containing:
           include $(ACE_ROOT)/include/makeinclude/platform_mingw32.GNU
           
    In the above text, don't replace $(ACE_ROOT) with the actual directory, GNU make will take the value from the environment variable you defined previously.

    If you lack Winsock 2, add the line

           winsock2 = 0
           
    before the previous one.

    If you want to install ACE (using "make install") and want all the .pc files generated, set the installation prefix in platform_macros.GNU.

          INSTALL_PREFIX=/c/ACE
           
    Headers will be installed to $INSTALL_PREFIX/include, documentation and build system files to $INSTALL_PREFIX/share and libraries to $INSTALL_PREFIX/lib. With INSTALL_PREFIX set, RPATH will be enabled. To disable RPATH (for example, if $INSTALL_PREFIX/$INSTALL_LIB is already a system-known location for shared libraries), set the make macro install_rpath to 0 by adding install_rpath=0 to platform_macros.GNU.

  7. In the MSYS shell, change to the $ACE_ROOT/ace directory and run make:
           % cd $ACE_ROOT/ace
           % make
           

    This should create libACE.dll (the Win32 shared library) and libACE.dll.a (the Win32 import library for the DLL). Note that the name for the ACE DLL follows the MinGW convention, which itself resembles UNIX.

    If you want static libs also, you may run:

           % make static_libs_only=1
           
  8. Run make install:
           % make install
           

    This should create ACE.pc to use with pkg-config.

  9. The same rules for Win32 search of DLLs apply for MinGW. If you want to run some ACE programs from the MSYS shell, you may need to add the directory for libACE.dll to your PATH:
           % export PATH=/c/work/mingw/ACE_wrappers/ace:$PATH
           
ACE TESTS

The tests are located in $ACE_ROOT/tests. After building the library, you can change to that directory and run make:

       % cd $ACE_ROOT/tests
       % make
       

Once you build all the tests, you can run run_tests.pl in the tests directory to try all the tests:

       % perl run_test.pl
       

If you are using ACE as a DLL, you will need to modify your PATH variable as explained above.

You may want to check $ACE_ROOT/tests/README for the status of the various tests on MinGW and the different Windows flavors.


Building and Installing ACE on Win32 with Cygwin

If you are building for a machine without a network card, you may want to check here first.

Building and installing ACE on Cygwin uses the UNIX building process. Also, as Cygwin uses GNU g++, you may want to take a look at the Compiling ACE with GNU g++ section.

You will need the Cygwin build tools and libraries, downloable from http://www.cygwin.com. For our build we require the following packages besides the packages the setup selects by default:

gcc (version 3.3.3), cygserver, make, perl, binutils.
  1. Install Cygwin (this can be easy downloading and running setup.exe from the Cygwin site). For working with ACE we recommend to select DOS as default text file type.

  2. Open a Cygwin shell. Set your PATH environment variable so your Cygwin bin directory is first:
           % export PATH=//c/cygwin/bin:$PATH
           
    or
           % export PATH=/cygdrive/c/cygwin/bin:$PATH
           

    Note Cygwin uses ``/'' as directory separator, and ``//X'' as a notation for Win32 drive X. Note also that you can't use ``c:/cygwin/bin'' because, for Cygwin, ``:'' is path separator character, as in UNIX.

  3. Add an ACE_ROOT environment variable pointing to the root of your ACE wrappers source tree (in this example c:/work/cygwin/ACE_wrappers):
           % export ACE_ROOT=/cygdrive/c/work/cygwin/ACE_wrappers
           

    Note here you can't use the ``//X'' Cygwin notation as this is seen by Cygwin's compiler and it doesn't support that (it does support ``/'' as directory separator however).

    From now on, we will refer to the root directory of the ACE source tree as $ACE_ROOT.

  4. Create a file called config.h in the $ACE_ROOT/ace directory that contains:
           #include "ace/config-cygwin32.h"
           
  5. Create a file called platform_macros.GNU in the $ACE_ROOT/include/makeinclude directory containing:
           include $(ACE_ROOT)/include/makeinclude/platform_cygwin32.GNU
           
    In the above text, don't replace $(ACE_ROOT) with the actual directory, GNU make will take the value from the environment variable you defined previously.
  6. On the Cygwin shell, change to the $ACE_ROOT/ace directory and run make:
           % cd $ACE_ROOT/ace
           % make
           

    This should create libACE.dll (the Win32 shared library) and libACE.dll.a (the Win32 import library for the DLL). Note the name for the ACE DLL on Cygwin follows the UNIX convention.

    If you want static libs also, you may run:

           % make static_libs_only=1
           
  7. The same rules for Win32 search of DLLs apply for Cygwin. If you want to run some ACE programs from the Cygwin shell, you may need to add the directory for libACE.dll to your PATH:
           # export PATH=//c/work/cygwin/ACE_wrappers/ace:$PATH
           
    If you are using MPC-generated Makefiles, then the DLLs have been placed in the lib directory instead of ace and thus your PATH addition would need to look like this:
           # export PATH=//c/work/mingw/ACE_wrappers/lib:$PATH
           
ACE TESTS

The tests are located in $ACE_ROOT/tests. After building the library, you can change to that directory and run make:

       % cd $ACE_ROOT/tests
       % make
       

Once you build all the tests, you can run run_tests.pl in the tests directory to try all the tests:

       % perl run_test.pl
       

If you are using ACE as a DLL, you will need to modify your PATH variable as explained above.

You may want to check $ACE_ROOT/tests/README for the status of the various tests on Cygwin and the different Windows flavors.


Building and Installing ACE on VxWorks

For the most part, you should be able to follow the instructions above to build ACE and applications that use it. Start with the Unix instructions above to build ACE and the applications that use it. Please see below for more information on building ACE on NT hosts for VxWorks targets.

A few notes on VxWorks builds (thanks to Paul von Behren and Remedy IT for these notes):

  • VxWorks builds are done with a cross compiler, i.e., the compiles are done on a workstation creating object modules which are downloaded and loaded into the VxWorks target system.

  • C++ object modules must be post-processed by a VxWorks utility called "munch" to set up calls to static constructors and destructors. ACE integrates the makefile includes/rules files distributed with VxWorks to achieve maximum compatibility and reuse the target specifications and buildcommands defined by Windriver itself. The original ACE support for VxWorks included a perl script called $ACE_ROOT/bin/ace_ld, which was called from the Makefiles, replacing the traditional ld step. Although this script is currently still available it is not used anymore.
    You must have perl installed to use ace_ld. If perl is not on your path, you'll have to set PERL_PATH to the full path (including perl.exe), either in your $(ACE_ROOT)/include/makeinclude/platform_macros.GNU or in your environment.

  • Wind River provides GCC/G++ cross-compilers for the supported target platforms. The executables are named cc<target> and g++<target>; for example, ccppc and g++cpp for PowerPC targets.

You'll have to let ACE know the target type at compile time. There are several ways to do this; please see the $ACE_ROOT/include/makeinclude/platform_vxworks5.5.x.GNU platform file for detailed information.

The VxWorks platform_vxworks*.GNU files are set up so that shared libraries are not built on VxWorks, by default. Only static libraries, with .a extension, are built. Therefore, it's not necessary to set the LD_LIBRARY_PATH environment variable on your host system when building for VxWorks targets. Please note, however, if you use TAO on VxWorks that you will need to set your LD_LIBRARY_PATH to find the TAO IDL compiler libraries (installed in the ace directory) on the host.

These non-default VxWorks kernel configuration #defines are required with ACE:

#define INCLUDE_CPLUS           /* include C++ support */
#define INCLUDE_CPLUS_IOSTREAMS /* include iostreams classes */
#define INCLUDE_POSIX_ALL       /* include all available POSIX functions */
For completeness, here are the non-default #defines that we used for VxWorks 5.3.1/g++ 2.7.2:
#define INCLUDE_CPLUS           /* include C++ support */
#define INCLUDE_CPLUS_IOSTREAMS /* include iostreams classes */
#define INCLUDE_CONFIGURATION_5_2 /* pre-tornado tools */
#define INCLUDE_DEBUG           /* pre-tornado debugging */
#define INCLUDE_LOADER          /* object module loading */
#define INCLUDE_NET_SYM_TBL     /* load symbol table from network */
#define INCLUDE_SYM_TBL_SYNC    /* synchronize host and target symbol tables */
#define INCLUDE_NFS             /* nfs package */
#define INCLUDE_PING            /* ping() utility */
#define INCLUDE_POSIX_ALL       /* include all available POSIX functions */
#define INCLUDE_RDB             /* remote debugging package */
#define INCLUDE_RLOGIN          /* remote login */
#define INCLUDE_RPC             /* rpc package */
#define INCLUDE_SECURITY        /* shell security for network access */
#define INCLUDE_SHELL           /* interactive c-expression interpreter */
#define INCLUDE_SHOW_ROUTINES   /* show routines for system facilities*/
#define INCLUDE_SPY             /* spyLib for task monitoring */
#define INCLUDE_STARTUP_SCRIPT  /* execute start-up script */
#define INCLUDE_STAT_SYM_TBL    /* create user-readable error status */
#define INCLUDE_SYM_TBL         /* symbol table package */
#define INCLUDE_UNLOADER        /* object module unloading */
#define INCLUDE_WINDVIEW        /* WindView command server */
Also, automatic construction/destruction of static objects should be enabled.

If you use TAO, it's also a good idea to increase the NUM_FILES parameter from its default of 50 to, say, 1000.

Please note that those VxWorks kernel configuration parameters are set in the VxWorks configAll.h file. You must rebuild your VxWorks kernel after modifying that file.

If you're first getting started with ACE and/or VxWorks, I recommend just building the ACE library and tests first. (Some of the ACE examples, in System_V_IPC, don't build on VxWorks yet.) Then try running the tests. Please see $ACE_ROOT/tests/README for the latest status of the ACE tests on VxWorks.

Please note that the main entry point is renamed to ace_main (configurable via ACE_MAIN) on VxWorks with g++, to comply with its restriction against using main. In addition, ACE_HAS_NONSTATIC_OBJECT_MANAGER is enabled by default to cleanly support construction and destruction of static objects. Please see the Non-static ACE_Object_Manager discussion for the important implication of this feature.

ACE threads (VxWorks tasks) can be named, for example, by supplying a non-null argument to the Thread_Manager spawn routines. However, names beginning with "==ace_t==" are forbidden because that prefix is used internally by ACE.

You can spawn a new task to run ace_main, using either VxWorks sp, or ACE'S spa. spa can be used from the VxWorks shell to pass arguments to ace_main. Its usage is:


spa ace_main, "arg1" [, ...]
All arguments must be quoted, even numbers. You can start also ace_main without spawning another thread by using:


spaef ace_main, "arg1" [, ...]
ACE also provides the function vx_execae which is capable of running ace_main in a separate thread, wait for the task to finish and return the return code from ace_main:

int vx_execae (FUNCPTR acemain,char* arguments, int prio = 0, int opt = 0, int stacksz = 0);

You could call this from the VxWorks shell like:


my_rc = vx_execae ace_main, "-o server.ior -ORBDottedDecimalAddresses 1"

When prio, opt or stacksz are omitted or specified as 0 default values will be used. See the VxWorks shell documentation for the defaults for prio and opt. For stacksz the default is ACE_NEEDS_HUGE_THREAD_STACKSIZE. The arguments string will be parsed and passed on to ace_main as a regular argc and argv.

Be aware of the fact that when you execute ace_main directly from the VxWorks shell argc will be zero and argv* will also be zero. Using argv[0] will not return the program name, but will result in a crash.
The ACE helper functions spa, spaef and vx_execae prevent this problem by building a regular argc and argv which also contain a valid argv[0] element.

Building Shared Libraries for VxWorks.

NOTE: Since VxWorks support is currently being reworked with an initial focus on static builds the support for shared builds is momentarily broken. This will be remedied(!) as soon as possible.

ACE supports shared libraries for VxWorks, but only with the g++ compiler. To build shared libraries instead of the default static libraries, added shared_libs_only=1 to either your ACE_wrappers/include/makeinclude/platform_macros.GNU or your make invocation. Then, be sure to load the ACE (and any other) shared library before loading your executable(s).

A shared library for VxWorks uses the same code as for a static (non-shared) library. However, calls to static constructors/ destructors are added. The code in the shared library must be reentrant if you shared it between programs (tasks). The ACE library meets this requirement.

Shared libraries reduce build time, executable size, and load time of the executable. But, you must manually load the shared library before loading your executable(s) with a command such as:


-> ld < libACE.so
Shared libraries can be unloaded the same way an executable (module) is unloaded.

NOTE: Shared libraries on VxWorks aren't the same as shared libraries on other operating systems. In particular, there is no support for creating copies of writeable global (static) data in the shared library. This includes the singleton ACE_Object_Manager instance pointer. If you share global data between separate programs, they may not work properly. See the discussion of shared code and reentrancy in the VxWorks' Programmers Guide.

Instead of trying to run separate programs onto a VxWorks target, we recommend creating just one program, and spawning a thread for each task. The TAO IDL_Cubit test collocation test is a good example.

Linking ACE and/or TAO Libraries into the VxWorks Kernel.

It's easy to link your ACE and/or TAO libraries into the VxWorks kernel. Just build shared versions, but disable the munch step. The easiest way to do that is to set the LD make variable to the name of your linker. For example, to build a libACE.so for PowerPC that can be linked into the kernel:
% cd $ACE_ROOT/ace
% make LD=ldppc shared_libs_only=1
After building the shared lib, link it into the kernel by setting the MACH_EXTRA make variable in the kernel configuration Makefile. Then, build the kernel using make exe.

Using the one-button ACE tests with VxWorks.

It is possible to generate a script to execute all ACE tests. You can do this by executing

% perl run_test.pl -v -o > run_test.vxworks
The ACE tests write their output files in a directory named log/, below the current (tests) directory.

To run the tests from the build directory on an NT host where you crossbuild your VxWorks ACE/TAO you can set up the Target Server File System (TSFS) in your Target Server configuration. If you f.i. set the root for the TSFS to the root directory of your builddisk you can set the default directory for the target by issueing the following command from a Host shell: '@cd "/tgtsvr/{path to ACE}/ACE_wrappers/tests"'. The '@' addition makes sure this command is executed for the target environment and not the local host shell environment. If you also issue the command 'cd {path to ACE}/ACE_wrappers/tests' you can execute the generated one button testscript like: '< run_test.vxworks'.

Running the ACE tests automatically from the ACE autobuild tool using Target Server and Host shell options is also supported.

If you don't have NFS included in your VxWorks kernel, you can use these steps, provided by Clarence M. Weaver, to run the tests and capture their output:

  1. What I did was create a log directory on the boot NT host of my VxWorks target.

  2. I copied all the test applications and the run_test.vxworks script to the parent of the log directory.

  3. Using the target shell not the host shell, I "cd" to the directory containing the script and test programs.

  4. Invoked the script using < run_test.vxworks from this target shell.

Kirk Davies provided this approach for running the ACE tests on Tornado II:
  • Under Tornado II, I set up the Target Server File System (TSFS), and the test logs get written to the log subdirectory under that.

  • You have to set an environment variable before running the tests:
    putenv("ACE_TEST_DIR=/tgtsvr")
    

Building ACE on Tornado/NT hosts for VxWorks targets.

The following, very useful information was contributed by Chris Ryan and Paul von Behren. Please submit corrections, additions, or clarifications to our the github project.

NOTE:The make (version 3.74) that is provided with Tornado 2.2 cannot be used to build ACE. A working version is available from the WindRiver support site, download the make3_80.gvk_patches and the make3_80.tor2_2.new_dependency_rules package and install them.

Using the Cygnus tools, this approach works:

  • You'll build both your NT and VxWorks executables in the same workspace (directory hierarchy). This works because the NT compiler and ACE's Makefiles put their output in different directories.

  • Set up your ACE_wrappers/include/makeinclude/platform_macros.GNU as usual for VxWorks. See the g++/VxWorks platform file for more information.

  • Create an ACE_wrappers/ace/config.h file that looks something like the following.
    #if defined (_MSC_VER)  ||  defined (__BORLANDC__)
    # include "ace/config-win32.h"
    #else
    # include "ace/config-vxworks5.x.h"
    #endif
    

  • Set your ACE_ROOT, CPP_LOCATION, WIND_BASE, and WIND_HOST_TYPE environment variables.

  • Build for NT, then build for VxWorks.

A few additional Windows Notes, from Paul von Behren:

  • Cygnus has created a Win32 API which is compatible with a "generic" Unix environment. Using this library, they have ported a large collection of GNU tools to WinNT/95 - including a port of gcc/g++. See http://www.cygnus.com/misc/gnu-win32/ A related link is ftp://ftp.cygnus.com/pub/gnu-win32/latest/

  • To set up the command-prompt build environment, run Tornado\host\x86-win32\bin\TorVars.bat. This is done implicitly within the Tornado IDE.

  • To run ace_ld, you still need perl installed - see ActiveState Perl or Strawberry Perl.

  • The Tornado IDE will use a standard Makefile for project builds, but does not have a GUI interface for managing the Makefile. By default, it will use rules from Makefile in the current directory and you can configure it to add certain Makefile targets to the project. If you have ACE_ROOT defined before starting Tornado, you can specify an ACE Makefile as a Tornado target and Tornado will then call make from the menu.

And Chris Ryan's instructions for building for VxWorks targets on Windows NT hosts:
  1. Path setting that seems to be working is:

          /tornado/host/x86-win32/bin:
          /tornado/host/x86-win32/lib/gcc-lib/i386-wrs-vxworks/cygnus-2.7.2-960126:
          /tornado/host/x86-win32/i386-wrs-vxworks/bin:
          /ace/ace_wrappers/bin:
          /gnuwin32/b18/H-i386-cygwin32/bin:
          /gnuwin32/b18/tcl/bin:
          /WINNT/system32:
          /WINNT:
          /WINNT/system32/nls/ENGLISH:
          /bin
          
    Other environment variables:

          WIND_BASE=/tornado
          SHELL=/bin/sh.exe
          TERM=pcbios
          TAO_ROOT=/ace/ACE_wrappers.vxworks/TAO
          CPP_LOCATION=/Program Files/DevStudio/VC/bin/CL.EXE
          GCC_EXEC_PREFIX=/tornado/host/x86-win32/lib/gcc-lib/
          WIND_HOST_TYPE=x86-win32
          ACE_ROOT=/ace/ACE_wrappers.vxworks
          
  2. /tornado is the root of the Tornado install ($WIND_BASE).
  3. /gnuwin32 is the root of a Cygnus GNU download and install.
  4. /bin content is:

          aced.dll
          cygwin.dll
          perl.exe
          rm.exe
          sh.exe
          true
          
    aced.dll is produced in an ACE NT source tree according to documented procedure for Windows VC++ ACE build. cygwin.dll is from the Cygnus GNU software download and install.
  5. Basically, follow documented procedure for ACE build/install on UNIX platform. Create a $ACE_ROOT/ace/config.h that looks like:

          #include "config-vxworks5.x.h"
          
    And create a $ACE_ROOT/include/makeinclude/platform_macros.GNU that looks like:

          WIND_BASE = /tornado
          WIND_HOST_TYPE = x86-win32
          CPU = I80486
          include $(ACE_ROOT)/include/makeinclude/platform_vxworks5.5.x.GNU
          
  6. When using cygnus windows GNUTools on WinNT you have to start make with "--unix" option, otherwise WinNT shell cmd.exe is responded and not sh.exe, i.e.,
     make --unix static_libs_only=1
     

TAO on NT Tornado host, VxWorks target.

  1. Build ACE and TAO_IDL in the NT tree as already documented. Be sure to build ACE's gperf on NT, in ACE_wrappers/apps/gperf/src.

  2. Build $TAO_ROOT/tao
          CPP_LOCATION=/Program Files/DevStudio/VC/bin/CL.exe
          cd $TAO_ROOT/tao
          /gnuwin32/b18/H-i386-cygwin32/bin/make
          
  3. Build orbsvcs.
          CPP_LOCATION=/Program Files/DevStudio/VC/bin/CL.exe
          cd $TAO_ROOT/orbsvcs/orbsvcs
          /gnuwin32/b18/H-i386-cygwin32/bin/make
          
  4. Build $TAO_ROOT/tests

Jaffar Shaikh's Notes for Building ACE and TAO for VxWorks on NT host

Scenario: I was building the ACE and TAO for VxWorks on NT. The target system was a PPC860 based chassis and another a NT host based card.

Host System:

NT 4.0 workstation with 128 M RAM, 266MHz Pentium.

Software Needed For Building TAO

1) ActiveState Perl or Strawberry Perl

2) Tornado 2.2.1 from Windriver.

3) Cygwin GNU to build TAO. It is available for NT as a freeware from the Cygwin site

The Cygwin Make (version 3.75) can only build the TAO not the Tornado II make (version 3.74)

Environment Variables:

On NT the environment Variables are set as follows, (from Control Panel-> System -> Environment)

I added following Environment variable entries to PATH

C:\Perl\bin\;
C:\tornado\host\x86-win32\bin;
C:\tornado\host\x86-win32\powerpc-wrs-vxworks\bin;
C:\tornado\host\x86-win32\lib\gcc-lib\powerpc-wrs-vxworks\cygnus-2.7.2-960126;
C:\Corba\Ace_wrappers\bin;
C:\Cygwin\bin;
C:\Cygwin\usr\bin;
C:\bin

Additional Environmental variables and the values,

CPU=PPC860
LD_LIBRARY_PATH=
SHELL=/bin/sh.exe
ACE_ROOT=/Corba/ACE_wrappers
WIND_BASE=/tornado
SHELL=/bin/sh.exe
TERM=pcbios
TAO_ROOT=/Corba/ACE_wrapper/Tao
CPP_LOCATION=/Program Files/Microsoft Visual Studio/VC98/Bin/CL.exe
GCC_EXEC_PREFIX=/tornado/host/x86-win32/lib/gcc-lib/
WIND_HOST_TYPE=x86-win32
PERL_PATH=/perl/bin/perl.exe

Directories of importance

C:\Corba <-- Ace_wrappers (uzipped)

C:\tornado <-- Tornado installed

C:\Perl <-- Perl installed

C:\Cygwin <-- Cygwin installed

C:\bin <-- Copy these files,

Ace.dll, <-- After you build Ace

gperf.exe <-- After you build gperf

Cygwin1.dll, <-- After you install Cygwin

perl.exe, <-- After you install Perl

rm.exe <-- After you install Cygwin

sh.exe <-- After you install Cygwin

true <-- After you install Cygwin

Create Files

1) C:\Corba\ACE_Wrappers\ace\config.h

with entry

#if defined (_MSC_VER) || (__BORLANDC__)
  #include "ace/config-win32.h"
#else
  #define ACE_HAS_IP_MULTICAST
  #include "ace/config-vxworks5.x.h"
#endif

2) C:\Corba\ACE_wrappers\include\makeinclude\platform_macros.GNU

WIND_BASE = /tornado
WIND_HOST_TYPE = x86-win32
include $(ACE_ROOT)/include/makeinclude/platform_vxworks5.5.x.GNU
ACE_COMPONENTS=FOR_TAO (you may choose this option to build ACE library that supports TAO)

Steps to Build

1) Build Ace.dll under NT

In MS Visual C++ open C:\Corba\ACE_wrappers\ace.sln And build Ace DLL

Copy Ace.dll in C:\bin

2) Build gperf utility under NT

In MS Visual C++ open C:\Corba\ACE_wrappers\apps\gperf\src\gperf.sln. Build gperf.exe

Copy gperf.exe to C:\bin

3) Mount Directries in Cygwin

Click on Cygnus Solutions -> Cygwin Bash Shell

Mount following directories by using mount command.

create respective directories first then use mount command

e.g. Create /Corba directory then use $mount -s "C:\Corba" /Corba

C:\Corba mount to /Corba

C:\tornado mount to /tornado

C:\Perl mount to /perl

C:\Cygwin mount to /cygwin

C:\bin mount to /bin

C:\Program Files mount to /Program Files

4) Build ACE in Cygwin

$cd /Corba/ACE_wrappers/ace

$make static_libs_only=1

This will build your ace library libACE.a for VxWorks. If you use option shared_libs_only=1 then the build will be libACE.so. The other options are same as follows.

5) Build TAO in Cygwin

$cd $TAO_ROOT/tao

$make debug=0 optimize=1 static_libs_only=1 minimum_orb=1

for shared libs use shared_libs_only=1

The minimum Tao does not have following components,

Dynamic Skeleton Interface

Dynamic Invocation Interface

Dynamic Any

Interceptors

Interface Repository

Advanced POA features

CORBA/COM interworking

You may play around with above options to find suitable build for your needs. For example when you give option debug=1 all the debug symbols will be created and the build will huge in size. The debug symbols are necessary when you want to debug your code.


Building and Installing ACE on Android

ACE can be built for Android by using the Android Native Development Kit (NDK). This is different than the standard way of writing Android applications in Java which run the on the Android Runtime or the older Dalvik Virtual Machine. Applications and libraries built using the NDK are native Linux applications written in C or C++ specifically compiled to run on Android systems and libraries can be included in normal Android apps. In addition, applications and libraries built using the NDK have access to Android-specific APIs much like the ones available to Java-based Android applications.

NOTE: ACE requires NDK r18 or later. Building with the NDK directly requires NDK r19 or later.

Windows Users: These instructions are written for a Unix based platform like Linux, but can also be used on Windows. If you are using an virtualized Linux environment like Windows Subsystem for Linux (WSL), Docker, or a traditional VM, then you can use the Linux version of the NDK and ignore rest of this note and all the other Windows specific notes.

If that is not the case, you should also pay attention to the notes marked with "Windows Users:" in addition to the rest of the instructions. In addition to the Windows version of the Android NDK, you will also need MSYS2 for Unix utilities that ACE needs.

After downloading the NDK, you will have to decide on what target you want to build for, which is covered in the next section, then decide if you want to build directly using the NDK or using a generated standalone toolchain. Generating a toolchain is optional and only really makes sense if you're building for just one architecture/API level pair and don't need to keep the entire NDK around.

Choosing the Target

To build ACE for Android you need to know the specific Android target you want. The specific target is defined by two things:

- The minimal API level to target.
A lower level means larger amount of potential users but also potentially less features. Android has many API levels to target. They roughly correspond to the versions of Android.
- The CPU architecture to target (Also called the Application Binary Interface or ABI by the NDK documentation).
In addition to ARM, Android also supports x86 and MIPS, although support for MIPS has been dropped from the NDK. This is the official documentation on the ABIs. These are the ABIs that ACE supports at the time of writing and must be passed to ACE as android_abi:
armeabi-v7a
32-bit ARM. Builds with NEON extensions enabled by default. Include android_neon := 0 in your platform_macros.GNU if you want to support processors without NEON support.
arm64-v8a
64-bit ARM, Sometimes referred to as aarch64.
x86
32-bit x86
x86_64
64-bit x86

It should be noted that starting in August 2019, the Google Play Store will require new apps to have 64-bit libraries if they have native libraries. 32-bit native libraries will still be supported but apps must also have 64-bit libraries. Look up any restrictions that may affect apps you want to publish on the Play Store, including targeted API level requirements.

Generating a Toolchain (Optional)

To generate a toolchain, one use must use build/tools/make_standalone_toolchain.py in the NDK. A destination must be chosen and is denoted here as $TOOLCHAIN. For example, to generate a toolchain targeting 32-bit ARM Android 7.0 "Nougat" (API Level 24) and later:

./make_standalone_toolchain.py --arch arm --api 24 --install-dir $TOOLCHAIN

$TOOLCHAIN/bin must be in your $PATH when building ACE and applications using ACE.

This table shows how the android_abi variable and the --arch argument correlate:

android_abi --arch
armeabi-v7a arm
arm64-v8a arm64
x86 x86
x86_64 x86_64

Windows Users: Android NDK includes Python in prebuilt\windows-x86_64\bin for 64-bit Windows NDKs. For the example above, assuming %NDK% is the location of the NDK and %TOOLCHAIN% is the desired location of the toolchain, run this command instead:

%NDK%\prebuilt\windows-x86_64\bin\python.exe %NDK%\build\tools\make_standalone_toolchain.py --arch arm --api 24 --install-dir %TOOLCHAIN%

For Windows %TOOLCHAIN%\bin and the location of the MSYS2 utilities must be in %PATH% when cross compiling ACE. The default location for these would be C:\msys64\usr\bin.

Building

  • If building TAO, build the ACE and TAO tools (ace_gperf and tao_idl) for the host. Follow the cross compilation setup instructions provide in TAO-INSTALL.html.

    Windows Users: If cross compiling TAO and the host tools were built using using Visual Studio, make sure cl.exe can be run from the environment when building for Android, as tao_idl will need to use it as a C preprocessor.

  • Setup the Android build
    • Create ace/config.h: #include "ace/config-android.h"
    • Create include/makeinclude/platform_macros.GNU:
      • Set android_abi to one of the options above. If using a standalone toolchain this must match the --arch argument used according to the table above.
      • If using the NDK directly, set android_ndk to the location of the extracted NDK and android_api to the API level desired.
      • Set options for debug and optimization options as desired.
      • If you want to compile static, add static_libs_only:=1
      • Must include include $(ACE_ROOT)/include/makeinclude/platform_android.GNU.
      • If building TAO, set the tao_idl options specified in the cross compiling instructions in TAO-INSTALL.html
  • Generate makefiles (if necessary).
  • Build with GNU make. If using a standalone toolchain, make sure you have $TOOLCHAIN/bin in your $PATH.

    Windows Users: If using a standalone toolchain, Make sure you have %TOOLCHAIN%\bin and MSYS2's bin in your %PATH% when building. If you are cross compiling TAO you will also need a preprocessor for tao_idl available (See Windows note above).

Installing ACE on Android

Native applications using the ACE library can be installed onto devices by several different methods. The files can be include as assets of Java application and can be written by the Java application into it's executable program directory. The native application can be downloaded by a Java application and written into the Java applications executable program directory. The native application can also be uploaded using the Software Development Kit's ADB tool. This method requires uploading the native application to a directory that allows execution and having any output directed to a writable directory.

Logging

On Android, ACE_Log_Msg (and therefore ACE_DEBUG and ACE_ERROR) uses Android's logging system (aka Logcat) by default in addition to stderr because stdout and stderr are discarded under normal circumstances. To disable this at runtime, run:

ACE_LOG_MSG->clr_flags (ACE_Log_Msg::SYSLOG);

To disable this at compile time include these lines in config.h:

#define ACE_DEFAULT_LOG_FLAGS ACE_Log_Msg::STDERR
#define ACE_DEFAULT_LOG_BACKEND_FLAGS 0

OpenSSL

Depending on the features of ACE, TAO, or other software desired, you might need OpenSSL. On Android, OpenSSL isn't part of the NDK Library and Android preloads the system SSL library (either OpenSSL or BoringSSL) for the Java Android API. This means OpenSSL MUST be statically linked to avoid conflicts with the almost certianly incompatible system SSL library. To build OpenSSL for Android, please read NOTES.ANDROID that comes with OpenSSL's source code. The static libraries will used if the shared libraries are not found. This can be accomplished by either disabling the generation of the shared libraries by passing no-shared to OpenSSL's Configure script or just deleting the so files after building OpenSSL.


Building and Installing ACE Network Services

The following explains how to build the ACE network services on UNIX and Win32.


Building and Installing ACE Network Services on UNIX

Building and installing ACE Network Services on UNIX is relatively simple (the process for Win32 is different). Here's what you need to do:

  1. Build and install ACE on UNIX as described earlier. If ACE is built at the root of the ACE source tree (and ACE has been ported to your platform, of course) the netsvcs static and shared object libraries should be built automatically. In addition, the server driver program (main) contained in $ACE_ROOT/netsvcs/servers/main.cpp should also be compiled and ready to run.

  2. Set your LD_LIBRARY_PATH environment variable to where the binary version of the ACE netsvcs library. For example, you probably want to do something like the following

    
          % setenv LD_LIBRARY_PATH $ACE_ROOT/ace:$ACE_ROOT/lib:$LD_LIBRARY_PATH
          

  3. By default, if the shared object library is built, the services are linked into the main driver program dynamically. To specify which services should be linked in and executed, edit the $ACE_ROOT/netsvcs/servers/svc.conf file. During your editing, you should update information (such as the default service port numbers) that affects the initialization of services in this file. Refer to the Service Configurator documentation to learn how the configuration file is parsed and how the services are dynamically linked and executed. In addition, refer to the Network Services documentation to learn more about how to configure each network service.

  4. If you only want to link the services statically, simply remove or rename the svc.conf file.


Building and Installing ACE Network Services on Win32

Once again, there are supplied project for Visual C++ 7.1 or later for the Network Services.


Building and Installing the ACE_SSL Library

The first step for all platforms is to build and install the OpenSSL distribution. The ACE_SSL library must then be built according to the instructions below.

Unix

  1. Make sure the OpenSSL header file directory is in your compiler's include path, and that OpenSSL libraries are in your library link/load path (e.g. LD_LIBRARY_PATH). If you installed OpenSSL into a set of directories unknown by the compiler, set the SSL_ROOT environment variable to point to the top level directory of your OpenSSL distribution, i.e. the one containing OpenSSL's include and lib directories.
  2. Build ACE as described above. When building ACE, add ssl=1 to your make command line invocation, or add it to your platform_macros.GNU file.
  3. Build the ACE_SSL library in the $ACE_ROOT/ace/SSL directory. The ACE_ROOT environment variable should be set prior to this point.

Microsoft Visual Studio

  1. Set the SSL_ROOT environment variable to the location of the directory containing the OpenSSL inc32 and out32dll directories.
  2. Add ssl=1 to your MPC $ACE_ROOT/bin/MakeProjectCreator/config/default.features or $ACE_ROOT/local.features file.
  3. At the moment you are using OpenSSL v1.1 or newer also add openssl11=1 to your MPC $ACE_ROOT/bin/MakeProjectCreator/config/default.features or $ACE_ROOT/local.features file.
  4. Re-run MPC to add support for building the ACE_SSL library to your MSVC++ workspaces and projects.
  5. Open the ACE.sln solution, and refer to the ACE build and installation instructions above for details on creating a config.h configuration header for this platform. Once the config.h file has been created, build the ACE_SSL project.

Embarcadero C++

Support for building ACE's ACE_SSL library and TAO's SSLIOP pluggable protocol with Embarcadero C++ does exist.

  1. Set the SSL_ROOT environment variable to the location of the directory containing the OpenSSL inc32 and out32 directories.
  2. Add ssl=1 to your MPC $ACE_ROOT/bin/MakeProjectCreator/config/default.features or $ACE_ROOT/local.features file, and re-run MPC to add support for building the ACE_SSL library to your Embarcadero C++ makefiles.
  3. Build ACE and TAO.


Building and Using GUI Reactors Libraries

There is a general method for building and using ACE_Reactors for various GUI libraries.

Building GUI Reactor Library

  1. Try to generate build files using MPC. Inspect the output of MPC to find out which features are necessary to build given reactor. Add these features to ACE_wrappers/bin/MakeProjectCreator/*.features file, or pass them directly to MPC using -features command line option. For example, for FlReactor the procedure consists of five steps
    1. In the first pass one gets that x11 (X11 libraries) is missing.
      $ mwc.pl -type gnuace Skipping ACE_FlReactor (ace_flreactor.mpc), it requires x11.
    2. Ensure that X11 libraries are installed, then pass x11=1 feature to MPC.
    3. In the second pass one gets that gl (OpenGL library) is missing.
      $ mwc.pl -type gnuace -features x11=1 ace.mwc Skipping ACE_FlReactor (ace_flreactor.mpc), it requires gl.
    4. Ensure that OpenGL libraries are installed, then pass gl=1 feature to MPC.
    5. In the third pass one gets that fl (Fast Light Toolkit) is missing.
      $ mwc.pl -type gnuace -features x11=1,gl=1 ace.mwc Skipping ACE_FlReactor (ace_flreactor.mpc), it requires fl.
    6. Ensure that Fast Light Toolkit libraries are installed, then pass fl=1 feature to MPC.
    7. In the fourth pass one gets that ace_flreactor feature is missing
      $ mwc.pl -type gnuace -features x11=1,gl=1,fl=1 ace.mwc Skipping ACE_FlReactor (ace_flreactor.mpc), it requires ace_flreactor.
    8. Allow MPC to generate makefiles for FlReactor by setting ace_flreactor=1 feature.
    9. In the last pass one obtains files for building FlReactor.
      $ mwc.pl -type gnuace -features x11=1,gl=1,fl=1,ace_flreactor=1 ace.mwc
    Currently to simplify MPC generation some of features are turned on by default in ACE_wrappers/bin/MakeProjectCreator/global.features. For examples to generate files related with Fl one has to provide only fl=1 feature. To obtain a more fine grained controll over MPC generation process one may modify ACE_wrappers/bin/MakeProjectCreator/*.features files.
  2. Required build files are generated now, it is enough then to invoke build tool. For example for under MPC::gnuace one has to call make fl=1. For MPC::vc7 target all features are encoded in generated project files, thus it is enough to compile ACE using MSVC.
The build procedure leads to a specific GUI Reactor library. For example, for Qt and Linux one gets libQtReactor.so, while for Windows the results are shared QtReactor.dll and import QtReactor.lib libraries or their variants depending on build options. When compiling TAO also GUI related libraries are created like libTAO_QtResource.so.

Using GUI Reactor Library

Here one has at least three use cases:
  1. Applications with their own build system. To use ACE support for GUI one has to include specific GUI headers and link with specific ACE_[GUI]Reactor library. When using TAO support for GUI one has also to link with specific TAO_[GUI]Resource library.
  2. Applications with build system using MPC. In general, it is better to create specific base projects for using ACE GUI support in such application. Base projects provided by ACE ACE_wrappers/bin/MakeProjectCreator/[ace,tao]_[gui][reactor,resource].mpb may be an examples of how to do this.
  3. Internal ACE applications like tests or examples. MPC project for internal ACE application using GUI support should be derived from ace_[gui]reactor.mpb base projects. To employ TAO support for GUI one should derive the project from tao_[gui]resource.mpb These base projects ensure that all necessary libraries are linked to the application, specifies features necessary to build a project and moreover impose a build order consistant with ACE. For example, the application project using XtReactor should be derived from ace_xtreactor.mpb.

Notes on specific GUI Reactors

  • QtReactor
  • The build is controlled by ace_qtreactor [1 by default] feature. To build this reactor one has to provide feature qt [0 by default] (Qt library). Moreover, it is assumed that Qt was installed in a standard way and QTDIR points to Qt installation folder. To build TAO support for Qt one should use tao_qtresource [1 by default] feature.
  • XtReactor
  • The build is controlled by ace_xtreactor [1 by default] feature. To build this reactor one has to provide the following features: x11 [1 by default] (X11 libraries) and xt [1 by default] (X11 Toolkit). Moreover, some examples and tests related with XtReactor needs additionall features namely either motif [0 by default] (Motif/Lesstif libraries) or athena [0 by default] (Athena widgets). To build TAO support for xt one should use tao_xtresource [1 by default] feature.
  • TkReactor
  • The is controlled by ace_tkreactor [1 by default] feature. To build this reactor one has to provide tk [0 by default] (Tcl libraries) feature. To build TAO support for Tk one should use tao_tkresource [1 by default] feature.
  • FlReactor
  • The build is controlled by ace_flreactor [1 by default] feature. To build this reactor one has to provide the following features: x11 [1 by default] (X11 libraries), gl [1 by default] (OpenGl) and fl [0 by default] (Fast Light Toolkit). To build TAO support for Fl one should use tao_flresource [1 by default] feature. MS Windows: The paths to fltkdll and OpenGL32 libraries, as well as fltk header files should be setup manually for succesfull compilation. Obviosuly, x11switch is ignored for this platform.

Installation Notes

  • Windows (Windows NT, 2000, XP, 2003, etc., and Windows '9x/ME)

    Please see the Non-static ACE_Object_Manager discussion below.

  • Linux

    ACE has been ported to Linux on Intel, PowerPC platforms. If you use a RedHat 5.x distribution, it's best to use RedHat 5.1 or later. ACE works without any modifications on RedHat 5.1 and later, and on Debian 2.1 on Intel. Use the platform_linux.GNU and ace/config-linux.h in your platform_macros.GNU and config.h files, respectively. The same files can be used on PowerPC, with LinuxPPC 1999 (R5), with glibc 2.1.1.

    If you run out of memory, it's easy to add virtual memory on Linux. Please see the mkswap man page. You'll need at least 256 to 300 Mb of virtual memory (RAM + swap) to compile all of ACE+TAO. The System Resource Requirements section has some suggestions on how to reduce the memory requirement.

    The glibc 2.0 dynamic loader isn't thread safe. If you want to use the Invocation API you'll have to set LD_BIND_NOW=true. If you want to use dlopen, you should use RTLD_NOW. The dynamic loader in glibc 2.1 is thread safe.

    NOTE: The TAO NameService uses IP multicasting by default, though it is not required. IP multicast on Linux requires the following:

    • Enable IP multicast in the Linux kernel. It is enabled in the default RedHat 5.1 kernel. In older distributions, you can enable it by rebuilding your kernel with CONFIG_IP_MULTICAST enabled.

    • Enable IP multicast in ACE. It is enabled by default in ace/config-linux.h. If you don't use IP multicast, add #define ACE_HAS_IP_MULTICAST 0 to your ace/config.h before building ACE.

    • There must be a network interface that is up and supports multicast. If you have linuxconf, it's easiest to use that to add a network route for multicast (224.0.0.0) on one of your network interfaces, such as eth0. If you don't have or use linuxconf, try adding a multicast routing table entry using something like this:

                   # route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
                  

    Some of the ACE tests fail on older, pre-glibc2 Linux platforms, such as RedHat 4.2. The problems are with threads and thread-specific storage.

  • SCO UNIX

    ACE has been ported to SCO UNIX using the GNU g++ 2.7.2 compiler. Arturo Montes <mitosys@colomsat.net.co> maintains this code. In addition, he also maintains a version of FSU pthreads.

  • FreeBSD

    FreeBSD is a fast evolving platform. However, it has the advantage of having standard releases. At this moment, ACE is only perodically tested against -stable (3.1R) and we rely a lot on FreeBSD users' feedbacks.

    Notice that on older FreeBSD, ld.so only looks for so libraries with version number appended. ACE makefiles create symlinks for most shared libraries if versioned_so is defined to 1 in $ACE_ROOT/ace with appropriate ACE version. However, this does not work for libACE.so itself so you have to create it manually (If you figure out how to do this, please let us know) like this:

    ln -sf $ACE_ROOT/ace/libACE.so $ACE_ROOT/ace/libACE.so.4.5

    On newer FreeBSD (3.0 or later,) this is no longer necessary.

  • NetBSD

    Like older FreeBSD, NetBSD's ld.so also requires versioned .so files.

  • OpenBSD

    ACE has been ported to OpenBSD 3.1 and GNU g++ 2.95.3.

    As with FreeBSD and NetBSD, OpenBSD requires versioned .so files. This is currently handled by the build files and no additional work is needed.

    ACE has been ported to OpenBSD with and without pthreads enabled. When using pthreads, though, C++ exceptions must be disabled. This is a known problem with the current release of OpenBSD (see www.openbsd.org, bug #1750). ACE emulated exceptions work fine.

    Compiling TAO may require the user data segment size restrictions and possibly other options to be increased. This is done by modifying the default user class in /etc/login.conf or by adding a new class and modifying the master passwer file accordingly.

  • UnixWare

    Steve Huston <shuston@riverace.com> has ported ACE to work with UnixWare 2.01 and g++.

    Ganesh Pai <gpai@voicetek.com> subsequently did the port for version 2.1.2, also with g++.

    Phil Mesnier < mesnier_p@ociweb.com> updated the port to support UnixWare 7.1.0, with help from Michael Meissnitzer < michael.meissnitzer@siemens.at>, Christian Klepp < christian.klepp@siemens.at > and Engelbert Staller < engelbert.staller@siemens.at> Building ACE (and TAO) on Unixware 7.1.0 requires a very specific g++ build environment. In particular, you must build and install g++ 2.95.2, along with binutils 2.9.1. The order (and the declaration of configuration) is extremely important. Using the gcc compiler provided on the Skunkware CD on a pentium system, here is the recipe I used to build a working environment (as root):

      mkdir /usr/local/newgnu
    < ftp and untar binutils-2.9.1 >
    < ftp and untar gcc-2.95.2 >
      mkdir -p build/binutils build/gcc
      cd build/binutils
      ../../binutils-2.9.1/configure i386-sco-sysv4
      gmake  # takes a long time
      gmake install # this creates /usr/local/i386-sco-sysv4/...
      mkdir /usr/local/i486-pc-sysv5/bin
      cd /usr/local/i486-pc-sysv5/bin
      for a in /usr/local/i386-sco-sysv4/bin/*; do ln -s $a .; done
      #links all the newly installed utilities
    
      cd /usr/local/newgnu/build/gcc
      ../../gcc-2.95.2/configure --with-gnu-as --with-gnu-ld
      gmake bootstrap # takes a long time
      gmake install
      mkdir /usr/local/i586-UnixWare7.1.0-sysv5/bin
      for a in /usr/local/i386-sco-sysv4/bin/*; do ln -s $a .; done
    
    Once done, ACE and TAO will successfully build and link.

  • LynxOS

    ACE builds and runs properly on LynxOS 4.0 for Intel and PowerPC targets. LynxOS 2.x and 3.x are no longer supported. If you run out of memory on LynxOS, these might help:

    • Increase the limits in /etc/starttab, then reboot system. We use these limits:
      # Data, stack, and core file limits (in Kbytes)
      80000
      16000
      102400

    • Enable or expand virtual memory, with something like:
      # mkcontig /swap 320
      # prio 17 vmstart /swap
      See the mkcontig and vmstart man pages, and /bin/rc.

    Please see the comments in the ACE platform_lynxos.GNU file for information on, and an example of, tailoring for your particular platform.

    NOTE: if you want to use IP multicast on LynxOS, be sure to add this line to your /net/rc.network, and reboot:

    
            /bin/route add "224.0.0.0" "$my_name"
          
  • VxWorks

    David Levine has ported ACE to VxWorks 5.2/5.3/5.3.1/5.4 with the GreenHills 1.8.8/1.8.9, g++ and diab compilers that are distributed with VxWorks/Tornado. It is not possible to use VxWorks 5.4 and earlier with ACE anymore because the compilers delivered with 5.4 and earlier don't support the C++ features ACE needs.

    At this moment Remedy IT is upgrading and stabilizing ACE/TAO support for Tornado 2.2/VxWorks 5.5.1. Since the existing support for previous VxWorks version has been unsupported and broken for some time and most (potential) users seem to have upgraded to VxWorks 5.5.1 no backporting effort is done. See also here.

    Tornado 2.2/VxWorks 5.5.1 support IP multicast. That is not enabled by default in ACE for VxWorks, because it depends on your kernel configuration. To enable it, add #define ACE_HAS_IP_MULTICAST to your ace/config.h.

    NOTE: In order for the ACE Broadcast and Multicast tests to work the VxWorks kernel should receive the packages it sends out locally. By default this is not supported. To enable this behaviour you need to include the IFF_SIMPLEX flag for your required NIC driver. See the following Windriver SPR 4542 for more information.

    In addition to all of the other benefits of ACE, it helps work around some deficiencies with VxWorks. The problems are:

    1. The program entry point cannot be called "main" with g++. ACE renames it to "ace_main" (configurable via ACE_MAIN) on VxWorks. While this may seem trivial, it is important with legacy code. ACE itself ran into this problem.

    2. argc/argv isn't used with VxWorks entry points. ACE provides a wrapper function that transparently converts shell command line arguments to argc/argv form. See below for details.

    Please note that ACE uses one of the spare fields in the Wind River task control block, spare4, for thread-specific storage. This field is specified in only one place, in ace/OS_NS_Thread.inl, so it can easily be changed to one of the other spare fields, if necessary.

    ACE destroys dynamically allocated singletons in the ACE library. But, they may not properly destroy some static objects. If you have trouble running a program multiple times, it may be necessary to unload the module, using unld, and reload it between runs. Alternatively, you could try calling cplusDtors and then cplusCtors between runs.

  • MVS OpenEdition

    All of ACE has been ported to OpenEdition by Chuck Gehr <gehr@sweng.stortek.com>. The ACE library, all the tests and most of the examples and apps build clean. There are still some problems that need to be ironed out:

    MVS does not support the dynamic linking dl...() calls that the Service Configurator uses to dynamically link services at run time. As a result, all the examples and apps that use a svc.conf file (for dynamically configuring service objects) do not work, however, most of these apps can be built/run statically. Also, the Svc_Conf_l.cpp and Svc_Conf_y.cpp files are generated using flex and yacc on a ascii (not ebcdic) machine and as a result they don't work very well with ebcdic svc.conf files. We should be able to regenerate these files on MVS but MVS doesn't have flex. This is something that needs to be done.

    Some of the tests do not execute properly. This is a minority and over time the goal is to get to 100%.

    The make scheme for some of the apps still doesn't work perfectly on MVS. This is mainly due to the way shared libraries are handled on MVS. See additional build tips for MVS for more on this.

  • QNX Neutrino

    ACE has been ported to QNX Neutrino 2.0. We cross-compile for Neutrino on a QNX4 host using g++ 2.8.1, using the ace/config-qnx-neutrino.h and include/makeinclude/platform_qnx_neutrino.GNU configuration files. Many of the ACE tests succeed, though some fail. As the porting effort progresses, we hope to eliminate these failures. If you know of fixes, please send them to us.

  • QNX RTP

    ACE has been ported to QNX RTP . We compile for QNX RTP using the GCC compiler shipped with the distribution, using the ace/config-qnx-rtp.h and include/makeinclude/platform_qnx_rtp_gcc.GNU configuration files. Many of the ACE tests succeed, though some fail. As the porting effort progresses, we hope to eliminate these failures. If you know of fixes, please send them to us.

    WARNING: Under the current version of QNX RTP ACE fails if compiled with inline=0 .

  • PharLap ETS

    ACE has been ported to Ardence's PharLap ETS version 13. The port was originally done for Pharlap 9.1 and MSVC 6, but has been updated to Pharlap ETS 13 with Visual Studio .NET 2003 (VC7.1).

    To build for PharLap, you'll need to use MPC to generate .sln/.vcproj files with the ETS configurations. For example:

    cd \ace\ACE_wrappers
    perl bin/mwc.pl  -type vc71 -relative ACE_ROOT=C:/ace/ACE_wrappers -relative TAO_ROOT=C:/ace/ACE_wrappers/TAO -value_template configurations='"ETS Debug"' -value_template configurations+='"ETS Release"' -name_modifier *_ETS TAO_ACE.mwc
          
    That command will generate the same .sln and .vproj files as for regular Windows builds with VC7.1, but they'll have names with an _ETS suffix and will include the "ETS Debug" and "ETS Release" configurations.

    After generating the needed VC7.1 files, use the ace/config-pharlap.h configuration file, and the instructions for building on Windows. Building the ACE library is the same as for regular Windows platforms, except you choose one of the PharLap ETS configurations to build within Visual Studio. For an example of how to build binaries, see the tests directory. The tests_pharlap_msvc.lnk file is a LinkLoc commands file that the ACE tests are built with. It is likely that local sites may need to adjust this file for their target environment.

    When executing programs on the target system, it is possible that not all of the VC++ support DLLs are resident on the target. In particular, the debug-supporting DLLs may not be present. If you require these, be sure to add those needed. For example, on the standard LabVIEW RT 8.2 distribution using Pharlap ETS, the following DLLs must be copied to the target before being able to run Debug programs:

    • msvcp71d.dll
    • msvcr71d.dll

    To build ACE for National Instruments' LabVIEW RT, use the Pharlap ETS information above, but add the following line to your config.h file:

          #define ACE_PHARLAP_LABVIEW_RT
          
    This setting makes the necessary adjustments for LabVIEW's implementation of Pharlap ETS. By default, the ACE tests log their output/results to the system console on Pharlap ETS. To change this behavior and make the test output log to a file in the log directory under the current working directory while executing, add the following line to your config.h file:
          #define ACE_PHARLAP_TESTLOG_TO_FILE
          
    This setting has no affect on TAO tests which always write test output to stdout.

  • Mac OS X (10.2.x)

    ACE builds and runs on Mac OS X 10.2.x, but the following are needed to build it:

    1. The latest version of the Apple Developer Tools (December 2002)

    2. The dlcompat library (obtained either through Fink or SourceForge)

    When creating $ACE_ROOT/ace/config.h for Mac OS X, you need to add the following if you obtained dlcompat via Fink:

    #define ACE_NEEDS_DL_UNDERSCORE

    You'll also need to do:

    setenv DYLD_LIBRARY_PATH $ACE_ROOT/ace:$ACE_ROOT/lib

    setenv MACOSX_DEPLOYMENT_TARGET 10.2

    Currently, all ACE tests pass except Process_Mutex_Test and MEM_Stream_Test. Also, Mac OS X doesn't yet support *nix aio_* calls, and ACE does not know anything about Mach.

    The work to port ACE to Mac OS X was done by several people, John Zorko <j.zorko@att.net> is only one of them.

  • iPhone/iPod Touch/iPad

    ACE builds and runs on the iPhone/iPod Touch/iPad Hardware and Simulator. Keep in mind that ACE/TAO needs to be built statically since Apple does not allow third party dynamic libraries to be deployed on the hardware. The following are needed to build ACE:

    1. The iPhone SDK.

    2. When creating $ACE_ROOT/ace/config.h, include config-macosx-iphone-hardware.h if you want to deploy on the hardware, include config-macosx-iphone-simulator.h if you want to deploy on the simulator. Even though those includes are named after the iPhone, the includes work for iPhone/iPod Touch, and iPad.

    3. You need to define two environment variables. The first is IPHONE_TARGET. Set IPHONE_TARGET to SIMULATOR if you want to deploy on SIMULATOR. Set IPHONE_TARGET to HARDWARE if you want to deploy on the hardware device.

    4. When creating $ACE_ROOT/include/makeinclude/platform_macros.GNU, include 'include $(ACE_ROOT)/include/makeinclude/platform_macosx_iphone.GNU' in the file.


Compiling ACE with GNU g++

If you use the GNU GCC g++ compiler please note the following:

  • ACE/TAO needs g++ 4.8 or better. Older versions are not usable anymore

  • Make sure to update your gcc config.status file. This file is produced when installing gcc; it specifies where to install the binary files that gcc uses. For example, it specifies whether to use Solaris's /usr/ccs/bin binary utils or GNU binary utils. The config.status file is an output of the gcc configure script; it is preferable to use the --prefix option to configure instead of hacking its output.

    NOTE: if you do use the GNU linker, you might need to change the -G flag to -shared in the SOFLAGS definition in your include/makeinclude/platform_macros.GNU.

  • Don't get too confused about contradictory statements in the gcc documentation. It was written by different people...

  • Make sure that the linker invoked by gcc produces code that initializes static objects. Please see gcc's documentation for using collect2.


What Do I Need to Build for TAO?

Toshio Hori <toshi@etl.go.jp> provided these suggestions on building just what's needed for (a subset of) TAO:

I usually make:

    $ACE_ROOT/ace,
    $ACE_ROOT/apps/gperf,
    $TAO_ROOT/tao,
    $TAO_ROOT/TAO_IDL, and
    $TAO_ROOT/orbsvcs/orbsvcs
and the whole make takes less than an hour on my Solaris 7 for intel, Pentium-III/550MHz, 256MB memory, 512MB swap machine. (Top secret: I renice the 'make' process to the highest priority, -20... ;-) To save time and space, I set
    TAO_ORBSVCS = Naming Time Trader ImplRepo
in $ACE_ROOT/include/makeinclude/platform_macros.GNU also. See TAO's orbsvcs library customization instructions for more information.


System Resource Requirements

The amount of system resources required to build ACE and TAO varies greatly. The required system resources are influenced by OS and compiler platform, build options, and component configurations. As a rough guide, the typical peak memory requirement can be well over 512 MB (notably, for TAO's orbsvcs). Depending on your OS and compiler configuration, an entire build of ACE and TAO can use well over 4 GB of disk space. It's usually not necessary to build all of ACE and TAO, though.

Much less disk space is required for just the libraries. For example, see the ACE library subset sizes.

If you run out of memory when building, you might consider trying some or all of these suggestions:

  • Enable or increase virtual memory. If you're on a Linux or LynxOS platform, please see the appropriate sections above.

  • Disable/enable optimization and/or debugging. See the Makefile Flags discussion for information on how to do that via ACE's Makefiles.

  • If you're using g++, try removing -pipe from CFLAGS in your include/makeinclude/platform_macros.GNU file.

  • Restrict the components that you build. For ACE and TAO, see the discussion of ACE_COMPONENTS in the ACE subsets page. For TAO's orbsvcs, see the discussion of TAO_ORBSVCS in orbsvcs Library configuration information.

    If disk space is a problem, disabling debugging should greatly reduce object code, and therefore, library size. This is especially true with g++.

    Toshio Hori <toshi@etl.go.jp> provided these tips for reducing disk space usage:

    To save space on a Unix machine, I usually run 'find . -name \*.sln -o -name \*.vcproj -o -name \*.bmak | xargs rm -f' in $ACE_ROOT at first after I untar the distribution. They are meaningless in my environment (Files named '*.sln' and '*.vcproj' are used for MSVC++ and files named '*.bmak' are for Embarcadero C++ Builder.)

    Finally, to save space, may want to run 'make clean' after 'make'. It removes generated object files and leaves libraries/executables intact. If you want to remove any of the libraries/executables, as well, try 'make realclean'.


General MPC information

The Makefile Project Creator (MPC) is a tool that takes platform and building tool generic files (mpc files) as input, which describe basic information needed to generate a "project" file for various build tools, including Make, NMake, Visual C++ 6, Visual C++ 7, etc. Please see USAGE, README for documentation on MPC.

A common usage for creating a Windows workspace containing just the core ACE and TAO libraries and executables is the following:


C:> cd %TAO_ROOT%
C:> %ACE_ROOT%\bin\mwc.pl -type vs2019 TAO_ACE.mwc

Replace vs2019 with whatever project type you want to use. On Linux and other UNIX platform use the gnuace type:


% cd $TAO_ROOT
% $ACE_ROOT/bin/mwc.pl -type gnuace TAO_ACE.mwc

This creates the appropriate GNUmakefiles. Additional information on how to obtain, configuration, and build ACE+TAO using MPC appear at the OCI FAQ.

If you are attempting to generate project files using MPC, and you get the following error message:

ERROR: Unable to find the MPC modules in /builds/ACE_wrappers/MPC.
You can set the MPC_ROOT environment variable to the location of MPC.

You need to do one of the following:

  1. If you have already obtained MPC, either move it underneath the ACE_wrappers directory or set your MPC_ROOT environment variable to point to the full path of MPC.
  2. Check out MPC from the DOC Group git repository and set your MPC_ROOT environment variable.

You can check out MPC from the DOCGroup git repository using the following command.

git clone https://github.com/DOCGroup/MPC.git MPC

The README and USAGE files in the MPC/docs directory are an up-to-date source of documentation, however it is not a complete set of documentation. The TAO Developer's Guide from OCI starting with the 1.3a version contains more information about MPC.

The MPC chapter from the TAO Developer's Guide is available at http://downloads.ociweb.com/MPC/. Some of MPC has changed since this version, but it is largely accurate. An updated version will be available as newer versions of the TAO Developer's Guide are released. In the meantime, please see the README and USAGE files in the MPC directory.

Working with ACE in Eclipse

The Eclipse CDT C++ development environment can be used to develop ACE applications. You can configure a new CDT project to build ACE using either a local source distribution or checking out ACE from CVS in Eclipse. These are the steps to create the CDT project to build ACE.

To create an Eclipse project for ACE starting from CVS:

  1. In the "CVS Repository Exploring" perspective, navigate to the module containing ACE.
  2. Checkout the module using "Check Out As" and select the "project configured using the New Project Wizard" option.
  3. Select "Standard Make C++ Project" for the project type.
  4. Follow the steps outlined above, up to the point of running make, for building ACE on your platform. Use "path_to_your_eclipse_workspace"/"project_name" as your $ACE_ROOT.
  5. If you had to regenerate the makefiles using MPC, select the root folder for your poject and use the import wizard to add them to your project.
  6. Select the root folder for the project and use the "Create Make Target" wizard to setup the appropriate make command and options.
  7. Select the root folder and run "Build Make Target." This will build ACE.

To create an Eclipse project for ACE from a local source distribution:

  1. Launch the "New Project Wizard" in Eclipse.
  2. Select "Standard Make C++ Project" for the project type.
  3. On the project name page, uncheck the "use default" location option and replace the default path with the path to your source distribution.
  4. Follow the steps, up to the point of running make, for building ACE on your platform.
  5. If you had to regenerate the makefiles using MPC, select the root folder for your poject and use the import wizard to add them to your project.
  6. Select the root folder for the project and use the "Create Make Target" wizard to setup the appropriate make command and options.
  7. Select the root folder and run "Build Make Target." This will build ACE.


Advanced Topics


Non-static ACE_Object_Manager

The ACE_Object_Manager can be instantiated as a static object, can be instantiated on the stack of the main program thread, or can be explicitly instantiated and destroyed by the application with ACE::init () and ACE::fini (). The comments in the header file, ace/Object_Manager.h, as well as Section 1.6.3 in The ACE Programmer's Guide provide more detail.

NOTE: Special requirements are imposed on applications if the ACE_Object_Manager is instantiated, by ACE, on the stack of the main thread. This behavior is selected by defining ACE_HAS_NONSTATIC_OBJECT_MANAGER in ace/config.h. Again, see the ACE Object_Manager header file, ace/Object_Manager.h for more information. One of these requirements is discussed here, because it is so important. Please note that ACE_HAS_NONSTATIC_OBJECT_MANAGER is defined in the distributed ACE config.h headers for VxWorks and Win32.

The important requirement is that the program must declare its main function with two arguments, even if they're not used, and with int return type:


int
main (int, char *[])
If you don't declare main exactly that way, then you'll see a link error about ace_main_i being undefined.

Alternatively, this feature can be disabled by commenting out the #define ACE_HAS_NONSTATIC_OBJECT_MANAGER in the ace/config.h. But, that will make repeated testing more difficult on VxWorks. And, you'd either have to call static constructors and destructors manually or unload/load the program between runs. On Win32, disabling the feature can possibly lead to shutdown difficulties.

WARNING: ACE_HAS_NONSTATIC_OBJECT_MANAGER assumes that your main function is named main. Any violation of this assumption is at your peril. If you really need to call your entry point something other than main, you'll need to construct and destroy the ACE_Object_Manager. The best way to do that is to call ACE::init () and ACE::fini (). Or, see the #define of main (int, char *[]) in ace/OS_main.h to see how ACE does that for entry points named main.


Cloning the Source Tree

On UNIX platforms, we typically like to support multiple platform builds using the same ACE source tree. This idiom is supported by ACE using the $ACE_ROOT/bin/create_ace_build.pl script. To clone the source tree, create ./build and ./build/{your build name} subdirectories under the ACE_wrappers directory. Then invoke the create_ace_build.pl script to clone the source tree using soft links from your build directory back to the actual sources. Here is an example:

% cd ACE_wrappers
% mkdir build build/build-SunOS5
% perl bin/create_ace_build.pl -a -v build-SunOS5
% cd build/build-SunOS5
% setenv ACE_ROOT $cwd
% make

This will establish a complete tree of links. In addition, make sure you set your LD_LIBRARY_PATH to $ACE_ROOT/lib:$LD_LIBRARY_PATH on SVR4 UNIX platforms.

When you do a make in the $ACE_ROOT directory you will be producing object code that is not stored in the same place as the original source tree. This way, you can easily build another platform in a parallel tree structure.

See the comments at the top of the create_ace_build.pl script for further usage information.


Additional Build Tips for MVS

For all intents and purpose, MVS OpenEdition (OE) is another flavor of UNIX, therefore, the instructions under Building and Installing ACE on Unix can be used along with the following additional tips:

You can get a copy of GNU make that has been ported to MVS OpenEdition from the IBM OpenEdition web site. ACE's make scheme generates compile commands that have options and operands interspersed. By default, the c89/cc/c++ compiler expects all options to precede all operands. To get around this, you must set a special compiler environment variable (_CXX_CCMODE) to 1 which tells the compiler to allow options and operands to be interspersed.

Note that the environment variable LD_LIBRARY_PATH is called LIBPATH on MVS.

Shared objects are built a little different on MVS than on other UNIX implementations. This has been accounted for in the makefiles that come with ACE When the linker (via the cxx command) builds the libACE.so file it will also create a file called libACE.x. This is a side-deck file and it must be included in subsequent link edits with application code. For more information on this see the C/C++ MVS Programming Guide. If you want to build your application statically, i.e., using libACE.a instead of libACE.so, you can set ACELIB to ACELIB_STATIC in platform_mvs.GNU.

When the libACE.so file is built (via the MVS pre-linker and binder), you will get a rc=4 from the pre-linker. This is ok. This is due to some warnings about unresolved references which should get resolved during the link step. Note, however, there shouldn't be any unresolved references from the binder (linkage editor). You can get pre-link and link maps by uncommenting the PMAP and LMAP lines in the platform_mvs.GNU file.


Makefile Flags

GNU make provides many options to customize its operation. See its documentation for more information. One example is that for multi-cpu UNIX machines you will be able to build faster if you use:


% make -j n

which allows parallel compilation. The number n should typically be the number of CPUs. It is likely that builds will be faster even on single-CPU UNIX machines with make -j 2.

ACE further supports the following flags. They can be enabled either on the command line, e.g., "make purify=1", or added to your platform_macros.GNU. To disable the option, set the flag to null, e.g., "make debug=". Some flags support setting to 0 disable, e.g., "make debug=0". debug=1 is enabled in the platform files that are released with ACE.

Please note that the effects of a flag may be platform specific. Also, combinations of certain flags may or may not be allowed on specific platforms, e.g., debug=1 opt=1 is supported by g++ but not all other C++ compilers.

If you use Purify or Quantify: purify or quantify must be on your PATH. By default, ACE puts the Purify/Quantify caches below /tmp. To override that, set the PURE_CACHE_BASE_DIR variable, either in your environment or on the make make command line, to the destination directory for your instrumented libraries.

Flag             Description
----             -----------
debug            Enable debugging; see DCFLAGS and DCCFLAGS.
exceptions       Enable exception handling (not supported by all platforms).
include_env      Support old-style ACE_TRY_ENV declarations in methods.
                 This switch is necessary for compiling TAO applications
                 in the native exception configuration that were written
                 for TAO versions before 1.2.2.
                 In TAO 1.2.2, new macros were introduced that supercede
                 the direct ACE_TRY_ENV declarations. These are the
                 ACE_ENV_ARG macros that are defined in ace/CORBA_macros.h
                 and are documented in docs/exceptions.html.
                 This switch only affects the exceptions=1 configuration.
                 It is for backward compatibility only.
                 There will be warnings about unused _ACE_environment_variable
                 parameters when using include_env=1.
                 If possible, do not use it, but instead change your TAO
                 applications to use the ACE_ENV_ARG macros.
inline           Enable ACE inlining.  Some platforms enable inlining by
                   default, others do not.
optimize         Enable optimization; see OCFLAGS and OCCFLAGS.
pace             Enable PACE as the underpinnings of ACE_OS.
probe            Enable ACE_Timeprobes.
profile          Enable profiling; see PCFLAGS and PCCFLAGS.
purify           Purify all executables.
quantify         Quantify all executables.
repo             Use GNU template repository (g++ with repo patches only).
rtti             Enable run-time type identification.  On some platforms,
                   it is enabled by default, so this is ignored.
shared_libs      If migrating from prior version use shared_libs_only
static_libs      If migrating from prior version use static_libs_only
shared_libs_only Only build shared libraries.  Ignored if no SHLIBs are
                   specified by the Makefile, as in performance-tests/Misc.
static_libs_only Only build static libraries.
threads          Build with thread support.
xt               Build with Xt (X11 Toolkit) support.
fl               Build with FlTk (Fast Light Toolkit) support.
tk               Build with Tk (Tcl/Tk) support.
qt               Build with Qt (Trolltech Qt) support.
ssl              Build with OpenSSL support.
rapi             Build with RAPI
split            Build the library by first splitting up the ACE source
                   to several files, with one object code entity for each
                   source file. This allows an application that is linked
                   with ACE to extract _exactly_ what it needs from the
                   library, resulting in a smaller executable.  Setting this
                   to 1 overrides debug to 0.

Usually, users do not need to be concerned with make targets.
Just enter "make" on the command line to build.  A few notable
targets are listed below.

Target             Description
------             -----------
show_statics       Lists all static objects in object files built for
                     current directory.  Only supported for g++.
show_uninit        Lists all uninitialized in object files built for
                     current directory.  Only supported for g++.


Building from git

If users are building from our Git repository the GNUmakefiles, and project files for building on various platforms will not be available. Git users are expected to generate them using MPC before building ACE or TAO. We point out some suggestions below to get bootstrapped quickly.
  • You can clone all code easily from our git repository.
      git clone https://github.com/DOCGroup/ACE_TAO.git

  • Please make sure that you have perl installed, preferably perl 5.8 or higher. Users on Win32 based platforms are recommended to use Active State Perl or Strawberry Perl. We use both perl versions without problems. We have ran into problems trying to use the cygwin version of perl on Win32 based platforms.

  • To build ACE and associated tests, examples, and associated utility libraries with GNUmakefiles, you must generate GNUmakefiles with MPC:

    $ACE_ROOT/bin/mwc.pl -type gnuace ACE.mwc

    On Windows, with Visual Studio 2015, you must generate solution and project files with MPC:

    $ACE_ROOT/bin/mwc.pl -type vc14 ACE.mwc

    On Windows, with Visual Studio 2017, you must generate solution and project files with MPC:

    $ACE_ROOT/bin/mwc.pl -type vs2017 ACE.mwc

    On Windows, with Visual Studio 2019, you must generate solution and project files with MPC:

    $ACE_ROOT/bin/mwc.pl -type vs2019 ACE.mwc

  • If you want to build TAO and its associated libraries please see TAO-INSTALL for details.

Back to the ACE home page.

ace-8.0.4+dfsg.orig/include/0000755000175000017500000000000015046037655014621 5ustar sudipsudipace-8.0.4+dfsg.orig/include/makeinclude/0000755000175000017500000000000015046037655017102 5ustar sudipsudipace-8.0.4+dfsg.orig/include/makeinclude/platform_vxworks.GNU0000644000175000017500000000264315027201773023102 0ustar sudipsudip# VxWorks main platform file. This requires that you have set the WIND_PLATFORM # environment variable ifeq (,$(WIND_PLATFORM)) default: @ERROR: you must set your WIND_PLATFORM environment variable endif # WIND_PLATFORM ifeq (vxworks-6.2, $(findstring vxworks-6.2,$(WIND_PLATFORM))) include $(ACE_ROOT)/include/makeinclude/platform_vxworks6.2.GNU endif ifeq (vxworks-6.3, $(findstring vxworks-6.3,$(WIND_PLATFORM))) include $(ACE_ROOT)/include/makeinclude/platform_vxworks6.3.GNU endif ifeq (vxworks-6.4, $(findstring vxworks-6.4,$(WIND_PLATFORM))) include $(ACE_ROOT)/include/makeinclude/platform_vxworks6.4.GNU endif ifeq (vxworks-6.5, $(findstring vxworks-6.5,$(WIND_PLATFORM))) include $(ACE_ROOT)/include/makeinclude/platform_vxworks6.5.GNU endif ifeq (vxworks-6.6, $(findstring vxworks-6.6,$(WIND_PLATFORM))) include $(ACE_ROOT)/include/makeinclude/platform_vxworks6.6.GNU endif ifeq (vxworks-6.7, $(findstring vxworks-6.7,$(WIND_PLATFORM))) include $(ACE_ROOT)/include/makeinclude/platform_vxworks6.7.GNU endif ifeq (vxworks-6.8, $(findstring vxworks-6.8,$(WIND_PLATFORM))) include $(ACE_ROOT)/include/makeinclude/platform_vxworks6.8.GNU endif ifeq (vxworks-6.9, $(findstring vxworks-6.9,$(WIND_PLATFORM))) include $(ACE_ROOT)/include/makeinclude/platform_vxworks6.9.GNU endif ifeq (vxworks-7, $(findstring vxworks-7,$(WIND_PLATFORM))) include $(ACE_ROOT)/include/makeinclude/platform_vxworks7.0.GNU endif ace-8.0.4+dfsg.orig/include/makeinclude/platform_qnx_gcc.GNU0000644000175000017500000000136615027201773023002 0ustar sudipsudip# # QNX/RTP hosted, using GCC ACE_PLATFORM_CONFIG ?= config-qnx.h inline ?= 1 debug ?= 1 optimize ?= 0 threads ?= 1 pipes ?= 0 c++std ?= gnu++17 CCFLAGS += -fexceptions LDFLAGS += -fexceptions ifeq ($(inline),1) CCFLAGS += -finline-functions else CCFLAGS += -fno-inline endif # inline DCFLAGS += -ggdb DCCFLAGS += -ggdb ifeq ($(optimize),1) OCFLAGS += -O3 endif #optimize CC ?= qcc CXX ?= q++ DLD = $(CXX) LD = $(CXX) LIBS += -lsocket -lstdc++ -lm PIC = -fPIC ARFLAGS = ruv SOFLAGS += $(CPPFLAGS) -shared SOBUILD = $(COMPILE.cc) $(PIC) -o $(VSHDIR)$*.so $< PRELIB = @true # Test for template instantiation, add to SOFLAGS if SONAME set, # add -E to LDFLAGS if using GNU ld # include $(ACE_ROOT)/include/makeinclude/platform_g++_common.GNU ace-8.0.4+dfsg.orig/include/makeinclude/platform_win32_msvc.GNU0000644000175000017500000000756015027201773023354 0ustar sudipsudip# -*- Makefile -*- # TODO: # - per-source-file flag_overrides (gnu.mpd) # Include this file from platform_macros.GNU to build with sh and GNU make # and the Visual C++ compiler and linker. # Tested with the MSYS shell and make from msysCORE-1.0.11-20080826.tar.gz and # the Visual C++ 9 toolchain (Visual C++ 2008 Express Edition) - SP1. # Assuming the msysCORE archive is extracted to c:\msys... # Start the Visual C++ Command Prompt # Set ACE_ROOT (TAO_ROOT, DDS_ROOT) # Add C:\msys\bin to PATH along with %ACE_ROOT%\lib and %ACE_ROOT%\bin # If necessary, generate GNUmakefiles with MPC (set MPC_ROOT, use -type gnuace) # Run "make" # - library naming # - dynamic: ACE.dll, ACE.lib is the "import library" # - static: ACE.lib # - no "s" suffix added for static, so static and dynamic can't coexist # - no other modifiers are added to the name (no ACEd.dll, ACEmfc.dll) # - user-customizable make variables # - everything in the "Defaults" section (plus inline) # - SUBSYSTEM: defaults to CONSOLE for exes, WINDOWS for libs # - CRT_TYPE: defaults to D (dynamic) for shared libs, T (static) for static # Defaults debug ?= 1 optimize ?= 0 #inline determined below, defaults to !debug CPU ?= X86 winnt ?= 1 winregistry ?= 1 wfmo ?= 1 qos ?= 1 # Programs CC = cl CXX = $(CC) RC = rc LD = link DLD = $(LD) AR = $(LD) # File naming EXEEXT = .exe SOEXT = dll OBJEXT = obj LIBEXT = lib LIB_PREFIX = versioned_so = 0 # Need forward slashes for paths going through sh.exe ACE_ROOT := $(subst \,/,$(ACE_ROOT)) # Options PIC = CC_OUTPUT_FLAG = -Fo CC_OUTPUT_FLAG_SEP = CPPFLAGS += -DWIN32 -D_WINDOWS -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE CFLAGS += -Zc:wchar_t -nologo -W3 -EHsc -GR -wd4355 -Fd$(INTDIR) ARFLAGS = -lib -nologo -machine:$(CPU) MSVC_LDFLAGS = -incremental:no -nologo -subsystem:$(SUBSYSTEM) -machine:$(CPU) ifeq (,$(BIN_UNCHECKED)) SUBSYSTEM ?= WINDOWS else SUBSYSTEM ?= CONSOLE REALCLEAN_FILES += $(BIN).manifest $(BIN_UNCHECKED).pdb endif ifeq (1,$(optimize)) CFLAGS += -O2 else CFLAGS += -Ob0 endif ifeq (1,$(static_libs_only)) static_libs = 1 endif ifeq (1,$(static_libs)) shared_libs = 0 shared_libs_only = 0 CRT_TYPE ?= T INTDIR = $(VDIR) else static_libs = 0 static_libs_only = 0 CRT_TYPE ?= D ifneq (,$(BIN_UNCHECKED)) INTDIR = $(VDIR) else INTDIR = $(VSHDIR) endif MSVC_IMPLIB = $(LIB_NAME).lib MSVC_DLLFLAGS += -dll -implib:$(MSVC_IMPLIB) REALCLEAN_FILES += $(LIB_NAME).dll $(INSLIB)/$(LIB_NAME).dll $(LIB_NAME).exp REALCLEAN_FILES += $(LIB_NAME).dll.manifest endif ifneq (,$(LIB_NAME)) REALCLEAN_FILES += $(LIB_NAME).lib $(INSLIB)/$(LIB_NAME).lib $(LIB_NAME).pdb endif ifeq (1,$(debug)) CPPFLAGS += -D_DEBUG CFLAGS += -Zi -M$(CRT_TYPE)d -Gy -Gm inline ?= 0 MSVC_LDFLAGS += -DEBUG MSVC_DLLFLAGS += -pdb:$(subst dll,pdb,$@) MSVC_EXEFLAGS += -pdb:$(subst exe,pdb,$@) else CPPFLAGS += -DNDEBUG CFLAGS += -M$(CRT_TYPE) inline ?= 1 endif CCFLAGS = $(CFLAGS) CXXFLAGS = $(CFLAGS) RC_INCLUDE_FLAG = -I RC_OUTPUT_FLAG = -fo SYSTEMLIBS += advapi32.lib user32.lib iphlpapi.lib MSVC_LINK = $(LD) $(SYSTEMLIBS) $(MSVC_LDFLAGS) $(patsubst %\,%,$(patsubst -L%,-libpath:%, $(subst /,\,$(LDFLAGS)))) $(patsubst -l%,%.lib,$(ACE_SHLIBS)) $(LIBS) -out:$@ define SOLINK.cc.override $(MSVC_LINK) $(MSVC_DLLFLAGS) $^ mt -nologo -manifest $@.manifest -outputresource:$@\;2 @if test . != $(INSLIB) -a $(call PWD) != $(INSLIB) -a -r $(MSVC_IMPLIB) ; then \ cp $(MSVC_IMPLIB) $(INSLIB) ; \ fi endef define LINK.cc.override $(MSVC_LINK) $(MSVC_EXEFLAGS) $(filter-out %.lib,$(filter-out %.a,$^)) $(patsubst -l%,%.lib,$(VLDLIBS)) $(POSTLINK) @if test -r $@.manifest ; then \ mt -nologo -manifest $@.manifest -outputresource:$@\;1 ; \ fi endef AR.cc.override = $(AR) $(ARFLAGS) -out:$@ $^ $(AREXTRA) #this is not mingw32, but the makefiles in ACE should act like it is mingw32 = 1 ace-8.0.4+dfsg.orig/include/makeinclude/platform_macosx_mojave.GNU0000644000175000017500000000011015027201773024175 0ustar sudipsudipinclude $(ACE_ROOT)/include/makeinclude/platform_macosx_highsierra.GNU ace-8.0.4+dfsg.orig/include/makeinclude/platform_lynxos.GNU0000644000175000017500000000473715027201773022721 0ustar sudipsudip# -*- Makefile -*- # LynxOS with g++. Defaults to LynxOS Version 4.0.0. For Version 4.2.0, # for example, add "VERSION=4.2.0" to your make invocation. ifeq ($(static_libs_only),1) shared_libs = 0 endif ifeq ($(shell uname -s),LynxOS) export VERSION=$(shell uname -r) # LynxOS's mkdir needs -f option to prevent it returning error # if directory already exists. ACE_MKDIR=mkdir -pf else CROSS-COMPILE = 1 ifeq (,$(VERSION)) # export VERSION = 4.0.0 export VERSION = 2.3.0 endif # VERSION endif # ! LynxOS LYNXOS_MAJOR = $(shell echo $(VERSION) | awk -F. '{print $$1;}') LYNXOS_MINOR = $(shell echo $(VERSION) | awk -F. '{print $$2;}') optimize ?= 1 debug ?= 1 threads ?= 1 ifeq ($(threads),1) FLAGS_C_CC += -mthreads LDFLAGS += -mthreads -L/usr/lib/thread endif ifeq ($(rpc),1) LIBS += -lrpc endif ifeq ($(shared_libs),1) CPPFLAGS += -DACE_HAS_SVR4_DYNAMIC_LINKING FLAGS_C_CC += -mshared LDFLAGS += -mshared LIBS += -ldl ifeq ($(CROSS-COMPILE),1) LDFLAGS += -Wl,-rpath-link,$(ACE_ROOT)/lib endif else LIBS += -lnetinet endif CC = gcc CXX = g++ AR = ar ARFLAGS = ruv CPPFLAGS += -DACE_LYNXOS_MAJOR=$(LYNXOS_MAJOR) -DACE_LYNXOS_MINOR=$(LYNXOS_MINOR) DCFLAGS += -g DCCFLAGS += $(DCFLAGS) DLD = $(CXX) LD = $(CXX) LIBS += -lbsd OCFLAGS += -O2 OCCFLAGS = $(OCFLAGS) PIC = -fPIC PRELIB = @true RANLIB = @true SOFLAGS += -shared PLATFORM_XT_CPPFLAGS= PLATFORM_XT_LIBS=-lXm -lXt PLATFORM_XT_LDFLAGS= PLATFORM_X11_CPPFLAGS= PLATFORM_X11_LIBS=-lXp -lXpm -lXmu -lXext -lX11 -lSM -lICE PLATFORM_X11_LDFLAGS= PLATFORM_TCL_CPPFLAGS=$(shell . /usr/lib/tclConfig.sh && echo -n $$TCL_INC_DIR $$TCL_DEFS) PLATFORM_TCL_LIBS=-ltcl8.0 PLATFORM_TCL_LDFLAGS= PLATFORM_TK_CPPFLAGS=$(shell . /usr/lib/tkConfig.sh && echo -n $$TK_INC_DIR $$TK_DEFS) $(PLATFORM_X11_CPPFLAGS) PLATFORM_TK_LIBS=-ltk8.0 $(PLATFORM_XT_LIBS) $(PLATFORM_X11_LIBS) PLATFORM_TK_LDFLAGS=$(PLATFORM_X11_LDFLAGS) # Test for template instantiation, add to SOFLAGS if SONAME set, # add -E to LDFLAGS if using GNU ld # include $(ACE_ROOT)/include/makeinclude/platform_g++_common.GNU CCFLAGS += -fpermissive -fno-strict-aliasing # To save much disk space, strip all executables. Comment the # following line out if you want to debug. Or, add "POSTLINK=" # to your make invocation. ifeq ($(static_libs),1) POSTLINK = ; strip $@ endif ace-8.0.4+dfsg.orig/include/makeinclude/platform_vxworks6.4.GNU0000644000175000017500000000113115027201773023321 0ustar sudipsudip# VxWorks 6.4 #### Notes: #### 1) This file requires that the WIND_BASE and WIND_HOST_TYPE environment #### variables be set. If the target CPU is not SIMNT, then your CPU #### environment variable must be set. #### 2) The TOOL environment variable may be set to "diab" (default is "gnu"). #### 3) If perl is not on your path, you'll also need to set your PERL_PATH #### environment variable to the full path to perl. ifeq ($(VXWORKS_VERSION_FLAG),) VXWORKS_VERSION_FLAG = -DACE_VXWORKS=0x640 endif # VXWORKS_VERSION_FLAG include $(ACE_ROOT)/include/makeinclude/platform_vxworks6.3.GNU ace-8.0.4+dfsg.orig/include/makeinclude/platform_mqx_icc.GNU0000644000175000017500000000767215027201773023011 0ustar sudipsudip# This file should allow ACE to be built on Windows, using the IAR compiler. MQX_CPU = PSP_CPU_MK70F120M MQX_CPU_INC = cortex_m ifndef MQX_ROOT $(error Please set MQX_ROOT to the toplevel directory of the MQX code.) endif MQX_CONFIG_COMMON_DIR ?= "$(MQX_ROOT)/config/common" ifndef MQX_USER_CONFIG_DIR $(error Please set MQX_USER_CONFIG_DIR to the directory containing the MQX user_config.h.) endif ACE_PLATFORM_CONFIG ?= config-mqx.h debug ?= 1 optimize ?= 1 threads ?= 1 static_libs_only = 1 gruntimelibselect ?= 1 AR = iarchive ARFLAGS = -o RANLIB = @true AR.cc.override = $(RM) $@; echo $(filter %.o, $^) | xargs $(AR) $(ARFLAGS) $@ $(AREXTRA) fast ?= 0 IAR_PLATFORM ?= arm CC = icc$(IAR_PLATFORM) CXX = icc$(IAR_PLATFORM) --c++ ifndef CXX_VERSION CXX_VERSION := $(shell $(CXX) --version) endif no_hidden_visibility ?= 1 ifeq ($(inline),0) CPPFLAGS += --no_inline endif ifeq ($(gruntimelibselect),1) CFLAGS += --dlib_config DLib_Config_Normal.h endif ifeq ($(gruntimelibselect),2) CFLAGS += --dlib_config DLib_Config_Full.h -DACE_MQX_DLIB_FULL endif ifeq ($(gruntimelibselect),3) CFLAGS += --dlib_config $(DLIB_CONFIG) endif CFLAGS += -I$(MQX_CONFIG_COMMON_DIR) -I$(MQX_USER_CONFIG_DIR) MQX_IO_DIR=$(MQX_ROOT)/mqx/source/io CFLAGS += -DMQX_CPU=$(MQX_CPU) --enable_restrict -I$(MQX_ROOT)/mqx/source/include -I$(MQX_ROOT)/mqx/source/psp/$(MQX_CPU_INC) -I$(MQX_ROOT)/mqx/source/psp/$(MQX_CPU_INC)/cpu -I$(MQX_ROOT)/mqx/source/psp/$(MQX_CPU_INC)/compiler/iar -I$(MQX_ROOT)/rtcs/source/include -I$(MQX_ROOT)/mqx/source/bsp/twrk70f120m -I$(MQX_IO_DIR)/adc -I$(MQX_IO_DIR)/asrc -I$(MQX_IO_DIR)/can -I$(MQX_IO_DIR)/cm -I$(MQX_IO_DIR)/core_mutex -I$(MQX_IO_DIR)/dcu4 -I$(MQX_IO_DIR)/debug -I$(MQX_IO_DIR)/dma -I$(MQX_IO_DIR)/enet -I$(MQX_IO_DIR)/esai -I$(MQX_IO_DIR)/esdhc -I$(MQX_IO_DIR)/fbdev -I$(MQX_IO_DIR)/flashx -I$(MQX_IO_DIR)/flextimer -I$(MQX_IO_DIR)/ftm -I$(MQX_IO_DIR)/gpio -I$(MQX_IO_DIR)/hmi -I$(MQX_IO_DIR)/hwtimer -I$(MQX_IO_DIR)/i2c -I$(MQX_IO_DIR)/i2s -I$(MQX_IO_DIR)/imxrt -I$(MQX_IO_DIR)/int_ctrl -I$(MQX_IO_DIR)/io_expander -I$(MQX_IO_DIR)/io_mem -I$(MQX_IO_DIR)/io_null -I$(MQX_IO_DIR)/lcd -I$(MQX_IO_DIR)/lpm -I$(MQX_IO_DIR)/lpm_mcore -I$(MQX_IO_DIR)/lwadc -I$(MQX_IO_DIR)/lwgpio -I$(MQX_IO_DIR)/mcg -I$(MQX_IO_DIR)/mu -I$(MQX_IO_DIR)/nandflash -I$(MQX_IO_DIR)/pcb -I$(MQX_IO_DIR)/pccard -I$(MQX_IO_DIR)/pcflash -I$(MQX_IO_DIR)/pipe -I$(MQX_IO_DIR)/qspi -I$(MQX_IO_DIR)/rnga -I$(MQX_IO_DIR)/rtc -I$(MQX_IO_DIR)/sai -I$(MQX_IO_DIR)/sdcard -I$(MQX_IO_DIR)/sdram -I$(MQX_IO_DIR)/sensor -I$(MQX_IO_DIR)/serial -I$(MQX_IO_DIR)/sim -I$(MQX_IO_DIR)/spi -I$(MQX_IO_DIR)/spi_legacy -I$(MQX_IO_DIR)/spi_slave -I$(MQX_IO_DIR)/tchres -I$(MQX_IO_DIR)/tfs -I$(MQX_IO_DIR)/timer -I$(MQX_IO_DIR)/usb -I$(MQX_IO_DIR)/usb_dcd -I$(MQX_IO_DIR)/gpio/kgpio -I$(MQX_IO_DIR)/sdcard/sdcard_spi -I$(MQX_IO_DIR)/sdcard/sdcard_esdhc -I$(MQX_IO_DIR)/flashx/freescale -I$(MQX_IO_DIR)/enet/macnet -I$(MQX_IO_DIR)/adc/kadc -I$(MQX_ROOT)/mfs/source/include -I$(MQX_ROOT)/posix/source/include ifeq ($(threads),1) CPPFLAGS += -D_REENTRANT endif # threads CCFLAGS += $(CFLAGS) DCFLAGS += --debug DLD = ilinkarm LD = ilinkarm MQX_LIB_DIR ?= $(MQX_ROOT)/lib/twrk70f120m.iar/debug LDFLAGS += --config $(MQX_LIB_DIR)/bsp/intflash_sramdata.icf --redirect __iar_dlmalloc=malloc \ --redirect __iar_dlcalloc=calloc --redirect __iar_dlfree=free --manual_dynamic_initialization SYSTEM_LIBS = -L$(MQX_LIB_DIR)/bsp bsp.a \ -L$(MQX_LIB_DIR)/psp psp.a \ -L$(MQX_LIB_DIR)/mfs mfs.a \ -L$(MQX_LIB_DIR)/rtcs rtcs.a \ -L$(MQX_LIB_DIR)/posix posix.a LINK.cc.override = $(PURELINK) $(PRELINK) $(LD) $(LDFLAGS) $(CC_OUTPUT_FLAG) $@ $(SYSTEM_LIBS) $(filter-out %.a,$^) $(VLDLIBS) $(POSTLINK) OCFLAGS += -O ifeq ($(optimize),0) # Disable all optimizing in code CPPFLAGS += -On endif SOFLAGS += $(CPPFLAGS) -shared SOBUILD = $(COMPILE.cc) $(PIC) -o $(VSHDIR)$*.so $<; \ $(SOLINK.cc) -o $@ $(LDFLAGS) $(VSHDIR)$*.o PRELIB = @true ace-8.0.4+dfsg.orig/include/makeinclude/platform_openbsd.GNU0000644000175000017500000000355615027201773023015 0ustar sudipsudip# -*- Makefile -*- # platform_openbsd.GNU debug ?= 1 optimize ?= 1 threads ?= 1 CC = gcc CXX = g++ AR = ar ARFLAGS = ruv CPPFLAGS += -I/usr/local/include DCFLAGS += -g DCCFLAGS += $(DCFLAGS) DLD = $(CXX) LD = $(CXX) LDFLAGS += -L/usr/local/lib OCFLAGS += -O2 OCCFLAGS = $(OCFLAGS) PIC = -fpic PRELIB = @true RANLIB = ranlib SOFLAGS += -shared ifeq ($(threads),1) CPPFLAGS += -D_THREAD_SAFE FLAGS_C_CC += -pthread SOFLAGS += -pthread endif # threads PLATFORM_X11_CPPFLAGS = -I/usr/X11R6/include PLATFORM_X11_LIBS = -lX11 PLATFORM_X11_LDFLAGS = -L/usr/X11R6/lib PLATFORM_XT_CPPFLAGS = PLATFORM_XT_LIBS = -lXt PLATFORM_XT_LDFLAGS = PLATFORM_FL_CPPFLAGS = PLATFORM_FL_LIBS = -lfltk -lfltk_forms -lfltk_gl PLATFORM_FL_LDFLAGS = PLATFORM_GL_CPPFLAGS = -I/usr/X11R6/include PLATFORM_GL_LIBS = -lGL PLATFORM_GL_LDFLAGS = -L/usr/X11R6/lib PLATFORM_GTK_CPPFLAGS = $(shell gtk-config --cflags) PLATFORM_GTK_LIBS = $(shell gtk-config --libs) PLATFORM_GTK_LDFLAGS = PLATFORM_FOX_CPPFLAGS ?= -I/usr/local/include/fox-1.6 PLATFORM_FOX_LIBS ?= -lFOX-1.6 PLATFORM_FOX_LDFLAGS ?= PLATFORM_TK_CPPFLAGS=$(shell . /usr/local/lib/tcl/tk*/tkConfig.sh && echo -n $$TK_INCLUDE_SPEC) $(PLATFORM_X11_CPPFLAGS) PLATFORM_TK_LIBS=$(shell . /usr/local/lib/tcl/tk*/tkConfig.sh && echo -n $$TK_LIB_FLAG) $(PLATFORM_X11_LIBS) PLATFORM_TK_LDFLAGS=$(PLATFORM_X11_LDFLAGS) PLATFORM_TCL_CPPFLAGS=$(shell . /usr/local/lib/tcl/tcl*/tclConfig.sh && echo -n $$TCL_INCLUDE_SPEC) PLATFORM_TCL_LIBS=$(shell . /usr/local/lib/tcl/tcl*/tclConfig.sh && echo -n $$TCL_LIB_FLAG) PLATFORM_TCL_LDFLAGS= # Test for template instantiation, add to versioned_so if versioned_so set, # add -E to LDFLAGS if using GNU ld # include $(ACE_ROOT)/include/makeinclude/platform_g++_common.GNU ace-8.0.4+dfsg.orig/include/makeinclude/platform_macosx_highsierra.GNU0000644000175000017500000000010415027201773025044 0ustar sudipsudipinclude $(ACE_ROOT)/include/makeinclude/platform_macosx_sierra.GNU ace-8.0.4+dfsg.orig/include/makeinclude/platform_cygwin32.GNU0000644000175000017500000000026115027201773023016 0ustar sudipsudip# -*- Makefile -*- # # This file should allow to build ACE for cygwin32 with cygwin tools. # cygwin32 = 1 include $(ACE_ROOT)/include/makeinclude/platform_gnuwin32_common.GNU ace-8.0.4+dfsg.orig/include/makeinclude/platform_clang_common.GNU0000644000175000017500000000340515027201773024010 0ustar sudipsudip# -*- Makefile -*- ifneq ($(CROSS_COMPILE),) CROSS-COMPILE = 1 # Build using the cross-tools override_cross_compile ?= 0 ifeq ($(override_cross_compile),0) CC = ${CROSS_COMPILE}clang${CROSS_COMPILE_SUFFIX} CXX = ${CROSS_COMPILE}clang++${CROSS_COMPILE_SUFFIX} AR = ${CROSS_COMPILE}ar${CROSS_COMPILE_SUFFIX} endif # Cross-linker requires this for linked in shared libs that depend # themselves on other shared libs (not directly linked in) LDFLAGS += -Wl,-rpath-link,$(ACE_ROOT)/lib ifneq (,$(HOST_ROOT)) TAO_IDLFLAGS += -g $(HOST_ROOT)/bin/ace_gperf TAO_IDL = $(HOST_ROOT)/bin/tao_idl TAO_IDL_DEP = $(TAO_IDL) # make sure to use the host compiler, not the cross-compiler # as preprocessor for the cross-compiled idl tools TAO_IDL_PREPROCESSOR = clang endif endif ifeq ($(CXX),insure) # insure does not pass through the -dumpversion option. CXX_FOR_VERSION_TEST ?= g++ else CXX_FOR_VERSION_TEST ?= $(CXX) endif CXX_VERSION := $(shell $(CXX_FOR_VERSION_TEST) -dumpversion) CXX_FULL_VERSION := $(shell $(CXX_FOR_VERSION_TEST) --version) # Only modify LDFLAGS if DLD has been set. ifneq ($(DLD),) ifeq ($(DLD),$(CXX_FOR_VERSION_TEST)) # only try this is we are using ld through gcc LD_FOR_VERSION_TEST = $(subst \,/,$(shell $(CXX_FOR_VERSION_TEST) -print-prog-name=ld)) else LD_FOR_VERSION_TEST = $(DLD) endif # DLD = CXX_FOR_VERSION_TEST # The -E option is GNU ld specific GNU_LD := $(if $(findstring GNU ld,$(shell $(LD_FOR_VERSION_TEST) -v 2>&1)), 1, 0) endif # DLD ifeq ($(GNU_LD),1) STATIC_LINK_FLAG ?= -static endif # GNU_LD ifeq ($(no_strict_aliasing), 1) CCFLAGS += -fno-strict-aliasing endif # Things Clang has in common with GCC include $(ACE_ROOT)/include/makeinclude/platform_gcc_clang_common.GNU ace-8.0.4+dfsg.orig/include/makeinclude/rules.local.GNU0000644000175000017500000003765115027201773021705 0ustar sudipsudip# -*- Makefile -*- #---------------------------------------------------------------------------- # # # Local targets # GNU version # Requires GNU make #---------------------------------------------------------------------------- CLEANUP_OBJDIRS = CLEANUP_DIRS = ifdef CLEANUP_BIN CLEANUP_OBJDIRS = $(VDIR) else # ! CLEANUP_BIN ifdef CLEANUP_LIB CLEANUP_OBJDIRS = $(VDIR) endif # CLEANUP_LIB endif # CLEANUP_BIN ifdef CLEANUP_SHLIB CLEANUP_OBJDIRS += $(VSHDIR) endif # CLEANUP_VSHLIB ifdef TEMPINCDIR CLEANUP_DIRS += $(TEMPINCDIR) endif vxworks_ntbuild ?= 0 lacks_touch ?= 0 ifeq ($(use_pwd_call),) ifneq ($(mingw32),1) use_pwd_call := 0 else use_pwd_call := 1 endif endif .PHONY: makefile_name.local ifneq ($(use_pwd_call),1) makefile_name.local: @echo @echo GNUmakefile: $(shell pwd)/$(MAKEFILE) MAKEFLAGS=$(MAKEFLAGS) @echo else ECHO_BLANK_LINE ?= echo makefile_name.local: @$(ECHO_BLANK_LINE) @echo GNUmakefile: $(call PWD)/$(MAKEFILE) MAKEFLAGS=$(MAKEFLAGS) @$(ECHO_BLANK_LINE) endif all.local: makefile_name.local build.objdirs build.local binout.local #---------------------------------------------------------------------------- # C/C++ compilation targets #---------------------------------------------------------------------------- IDL_SRC ?= VLIBS ?= BUILD ?= BIN ?= VBIN ?= $(ARCH_BIN:%=%$(VAR)) ifneq ($(VBIN),) $(VBIN): $(VLIBS) endif # Always build the V* targets in this order. We control assignment to them # elsewhere. We add the existing $(BUILD) targets to the end to allow the # caller to set additional ones, e.g., when defining multiple targets in a # single makefile--note that we filter out any that are already present. VBUILD = $(IDL_SRC) $(VLIBS) $(VBIN) $(filter-out $(IDL_SRC) $(VLIBS) $(VBIN), $(BUILD)) build.local: $(VBUILD) # By setting SUFFIXES to nothing, we turn off all implicit rules, and force # make to only use the explicit ones we define. .SUFFIXES: # C++ related targets STATIC_LINK_FLAG ?= static_link ?= 0 ifeq ($(static_link),1) LDFLAGS += $(STATIC_LINK_FLAG) endif # static_link = 1 OS ?= # Define a canned command set to create the output object directory if needed. ifeq ($(vxworks_ntbuild),1) define mk_obj_out_dir @if not exist $(subst /,\,$(@D)) $(MKDIR) $(subst /,\,$(@D)) $(ACE_NUL_STDERR) endef else define mk_obj_out_dir @-test -d $(@D) || $(MKDIR) $(@D) $(ACE_NUL_STDERR) endef endif nullstring := CC_OUTPUT_FLAG_SEP ?= $(nullstring) #space %.$(PREPROCESS_SUFFIX): %.c $(PREPROCESS.c) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<) %.$(PREPROCESS_SUFFIX): %.cpp $(PREPROCESS.cc) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<) $(VDIR)%.$(OBJEXT): %.c $(mk_obj_out_dir) $(COMPILE.c) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<) ${MVCMD} $(VDIR)%.$(OBJEXT): %.C $(mk_obj_out_dir) $(COMPILE.c) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<) ${MVCMD} $(VDIR)%.$(OBJEXT): %.cpp $(mk_obj_out_dir) $(COMPILE.cc) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<) ${MVCMD} $(VDIR)%.$(OBJEXT): %.cc $(mk_obj_out_dir) $(COMPILE.cc) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<) ${MVCMD} $(VDIR)%.$(OBJEXT): %.cxx $(mk_obj_out_dir) $(COMPILE.cc) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<) ${MVCMD} RC_OUTPUT_FLAG ?= ifneq (,$(COMPILE.rc)) $(VDIR)%.rc.o: %.rc $(mk_obj_out_dir) $(COMPILE.rc) $(RC_OUTPUT_FLAG) $@ $(abspath $<) ${MVCMD} endif # COMPILE.rc # If SOLINK is defined, then the .$(SOEXT) file is built from the # .$(OBJEXT) file via separate rules in the same directory. # Otherwise, the .$(SOEXT) and .$(OBJEXT) are built via the same rule. # SOLINK is required for the repository under gcc. ifndef SOLINK $(VSHDIR)%.$(OBJEXT): %.c $(mk_obj_out_dir) $(COMPILE.c) $(PIC) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<) $(VSHDIR)%.$(OBJEXT): %.C $(mk_obj_out_dir) $(COMPILE.c) $(PIC) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<) # I added the "Executable Shared Object (ESO)" define to separate between # normal shared object files and executable shared object files (the kind # that the service configurator needs to be able to function). # 970104 Marius Kjeldahl ifdef (ESOBUILD) $(VSHDIR)%.$(SOEXT): %.cpp $(mk_obj_out_dir) $(ESOBUILD) else # ! ESOBUILD $(VSHDIR)%.$(SOEXT): %.cpp $(mk_obj_out_dir) $(SOBUILD) endif # ESOBUILD $(VSHDIR)%.$(OBJEXT): %.cc $(mk_obj_out_dir) $(COMPILE.cc) $(PIC) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<) $(VSHDIR)%.$(OBJEXT): %.cpp $(mk_obj_out_dir) $(COMPILE.cc) $(PIC) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<) $(VSHDIR)%.$(OBJEXT): %.cxx $(mk_obj_out_dir) $(COMPILE.cc) $(PIC) $(CC_OUTPUT_FLAG)$(CC_OUTPUT_FLAG_SEP)$@ $(abspath $<) ifneq (,$(COMPILE.rc)) $(VSHDIR)%.rc.$(OBJEXT): %.rc $(mk_obj_out_dir) $(COMPILE.rc) $(RC_OUTPUT_FLAG) $@ $(abspath $<) endif # COMPILE.rc $(VSHDIR)%.$(SOEXT): $(VSHDIR)%.$(OBJEXT) $(mk_obj_out_dir) $(SOLINK) endif # SOLINK #---------------------------------------------------------------------------- # Library generation targets #---------------------------------------------------------------------------- #### show_statics shows static objects in locally-created object files. #### It assumes that the object files were built using g++. #### TOOLENV selects the proper nm in VxWorks host environments. #### TOOLDIR allows specification of the full path to nm via definition #### in the platform_macros.GNU file. show_statics: -@$(TOOLDIR)nm$(TOOLENV) -Co $(VSHDIR)*o | \ grep -E ' global destructors '; true #### show_uninit shows uninitialized data in locally-created object files. #### TOOLENV selects the proper nm in VxWorks host environments. show_uninit: -@$(TOOLDIR)nm$(TOOLENV) -Co $(VSHDIR)*o | grep -E ' b ' #---------------------------------------------------------------------------- # Installation targets #---------------------------------------------------------------------------- # Always add LIB_INSTALL to INSTALL, so libs will get installed even no BIN # is built. LIB_INSTALL is a dependency for BIN, so libs are installed prior # to use. Also, make LIB_INSTALL depend on VLIBS, so libs get built prior to # installation. ifdef LIB_INSTALL INSTALL ?= $(LIB_INSTALL) $(LIB_INSTALL): $(VLIBS) endif ifneq ($(INSBIN),) $(INSBIN)/$(VBIN): $(VBIN) endif INSTALL ?= binout.local: $(INSTALL) clean_binout.local: ifdef CLEANUP_INSTALL ifneq ($(strip $(CLEANUP_INSTALL)),) $(RM) $(CLEANUP_INSTALL) endif # CLEANUP_INSTALL endif # CLEANUP_INSTALL ifndef LN_S ifndef COMSPEC ifdef ComSpec #### ACE+TAO use COMSPEC, but ComSpec is defined. COMSPEC = $(ComSpec) endif # ComSpec endif # ! COMPSPEC ifdef COMSPEC #### Assume we're on a WIN32 host. LN_S = cp -p else # ! WIN32 ifeq ($(symlinks),absolute) LN_S = ln -s else LN_S = $(ACE_ROOT)/bin/add_rel_link.sh endif # symlinks endif # ! WIN32 endif # ! LN_S # Don't call shell/call directly in the rule below, since we may need to # add the architecture specific suffix to the directory. Using $(shell pwd) # instead of just $(PWD) is needed for Korn shell on Solaris. ifneq ($(use_pwd_call),1) ARCH_SOURCE_DIR := $(patsubst %/,%,$(shell pwd)/$(ARCH)) else ARCH_SOURCE_DIR := $(patsubst %/,%,$(call PWD)/$(ARCH)) endif $(INSBIN)/%$(VAR)$(EXEEXT) \ $(INSINC)/ace% \ $(INSLIB)/% \ $(INSMAN)/man1/% \ $(INSMAN)/man2/% \ $(INSMAN)/man3/% \ $(INSMAN)/man4/% \ $(INSMAN)/man5/% \ $(INSMAN)/man6/% \ $(INSMAN)/man7/% \ $(INSMAN)/man8/% \ $(INSMAN)/manl/% \ $(INSMAN)/mann/% : @$(MKDIR) $(@D) ifeq ($(vxworks_ntbuild),1) ifeq ($(SOVERSION),) @if not "$(ARCH_SOURCE_DIR)/$(@F)" == "$@" \ echo $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $@ && \ $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $@ else @if not exist $@ $(RM) $(@:%.$(SOEXT)$(SOVERSION)=%.$(SOEXT)) && \ $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $(@:%.$(SOEXT)$(SOVERSION)=%.$(SOEXT)) && \ $(RM) $@ && \ echo $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $@ && \ $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $@ endif #SOVERSION else #not vxworks_ntbuild ifeq ($(firstword $(LN_S)),cp) ifneq ($(SOVERSION),) @if test $(ARCH_SOURCE_DIR) != $(@D) ; then \ $(RM) $(@:%.$(SOEXT)$(SOVERSION)=%.$(SOEXT)); \ echo $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $(@:%.$(SOEXT)$(SOVERSION)=%.$(SOEXT)); \ $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $(@:%.$(SOEXT)$(SOVERSION)=%.$(SOEXT)); \ fi endif #SOVERSION @if test $(ARCH_SOURCE_DIR) != $(@D) ; then \ $(RM) $@; \ echo $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $@; \ $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $@; \ fi else #firstword of LN_S is not cp, so we're using real symlinks ifneq ($(SOVERSION),) ifneq ($(versioned_so),2) @if test $(ARCH_SOURCE_DIR) != $(@D) ; then \ if test ! -s $@ ; then \ $(RM) $(@:%.$(SOEXT)$(SOVERSION)=%.$(SOEXT)); \ echo $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $(@:%.$(SOEXT)$(SOVERSION)=%.$(SOEXT)); \ $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $(@:%.$(SOEXT)$(SOVERSION)=%.$(SOEXT)); \ fi ; \ fi else @if test $(ARCH_SOURCE_DIR) != $(@D) ; then \ if test ! -s $@ ; then \ $(RM) $(@:%$(SOVERSION).$(SOEXT)=%.$(SOEXT)); \ echo $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $(@:%$(SOVERSION).$(SOEXT)=%.$(SOEXT)); \ $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $(@:%$(SOVERSION).$(SOEXT)=%.$(SOEXT)); \ fi ; \ fi endif #versioned_so endif #SOVERSION @if test $(ARCH_SOURCE_DIR) != $(@D) ; then \ if test ! -s $@ ; then \ $(RM) $@; \ echo $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $@; \ $(LN_S) $(ARCH_SOURCE_DIR)/$(@F) $@; \ fi ; \ fi endif #firstword endif #vxworks_ntbuild ifdef MVSLIB #special for MVS in order to use the .x files @if test -w $(@D) ; then \ if test ! -s $(@:.$(SOEXT)=.x) ; then \ $(RM) $(@); $(LN_S) $(ARCH_SOURCE_DIR)/$(@F:.$(SOEXT)=.x) $(@:.$(SOEXT)=.x) ; \ fi \ fi endif #---------------------------------------------------------------------------- # Cleanup targets #---------------------------------------------------------------------------- clean_binaries.local: ifneq ($(BIN_UNCHECKED),) -$(RM) $(BIN_UNCHECKED) endif ifneq ($(SHLIB_UNCHECKED),) -$(RM) $(SHLIB_UNCHECKED) ifeq ($(versioned_so),1) -$(RM) $(SHLIB_UNCHECKED)$(SOVERSION) else ifeq ($(versioned_so),2) -$(RM) $(SHLIB_UNCHECKED:.$(SOEXT)=$(SOVERSION).$(SOEXT)) endif endif endif clean_idl_stubs.local: makefile_name.local ifdef IDL_FILES -$(RM) $(foreach ext, $(IDL_EXT), $(addsuffix $(ext), $(IDL_FILES))) endif CLEANUP_BIN ?= ifneq ($(CLEANUP_BIN),) DO_CLEANUP = 1 REALCLEAN_FILES += $(CLEANUP_BIN:%=%$(EXEEXT)) $(CLEANUP_BIN:%=%_debug$(EXEEXT)) $(CLEANUP_BIN:%=%_profile$(EXEEXT)) $(CLEANUP_BIN:%=%_optimize$(EXEEXT)) endif # !CLEANUP_BIN ifdef static_libs CLEANUP_LIB ?= ifneq ($(CLEANUP_LIB),) DO_CLEANUP = 1 REALCLEAN_FILES += $(CLEANUP_LIB:%=%) $(CLEANUP_LIB:%=%_debug) $(CLEANUP_LIB:%=%_profile) $(CLEANUP_LIB:%=%_optimize) endif # !CLEANUP_LIB endif # static_libs ifdef shared_libs CLEANUP_SHLIB ?= ifneq ($(CLEANUP_SHLIB),) DO_CLEANUP = 1 REALCLEAN_FILES += $(CLEANUP_VSHLIB:%=%) $(CLEANUP_VSHLIB_NO_VER:%=%*) $(CLEANUP_VSHLIB_NO_VER:%=%_debug) $(CLEANUP_VSHLIB_NO_VER:%=%_profile) $(CLEANUP_VSHLIB_NO_VER:%=%_optimize) endif # !CLEANUP_SHLIB endif # shared_libs ifdef OBJS CLEANUP_OBJS += $(addprefix $(VDIR), $(OBJS)) endif # OBJS ifneq ($(CLEANUP_BIN),) CLEANUP_OBJS += $(addsuffix .$(OBJEXT),$(addprefix $(VDIR),$(basename $(CLEANUP_BIN:$(ARCH)/%=%)))) $(VOBJS) endif # CLEANUP_BIN ifdef VSHOBJS CLEANUP_OBJS += $(VSHOBJS) endif # VSHOBJS clean.local: makefile_name.local ifdef DO_CLEANUP -$(RM) -r \ *.$(OBJEXT) *~ *.bak *.rpo *.sym lib*.*_pure_* \ GNUmakefile.old core-r $(CLEANUP_DIRS) \ cxx_repository ptrepository ti_files \ gcctemp.c gcctemp so_locations *.ics \ templateregistry templateregistry.* ir.out core.* *.core $(CLEANUP_OBJS) endif # DO_CLEANUP realclean.local: clean.local clean_binout.local clean_idl_stubs.local ifdef DO_CLEANUP -$(RM) -r $(REALCLEAN_FILES) $(sort $(CLEANUP_OBJDIRS)) $(ARCH) endif # DO_CLEANUP #---------------------------------------------------------------------------- # Dependency generation target #---------------------------------------------------------------------------- TOP_MAKEFILE := $(word 1,$(MAKEFILE_LIST)) MAKEFILE ?= $(TOP_MAKEFILE) DEPENDENCY_FILE ?= $(MAKEFILE) IDL_DEPENDENCY_FILES ?= $(MAKEFILE) TAO_ROOT ?= $(ACE_ROOT)/TAO # If no libraries are build in the current directory (actually, if # rules.lib.GNU isn't included), then SOEXT might not be set. SOEXT ?= so ORIGdepend.local: $(MAKEFILE) @$(RM) $(MAKEFILE).old @cp $(MAKEFILE) $(MAKEFILE).old $(ACE_ROOT)/bin/g++dep -f $(MAKEFILE) $(CPPFLAGS) -DMAKEDEPEND $(LSRC) $(SRC) $(PSRC) @cat $(MAKEFILE) | \ sed -e "s;$(TAO_ROOT);\$$(TAO_ROOT);g" \ -e "s;$(ACE_ROOT);\$$(ACE_ROOT);g" \ $(ACE_DEPEND_SED_CMD) \ -e '/$$(ACE_ROOT)\/ace\/config[^\.]*\.h/d' \ -e "s; /[-a-zA-Z0-9_./]*\.h;;g" \ -e "s;\([-a-zA-Z0-9._]*\)\.$(OBJEXT):;.obj/\1.$(OBJEXT) .obj/\1.$(SOEXT) $(VSHDIR)\1.$(OBJEXT) $(VSHDIR)\1.$(SOEXT):;" \ > $(MAKEFILE).new @cat $(MAKEFILE).new >$(MAKEFILE) @$(RM) $(MAKEFILE).new @if cmp -s $(MAKEFILE) $(MAKEFILE).old ;\ then echo "GNUmakefile dependencies unchanged." ;\ else \ echo "GNUmakefile dependencies updated." ;\ fi ;\ $(RM) $(MAKEFILE).old ; ifneq ($(MAKEFILE),$(DEPENDENCY_FILE)) $(DEPENDENCY_FILE): ifeq ($(lacks_touch),1) copy NUL "$(DEPENDENCY_FILE)" else touch $(DEPENDENCY_FILE) endif depend_idl.local depend.local: $(DEPENDENCY_FILE) -include $(DEPENDENCY_FILE) endif ifneq ($(MAKEFILE),$(IDL_DEPENDENCY_FILES)) $(IDL_DEPENDENCY_FILES): ifeq ($(lacks_touch),1) copy NUL $@ else touch $@ endif depend_idl.local: $(IDL_DEPENDENCY_FILES) -include $(IDL_DEPENDENCY_FILES) endif ifdef COMSPEC DEPGEN ?= perl $(ACE_ROOT)/bin/depgen.pl else DEPGEN ?= $(ACE_ROOT)/bin/depgen.pl DEPGEN_ENV := ACE_PLATFORM_CONFIG=$(ACE_PLATFORM_CONFIG) \ ACE_DEPEND_SED_CMD="$(ACE_DEPEND_SED_CMD)" endif # Use findstring just in case the script was preceded by /usr/bin/perl ifeq ($(findstring depgen.pl, $(notdir $(DEPGEN))), depgen.pl) DEPEND_CMD_ARGS += -i ifeq ($(inline), 0) DEPEND_CMD_ARGS += -n endif endif depend_idl.local: $(MAKEFILE) idl_stubs.local incremental_depend_idl depend.local: $(MAKEFILE) idl_stubs.local @$(RM) $(DEPENDENCY_FILE).old @cp $(DEPENDENCY_FILE) $(DEPENDENCY_FILE).old $(DEPGEN_ENV) $(DEPGEN) -A $(DEPEND_CMD_ARGS) -f $(DEPENDENCY_FILE) \ $(CPPFLAGS) -t gnu -DMAKEDEPEND $(CCFLAGS) $(LSRC) $(SRC) $(PSRC) @if cmp -s $(DEPENDENCY_FILE) $(DEPENDENCY_FILE).old ;\ then echo "GNUmakefile dependencies unchanged." ;\ else \ echo "GNUmakefile dependencies updated." ;\ fi ;\ $(RM) $(DEPENDENCY_FILE).old ; #---------------------------------------------------------------------------- # idl_stubs target #---------------------------------------------------------------------------- IDL_FILES ?= IDL_CLIENT_HDR_EXT ?= idl_stubs.local: $(foreach file, $(IDL_FILES), $(file)$(IDL_CLIENT_HDR_EXT)) #---------------------------------------------------------------------------- # no-op idl dependency :: Makefiles append to this rule if there # are idl dependencies. #---------------------------------------------------------------------------- incremental_depend_idl:: ; #---------------------------------------------------------------------------- # Variant targets and conditional macros #---------------------------------------------------------------------------- build.objdirs: $(CLEANUP_DIRS) ifeq ($(MKDIR_NTSTYLE),1) $(CLEANUP_DIRS): @if not exist $@ $(MKDIR) $@ $(ACE_NUL_STDERR) else $(CLEANUP_DIRS): @test -d $@ || $(MKDIR) $@ $(ACE_NUL_STDERR) endif svnignore.local: if [ "n$(ARCH_BIN)" != "n" ]; then \ (svn propget svn:ignore .; echo $(ARCH_BIN)) | sort | uniq | sed '/^$$/d' >SvNiGnOrE; \ svn propset svn:ignore -F SvNiGnOrE .; \ rm SvNiGnOrE; \ fi #---------------------------------------------------------------------------- # Optional private, site-specific rules #---------------------------------------------------------------------------- private_rules_file ?= rules.private.GNU -include $(private_rules_file) ace-8.0.4+dfsg.orig/include/makeinclude/platform_macosx_mountainlion.GNU0000644000175000017500000000010315027201773025432 0ustar sudipsudip include $(ACE_ROOT)/include/makeinclude/platform_macosx_lion.GNU ace-8.0.4+dfsg.orig/include/makeinclude/platform_macosx_icc.GNU0000644000175000017500000000375015027201773023467 0ustar sudipsudip threads ?= 1 debug ?= 1 optimize ?= 0 ssl ?= 1 versioned_so ?= 0 universal ?= 0 insure ?= 0 AR = xiar ifeq ($(insure),0) CC = icc CXX = icpc endif ifndef CXX_VERSION CXX_VERSION := $(shell $(CXX) --version) endif ifeq (10.0,$(findstring 10.0,$(CXX_VERSION))) CFLAGS += -wd1684 endif ifeq (10.1,$(findstring 10.1,$(CXX_VERSION))) CFLAGS += -wd1684 endif no_hidden_visibility ?= 1 ifeq ($(inline),0) CPPFLAGS += -fno-inline endif ifeq ($(fast),1) CPPFLAGS += -fast endif ifeq ($(ipo),1) CPPFLAGS += -ipo endif CFLAGS += -w1 ifeq ($(threads),1) CPPFLAGS += -D_REENTRANT $(PLATFORM_AIO_SUPPORT) endif # threads CCFLAGS += $(CFLAGS) -ip DCFLAGS += -g -debug full DLD = $(CXX) LD = $(CXX) LIBS += -ldl RANLIB = ranlib ifeq ($(threads),1) LIBS += -lpthread ifeq (-DACE_HAS_AIO_CALLS,$(PLATFORM_AIO_SUPPORT)) LIBS += -lrt endif endif OCFLAGS += -O3 # Disable floating point optimizer solves problem with # min/max float values in the TAO_IDL compiler tests # If these options are not passed we can get overflows # when testing min/max ifeq ($(SYSARCH),ia64) CPPFLAGS += -mp else CPPFLAGS += -fp-model double endif ifeq ($(optimize),0) # Disable all optimizing in code CPPFLAGS += -O0 endif SOEXT = dylib SOFLAGS += $(CPPFLAGS) -dynamiclib SOBUILD = $(COMPILE.cc) $(PIC) -o $(VSHDIR)$*.dylib $<; \ $(SOLINK.cc) -o $@ $(LDFLAGS) $(SOFLAGS) $(VSHDIR)$*.o PRELIB = @true ifeq ($(shared_libs), 1) ifneq ($static_libs_only), 1) LDFLAGS += ifneq ($(no_hidden_visibility),1) CCFLAGS += -fvisibility=hidden else CPPFLAGS += -DACE_HAS_CUSTOM_EXPORT_MACROS=0 endif # no_hidden_visibility endif endif # Added line below to support "Executable Shared Object" files (as # needed by the service configurator). # Marius Kjeldahl ifeq ($(threads),1) ESOBUILD = $(COMPILEESO.cc) $(PIC) -dynamiclib -o $(VSHDIR)$*.dylib $< ifndef PRELIB PRELIB = @true endif # ! PRELIB endif ace-8.0.4+dfsg.orig/include/makeinclude/platform_mingw32.GNU0000644000175000017500000000124115027201773022636 0ustar sudipsudip# -*- Makefile -*- # # This file should allow to build ACE for mingw32 with mingw tools. ACE_PLATFORM_CONFIG ?= config-win32.h mingw32 = 1 # MinGW has wfmo and registry wfmo ?= 1 winregistry ?= 1 # We can use the QoS support qos ?= 1 PWD=$(subst \,/,$(shell pwd)) ifeq (cmd,$(findstring cmd,$(SHELL))) CMDSEP = & vxworks_ntbuild = 1 MKDIR_NTSYTLE = 1 ACE_MKDIR = mkdir ECHO_BLANK_LINE = cmd /c echo. PRELIB:= endif include $(ACE_ROOT)/include/makeinclude/platform_gnuwin32_common.GNU PLATFORM_SSL_LIBS ?= -lssl32 -leay32 ifeq ($(winsock2),1) LIBS += -lws2_32 -lmswsock -liphlpapi endif LIBS += -lwsock32 -lnetapi32 CPPFLAGS += -Wno-unknown-pragmas ace-8.0.4+dfsg.orig/include/makeinclude/platform_linux.GNU0000644000175000017500000000275615027201773022523 0ustar sudipsudip# -*- Makefile -*- include $(ACE_ROOT)/include/makeinclude/platform_linux_common.GNU ifeq ($(insure),0) CC ?= gcc CXX ?= g++ CXX_FOR_VERSION_TEST ?= $(CXX) else CXX_FOR_VERSION_TEST ?= g++ endif ifndef CXX_FULL_VERSION CXX_FULL_VERSION := $(shell $(CXX_FOR_VERSION_TEST) --version) endif ifndef CXX_VERSION CXX_VERSION := $(shell $(CXX_FOR_VERSION_TEST) -dumpversion) endif ifeq ($(buildbits),32) FLAGS_C_CC += -m32 LDFLAGS += -m32 endif ifeq ($(buildbits),64) FLAGS_C_CC += -m64 LDFLAGS += -m64 endif ifeq ($(dynamic_loader),0) CPPFLAGS += -DACE_HAS_DYNAMIC_LINKING=0 else LIBS += -ldl endif ifeq ($(threads),1) FLAGS_C_CC += -pthread SOFLAGS += -pthread LIBS += -lrt endif ifeq ($(static_stdlibs),1) LDFLAGS += -static-libgcc -static-libstdc++ endif # Test for template instantiation, add to SOFLAGS if SONAME set, # add -E to LDFLAGS if using GNU ld # include $(ACE_ROOT)/include/makeinclude/platform_g++_common.GNU OCFLAGS ?= -O3 OCCFLAGS ?= -O3 #### GNU gas has a string limit of 4096 characters. On Alphas, #### builds will fail due to running over that limit. There are #### at least two workarounds: #### 1) Change the limit to 8192 characters and rebuild gas. See #### ACE-INSTALL.html for more information. #### 2) Don't use -g when compiling those files. #### If you're building on an Alpha and you haven't hacked and #### rebuilt gas, you might need to uncomment the following. #### ifeq ($(debug),1) #### SUPPRESS_DASH_G = 1 #### endif # debug ace-8.0.4+dfsg.orig/include/makeinclude/platform_win32_icc.GNU0000644000175000017500000000115315027201773023132 0ustar sudipsudip# -*- Makefile -*- # debug = 1 # optimize = 1 winsock2 ?= 1 debug ?= 1 optimize ?= 1 threads ?= 1 pipes ?= 0 inline ?= 0 ifeq ($(debug),0) CFLAGS += -DNDEBUG /MD else CFLAGS += /MDd endif ifeq ($(buildbits),64) CFLAGS += /Wp64 -DWIN64 endif CC = icl CXX = icl RC = rc CFLAGS += -DWIN32 /nologo /GR EXEEXT = .exe DCFLAGS += DLD = $(CXX) LD = $(CXX) OCFLAGS += -O3 PIC = AR = ar ARFLAGS = rsuv RANLIB = ranlib SOEXT = dll OBJEXT = obj SOFLAGS += $(MODEL_FLAGS) $(CPPFLAGS) SOBUILD = $(COMPILE.cc) $(PIC) -o $(VSHDIR)$*.so $< CCFLAGS += $(CFLAGS) ace-8.0.4+dfsg.orig/include/makeinclude/component_check.GNU0000644000175000017500000000115415027201773022606 0ustar sudipsudip# -*- Makefile -*- #---------------------------------------------------------------------------- # #---------------------------------------------------------------------------- # Load all components. ALL_COMPONENTS := $(ACE_MAKE_OPTIONS) ALL_COMPONENTS += $(shell sh $(ACE_ROOT)/bin/ace_components --ace) ALL_COMPONENTS += $(shell sh $(ACE_ROOT)/bin/ace_components --tao) ALL_COMPONENTS += $(shell sh $(ACE_ROOT)/bin/ace_components --orbsvcs) # Filter out all the components that are currently available from the # list of requirements. MISSING_COMPONENTS := $(filter-out $(ALL_COMPONENTS), $(REQUIRED_COMPONENTS)) ace-8.0.4+dfsg.orig/include/makeinclude/platform_g++_common.GNU0000644000175000017500000000722615027201773023305 0ustar sudipsudip# -*- Makefile -*- ifeq ($(insure),1) CC = insure CXX = insure else ifneq ($(CROSS_COMPILE),) CROSS-COMPILE = 1 # Build using the cross-tools CC = ${CROSS_COMPILE}gcc${CROSS_COMPILE_SUFFIX} CXX = ${CROSS_COMPILE}g++${CROSS_COMPILE_SUFFIX} AR = ${CROSS_COMPILE}ar${CROSS_COMPILE_SUFFIX} # Cross-linker requires this for linked in shared libs that depend # themselves on other shared libs (not directly linked in) LDFLAGS += -Wl,-rpath-link,$(ACE_ROOT)/lib ifneq (,$(HOST_ROOT)) TAO_IDLFLAGS += -g $(HOST_ROOT)/bin/ace_gperf TAO_IDL = $(HOST_ROOT)/bin/tao_idl TAO_IDL_DEP = $(TAO_IDL) # make sure to use the host compiler, not the cross-compiler # as preprocessor for the cross-compiled idl tools TAO_IDL_PREPROCESSOR = gcc endif endif endif ifneq ($(TCPU),) ifeq ($(tunemodelflag),1) FLAGS_C_CC += -mtune=$(TCPU) endif ifeq ($(cpumodelflag),1) FLAGS_C_CC += -mcpu=$(TCPU) endif ifeq ($(archmodelflag),1) FLAGS_C_CC += -march=$(TCPU) endif endif ifeq ($(gprof),1) FLAGS_C_CC += -pg LDFLAGS += -pg endif ifeq ($(no_deprecated),1) CCFLAGS += -Wno-deprecated endif ifeq ($(gcov),1) CCFLAGS += --coverage LDFLAGS += --coverage endif ifeq ($(CXX),insure) # insure does not pass through the -dumpversion option. CXX_FOR_VERSION_TEST ?= g++ else CXX_FOR_VERSION_TEST ?= $(CXX) endif ifndef CXX_VERSION CXX_VERSION := $(shell $(CXX_FOR_VERSION_TEST) -dumpversion) endif ifndef CXX_MACHINE CXX_MACHINE := $(shell $(CXX_FOR_VERSION_TEST) -dumpmachine) endif ifndef CXX_FULL_VERSION CXX_FULL_VERSION := $(shell $(CXX_FOR_VERSION_TEST) --version) endif CXX_MAJOR_VERSION := $(firstword $(subst ., ,$(CXX_VERSION))) CXX_MINOR_VERSION := $(word 2,$(subst ., ,$(CXX_VERSION))) # Minimum C++ level is now C++17, gcc until version 11 have an older version as default ifeq ($(CXX_MAJOR_VERSION),7) c++std ?= c++17 endif ifeq ($(CXX_MAJOR_VERSION),8) c++std ?= c++17 endif ifeq ($(CXX_MAJOR_VERSION),9) c++std ?= c++17 endif ifeq ($(CXX_MAJOR_VERSION),10) c++std ?= c++17 endif # Only modify LDFLAGS if DLD has been set. ifneq ($(DLD),) ifeq ($(DLD),$(CXX_FOR_VERSION_TEST)) # only try this is we are using ld through gcc LD_FOR_VERSION_TEST = $(shell $(CXX_FOR_VERSION_TEST) -print-prog-name=ld) else LD_FOR_VERSION_TEST = $(DLD) endif # DLD = CXX_FOR_VERSION_TEST # The -E option is GNU ld specific ifneq ($(mingw32),1) GNU_LD := $(shell sh -c '$(LD_FOR_VERSION_TEST) -v 2>&1 | grep -c "GNU ld"') else GNU_LD := $(if $(findstring GNU ld,$(shell $(LD_FOR_VERSION_TEST) -v)), 1, 0) endif # mingw32 endif # DLD ifeq ($(no-optimize-sibling-calls), 1) FLAGS_C_CC += -fno-optimize-sibling-calls endif ifeq ($(no_strict_aliasing), 1) FLAGS_C_CC += -fno-strict-aliasing else ifneq ($(no_strict_aliasing), 0) # if not explicitly disabled enable suppression of strict-aliasing checks by default; # these checks and the resulting warnings are very controversial and # popular opinion on the web seems to be that it brings little practical value and a # lot of pain to attempt to solve code issues and the best way to deal is to suppress FLAGS_C_CC += -fno-strict-aliasing endif endif minimaltoc ?= 0 ifeq ($(minimaltoc),1) FLAGS_C_CC += -mminimal-toc endif address-sanitizer ?= 0 ifeq ($(address-sanitizer),1) CPPFLAGS += -fsanitize=address -fno-omit-frame-pointer LDFLAGS += -fsanitize=address endif thread-sanitizer ?= 0 ifeq ($(thread-sanitizer),1) CPPFLAGS += -fsanitize=thread LDFLAGS += -fsanitize=thread endif pipes ?= 1 # Things GCC has in common with Clang include $(ACE_ROOT)/include/makeinclude/platform_gcc_clang_common.GNU ace-8.0.4+dfsg.orig/include/makeinclude/platform_macosx_snowleopard.GNU0000644000175000017500000000056315027201773025265 0ustar sudipsudip ifeq ($(buildbits),32) FLAGS_C_CC += -m32 LDFLAGS += -m32 endif ifeq ($(buildbits),64) FLAGS_C_CC += -m64 LDFLAGS += -m64 endif ifeq ($(buildbits),universal) FLAGS_C_CC += -arch i386 -arch x86_64 LDFLAGS += -arch i386 -arch x86_64 endif PLATFORM_NDDS_FLAGS="-ppPath cpp-4.2 -I." include $(ACE_ROOT)/include/makeinclude/platform_macosx_common.GNU ace-8.0.4+dfsg.orig/include/makeinclude/platform_vxworks6.2.GNU0000644000175000017500000002247415027201773023334 0ustar sudipsudip# -*- Makefile -*- # VxWorks 6.2 #### Notes: #### 1) This file requires that the WIND_BASE and WIND_HOST_TYPE environment #### variables be set. If the target CPU is not SIMNT, then your CPU #### environment variable must be set. #### 2) If you have problems with munch output not being compilable #### because it contains identifiers with ".", e.g., ".cpp", in them: #### add a global variable or function to that .cpp file. See #### ace/IOStream_T.cpp for an explanation and example. #### 3) The TOOL environment variable may be set to "diab" (default is "gnu"). #### 4) If perl is not on your path, you'll also need to set your PERL_PATH #### environment variable to the full path to perl. VXWORKS = 1 CROSS-COMPILE = 1 debug ?= 1 optimize ?= 1 threads ?= 1 rtp ?= 1 ifeq ($(rtp),0) pthread ?= 0 else pthread ?= 1 endif xerces ?= 0 aio ?= 0 versioned_so ?= 0 ifeq ($(static_libs),1) shared_libs = 0 else static_libs = 0 endif ifeq ($(static_libs_only),1) shared_libs = 0 endif # VxWorks doesn't have rwho rwho = 0 ifeq (,$(WIND_BASE)) default: @ERROR: you must set your WIND_BASE environment variable endif # WIND_BASE ifeq (,$(WIND_HOST_TYPE)) default: @ERROR: you must set your WIND_HOST_TYPE environment variable endif # WIND_HOST_TYPE ifeq ("$(WIND_HOST_TYPE)","x86-win32") vxworks_ntbuild ?= 0 mingw32 ?= 1 lacks_touch ?= 0 PWD=$(subst \,/,$(shell pwd)) ACE_ROOT:=$(subst \,/,$(ACE_ROOT)) TAO_ROOT:=$(subst \,/,$(TAO_ROOT)) HOST_ROOT:=$(subst \,/,$(HOST_ROOT)) override RM=rm -f endif # x86-win32 ifneq (,$(HOST_ROOT)) TAO_IDLFLAGS += -g $(HOST_ROOT)/bin/ace_gperf ifeq ("$(WIND_HOST_TYPE)","x86-win32") TAO_IDL = $(HOST_ROOT)/bin/tao_idl.exe else TAO_IDL = $(HOST_ROOT)/bin/tao_idl endif TAO_IDL_DEP = $(TAO_IDL) endif HOST_DIR = $(WIND_BASE)/host/$(WIND_HOST_TYPE) ifeq (,$(PERL_PATH)) PERL_PATH = perl endif # ! PERL_PATH ifeq ($(VXWORKS_VERSION_FLAG),) VXWORKS_VERSION_FLAG = -DACE_VXWORKS=0x620 endif # VXWORKS_VERSION_FLAG ifeq ($(TOOL),) override TOOL = gnu else override TOOL := $(TOOL) endif ifeq ($(TOOL_FAMILY),) ifeq ($(findstring gnu,$(TOOL)),gnu) override TOOL_FAMILY := gnu else override TOOL_FAMILY := diab endif endif ifeq ("$(TOOL_FAMILY)","gnu") templates ?= automatic endif ifeq ($(rtp),0) ifeq ($(findstring PPC, $(CPU)), PPC) CPPFLAGS += -mlongcall endif PRJ_TYPE = vxApp endif ifeq ($(rtp),1) TARGET_DIR = $(WIND_BASE)/target/usr else TARGET_DIR = $(WIND_BASE)/target/h endif TGT_DIR = $(WIND_BASE)/target ifeq ($(CPU),) # default CPU CPU = SIMNT else override CPU := $(CPU) endif ifeq ($(shared_libs),1) SHARED_LIBS = 1 endif ifeq ($(shared_libs_only),1) SHARED_LIBS = 1 endif ifeq ($(rtp),0) ifeq ($(SHARED_LIBS),1) ACELIB = -L./ #### There's no difference between non-shared and shared object code. VSHDIR = $(VDIR) endif # shared_libs endif BIN_UNCHECKED ?= SHLIB_UNCHECKED ?= ifneq ("$(BIN_UNCHECKED)","") VX_APP_BUILD := 1 else ifeq ($(SHARED_LIBS),1) ifneq ("$(SHLIB_UNCHECKED)","") VX_SO_BUILD := 1 endif endif ifneq ($(VX_SO_BUILD),1) VX_LIB_BUILD := 1 endif endif ifneq ($(VX_LIB_BUILD),1) ifeq ($(rtp),0) VXWORKSLINK = 1 endif ifeq ($(VX_APP_BUILD),1) ## set variables for VxWorks linktarget identification ifeq ($(rtp),0) EXEEXT = .out PRJ_FILE = $(basename $(notdir $(BIN_UNCHECKED))).vxworks else PRJ_FILE = $(basename $(notdir $(BIN_UNCHECKED))).vxe EXEEXT = .vxe VXE_DIR := $(OUTPUT_DIRECTORY) EXE = $(BIN_UNCHECKED) endif PRJ_DIR = . CLEANUP_OBJS := ctdt.c $(PRJ_DIR)/$(PRJ_FILE) $(CLEANUP_OBJS) else ## set variables for VxWorks .SO linktarget identification PRJ_FILE = $(basename $(notdir $(SHLIB_UNCHECKED))).vxworks PRJ_DIR = . CLEANUP_OBJS := ctdt.c $(PRJ_DIR)/$(PRJ_FILE) *.out $(CLEANUP_OBJS) endif endif ifeq ($(rtp),1) include $(WIND_USR)/make/defs.default include $(WIND_USR)/make/defs.$(WIND_HOST_TYPE) include $(WIND_USR)/tool/$(TOOL_FAMILY)/make.$(CPU)$(TOOL) CPPFLAGS += -mrtp LDFLAGS := $(filter-out -X, $(LDFLAGS)) LDFLAGS := $(filter-out -N, $(LDFLAGS)) LD := $(CPLUS) DLD := $(CPLUS) ifeq ($(SHARED_LIBS), 1)) ifeq ($(PRJ_TYPE),library) PICDIR = /PIC endif endif ifeq ($(findstring *sf,*$(TOOL)),*sf) LDFLAGS += -L$(WIND_USR)/lib/$(VX_CPU_FAMILY)/$(CPU)/sfcommon$(PICDIR) else LDFLAGS += -L$(WIND_USR)/lib/$(VX_CPU_FAMILY)/$(CPU)/common$(PICDIR) endif LDLIBS += -ldl else include $(TGT_DIR)/h/make/defs.default include $(TGT_DIR)/h/make/defs.$(WIND_HOST_TYPE) include $(TGT_DIR)/h/make/defs.$(PRJ_TYPE) include $(TGT_DIR)/h/tool/$(TOOL_FAMILY)/make.$(CPU)$(TOOL) endif no_cflags_ansi ?= 0 ifeq ($(no_cflags_ansi), 1) ifeq ("$(TOOL_FAMILY)","gnu") CC_COMPILER := $(filter-out -ansi, $(CC_COMPILER)) else CC_COMPILER := $(filter-out -Xansi, $(CC_COMPILER)) endif endif no_ccflags_ansi ?= 0 ifeq ($(no_ccflags_ansi), 1) ifeq ("$(TOOL_FAMILY)","gnu") C++_COMPILER := $(filter-out -ansi, $(C++_COMPILER)) else C++_COMPILER := $(filter-out -Xansi, $(C++_COMPILER)) endif endif ifeq ($(VXWORKSLINK),1) # prevent possible clash with static LIB rules # in VxWorks make includes and rules.lib.GNU override ARCHIVE = override LARGE_PROJECT = PRJ_OBJS = $(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) ifeq ($(SHARED_LIBS),1) ##LD_PARTIAL += -L$(ACE_ROOT)/lib -L./ $(LDLIBPATH) $(LD_LINK_PATH) PRJ_OBJS_FOR_LD_PARTIAL=$(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) ifeq ($(VX_SO_BUILD),1) ## Shared lib builds for VxWorks will also build 'import' libraries LIB_INSTALL += $(VLIB:%=$(INSLIB)/%) CLEANUP_INSTALL += $(CLEANUP_VLIB:%=$(INSLIB)/%) REALCLEAN_FILES += $(CLEANUP_LIB:%=%) $(CLEANUP_LIB:%=%_debug) $(CLEANUP_LIB:%=%_profile) $(CLEANUP_LIB:%=%_optimize) endif else LD_PARTIAL += -L$(ACE_ROOT)/ace -L./ $(LDLIBPATH) $(LD_LINK_PATH) $(LD_PARTIALFLAGS) PRJ_OBJS_FOR_LD_PARTIAL=$(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) $(VLDLIBS) $(ACE_SHLIBS) $(LIBS) endif PRJ_OBJS_FOR_LD=$(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) PRJ_OBJS_FOR_NM=$(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) PRJ_OBJS_FOR_AR=$(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) POST_BUILD_RULE = $(POSTLINK) COMPILE_TRADITIONAL = $(CC) $(OPTION_OBJECT_ONLY) $(OPTION_DOLLAR_SYMBOLS)\ $(filter-out -ansi, $(CFLAGS)) ## make sure default target stays the ACE/TAO default target ## default: all endif CPPFLAGS += $(VXWORKS_VERSION_FLAG) ifeq ($(debug),1) DCFLAGS += -g DCCFLAGS += -g CPPFLAGS += endif ifeq ($(pthread),1) CPPFLAGS += -DACE_HAS_PTHREADS endif ifeq ("$(TOOL_FAMILY)","gnu") # Test for template instantiation, add to SOFLAGS if SONAME set, # add -E to LDFLAGS if using GNU ld include $(ACE_ROOT)/include/makeinclude/platform_g++_common.GNU ifeq ("$(templates)","automatic") ifeq ($(repo),1) ifeq ($(VXWORKSLINK),1) ifeq ($(VX_APP_BUILD),1) ifneq ($(SHARED_LIBS),1) LD_PARTIAL += -frepo endif endif else ifeq ($(rtp),0) ace_lib_prelink := 1 LINK.cc = override LINK.cc.override = $(LD_PARTIAL) -frepo -L$(ACE_ROOT)/ace -L$(INSLIB) -L./ $(LDLIBPATH) $(LD_LINK_PATH) ifneq ($(SHARED_LIBS),1) LDFLAGS = $(ACE_SHLIBS) endif endif endif endif endif endif # TOOL_FAMILY == gnu ifeq ("$(TOOL_FAMILY)","diab") C++FLAGS += -Xexceptions else ifeq ("$(TOOL_FAMILY)","gnu") C++FLAGS += -fexceptions endif endif ifneq ($(findstring $(VX_CPU_FAMILY),ppc arm),) ifeq ("$(TOOL_FAMILY)","diab") C++FLAGS += -Xchar-signed else ifeq ("$(TOOL_FAMILY)","gnu") C++FLAGS += -fsigned-char endif endif endif ifeq ($(CPU),SIMNT) override MUNCH_FLAGS := -asm $(TOOLENV) endif ifneq ($(optimize),1) CC_OPTIM_NORMAL = endif CCFLAGS += $(C++FLAGS) $(FLAGS_C_CC) ifeq (0,$(rtp)) PIC = else ifeq ("$(TOOL)","diab") PIC = -Xpic else ifeq ("$(TOOL)","gnu") PIC = -fpic endif endif endif ifeq ($(VXWORKSLINK),1) ifeq ($(repo),1) ifeq ($(SHARED_LIBS),1) BACKUP_RPO_RULE = for %f in ($(basename $(addprefix $(VDIR), $(OBJS)) $(VSHOBJS))) do if exist %f.rpo mv %f.rpo %f.rpobak $(ACE_NUL_STDERR) POST_BUILD_RULE = for %f in ($(basename $(addprefix $(VDIR), $(OBJS)) $(VSHOBJS))) do if exist %f.rpobak mv %f.rpobak %f.rpo $(ACE_NUL_STDERR) endif endif .PHONY: $(PRJ_DIR)/$(PRJ_FILE) ## special target to satisfy VxWorks dependencies for images $(PRJ_DIR)/$(PRJ_FILE): ifeq ($(repo),1) ifeq ($(SHARED_LIBS),1) #### execute prelink step to make compiler instantiate all needed #### templates; discard image and repo files (*.rpo) after linkstep #### this step holds for both .SO as well as 'app' images so use both VSHOBJS and OBJS -$(LD_PARTIAL) -frepo -L$(ACE_ROOT)/ace -L./ $(LDLIBPATH) $(LD_LINK_PATH)$(LINK_OUTPUT_FLAG) ace-templ_inst $? $(ACE_SHLIBS) $(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) -$(RM) ace-templ_inst #### We need to backup the .RPO files or otherwise the link step of the final image will #### start instantiating templates again even if we do not specify '-frepo'! -$(BACKUP_RPO_RULE) ifeq ($(VX_SO_BUILD),1) #### build library of objects in .SO to use as a sort of import library for VxWorks echo $(filter %.o, $(VSHOBJS)) | xargs $(AR) $(ARFLAGS) $(VLIB) $(AREXTRA) -chmod a+r $(VLIB) ifneq (,$(RANLIB)) -$(RANLIB) $(VLIB) endif # RANLIB endif # VX_SO_BUILD endif endif @echo 1>$@ endif ace-8.0.4+dfsg.orig/include/makeinclude/platform_macosx.GNU0000644000175000017500000000451415027201773022650 0ustar sudipsudip# include the platform_macosx_*.GNU based on the detected MacOS version MACOS_RELEASE_VERSION=$(shell sw_vers -productVersion) MACOS_REL_WORDS := $(subst ., ,${MACOS_RELEASE_VERSION}) MACOS_MAJOR_VERSION = $(word 1,${MACOS_REL_WORDS}) MACOS_MINOR_VERSION = $(word 2,${MACOS_REL_WORDS}) MACOS_BUILD_VERSION = $(word 3,${MACOS_REL_WORDS}) MACOS_CODENAME_VER_10_2 := MACOS_CODENAME_VER_10_3 := panther MACOS_CODENAME_VER_10_4 := tiger MACOS_CODENAME_VER_10_5 := leopard MACOS_CODENAME_VER_10_6 := snowleopard MACOS_CODENAME_VER_10_7 := lion MACOS_CODENAME_VER_10_8 := mountainlion MACOS_CODENAME_VER_10_9 := mavericks MACOS_CODENAME_VER_10_10 := yosemite MACOS_CODENAME_VER_10_11 := elcapitan MACOS_CODENAME_VER_10_12 := sierra MACOS_CODENAME_VER_10_13 := highsierra MACOS_CODENAME_VER_10_14 := mojave MACOS_CODENAME_VER_10_latest := mojave MACOS_CODENAME_VER_11_0 := bigsur MACOS_CODENAME_VER_11_1 := bigsur MACOS_CODENAME_VER_11_2 := bigsur MACOS_CODENAME_VER_11_latest := bigsur MACOS_CODENAME_VER_12_0 := monterey MACOS_CODENAME_VER_12_latest := monterey MACOS_CODENAME = $(MACOS_CODENAME_VER_$(MACOS_MAJOR_VERSION)_$(MACOS_MINOR_VERSION)) ifeq ($(MACOS_MAJOR_VERSION),10) ifeq ($(shell test $(MACOS_MINOR_VERSION) -gt 14; echo $$?),0) ## if the detected version is greater than the latest know version, ## just use the latest known version MACOS_CODENAME = $(MACOS_CODENAME_VER_10_latest) else ifeq ($(shell test $(MACOS_MINOR_VERSION) -lt 2; echo $$?),0) ## Unsupported minor version $(error Unsupported MacOS version $(MACOS_RELEASE_VERSION)) endif else ifeq ($(MACOS_MAJOR_VERSION),11) ifeq ($(shell test $(MACOS_MINOR_VERSION) -gt 2; echo $$?),0) ## if the detected version is greater than the latest know version, ## just use the latest known version MACOS_CODENAME = $(MACOS_CODENAME_VER_11_latest) endif else ifeq ($(MACOS_MAJOR_VERSION),12) ifeq ($(shell test $(MACOS_MINOR_VERSION) -gt 0; echo $$?),0) ## if the detected version is greater than the latest know version, ## just use the latest known version MACOS_CODENAME = $(MACOS_CODENAME_VER_12_latest) endif else ## Unsupported major version -- will fallback to the last known version. MACOS_CODENAME = $(MACOS_CODENAME_VER_12_latest) endif include $(ACE_ROOT)/include/makeinclude/platform_macosx_$(MACOS_CODENAME).GNU ace-8.0.4+dfsg.orig/include/makeinclude/rules.nonested.GNU0000644000175000017500000000031415027201773022414 0ustar sudipsudip#---------------------------------------------------------------------------- # # # Null nested targets #---------------------------------------------------------------------------- $(TARGETS_NESTED): ace-8.0.4+dfsg.orig/include/makeinclude/platform_macosx_elcapitan.GNU0000644000175000017500000000011515027201773024661 0ustar sudipsudipssl?=0 include $(ACE_ROOT)/include/makeinclude/platform_macosx_yosemite.GNU ace-8.0.4+dfsg.orig/include/makeinclude/platform_linux_common.GNU0000644000175000017500000001105515027201773024063 0ustar sudipsudip# -*- Makefile -*- # We always include config-linux.h on Linux platforms. ACE_PLATFORM_CONFIG ?= config-linux.h debug ?= 1 optimize ?= 1 threads ?= 1 insure ?= 0 LSB_RELEASE_ID := $(shell lsb_release -i 2> /dev/null || echo Distributor ID: Unknown) LSB_RELEASE_RELEASE := $(shell lsb_release -r 2> /dev/null || echo Release: Unknown) PLATFORM_XT_CPPFLAGS= PLATFORM_XT_LIBS=-lXt PLATFORM_XT_LDFLAGS= PLATFORM_FL_CPPFLAGS= PLATFORM_FL_LIBS=-lfltk -lfltk_forms -lfltk_gl PLATFORM_FL_LDFLAGS= PLATFORM_X11_CPPFLAGS=-I/usr/X11R6/include PLATFORM_X11_LIBS=-lX11 PLATFORM_X11_LDFLAGS=-L/usr/X11R6/lib PLATFORM_GL_CPPFLAGS=-I/usr/X11R6/include PLATFORM_GL_LIBS =-lGL PLATFORM_GL_LDFLAGS =-L/usr/X11R6/lib PLATFORM_GTK_CPPFLAGS=$(shell gtk-config --cflags) PLATFORM_GTK_LIBS =$(shell gtk-config --libs) PLATFORM_GTK_LDFLAGS = PLATFORM_FOX_CPPFLAGS ?= -I/usr/include/fox PLATFORM_FOX_LIBS ?= -lFOX PLATFORM_FOX_LDFLAGS ?= # NOTE: we only support wxWindows over GTK PLATFORM_WX_CPPFLAGS= $(shell wx-config --cxxflags) $(PLATFORM_GTK_CPPFLAGS) PLATFORM_WX_LIBS = $(shell wx-config --libs) $(PLATFORM_GTK_LIBS) PLATFORM_WX_LDFLAGS = $(shell wx-config --ldflags) $(PLATFORM_GTK_LDFLAGS) PLATFORM_BOOST_CPPFLAGS ?= PLATFORM_BOOST_LDLAGS ?= PLATFORM_BOOST_UTF_LIBS ?= -lboost_unit_test_framework ace_source_if_exists=$(if $(wildcard $(1)), $(shell . $(1) $(2))) ace_buildbits_64=$(findstring 64,$(buildbits)) PLATFORM_TK_CPPFLAGS=$(call ace_source_if_exists,/usr/lib$(ace_buildbits_64)/tkConfig.sh,&& echo -n $$TK_INCLUDE_SPEC $$TK_DEFS) PLATFORM_TK_LIBS=$(call ace_source_if_exists,/usr/lib$(ace_buildbits_64)/tkConfig.sh,&& echo -n $$TK_LIB_FLAG) PLATFORM_TK_LDFLAGS= PLATFORM_TCL_CPPFLAGS=$(call ace_source_if_exists,/usr/lib$(ace_buildbits_64)/tclConfig.sh,&& echo -n $$TCL_INCLUDE_SPEC $$TCL_DEFS) PLATFORM_TCL_LIBS=$(call ace_source_if_exists,/usr/lib$(ace_buildbits_64)/tclConfig.sh,&& echo -n $$(eval echo $$TCL_LIB_FLAG)) PLATFORM_TCL_LDFLAGS= PLATFORM_QT_CPPFLAGS ?= -I$(QTDIR)/include PLATFORM_QT_LIBS ?= -lqt-mt PLATFORM_QT_LDFLAGS ?= -L$(QTDIR)/lib sctp ?= # support for OpenSS7 SCTP ifeq ($(sctp),openss7) PLATFORM_SCTP_CPPFLAGS+= -DACE_HAS_OPENSS7_SCTP PLATFORM_SCTP_LDFLAGS?= PLATFORM_SCTP_LIBS?= endif # support for LKSCTP (Linux Kernel 2.5) ifeq ($(sctp),lksctp) PLATFORM_SCTP_CPPFLAGS+= -DACE_HAS_LKSCTP PLATFORM_SCTP_LDFLAGS?= -L/usr/local/lib PLATFORM_SCTP_LIBS?= -lsctp endif GNU_LIBPTHREAD_VERSION := $(shell getconf GNU_LIBPTHREAD_VERSION 2> /dev/null || echo Unknown) ifeq (NPTL, $(word 1,$(GNU_LIBPTHREAD_VERSION))) NPTL_VERS := $(subst ., ,$(word 2,$(GNU_LIBPTHREAD_VERSION))) ifneq (0, $(word 1,$(NPTL_VERS))) nptl ?= 1 endif endif nptl ?= 0 ifeq ($(nptl),0) CPPFLAGS += -DACE_LACKS_LINUX_NPTL endif ssl ?= 0 ifeq ($(ssl),1) # Some Linux OpenSSL installations compile in Kerberos support. Add # the Kerberos include path to preprocessor include path. # # We should probably also add the Kerberos libraries to # PLATFORM_SSL_LIBS but we can't be sure if they are needed without # a more sophisticated check. This will only be a problem when # statically linking the OpenSSL library. The majority of # installations use shared OpenSSL libraries so we should be okay, # at least until we migrate to Autoconf. PLATFORM_SSL_CPPFLAGS += -I/usr/kerberos/include endif # ssl PLATFORM_LARGEFILE_CFLAGS := $(shell getconf LFS_CFLAGS 2> /dev/null) ifdef PLATFORM_LARGEFILE_CFLAGS # Large file support CPPFLAGS += $(PLATFORM_LARGEFILE_CFLAGS) endif SYSARCH := $(shell uname -m) PIC = -fPIC AR ?= ar ARFLAGS ?= rsuv RANLIB = @true # Added line below to support "Executable Shared Object" files (as # needed by the service configurator). # Marius Kjeldahl ifeq ($(threads),1) ESOBUILD = $(COMPILEESO.cc) $(PIC) -shared -o $(VSHDIR)$*.so $< ifndef PRELIB PRELIB = @true endif # ! PRELIB endif # DT_RUNPATH is preferred over DT_RPATH, but the linker will only use it when # this extra flag option (enable-new-dtags) is present LD_RPATH_FLAGS += -Wl,--enable-new-dtags # Rely on _GNU_SOURCE to set these defaults defined in /usr/include/features.h # instead of setting them directly here (older versions of gcc don't set it # for you): _SVID_SOURCE _BSD_SOURCE _POSIX_SOURCE _POSIX_C_SOURCE=199506L, ... CPPFLAGS += -D_GNU_SOURCE DCFLAGS += -ggdb DCCFLAGS += -ggdb DLD = $(CXX) LD = $(CXX) ifeq ($(optimize),1) SOFLAGS += -Wl,-O3 endif SOFLAGS += -shared SOBUILD = $(COMPILE.cc) $(PIC) -o $(VSHDIR)$*.so $<; \ $(SOLINK.cc) -o $@ $(LDFLAGS) $(VSHDIR)$*.o PRELIB = @true ace-8.0.4+dfsg.orig/include/makeinclude/platform_vxworks6.5.GNU0000644000175000017500000000027215027201773023327 0ustar sudipsudip# VxWorks 6.5 ifeq ($(VXWORKS_VERSION_FLAG),) VXWORKS_VERSION_FLAG = -DACE_VXWORKS=0x650 endif # VXWORKS_VERSION_FLAG include $(ACE_ROOT)/include/makeinclude/platform_vxworks6.4.GNU ace-8.0.4+dfsg.orig/include/makeinclude/platform_macosx_lion.GNU0000644000175000017500000000074715027201773023675 0ustar sudipsudip INSLIB?=$(ACE_ROOT)/lib ifeq ($(buildbits),32) FLAGS_C_CC += -m32 LDFLAGS += -m32 endif ifeq ($(buildbits),64) FLAGS_C_CC += -m64 LDFLAGS += -m64 endif ifeq ($(buildbits),universal) FLAGS_C_CC += -arch i386 -arch x86_64 LDFLAGS += -arch i386 -arch x86_64 endif ifeq (,$(buildbits)) FLAGS_C_CC += -m64 LDFLAGS += -m64 endif CC:=clang CXX:=clang++ PLATFORM_NDDS_FLAGS=-ppPath cpp-4.2 -I. include $(ACE_ROOT)/include/makeinclude/platform_macosx_common.GNU ace-8.0.4+dfsg.orig/include/makeinclude/all_in_one.GNU0000644000175000017500000000363615027201773021555 0ustar sudipsudip# -*- Makefile -*- #---------------------------------------------------------------------------- # #---------------------------------------------------------------------------- # Only include once. ifndef ALL_IN_ONE_GNU ALL_IN_ONE_GNU = 1 # Include wrapper macros to all user defines, etc. include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU TAO_ROOT ?= $(ACE_ROOT)/TAO ifneq ($(ADDITIONAL_INCLUDE),) include $(ADDITIONAL_INCLUDE) endif # Now test for installed components, and set the BIN. LIB, and SHLIB # targets from the *_UNCHECKED ones if the component checks # succeed. Client Makefile must set the variable REQUIRED_COMPONENTS # with a list of required components. If no additional components # are required, REQUIRED_COMPONENTS need not be set. include $(ACE_ROOT)/include/makeinclude/component_check.GNU # If no required components are missing, set the real targets ifeq ($(MISSING_COMPONENTS),) ifdef BIN_UNCHECKED BIN += $(BIN_UNCHECKED) endif # !BIN_UNCHECKED ifdef static_libs ifdef LIB_UNCHECKED LIB += $(LIB_UNCHECKED) endif # !LIB_UNCHECKED endif # static_libs ifdef shared_libs ifdef SHLIB_UNCHECKED SHLIB += $(SHLIB_UNCHECKED) endif # !SHLIB_UNCHECKED endif # !shared_libs endif # COMPILE_COMPONENT include $(ACE_ROOT)/include/makeinclude/macros.GNU include $(ACE_ROOT)/include/makeinclude/rules.common.GNU ifdef DIRS include $(ACE_ROOT)/include/makeinclude/rules.nested.GNU else # !DIRS include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU endif # DIRS ifdef CLEANUP_LIB include_lib = 1 endif # LIB ifdef CLEANUP_SHLIB include_lib = 1 endif # SHLIB ifeq ($(include_lib),1) include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU endif include $(ACE_ROOT)/include/makeinclude/rules.local.GNU # Remove the -g option if requested. SUPPRESS_DASH_G ?= ifeq ($(SUPPRESS_DASH_G),1) DCFLAGS := $(filter-out -g, $DCFLAGS) endif endif # ALL_IN_ONE_GNU ace-8.0.4+dfsg.orig/include/makeinclude/platform_vxworks7.0.GNU0000644000175000017500000001201615027201773023322 0ustar sudipsudip# -*- Makefile -*- # VxWorks 7 # Building ACE for VxWorks 7 # # Unlike earlier versions, VxWorks 7 requires a VSB before application code # can be compiled (either kernel mode or RTP). See the VxWorks documentation # for information on creating a VSB (VxWorks Source Build). # # Create the file ace/config.h containing #include "ace/config-vxworks.h" # Create the file include/makeinclude/platform_macros.GNU containing... # VSB_DIR = <> # TOOL = gnu # HOST_ROOT = <> # << add other build settings here (debug, optimize, inline, rtp) >> # include $(ACE_ROOT)/include/makeinclude/platform_vxworks.GNU # # Use the wrenv script for your host system to start a VxWorks development shell # and build ACE from that shell using the normal procedure (set ACE_ROOT, # generate makefiles if necessary, etc.). # # Not all configurations supported on VxWorks 6.x have been brought forward # to this file. If you are building a configuration that has not yet been # attempted on VxWorks 7, this file may need to be changed. VXWORKS = 1 CROSS-COMPILE = 1 debug ?= 1 optimize ?= 1 threads ?= 1 rtp ?= 1 pthread ?= $(if $(findstring 1,$(rtp)),1,0) xerces ?= 0 aio ?= 0 versioned_so ?= 0 footprint ?= 0 rwho = 0 templates ?= automatic build_tao_idl_be = 0 ifeq (,$(WIND_BASE)) default: @ERROR: you must set your WIND_BASE environment variable endif # WIND_BASE ifeq (,$(WIND_HOST_TYPE)) default: @ERROR: you must set your WIND_HOST_TYPE environment variable endif # WIND_HOST_TYPE ifeq ($(WIND_HOST_TYPE),x86-win32) vxworks_ntbuild ?= 0 mingw32 ?= 1 lacks_touch ?= 0 PWD = $(subst \,/,$(shell pwd)) ACE_ROOT := $(subst \,/,$(ACE_ROOT)) TAO_ROOT := $(subst \,/,$(TAO_ROOT)) HOST_ROOT := $(subst \,/,$(HOST_ROOT)) override RM = rm -f HOST_EXE_EXT = .exe endif # x86-win32 ifneq (,$(HOST_ROOT)) TAO_IDLFLAGS += -g $(HOST_ROOT)/bin/ace_gperf TAO_IDL = $(HOST_ROOT)/bin/tao_idl$(HOST_EXE_EXT) TAO_IDL_DEP = $(TAO_IDL) else # Append the HOST_EXE_EXT if it's not already there TAO_IDL_DEP = $(TAO_IDL:$(HOST_EXE_EXT)=)$(HOST_EXE_EXT) endif VXWORKS_VERSION_FLAG ?= -DACE_VXWORKS=0x700 CPPFLAGS += $(VXWORKS_VERSION_FLAG) ifneq ($(WIND_RELEASE_ID), ) CPPFLAGS += -DACE_VXWORKS_RELEASE=0x$(subst .,,$(WIND_RELEASE_ID)) endif ifeq ($(pthread),1) CPPFLAGS += -DACE_HAS_PTHREADS endif ifeq ($(rtp),0) VSHDIR = $(VDIR) ifneq ($(shared_libs_only),1) DKM_LIBS = $(if $(findstring 1,$(static_libs)$(static_libs_only)),$(LDLIBS)) endif IFILE = $(VDIR)$(notdir $(basename $(1))) define LINK.cc.override $(LD) -r -nostdlib $(LDFLAGS) -o $(call IFILE,$@)_partial.o $(filter %.o,$^) $(DKM_LIBS) $(NM) $(call IFILE,$@)_partial.o | $(MUNCH) > $(call IFILE,$@)_ctdt.c $(COMPILE.c) -o $(call IFILE,$@)_ctdt.o $(call IFILE,$@)_ctdt.c $(LD) -r -nostdlib -X $(LD_SCRIPT_DOWNLOAD) -o $@ $(call IFILE,$@)_ctdt.o $(call IFILE,$@)_partial.o $(DKM_FINAL_LIBS) endef SOLINK.cc.override = $(LINK.cc.override) CLEANUP_OBJS += $(foreach x,_ctdt.c _ctdt.o _partial.o,$(addsuffix $(x),$(VDIR)$(notdir $(basename $(if $(LIB_NAME),$(VLIB),$(VBIN)))))) endif ace_vx_mk_dir = $(if $(findstring 1,$(rtp)),$(WIND_USR_MK),$(WIND_KRNL_MK)) include $(ace_vx_mk_dir)/defs.library.mk ifneq ($(rtp),0) ## If we are building rtp and using the llvm (clang) compiler, we need to ## use the linker directly to create shared libraries and executables. ifeq ($(TOOL),llvm) LLD = $(__WRS_TOOL_PATH)/ld$(TOOLENV) define LINK.cc.override $(LLD) $(LDFLAGS) $(LD_EMULATION) --allow-shlib-undefined -EL $(VSB_DIR)/usr/lib/common/crt0.o -o $@ $(filter %.o,$^) --start-group --as-needed $(LDLIBS) -lc -lc_internal -lllvm -lcplusplus -lllvmcplus -lnet -ldl --end-group endef define SOLINK.cc.override $(LLD) $(LDFLAGS) $(LD_EMULATION) -shared --exclude-libs libc_internal.a -u __init -u __fini -o $@ $(filter %.o,$^) --start-group --as-needed $(ACE_SHLIBS) -lc -lc_internal -lcplusplus -lnet --end-group endef endif endif dkm_libstdcpp ?= $(if $(findstring y,$(_WRS_CONFIG_PRI_diab)),1,0) ifeq ($(dkm_libstdcpp),1) DKM_LIBS += -L$(VSB_DIR)/krnl/gnu_standard --start-group -lstl -lgnucplus --end-group DKM_FINAL_LIBS = -L$(VSB_DIR)/krnl/gnu_standard -lgnucplus endif CCFLAGS += $(C++FLAGS) PIC += $(OPTION_SHARED_CODE) OCFLAGS += $(CC_OPTIM_NORMAL) OCCFLAGS += $(CC_OPTIM_NORMAL) CC_OPTIM = DCFLAGS += -g DCCFLAGS += -g DLD = $(LD) LDFLAGS += $(LDFLAGS_COMMON) EXEEXT = $(if $(findstring 1,$(rtp)),.vxe,.out) SO_NAME = $(SHLIB) SOFLAGS += $(C++_COMPILER) $(OPTION_SHARED_CODE) $(LD_SHARED_LIB) \ $(LD_OPTION_SONAME) ifeq ($(rtp),1) LD = $(CXX) LDFLAGS := $(filter-out -X -N,$(LDFLAGS)) LDFLAGS += -L$(VSB_DIR)/usr/lib/common$(if $(filter library,$(PRJ_TYPE)),/PIC -L$(VSB_DIR)/usr/lib/common) endif LIBS_CPLUSPLUS = $(foreach lib,$(LIBCPLUS), -l$(lib)) LIBS += $(LIBS_CPLUSPLUS) build_nonstatic = $(if $(findstring 1,$(shared_libs)$(shared_libs_only)),$(if $(filter 1,$(static_libs_only)),,1)) LDFLAGS += $(if $(build_nonstatic),$(LDFLAGS_DYNAMIC),-static $(LDFLAGS_STATIC)) ace-8.0.4+dfsg.orig/include/makeinclude/platform_vxworks6.3.GNU0000644000175000017500000002417215027201773023332 0ustar sudipsudip# -*- Makefile -*- # VxWorks 6.3 #### Notes: #### 1) This file requires that the WIND_BASE and WIND_HOST_TYPE environment #### variables be set. If the target CPU is not SIMNT, then your CPU #### environment variable must be set. #### 2) If you have problems with munch output not being compilable #### because it contains identifiers with ".", e.g., ".cpp", in them: #### add a global variable or function to that .cpp file. See #### ace/IOStream_T.cpp for an explanation and example. #### 3) The TOOL environment variable may be set to "diab" (default is "gnu"). #### 4) If perl is not on your path, you'll also need to set your PERL_PATH #### environment variable to the full path to perl. VXWORKS = 1 CROSS-COMPILE = 1 debug ?= 1 optimize ?= 1 threads ?= 1 rtp ?= 1 ifeq ($(rtp),0) pthread ?= 0 else pthread ?= 1 endif xerces ?= 0 aio ?= 0 versioned_so ?= 0 footprint ?= 0 ifeq ($(static_libs),1) shared_libs = 0 else static_libs = 0 endif ifeq ($(static_libs_only),1) shared_libs = 0 endif # VxWorks doesn't have rwho rwho = 0 ifeq (,$(WIND_BASE)) default: @ERROR: you must set your WIND_BASE environment variable endif # WIND_BASE ifeq (,$(WIND_HOST_TYPE)) default: @ERROR: you must set your WIND_HOST_TYPE environment variable endif # WIND_HOST_TYPE ifeq ("$(WIND_HOST_TYPE)","x86-win32") vxworks_ntbuild ?= 0 mingw32 ?= 1 lacks_touch ?= 0 PWD=$(subst \,/,$(shell pwd)) ACE_ROOT:=$(subst \,/,$(ACE_ROOT)) TAO_ROOT:=$(subst \,/,$(TAO_ROOT)) HOST_ROOT:=$(subst \,/,$(HOST_ROOT)) override RM=rm -f HOST_EXE_EXT = .exe endif # x86-win32 ifneq (,$(HOST_ROOT)) TAO_IDLFLAGS += -g $(HOST_ROOT)/bin/ace_gperf TAO_IDL = $(HOST_ROOT)/bin/tao_idl$(HOST_EXE_EXT) TAO_IDL_DEP = $(TAO_IDL) else # Append the HOST_EXE_EXT if it's not already there TAO_IDL_DEP = $(TAO_IDL:$(HOST_EXE_EXT)=)$(HOST_EXE_EXT) endif HOST_DIR = $(WIND_BASE)/host/$(WIND_HOST_TYPE) ifeq (,$(PERL_PATH)) PERL_PATH = perl endif # ! PERL_PATH ifeq ($(VXWORKS_VERSION_FLAG),) VXWORKS_VERSION_FLAG = -DACE_VXWORKS=0x630 endif # VXWORKS_VERSION_FLAG ifeq ($(TOOL),) override TOOL = gnu else override TOOL := $(TOOL) endif ifeq ($(TOOL_FAMILY),) ifeq ($(findstring gnu,$(TOOL)),gnu) override TOOL_FAMILY := gnu else override TOOL_FAMILY := diab endif endif ifeq ("$(TOOL_FAMILY)","gnu") templates ?= automatic endif ifeq ($(rtp),0) ifeq ($(findstring PPC,$(CPU)),PPC) CPPFLAGS += -mlongcall endif PRJ_TYPE = vxApp endif ifeq ($(rtp),1) TARGET_DIR = $(WIND_BASE)/target/usr else TARGET_DIR = $(WIND_BASE)/target/h endif TGT_DIR = $(WIND_BASE)/target ifeq ($(CPU),) # default CPU CPU = SIMNT else override CPU := $(CPU) endif ifeq ($(shared_libs),1) SHARED_LIBS = 1 endif ifeq ($(shared_libs_only),1) SHARED_LIBS = 1 endif ifeq ($(rtp),0) ifeq ($(SHARED_LIBS),1) ACELIB = -L./ #### There's no difference between non-shared and shared object code. VSHDIR = $(VDIR) endif # shared_libs endif BIN_UNCHECKED ?= SHLIB_UNCHECKED ?= ifneq ("$(BIN_UNCHECKED)","") VX_APP_BUILD := 1 else ifeq ($(SHARED_LIBS),1) ifneq ("$(SHLIB_UNCHECKED)","") VX_SO_BUILD := 1 endif endif ifneq ($(VX_SO_BUILD),1) VX_LIB_BUILD := 1 endif endif ifneq ($(VX_LIB_BUILD),1) ifeq ($(rtp),0) VXWORKSLINK ?= 1 endif ifeq ($(VX_APP_BUILD),1) ## set variables for VxWorks linktarget identification ifeq ($(rtp),0) EXEEXT = .out PRJ_FILE = $(basename $(notdir $(BIN_UNCHECKED))).vxworks else PRJ_FILE = $(basename $(notdir $(BIN_UNCHECKED))).vxe EXEEXT = .vxe VXE_DIR := $(OUTPUT_DIRECTORY) EXE = $(BIN_UNCHECKED) endif PRJ_DIR = . CLEANUP_OBJS := ctdt.c $(PRJ_DIR)/$(PRJ_FILE) $(CLEANUP_OBJS) else ## set variables for VxWorks .SO linktarget identification PRJ_FILE = $(basename $(notdir $(SHLIB_UNCHECKED))).vxworks PRJ_DIR = . CLEANUP_OBJS := ctdt.c $(PRJ_DIR)/$(PRJ_FILE) *.out $(CLEANUP_OBJS) endif endif ifeq ($(rtp),1) include $(WIND_USR)/make/defs.default include $(WIND_USR)/tool/$(TOOL_FAMILY)/make.$(CPU)$(TOOL) include $(WIND_USR)/make/defs.$(WIND_HOST_TYPE) ifeq ("$(TOOL_FAMILY)","gnu") CPPFLAGS += -mrtp SOFLAGS += -mrtp endif ifeq ($(SHARED_LIBS), 1) ifeq ($(aio),1) CPPFLAGS += -DACE_HAS_AIO_CALLS LIBS += AioPx endif ifeq ($(PRJ_TYPE),library) PICDIR = /PIC endif endif LDFLAGS := $(filter-out -X, $(LDFLAGS)) LDFLAGS := $(filter-out -N, $(LDFLAGS)) LD := $(CPLUS) DLD := $(CPLUS) WIND_USR_LIB ?= lib ifeq ($(findstring *sf,*$(TOOL)),*sf) LDFLAGS += -L$(WIND_USR)/$(WIND_USR_LIB)/$(VX_CPU_FAMILY)/$(CPU)/sfcommon$(PICDIR) else LDFLAGS += -L$(WIND_USR)/$(WIND_USR_LIB)/$(VX_CPU_FAMILY)/$(CPU)/common$(PICDIR) endif else include $(TGT_DIR)/h/make/defs.default include $(TGT_DIR)/h/make/defs.$(WIND_HOST_TYPE) include $(TGT_DIR)/h/make/defs.$(PRJ_TYPE) include $(TGT_DIR)/h/tool/$(TOOL_FAMILY)/make.$(CPU)$(TOOL) endif ifeq ($(SHARED_LIBS), 1) ifeq ("$(TOOL_FAMILY)","gnu") ifeq ($(rtp),1) PIC = -fpic SOFLAGS += -fpic LDFLAGS += -Wl,-rpath-link,$(ACE_ROOT)/lib endif SOFLAGS += -shared LDFLAGS += -non-static else ifeq ($(rtp),1) PIC = -Xpic endif SOFLAGS += -Xshared LDFLAGS += -Xdynamic endif endif no_cflags_ansi ?= 0 ifeq ($(no_cflags_ansi), 1) ifeq ("$(TOOL_FAMILY)","gnu") CC_COMPILER := $(filter-out -ansi, $(CC_COMPILER)) else CC_COMPILER := $(filter-out -Xansi, $(CC_COMPILER)) endif endif no_ccflags_ansi ?= 0 ifeq ($(no_ccflags_ansi), 1) ifeq ("$(TOOL_FAMILY)","gnu") C++_COMPILER := $(filter-out -ansi, $(C++_COMPILER)) else C++_COMPILER := $(filter-out -Xansi, $(C++_COMPILER)) endif endif ifeq ($(footprint),1) LD_PARTIALFLAGS += -Xlinker -M -Xlinker -Map -Xlinker $@.map endif ifeq ($(VXWORKSLINK), 1) # prevent possible clash with static LIB rules # in VxWorks make includes and rules.lib.GNU override ARCHIVE = override LARGE_PROJECT = PRJ_OBJS = $(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) ifeq ($(SHARED_LIBS),1) ##LD_PARTIAL += -L$(ACE_ROOT)/lib -L./ $(LDLIBPATH) $(LD_LINK_PATH) PRJ_OBJS_FOR_LD_PARTIAL=$(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) ifeq ($(VX_SO_BUILD),1) ## Shared lib builds for VxWorks will also build 'import' libraries ifeq ($(rtp),1) LIB_INSTALL += $(VLIB:%=$(INSLIB)/%) CLEANUP_INSTALL += $(CLEANUP_VLIB:%=$(INSLIB)/%) REALCLEAN_FILES += $(CLEANUP_LIB:%=%) $(CLEANUP_LIB:%=%_debug) $(CLEANUP_LIB:%=%_profile) $(CLEANUP_LIB:%=%_optimize) endif endif else LD_PARTIAL += -L$(ACE_ROOT)/ace -L./ $(LDLIBPATH) $(LD_LINK_PATH) $(LD_PARTIALFLAGS) ifeq ($(footprint),0) PRJ_OBJS_FOR_LD_PARTIAL=$(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) $(VLDLIBS) $(ACE_SHLIBS) $(LIBS) else PRJ_OBJS_FOR_LD_PARTIAL=$(VSHOBJS) $(VLDLIBS) $(ACE_SHLIBS) $(LIBS) LD_PARTIAL_LAST_FLAGS += $(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) $(VLDLIBS) endif endif PRJ_OBJS_FOR_LD=$(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) PRJ_OBJS_FOR_NM=$(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) PRJ_OBJS_FOR_AR=$(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) POST_BUILD_RULE = $(POSTLINK) COMPILE_TRADITIONAL = $(CC) $(OPTION_OBJECT_ONLY) $(OPTION_DOLLAR_SYMBOLS)\ $(filter-out -ansi, $(CFLAGS)) ## make sure default target stays the ACE/TAO default target ## default: all endif CPPFLAGS += $(VXWORKS_VERSION_FLAG) ifeq ($(debug),1) DCFLAGS += -g DCCFLAGS += -g CPPFLAGS += endif ifeq ($(pthread),1) CPPFLAGS += -DACE_HAS_PTHREADS endif ifeq ("$(TOOL_FAMILY)","gnu") # Test for template instantiation, add to SOFLAGS if SONAME set, # add -E to LDFLAGS if using GNU ld include $(ACE_ROOT)/include/makeinclude/platform_g++_common.GNU ifeq ("$(templates)","automatic") ifeq ($(repo),1) ifeq ($(VXWORKSLINK), 1) ifeq ($(VX_APP_BUILD),1) ifneq ($(SHARED_LIBS),1) LD_PARTIAL += -frepo endif endif else ifeq ($(rtp),0) ace_lib_prelink := 1 LINK.cc = override LINK.cc.override = $(LD_PARTIAL) -frepo -L$(ACE_ROOT)/ace -L$(INSLIB) -L./ $(LDLIBPATH) $(LD_LINK_PATH) ifneq ($(SHARED_LIBS),1) LDFLAGS = $(ACE_SHLIBS) endif endif endif endif endif endif # TOOL_FAMILY == gnu ifeq ("$(TOOL_FAMILY)","diab") C++FLAGS += -Xexceptions else ifeq ("$(TOOL_FAMILY)","gnu") C++FLAGS += -fexceptions endif endif ifeq ("$(TOOL_FAMILY)","diab") LIBS += -lstlstd endif ifneq ($(findstring $(VX_CPU_FAMILY),ppc arm),) ifeq ("$(TOOL_FAMILY)","diab") C++FLAGS += -Xchar-signed else ifeq ("$(TOOL_FAMILY)","gnu") C++FLAGS += -fsigned-char endif endif endif ifeq ($(CPU),SIMNT) override MUNCH_FLAGS := -asm $(TOOLENV) endif ifneq ($(optimize),1) CC_OPTIM_NORMAL = endif CCFLAGS += $(C++FLAGS) $(FLAGS_C_CC) ifeq ($(VXWORKSLINK), 1) ifeq ($(repo),1) ifeq ($(SHARED_LIBS),1) BACKUP_RPO_RULE = for f in $(basename $(addprefix $(VDIR), $(OBJS)) $(VSHOBJS)) ; do if [ -a $$f.rpo ] ; then mv $$f.rpo $$f.rpobak $(ACE_NUL_STDERR) ; fi ; done ; POST_BUILD_RULE = for f in $(basename $(addprefix $(VDIR), $(OBJS)) $(VSHOBJS)) ; do if [ -a $$f.rpobak ] ; then mv $$f.rpobak $$f.rpo $(ACE_NUL_STDERR) ; fi ; done ; endif endif ## special target to satisfy VxWorks dependencies for images $(PRJ_DIR)/$(PRJ_FILE): ifeq ($(repo),1) ifeq ($(SHARED_LIBS),1) #### execute prelink step to make compiler instantiate all needed #### templates; discard image and repo files (*.rpo) after linkstep #### this step holds for both .SO as well as 'app' images so use both VSHOBJS and OBJS -$(LD_PARTIAL) -frepo -L$(ACE_ROOT)/ace -L./ $(LDLIBPATH) $(LD_LINK_PATH)$(LINK_OUTPUT_FLAG) ace-templ_inst $? $(ACE_SHLIBS) $(addprefix $(VDIR), $(OBJS)) $(VSHOBJS) -$(RM) ace-templ_inst #### We need to backup the .RPO files or otherwise the link step of the final image will #### start instantiating templates again even if we do not specify '-frepo'! -$(BACKUP_RPO_RULE) ifeq ($(VX_SO_BUILD),1) #### build library of objects in .SO to use as a sort of import library for VxWorks echo $(filter %.o, $(VSHOBJS)) | xargs $(AR) $(ARFLAGS) $(VLIB) $(AREXTRA) -chmod a+r $(VLIB) ifneq (,$(RANLIB)) -$(RANLIB) $(VLIB) endif # RANLIB endif # VX_SO_BUILD endif endif @echo 1>$@ endif ace-8.0.4+dfsg.orig/include/makeinclude/platform_macosx_jaguar.GNU0000644000175000017500000000243515027201773024201 0ustar sudipsudip# -*- Makefile -*- # support for Mac OS X 10.2 (jaguar), 10.3 (panther) # Note: /sw/lib & /sw/include are inserted for the convience of Fink # users. Non-Fink users should simply create these directories to # eliminate the warnings. threads ?= 1 debug ?= 1 optimize ?= 0 versioned_so ?= 0 with_ld = macosx CC = gcc CXX = g++ CFLAGS += -Wno-long-double -I/sw/include DCFLAGS += -g DLD = libtool LD = $(CXX) LDFLAGS += -L/sw/lib -flat_namespace -undefined warning LIBS += -lcc_dynamic -lstdc++ -lSystem ## dlcompat package (not part of base Darwin) is needed for dlopen() on 10.2. ## Fink installer puts libraries in /sw/lib and headers in /sw/include ## In order to install dlcompat do the following: ## - download fink from http://fink.sf.net ## - type: ## fink install dlcompat ## 10.3 does not need this package. LIBS += -ldl # 10.3 cannot do -03, this could be version dependent (probably on gcc) OCFLAGS += -O2 RANLIB = ranlib SOEXT = dylib SOFLAGS += -dynamic SOBUILD = -o $(VSHDIR)$*.dylib $< # Test for template instantiation, add to SOFLAGS if versioned_so set, # add -E to LDFLAGS if using GNU ld # include $(ACE_ROOT)/include/makeinclude/platform_g++_common.GNU ace-8.0.4+dfsg.orig/include/makeinclude/platform_macosx_sierra.GNU0000644000175000017500000000010715027201773024207 0ustar sudipsudipinclude $(ACE_ROOT)/include/makeinclude/platform_macosx_elcapitan.GNU ace-8.0.4+dfsg.orig/include/makeinclude/platform_vxworks6.6.GNU0000644000175000017500000000111115027201773023321 0ustar sudipsudip# VxWorks 6.6 ifeq ($(VXWORKS_VERSION_FLAG),) VXWORKS_VERSION_FLAG = -DACE_VXWORKS=0x660 endif # VXWORKS_VERSION_FLAG include $(ACE_ROOT)/include/makeinclude/platform_vxworks6.5.GNU # Disable strict aliasing warnings, these are given on some VxWorks system # header files and has been reported to WindRiver ifeq ("$(TOOL_FAMILY)","gnu") CPPFLAGS += -fno-strict-aliasing endif # Workaround for bug in diab compiler with just 6.6 ifeq (vxworks-6.6, $(findstring vxworks-6.6,$(WIND_PLATFORM))) ifeq ("$(TOOL_FAMILY)","diab") C++FLAGS += -W:c++:,-Xusing-std-on endif endif ace-8.0.4+dfsg.orig/include/makeinclude/platform_vxworks6.8.GNU0000644000175000017500000000033315027201773023330 0ustar sudipsudip# VxWorks 6.8 ifeq ($(VXWORKS_VERSION_FLAG),) VXWORKS_VERSION_FLAG = -DACE_VXWORKS=0x680 endif # VXWORKS_VERSION_FLAG WIND_USR_LIB ?= ../lib/usr/lib include $(ACE_ROOT)/include/makeinclude/platform_vxworks6.7.GNU ace-8.0.4+dfsg.orig/include/makeinclude/platform_gnuwin32_common.GNU0000644000175000017500000000437515027201773024407 0ustar sudipsudip# -*- Makefile -*- ifneq ($(mingw32),1) ifneq ($(cygwin32),1) fail := \ $(shell \ echo "You should not use this file but one of"; \ echo "platform_mingw32.GNU or platform_cygwin32.GNU"; \ exit 1) endif endif # Cygwin/MinGW doesn't allow to add the version number of ACE to the dll name # because ace.dll.6.0.1 isn't a valid dll name versioned_so = 0 # Cygwin/MinGW doesn't have rwho rwho = 0 # Disable auto-import warnings. The Cygwin/MinGW linker has a problem # with imports # See https://sourceforge.net/tracker/?func=detail&atid=102435&aid=683455&group_id=2435 # for the details why to do this. LDFLAGS += -Wl,--enable-auto-import no_hidden_visibility ?= 1 winsock2 ?= 1 debug ?= 1 optimize ?= 1 threads ?= 1 cpumodelflag ?= 0 tunemodelflag ?= 1 # When building shared libraries ifeq ($(shared_libs), 1) ifneq ($(static_libs_only), 1) inline ?= 0 endif endif ifeq ($(debug),0) CPPFLAGS += -DNDEBUG endif ifeq ($(threads),1) FLAGS_C_CC += -mthreads endif # threads ifneq ($(CROSS_COMPILE),) COMPARCH ?= $(CROSS_COMPILE) endif CC = ${COMPARCH}gcc CXX = ${COMPARCH}g++ RC = ${COMPARCH}windres DLLTOOL = ${COMPARCH}dlltool AR = ${COMPARCH}ar RANLIB = ${COMPARCH}ranlib DCFLAGS += -g DCCFLAGS += -g DLD = $(CXX) LD = $(CXX) OCFLAGS += -O3 OCCFLAGS += -O3 ARFLAGS = rsuv SOEXT = dll EXEEXT = .exe RC_OUTPUT_FLAG = -o SOBUILD = $(COMPILE.cc) $(PIC) -o $(VSHDIR)$*.so $< SHLIBBUILD = $(DLLTOOL) --dllname $@ --output-lib $@.a $(VSHOBJS) && \ $(SOLINK.cc) -Wl,--enable-auto-image-base -Wl,--out-implib,$@.a \ -shared -o $@ $(LDFLAGS) $(VSHOBJS) $(ACE_SHLIBS) $(LIBS) PLATFORM_FL_CPPFLAGS ?= PLATFORM_FL_LIBS ?= -lfltk -lfltk_forms -lfltk_gl -lfltk_images PLATFORM_FL_LDFLAGS ?= PLATFORM_GL_CPPFLAGS ?= -I/usr/X11R6/include PLATFORM_GL_LIBS ?= -lGL PLATFORM_GL_LDFLAGS ?= -L/usr/X11R6/lib PLATFORM_WX_CPPFLAGS ?= $(shell wx-config --cxxflags) -I/usr/local/include PLATFORM_WX_LIBS ?= $(shell wx-config --libs) PLATFORM_WX_LDFLAGS ?= $(shell wx-config --ldflags) # Test for template instantiation, add to SOFLAGS if SONAME set, # add -E to LDFLAGS if using GNU ld # include $(ACE_ROOT)/include/makeinclude/platform_g++_common.GNU PRELIB = @true ace-8.0.4+dfsg.orig/include/makeinclude/platform_integrity_ghs.GNU0000644000175000017500000000277115027201773024240 0ustar sudipsudipCROSS-COMPILE = 1 debug ?= 1 optimize ?= 1 shared_libs = static_libs = 1 #### CPU type ifndef CPU CPU = ppc endif # CPU INTEGRITYTARGET = 1 #### Green Hills location, and target-specific definitions. ifndef GHSROOT GHSROOT = /home/scooter2/i40_solaris2 endif ifndef RTOSROOT RTOSROOT = /export/integrity/rtos endif ifndef BSP BSP = mcp750 endif ifndef TARGET_BSP TARGET_BSP = $(ACE_ROOT)/tests/ACE.bsp endif ifndef TARGET_LD TARGET_LD = $(ACE_ROOT)/tests/INTEGRITY.ld endif #### Set Integrity version verline := $(shell ($(GHSROOT)/gversion 2>&1|grep "Green Hills Software")) ifeq "$(verline)" "" $(error Not Green Hills or the environment is not set-up) endif INTEGRITY_VERSION_STR := $(strip $(if ifeq $(word 4, $(verline)) "INTEGRITY", $(word 5, $(verline)))) ifeq "$(INTEGRITY_VERSION_STR)" "" $(error This Green Hills setup is not for Integrity) endif ifeq "$(INTEGRITY_VERSION_STR)" "4.1.8" CCFLAGS += -DINTEGRITY_VERSION=40108 endif CC = $(GHSROOT)/cc$(CPU) CXX = $(GHSROOT)/cx$(CPU) # undefine "vector" because it's predefined for 7400 boards IOPS = -bspname=$(RTOSROOT)/target/$(BSP).bld -os_dir $(RTOSROOT) --one_instantiation_per_object -non_shared -Uvector IOPS += --exceptions CCFLAGS += $(CFLAGS) -integrate -dynamic -I$(RTOSROOT)/INTEGRITY-include-SCA $(IOPS) -bspfile=$(TARGET_BSP) $(TARGET_LD) DCFLAGS += -G SOFLAGS += -shared DLD = $(CXX) LD = $(CXX) LIBS += -lshm_client -lnet -livfssca -lposixsca -lsocket PIC = AR := $(CXX) -archive $(IOPS) ARFLAGS = -o ace-8.0.4+dfsg.orig/include/makeinclude/platform_android.GNU0000644000175000017500000001145015027201773022773 0ustar sudipsudip# -*- Makefile -*- # This file allows ACE and applications using ACE GNU Makefiles to be built for # Android by cross compiling on Linux. # # See here for latest documentation on how to invoke the NDK: # https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md # We always include config-android.h on Android platforms. ACE_PLATFORM_CONFIG ?= config-android.h # Common Linux Functionality include $(ACE_ROOT)/include/makeinclude/platform_linux_common.GNU # as of NDK r6 inlining is required inline ?= 1 #No rwho on Android rwho = 0 # Android Studio does not seem to recognize so files with versions, but if # trying to add gnuace-built libraries as imported libraries in CMake in a # Android Studio project, at runtime apparently the Android loader needs the # SONAME be set to the filename or else it was fail trying to load the so file # path from the host computer. versioned_so = 3 # This section deals with selecting the architecture/compiler # As of writing information on ABIs can be found at https://developer.android.com/ndk/guides/abis # Make sure android_abi or ANDROID_ABI are defined and they are the same. ifndef android_abi ifdef ANDROID_ABI android_abi := $(ANDROID_ABI) else $(error android_abi or ANDROID_ABI must be defined) endif else ANDROID_ABI := $(android_abi) endif # Alias neon ifeq ($(android_abi), neon) android_abi := armeabi-v7a-with-neon endif android_neon ?= 1 ifeq ($(android_abi),armeabi-v7a-with-neon) android_abi := armeabi-v7a android_neon := 1 endif ifeq ($(android_abi),armeabi-v7a) CROSS_COMPILE := armv7a-linux-androideabi ifeq ($(android_neon),1) FLAGS_C_CC += -mfpu=neon else FLAGS_C_CC += -mfpu=vfpv3-d16 endif else ifeq ($(android_abi),arm64-v8a) CROSS_COMPILE := aarch64-linux-android else ifeq ($(android_abi),x86) CROSS_COMPILE := i686-linux-android else ifeq ($(android_abi),x86_64) CROSS_COMPILE := x86_64-linux-android endif ifndef CROSS_COMPILE $(error android_abi $(android_abi) is not valid) endif ifdef android_ndk ifndef android_api $(error android_ndk also requires defining android_api) endif android_ndk_tools ?= $(wildcard $(android_ndk)/toolchains/llvm/prebuilt/*/bin) ifndef android_ndk_tool_prefix android_ndk_tool_prefix := $(CROSS_COMPILE)$(android_api)- endif # We don't want this being used again except to signal that this is a # cross-compile build. If it is then the resulting command probably won't # exist and cause an error. CROSS_COMPILE := THIS_VALUE_SHOULD_NOT_BE_USED # Ignore value of CROSS_COMPILE because ar doesn't match clang like in # platform_clang_common.GNU. override_cross_compile = 1 CC = $(android_ndk_tools)/$(android_ndk_tool_prefix)clang CXX = $(android_ndk_tools)/$(android_ndk_tool_prefix)clang++ AR = $(android_ndk_tools)/llvm-ar else # Standalone Toolchain CROSS_COMPILE := $(CROSS_COMPILE)- ifeq ($(android_abi),armeabi-v7a) # According to Google the armv7a-linux-androideabi- prefix should be # preferred because it produces more efficient code. However if it doesn't # exist since we're using an older NDK we have to fallback to # arm-linux-androideabi-. This isn't a problem when directly using the NDK # because the NDKs we support for that have armv7a-* clangs. ifeq (,$(shell command -v $(CROSS_COMPILE)clang $(ACE_NUL_STDERR))) CROSS_COMPILE := arm-linux-androideabi- endif endif # Export so child processes can use tools from the same toolchain. export CROSS_COMPILE endif ifeq ($(threads),1) CPPFLAGS += -D_REENTRANT ifdef PLATFORM_AIO_SUPPORT CPPFLAGS += $(PLATFORM_AIO_SUPPORT) endif endif # threads # Use -pipes by default pipes ?= 1 # Use LLD, the LLVM linker as recommended by Google android_set_lld ?= 1 ifeq ($(android_set_lld),1) # The other two arguments are explained by # https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#additional-required-arguments LDFLAGS += -fuse-ld=lld -Wl,--build-id=sha1 -Wl,--no-rosegment endif include $(ACE_ROOT)/include/makeinclude/platform_clang_common.GNU OCFLAGS ?= -O3 OCCFLAGS ?= -O3 # Android preloads the (almost certainly incompatible) system SSL library # (either OpenSSL or BoringSSL) for the Java Android API, so we must: # 1. Statically link OpenSSL to this library # 2. Keep our OpenSSL symbols internal # Number 1 is described in ACE-INSTALL.html. # We are doing number 2 here. ifeq ($(ssl),1) PLATFORM_SSL_LDFLAGS += --exclude-libs libcrypto.a,libssl.a endif # link step to avoid 'command line too long' error on Windows ifeq ($(OS), Windows_NT) SHOBJS_FILE = $(VSHDIR)$(MAKEFILE)_object_list.tmp CLEANUP_OBJS += $(SHOBJS_FILE) define SHLIBBUILD $(file >$(SHOBJS_FILE), $^) $(SHR_FILTER) $(SOLINK.cc) $(SO_OUTPUT_FLAG) $@ @$(SHOBJS_FILE) $(LDFLAGS) $(ACE_SHLIBS) $(LIBS) endef endif ace-8.0.4+dfsg.orig/include/makeinclude/platform_macosx_mavericks.GNU0000644000175000017500000000011315027201773024703 0ustar sudipsudip include $(ACE_ROOT)/include/makeinclude/platform_macosx_mountainlion.GNU ace-8.0.4+dfsg.orig/include/makeinclude/platform_gcc_clang_common.GNU0000644000175000017500000000466415027201773024634 0ustar sudipsudip# Shared Logic for GCC and Clang FLAGS_C_CC += -Wall -Wextra -Wpointer-arith CCFLAGS += -Wnon-virtual-dtor # Suppress "Creating *.a" Message ARFLAGS += -c ifeq ($(shared_libs), 1) ifneq ($(static_libs_only), 1) # Add all symbols to the dynamic symbol table. Needed to enable # dynamic_cast<> for shared libraries. (see # http://gcc.gnu.org/faq.html#dso) ifeq ($(GNU_LD),1) # Make sure this version of ld supports the -E option. ifneq ($(mingw32),1) LD_EXPORT_DEFINED := $(shell sh -c '$(LD_FOR_VERSION_TEST) -E 2>&1 | grep -E -i "(option|flag)" /dev/null; echo $$?') else LD_EXPORT_DEFINED := $(shell $(LD_FOR_VERSION_TEST) -E 2>&1 | grep -c -i -e '(option|flag)') ifeq ($(LD_EXPORT_DEFINED),0) LD_EXPORT_DEFINED:=1 else LD_EXPORT_DEFINED:=0 endif endif # mingw32 ifeq ($(LD_EXPORT_DEFINED),1) LDFLAGS += -Wl,-E endif # LD_EXPORT_DEFINED = 1 endif # GNU ld # Take advantage of g++ visibility attributes to generate # improved shared library binaries. ifneq ($(no_hidden_visibility),1) CCFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden else CPPFLAGS += -DACE_HAS_CUSTOM_EXPORT_MACROS=0 endif # no_hidden_visibility else # Explicitly disable g++ visibility attributes since # they are only meant for use when building shared libraries. no_hidden_visibility = 1 CPPFLAGS += -DACE_HAS_CUSTOM_EXPORT_MACROS=0 endif # static_libs_only else # Explicitly disable g++ visibility attributes since # they are only meant for use when building shared libraries. no_hidden_visibility = 1 CPPFLAGS += -DACE_HAS_CUSTOM_EXPORT_MACROS=0 endif # shared_libs ifneq ($(c++std),) CCFLAGS += -std=$(c++std) else ifeq ($(c++20),1) CCFLAGS += -std=c++20 else ifeq ($(c++17),1) CCFLAGS += -std=c++17 endif # If no option has been specified, set templates to automatic # version of the compiler. # templates ?= automatic # The correct flags to pass to the linker for ELF dynamic shared library # versioning. # If the platform file didn't already set versioned_so, default to 1. versioned_so ?= 1 with_ld ?= ifneq ($(versioned_so),0) SOFLAGS += -Wl,-h -Wl,$(SONAME) endif ifeq ($(versioned_so),2) FLAGS_C_CC += -DACE_VERSIONED_SO=2 endif static_libs_only ?= ifeq ($(GNU_LD),1) STATIC_LINK_FLAG ?= -static endif # GNU_LD ifeq ($(openmp),1) FLAGS_C_CC += -fopenmp LDFLAGS += -fopenmp endif ace-8.0.4+dfsg.orig/include/makeinclude/rules.nested.GNU0000644000175000017500000000311215027201773022056 0ustar sudipsudip# -*- Makefile -*- #---------------------------------------------------------------------------- # # # Nested directory targets makefile definitions #---------------------------------------------------------------------------- # If the client makefile is not called "Makefile", the MAKEFILE # variable must be set to its actual name before including this # file to allow the recursive MAKE to work properly. TOP_MAKEFILE := $(word 1,$(MAKEFILE_LIST)) MAKEFILE ?= $(TOP_MAKEFILE) SUBDIR_MAKEFILE ?= $(MAKEFILE) # Make sure that we build directories with DIRS= in sequence instead of in # parallel, unless DIRS_PARALLEL is set, in which case they may be built # in parallel if enabled by the proper flags and not disabled elsewhere. DIRS_PARALLEL ?= ifeq ($(DIRS_PARALLEL),) .NOTPARALLEL: endif # A rule to build DIR.subdir from DIR by calling MAKE again, with # DIR as the new directory, SUBDIR_TARGET as the target to build, and # "GNUmakefile" as the makefile to use in the new directory. # Triggered by the $(TARGETS_NESTED) target, below. %.subdir: % ifneq ($(timed),) @date=`date`; echo "START: $< $$date" endif cd $< && $(MAKE) -f $(SUBDIR_MAKEFILE) $(SUBDIR_TARGET) ifneq ($(timed),) @date=`date`;echo "FINISH: $< $$date" endif # Build FOO.nested by calling MAKE again, this time with DIRS (with # ".subdir" appended to each) as the targets, and passing FOO as the # real target to build in the SUBDIR_TARGET variable. $(TARGETS_NESTED): ifdef DIRS ifneq ($(DIRS),) $(MAKE) -f $(MAKEFILE) SUBDIR_TARGET=$(@:.nested=) $(addsuffix .subdir, $(DIRS)) endif # DIRS endif # DIRS ace-8.0.4+dfsg.orig/include/makeinclude/platform_macosx_monterey.GNU0000644000175000017500000000010415027201773024561 0ustar sudipsudipinclude $(ACE_ROOT)/include/makeinclude/platform_macosx_bigsur.GNU ace-8.0.4+dfsg.orig/include/makeinclude/platform_macosx_tiger.GNU0000644000175000017500000000034115027201773024034 0ustar sudipsudip# platform_macosx.GNU # support for Mac OS X 10.4 (Tiger) # By default, this uses the default compiler selected using gcc_select. include $(ACE_ROOT)/include/makeinclude/platform_macosx_common.GNU CFLAGS += -Wno-long-doubleace-8.0.4+dfsg.orig/include/makeinclude/platform_linux_clang.GNU0000644000175000017500000000341515027201773023660 0ustar sudipsudip# This file should allow ACE to be built on Linux, using the clang compiler. include $(ACE_ROOT)/include/makeinclude/platform_linux_common.GNU ifeq ($(insure),0) ifeq ($(CXX),g++) CC = clang CXX = clang++ endif endif ifndef CXX_VERSION CXX_VERSION := $(shell $(CXX) -dumpversion) endif CXX_MAJOR_VERSION := $(firstword $(subst ., ,$(CXX_VERSION))) # clang 16 and newer default to C++17 ifeq ($(CXX_MAJOR_VERSION),$(filter $(CXX_MAJOR_VERSION),4 5 6 7 8 9 10 11 12 13 14 15)) c++std ?= c++17 endif CCFLAGS += $(CFLAGS) DCFLAGS += -g DLD = $(CXX) LD = $(CXX) LIBS += -ldl ifeq ($(threads),1) LIBS += -lpthread LIBS += -lrt endif OCFLAGS += -O3 ifeq ($(optimize),0) CPPFLAGS += -O0 endif ifneq ($(c++std),) CCFLAGS += -std=$(c++std) else ifeq ($(c++20),1) CCFLAGS += -std=c++20 else ifeq ($(c++17),1) CCFLAGS += -std=c++17 endif ifeq ($(no_deprecated),1) CCFLAGS += -Wno-deprecated-declarations endif SOFLAGS += $(CPPFLAGS) -shared SOBUILD = $(COMPILE.cc) $(PIC) -o $(VSHDIR)$*.so $<; \ $(SOLINK.cc) -o $@ $(LDFLAGS) $(VSHDIR)$*.o PRELIB = @true # Visibility doesn't seem to work with clang 2.8, default to off no_hidden_visibility ?= 1 ifeq ($(shared_libs), 1) ifneq ($static_libs_only), 1) LDFLAGS += -Wl,-E ifneq ($(no_hidden_visibility),1) CCFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden else CPPFLAGS += -DACE_HAS_CUSTOM_EXPORT_MACROS=0 endif # no_hidden_visibility endif endif # Added line below to support "Executable Shared Object" files (as # needed by the service configurator). # Marius Kjeldahl ifeq ($(threads),1) ESOBUILD = $(COMPILEESO.cc) $(PIC) -shared -o $(VSHDIR)$*.so $< ifndef PRELIB PRELIB = @true endif # ! PRELIB endif ace-8.0.4+dfsg.orig/include/makeinclude/platform_macosx_iOS.GNU0000644000175000017500000000417415027201773023424 0ustar sudipsudip static_libs_only=1 include $(ACE_ROOT)/include/makeinclude/platform_macosx_common.GNU ifneq (,$(XCODE_ROOT)) XCODE:=$(XCODE_ROOT) else XCODE:=/Applications/Xcode.app endif ifndef IPHONE_TARGET $(error Please set IPHONE_TARGET to SIMULATOR or HARDWARE) endif ifeq ($(IPHONE_TARGET), SIMULATOR) CROSS-COMPILE=1 IPHONE_PLATFORM:=$(XCODE)/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer IPHONE_SDK:=$(IPHONE_PLATFORM)/SDKs/iPhoneSimulator${IPHONE_VERSION}.sdk IPHONE_HARDWARE_ARCHITECTURE=x86_64 # June 2017 release, iPhone 6s and later CFLAGS += -miphoneos-version-min=12.0 CCFLAGS += -miphoneos-version-min=12.0 LDFLAGS += -miphoneos-version-min=12.0 endif ifeq ($(IPHONE_TARGET), HARDWARE) CROSS-COMPILE=1 IPHONE_PLATFORM:=$(XCODE)/Contents/Developer/Platforms/iPhoneOS.platform/Developer IPHONE_SDK:=$(IPHONE_PLATFORM)/SDKs/iPhoneOS${IPHONE_VERSION}.sdk # arm64 iPhone 6 and later IPHONE_HARDWARE_ARCHITECTURE=arm64 ifeq ($(iphone_bitcode),1) # enable bitcode CFLAGS += -fembed-bitcode CCFLAGS += -fembed-bitcode endif ifeq ($(iphone_codesign),1) CODESIGN_ALLOCATE:=$(IPHONE_PLATFORM)/usr/bin/codesign_allocate POSTLINK=; codesign -f -s "iPhone Developer" $(BIN) endif rwho = 0 endif # pass a flag to the preprocessor CFLAGS += -DACE_HAS_IOS CCFLAGS += -DACE_HAS_IOS CC:=$(XCODE)/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CXX:=$(XCODE)/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ AR:=$(XCODE)/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar ARFLAGS = rSv RANLIB:=$(XCODE)/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib -no_warning_for_no_symbols DLD = $(CXX) LD = $(CXX) CFLAGS += -arch $(IPHONE_HARDWARE_ARCHITECTURE) -isysroot $(IPHONE_SDK) CCFLAGS += -arch $(IPHONE_HARDWARE_ARCHITECTURE) -isysroot $(IPHONE_SDK) ifneq (,$(HOST_ROOT)) TAO_IDLFLAGS += -g $(HOST_ROOT)/bin/ace_gperf TAO_IDL = $(HOST_ROOT)/bin/tao_idl TAO_IDL_DEP = $(TAO_IDL) # make sure to use the target compiler, not the cross-compiler # as preprocessor for the cross-compiled idl tools TAO_IDL_PREPROCESSOR = clang endif ace-8.0.4+dfsg.orig/include/makeinclude/platform_macosx_bigsur.GNU0000644000175000017500000000010415027201773024212 0ustar sudipsudipinclude $(ACE_ROOT)/include/makeinclude/platform_macosx_mojave.GNU ace-8.0.4+dfsg.orig/include/makeinclude/rules.nolocal.GNU0000644000175000017500000000035415027201773022230 0ustar sudipsudip#---------------------------------------------------------------------------- # # # Makefile for directories with no local build targets #---------------------------------------------------------------------------- $(TARGETS_LOCAL): ace-8.0.4+dfsg.orig/include/makeinclude/rules.bin.GNU0000644000175000017500000000225715027201773021355 0ustar sudipsudip# -*- Makefile -*- #---------------------------------------------------------------------------- # # # Build binaries # GNU version # Requires GNU make #---------------------------------------------------------------------------- ifdef BIN VBIN = $(ARCH_BIN:%=%$(VAR)) # VBIN always depends on idl_stubs and libraries, if they exist. ifdef IDL_SRC $(VBIN): $(IDL_SRC) endif ifdef VLIBS $(VBIN): $(LIB_INSTALL) $(VLIBS) endif else # !BIN ifndef BIN_UNCHECKED @echo Warning: rules.bin.GNU included, but no BIN targets detected. endif # !BIN_UNCHECKED endif # BIN VOBJS = $(addsuffix .$(OBJEXT),$(addprefix $(VDIR),$(basename $(SRC)))) ifneq ($(IDL_SRC),) $(VBIN): $(IDL_SRC) endif # Needed for depend. PSRC += $(addsuffix .cpp, $(CLEANUP_BIN)) CLEANUP_INSTALL += $(CLEANUP_BIN:%=$(INSBIN)/%$(VAR)$(EXEEXT)) VXWORKSLINK ?= ifeq ($(VXWORKSLINK),1) $(ARCH_BIN): $(DEFAULTRULE) mv $(DEFAULTRULE) $@ else # !VXWORKSLINK # Since we add in the vdir, don't use arch_bin. use bin instead! $(ARCH_BIN): %: $(VDIR)$(BIN).$(OBJEXT) $(VOBJS) $(LINK.cc) $(LDFLAGS) $(CC_OUTPUT_FLAG) $@ $(sort $(VDIR)$(BIN).$(OBJEXT) $(VOBJS)) $(VLDLIBS) $(POSTLINK) endif ace-8.0.4+dfsg.orig/include/makeinclude/platform_vxworks6.7.GNU0000644000175000017500000000027215027201773023331 0ustar sudipsudip# VxWorks 6.7 ifeq ($(VXWORKS_VERSION_FLAG),) VXWORKS_VERSION_FLAG = -DACE_VXWORKS=0x670 endif # VXWORKS_VERSION_FLAG include $(ACE_ROOT)/include/makeinclude/platform_vxworks6.6.GNU ace-8.0.4+dfsg.orig/include/makeinclude/platform_netbsd.GNU0000644000175000017500000000154115027201773022632 0ustar sudipsudip# -*- Makefile -*- # platform_netbsd.GNU debug ?= 1 optimize ?= 1 threads ?= 1 versioned_so ?= 1 CC = gcc CXX = g++ AR = ar ARFLAGS = ruv CPPFLAGS += -I/usr/local/include DCFLAGS += -g DCCFLAGS += $(DCFLAGS) DLD = $(CXX) LD = $(CXX) LDFLAGS += -L/usr/local/lib OCFLAGS += -O2 OCCFLAGS = $(OCFLAGS) PIC = -fpic PRELIB = @true RANLIB = ranlib SOFLAGS += -shared SOBUILD = $(COMPILE.cc) $(PIC) -o $(VSHDIR)$*.so $< ifeq ($(threads),1) LDFLAGS += -pthread CPPFLAGS += -D_REENTRANT -DACE_HAS_THREADS endif # threads # Test for template instantiation, add to versioned_so if versioned_so set, # add -E to LDFLAGS if using GNU ld # include $(ACE_ROOT)/include/makeinclude/platform_g++_common.GNU ace-8.0.4+dfsg.orig/include/makeinclude/platform_macosx_panther.GNU0000644000175000017500000000140015027201773024360 0ustar sudipsudip# -*- Makefile -*- # platform_macosx.GNU # support for Mac OS X 10.3 (Panther) threads ?= 1 debug ?= 1 optimize ?= 0 versioned_so ?= 0 with_ld = macosx CC = gcc CXX = g++ CFLAGS += -Wno-long-double DCFLAGS += -g DLD = libtool LD = $(CXX) LIBS += -lcc_dynamic -lstdc++ -lSystem OCFLAGS += -O2 -mcpu=G3 -mtune=G4 RANLIB = ranlib SOEXT = dylib SOFLAGS += -dynamic SOBUILD = -o $(VSHDIR)$*.dylib $< # Test for template instantiation, add to SOFLAGS if versioned_so set, # add -E to LDFLAGS if using GNU ld # include $(ACE_ROOT)/include/makeinclude/platform_g++_common.GNU LDFLAGS += -flat_namespace -undefined warning CCFLAGS += $(CFLAGS) $(FLAGS_C_CC) ace-8.0.4+dfsg.orig/include/makeinclude/platform_linux_pgi.GNU0000644000175000017500000000210215027201773023343 0ustar sudipsudip # This file should allow ACE to be built on Linux, using the # Portland Group PGI compilers # # This is just a copy of platform_linux.GNU, with a few things changed. include $(ACE_ROOT)/include/makeinclude/platform_linux_common.GNU CC = pgcc CXX = pgCC ifeq ($(threads),1) CPPFLAGS += -D_REENTRANT $(PLATFORM_AIO_SUPPORT) endif # threads CCFLAGS += $(CFLAGS) DCFLAGS += -g DLD = $(CXX) LD = $(CXX) LIBS += -ldl ifeq ($(threads),1) LIBS += -lpthread ifeq (-DACE_HAS_AIO_CALLS,$(PLATFORM_AIO_SUPPORT)) LIBS += -lrt endif endif OCFLAGS += -O3 SOFLAGS += $(CPPFLAGS) -shared $(PIC) --prelink_objects SOBUILD = $(COMPILE.cc) $(PIC) --prelink_objects -o $(VSHDIR)$*.so $<; \ $(SOLINK.cc) -o $@ $(LDFLAGS) $(VSHDIR)$*.o PRELIB = @true # Added line below to support "Executable Shared Object" files (as # needed by the service configurator). # Marius Kjeldahl ifeq ($(threads),1) ESOBUILD = $(COMPILEESO.cc) $(PIC) -shared -o $(VSHDIR)$*.so $< ifndef PRELIB PRELIB = @true endif # ! PRELIB endif ace-8.0.4+dfsg.orig/include/makeinclude/platform_vxworks6.9.GNU0000644000175000017500000000067515027201773023342 0ustar sudipsudip# VxWorks 6.9 ifeq ($(VXWORKS_VERSION_FLAG),) VXWORKS_VERSION_FLAG = -DACE_VXWORKS=0x690 endif # VXWORKS_VERSION_FLAG WIND_USR_LIB = ../lib$(MAJOR_CLI_OPTION_SUFFIX)/usr/lib VXBUILD += $(if $(findstring 64,$(buildbits)), LP64) include $(ACE_ROOT)/include/makeinclude/platform_vxworks6.8.GNU # override. we do not want -Wsystem-header (new in vx6.9) CC_WARNINGS_ALL = -Wall ifeq ($(CPU),SIMNT) override MUNCH_FLAGS := -c $(TOOLENV) endif ace-8.0.4+dfsg.orig/include/makeinclude/rules.lib.GNU0000644000175000017500000001703115027201773021347 0ustar sudipsudip# -*- Makefile -*- #---------------------------------------------------------------------------- # # # Build libraries (i.e., contain no binary executables) # GNU version # Requires GNU make #---------------------------------------------------------------------------- #--------------------------------------------------------------------------- # Library versioning #--------------------------------------------------------------------------- ifneq ($(versioned_so),0) # Turn on symbol versioning. The scheme that we follow is to allow # applications dependent on libraries, with same version numbers (major, # minor and beta) to run, but applications with dependencies on libraries # with different minor or major or beta versions to fail. # # Version number of the libraries # ifeq ($(SOVERSION),) ifeq ($(versioned_so),1) SOVERSION = .$(GNUACE_PROJECT_VERSION) else ifeq ($(versioned_so),2) SOVERSION = -$(GNUACE_PROJECT_VERSION) else ifeq ($(versioned_so),3) # Nothing else $(error unknown value for versioned_so: $(versioned_so)) endif endif # SOVERSION # Name that will be written into the dynamic library # ifeq ($(SONAME),) ifeq ($(versioned_so),1) SONAME = $(SHLIB)$(SOVERSION) else ifeq ($(versioned_so),2) SONAME = $(patsubst %.$(SOEXT),%,$(SHLIB))$(SOVERSION).$(SOEXT) else ifeq ($(versioned_so),3) SONAME = $(SHLIB) endif endif # SONAME endif # versioned_so #---------------------------------------------------------------------------- # The following targets arrange to build both unshared and shared libraries #---------------------------------------------------------------------------- VLIB = $(ARCH_LIB:%.$(LIBEXT)=%$(VAR).$(LIBEXT)) CLEANUP_VLIB = $(CLEANUP_LIB:%.$(LIBEXT)=%$(VAR).$(LIBEXT)) # Add VLIB to VLIBS if building static_libs. ifdef static_libs VLIBS += $(VLIB) endif SHLIB ?= # Setup shared library variables, including versions. VSHLIB_NO_VER = $(ARCH_SHLIB:%.$(SOEXT)=%$(VAR).$(SOEXT)) CLEANUP_VSHLIB_NO_VER = $(CLEANUP_SHLIB:%.$(SOEXT)=%$(VAR).$(SOEXT)) ifneq ($(versioned_so),2) VSHLIB = $(VSHLIB_NO_VER:%=%$(SOVERSION)) CLEANUP_VSHLIB = $(CLEANUP_VSHLIB_NO_VER:%=%$(SOVERSION)) SHLIB_WITH_VER = $(SHLIB:%=%$(SOVERSION)) else VSHLIB = $(if $(VSHLIB_NO_VER), $(patsubst %.$(SOEXT),%,$(VSHLIB_NO_VER))$(SOVERSION).$(SOEXT)) CLEANUP_VSHLIB = $(if $(CLEANUP_VSHLIB_NO_VER), $(patsubst %.$(SOEXT),%,$(CLEANUP_VSHLIB_NO_VER))$(SOVERSION).$(SOEXT)) SHLIB_WITH_VER = $(if $(SHLIB), $(patsubst %.$(SOEXT),%,$(SHLIB))$(SOVERSION).$(SOEXT)) endif SHLIBA ?= VSHLIBA = $(ARCH_SHLIBA:%.$(LIBEXT)=%$(VAR).$(LIBEXT)) # Add VSHLIB if we're building shared_libs. ifdef shared_libs VLIBS += $(VSHLIB) $(VSHLIBA) endif # Warn if no libs found ifeq ($(VLIBS),) LIB_WARNING = 0 ifndef LIB_UNCHECKED LIB_WARNING = 1 endif # !LIB_CHECKED ifndef SHLIB_UNCHECKED LIB_WARNING = 1 endif # !SHLIB_UNCHECKED ifeq ($(LIB_WARNING),1) @echo Warning: rules.lib.GNU included, but no library targets detected. endif # LIB_WARNING else # VLIBS # Libraries always depend on idl_stubs, if they exist. IDL_SRC ?= ifeq ($(IDL_SRC),) $(VLIBS): $(IDL_SRC) endif # IDL_SRC endif # !VLIBS VLOBJS = $(addprefix $(VDIR),$(foreach var, $(addsuffix .$(OBJEXT), $(basename $(LSRC)) $(RESOURCES)), $(patsubst ../%,$(notdir $(var)),$(var)))) ifdef LSRC2 LSRC += $(LSRC2) endif VSHOBJS = $(addprefix $(VSHDIR),$(foreach var, $(addsuffix .$(OBJEXT), $(basename $(LSRC)) $(RESOURCES)), $(patsubst ../%,$(notdir $(var)),$(var)))) ifneq ($(IDL_SRC),) $(VLOBJS) $(VSHOBJS): $(IDL_SRC) endif # Since INSLIB already has the ARCH dir appended, if appropriate, ARCH # needs to be stripped from V[SH]LIB on the way over to INSLIB. To avoid # an extra '/' which confuses the relative link calculation, ensure the # '/' after ARCH is stripped if it's an ARCH build. ARCHDIR ?= ifdef ARCH ARCHDIR = $(ARCH)/ endif ifneq ($(INSLIB),) ifdef static_libs LIB_INSTALL += $(VLIB:$(ARCHDIR)%=$(INSLIB)/%) CLEANUP_INSTALL += $(CLEANUP_VLIB:$(ARCHDIR)%=$(INSLIB)/%) endif # static_libs ifdef shared_libs LIB_INSTALL += $(VSHLIB:$(ARCHDIR)%=$(INSLIB)/%) CLEANUP_INSTALL += $(CLEANUP_VSHLIB:$(ARCHDIR)%=$(INSLIB)/%) CLEANUP_INSTALL += $(CLEANUP_VSHLIB_NO_VER:$(ARCHDIR)%=$(INSLIB)/%*) ifdef SHLIBA LIB_INSTALL += $(VSHLIBA:$(ARCHDIR)%=$(INSLIB)/%) CLEANUP_INSTALL += $(CLEANUP_SHLIBA:$(ARCHDIR)%=$(INSLIB)/%) endif endif # shared_libs endif # INSLIB ace_lib_prelink ?= 0 ifeq (1,$(VXWORKS)) ifeq (1,$(ace_lib_prelink)) .PHONY: ace-templ_inst ace-templ_inst: -$(LINK.cc) $(LINK_OUTPUT_FLAG) ace-templ_inst $(VLOBJS) $(LDFLAGS) $(ACE_SHLIBS) -$(RM) ace-templ_inst $(VLIB): $(VLOBJS) ace-templ_inst else $(VLIB): $(VLOBJS) endif ifeq (1,$(repo)) @echo $(LINK.cc) $(LINK_OUTPUT_FLAG) > .prelink.spec @echo xargs $(AR) $(ARFLAGS) $(notdir $@) $(AREXTRA) >> .prelink.spec @if not [""]==["$(ACE_SHLIBS)"] @echo $(subst -l,,$(ACE_SHLIBS)) >> .prelink.spec @echo Add .rpo files echo .prelink.spec $(foreach rpo,$(patsubst %.$(OBJEXT),%.rpo,$(filter %.$(OBJEXT), $?)),$(shell if exist $(rpo) echo $(rpo))) | xargs $(AR) $(ARFLAGS) $@ $(AREXTRA) endif @echo Add .o files echo $(TMPINCDIR:%=%/*.$(OBJEXT)) $(filter %.$(OBJEXT), $?) | xargs $(AR) $(ARFLAGS) $@ $(AREXTRA) -chmod a+r $@ ifneq (,$(RANLIB)) -$(RANLIB) $@ endif # RANLIB else # !VXWORKS $(VLIB): $(VLOBJS) ifeq (1,$(repo)) ifneq (,$(ACELIB)) #### With repo, link in all of the ace object files to the lib. #### This avoids multiple instantiations. We haven't found it to #### be necessary with shared libs, so just do it for static libs. vpath %.$(OBJEXT) $(ACE_ROOT)/ace/$(VDIR) $(VLIB): $(ACE_ROOT)/ace/$(VDIR)*.$(OBJEXT) endif # ! ACELIB endif # repo ifdef PRELIB $(PRELIB) endif ifeq (1,$(ace_lib_prelink)) #### Attempt a link (which will fail), to add template instantiations #### to lib files, for example. -$(LINK.cc) $(LINK_OUTPUT_FLAG) ace-templ_inst $? $(LDFLAGS) $(ACE_NUL_STDERR) endif # ace_lib_prelink ifneq (,$(AR.cc.override)) $(AR.cc.override) else ([ "`echo $(TMPINCDIR:%=%/*.$(OBJEXT))`" != "$(TMPINCDIR:%=%/*.$(OBJEXT))" ] && echo $(TMPINCDIR:%=%/*.$(OBJEXT)); \ echo $(filter %.$(OBJEXT), $^)) | xargs $(AR) $(ARFLAGS) $@ $(AREXTRA) endif -chmod a+r $@ ifneq (,$(RANLIB)) -$(RANLIB) $@ endif # RANLIB endif # !VXWORKS ifeq ($(VXWORKSLINK),1) $(VSHLIB): $(basename $(notdir $(PRJ_FILE))).out -$(RM) $@ -$(LN_S) $(PROJECT_OUT) $@ -$(POST_BUILD_RULE) else # !VXWORKSLINK $(VSHLIB): $(VSHOBJS) ifdef PRELIB $(PRELIB) endif # PRELIB ifdef SHLIBBUILD $(SHLIBBUILD) else # ! SHLIBBUILD ifeq (1,$(ace_lib_prelink)) #### Attempt a link (which will fail), to add template instantiations #### to lib files, for example. -$(LINK.cc) $(LINK_OUTPUT_FLAG) ace-templ_inst $^ $(LDFLAGS) $(ACE_NUL_STDERR) endif # ace_lib_prelink ifneq ($(SOLINK.cc.override),) $(SOLINK.cc.override) else $(SHR_FILTER) $(SOLINK.cc) $(SO_OUTPUT_FLAG) $@ $^ $(LDFLAGS) $(ACE_SHLIBS) $(LIBS) endif #override endif # SHLIBBUILD endif # VXWORKSLINK ifneq ($(SOVERSION),) # This carefully works with both ARCH (where VSHLIB_* refer to the ARCH # subdir, but SHLIB does not) and non-ARCH builds (where VSHLIB_* and SHLIB # refer to the same place). SHLIB_WITH_VER should be the same as $@ but # without the ARCH subdir. -$(RM) $(VSHLIB_NO_VER) -$(LN_S) $(if $(findstring cp,$(firstword $(LN_S))),$(@),$(SHLIB_WITH_VER)) $(VSHLIB_NO_VER) endif -chmod a+rx $@ ace-8.0.4+dfsg.orig/include/makeinclude/platform_macosx_leopard.GNU0000644000175000017500000000010315027201773024344 0ustar sudipsudip include $(ACE_ROOT)/include/makeinclude/platform_macosx_tiger.GNU ace-8.0.4+dfsg.orig/include/makeinclude/platform_tandem.GNU0000644000175000017500000000546015027201773022627 0ustar sudipsudip # NonStop-UX NCC 3.20 debug = 1 # Please see the config-NonS... file for more information about status # This file is built from Sunos5(os) and sgic++(compiler) CC = cc CXX = NCC DLD = $(CXX) LD = $(CXX) CPPFLAGS += -I/usr/include3.18 CPPFLAGS += -D_REENTRANT #CPPFLAGS += -ptused -prelink CPPFLAGS += -pta #CPPFLAGS += +pp #CPPFLAGS += -show #-D_SGI_MP_SOURCE #3106 nested comment is not allowed #3203 statement is unreachable #3252 argument of type "X" is incompatible with parameter of type "Y" #3262 Parameter "X" declared and never referenced #3611 a value of "X" cannot be assigned to an entity of type "Y" #3140 macro redefined differently (param redefines NULL) CPPFLAGS += -woff 3106,3203,3262 #CPPFLAGS += -woff 3106,3203,3262,3611,3252 #CPPFLAGS += -woff 3106,3203,3212,3252,3262,3611 # For the new 32 bit C++ compiler (-n32) #CPPFLAGS += -n32 -woff 1174,1209,1375,1506,1110,1552,1021,1171 # For the old C++ compiler (-32) #CPPFLAGS += +pp LDFLAGS += -rpath "$(ACE_ROOT)/lib" #LDFLAGS += -Wl,-woff,85 LIBS += -lsocket LIBS += -ldl LIBS += -lnsl LIBS += -lgen LIBS += -lthread PIC = -KPIC AR = ar ARFLAGS = r RANLIB = echo SOFLAGS += -shared $(CPPFLAGS) -all SOBUILD = $(COMPILE.cc) $(PIC) -o $(VSHDIR)$*.o $<; \ $(SOLINK.cc) -o $@ $(LDFLAGS) $(VSHDIR)$*.o #3106 nested comment is not allowed #3203 statement is unreachable #3252 argument of type "X" is incompatible with parameter of type "Y" #3262 Parameter declared and never referenced #3611 a value of "X" cannot be assigned to an entity of type "Y" #WARNOFF += -woff 3106,3203,3262,3611 #INCDIR += -I/usr/include -I/usr/include3.18 # -I /usr/ucbinclude #### No threads #CCFLAGS += -pta $(WARNOFF) $(INCDIR) #### Threads #CCFLAGS += -D_REENTRANT -pta $(WARNOFF) #DLD = $(CXX) #LD = $(CXX) #LDFLAGS += -R $(ACE_ROOT)/lib #LIBS += -lsocket -ldl -lnsl -lgen -lthread # Threads #LIBS += -lsocket -ldl -lnsl -lgen # No threads #PIC = -PIC # SUNC++ 4.1 has a bug with the -xar command: # # from 'CC -readme' the following bug is reported: # # 4. Using -xar to add generated templates # ---------------------------------------- # # When using -xar to add generated templates to an archive, # please be aware that this command will both update # existing object files in the archive, and add new ones. # Existing object files that may be obsolete will still # be present. In these cases, the safest course of action # would be to delete the .a file prior to the invocation of -xar. # # so here we remove the archive prior to making the new one # #AR = CC #ARFLAGS = -xar -o #RANLIB = echo #SOFLAGS = -G $(CPPFLAGS) #SOBUILD = $(COMPILE.cc) $(PIC) -o $(VSHDIR)$*.o $<; \ $(SOLINK.cc) -o $@ -h $@ $(LDFLAGS) $(VSHDIR)$*.o ace-8.0.4+dfsg.orig/include/makeinclude/platform_macosx_common.GNU0000644000175000017500000000231715027201773024217 0ustar sudipsudip# -*- Makefile -*- # support for Mac OS X 10.4 (Tiger) # By default, this uses the default compiler selected using gcc_select. boost = 1 zzip = 1 zlib = 1 threads ?= 1 debug ?= 1 optimize ?= 0 ssl ?= 1 versioned_so ?= 0 universal ?= 0 ifeq (,$(no_hidden_visibility)) # Disable symbol visibility support by default. # # Apple's g++ 4 compiler doesn't appear to correctly support # visibility attributes, at least as well as the vanilla g++. no_hidden_visibility = 1 endif with_ld = macosx CC ?= gcc CXX ?= g++ DCCFLAGS += -g DCFLAGS += -g DLD = $(CXX) LD = $(CXX) #LIBS += -lstdc++.6 -lSystem -lSystemStubs OCFLAGS += -O2 RANLIB = ranlib SOEXT = dylib SOFLAGS += -dynamiclib SOBUILD = -o $(VSHDIR)$*.dylib $< # Test for template instantiation, add to SOFLAGS if versioned_so set, # add -E to LDFLAGS if using GNU ld ifeq ($(findstring g++,$(CXX)),)# include $(ACE_ROOT)/include/makeinclude/platform_g++_common.GNU else c++std ?= c++17 include $(ACE_ROOT)/include/makeinclude/platform_clang_common.GNU endif LDFLAGS += -flat_namespace ifeq ($(universal),1) CFLAGS += -arch i386 -arch ppc LDFLAGS += -arch i386 -arch ppc endif ace-8.0.4+dfsg.orig/include/makeinclude/wrapper_macros.GNU0000644000175000017500000007245115027201773022503 0ustar sudipsudip# -*- Makefile -*- #---------------------------------------------------------------------------- # #---------------------------------------------------------------------------- # # ACE supports the following flags. They can be enabled either on # the command line, e.g., "make purify=1", or added to your # platform_macros.GNU. To disable the option, set the flag to null, # e.g., "make debug=". Some flags support setting to 0 disable, # e.g., "make debug=0". debug=1 is enabled in the platform files # that are released with ACE. # # Please note that the effects of a flag may be platform specific. # Also, combinations of certain flags may or may not be allowed on # specific platforms, e.g., debug=1 opt=1 is supported by g++ but # not all other C++ compilers. # # Flag Description # ---- ----------- # ace_for_tao Build "ace_for_tao" subset. Primarily useful for # reducing the size of the ACE shared library when # using TAO. # debug Enable debugging; see DCFLAGS and DCCFLAGS. # dmalloc Indicate build with dmalloc; adds PLATFORM_DMALLOC_CPPFLAGS # to CPPFLAGS, PLATFORM_DMALLOC_LDFLAGS to LDFLAGS, and # PLATFORM_DMALLOC_LIBS to LIBS. For more information on # dmalloc, see http://dmalloc.com. # inline Enable ACE inlining. Some platforms enable inlining by # default, others do not. If platform_macros.GNU does not # set this, inline is enabled. # minimum_corba Enable minimumCORBA support. (Documented here, but # implemented in TAO/rules.TAO.GNU.) # mtrace Indicate build with mtrace; adds PLATFORM_MTRACE_CPPFLAGS # to CPPFLAGS. Mtrace is an extension in GNU libc. # optimize Enable optimization; see OCFLAGS and OCCFLAGS. # probe Enable ACE_Timeprobes. # profile Enable profiling; see PCFLAGS and PCCFLAGS. # purify Purify all executables. purify must be in user's PATH! # quantify Quantify all executables. quantify must be in user's PATH! # repo Use GNU template repository (g++ with repo patches and # egcs only). # shared_libs Build shared libraries. Ignored if static_libs_only is set. # static_libs Build static libraries. Ignored if shared_libs_only is set. # shared_libs_only Only build shared libraries. Ignored if no SHLIBs are # specified by the Makefile, as in performance-tests/Misc. # static_libs_only Only build static libraries. # static_link Link only static libs to executables, e.g., uses "-static" # flag with the GNU ld linker. # symlinks Make symbolic links (on appropriate platforms) in the lib # directory be either "absolute" or "relative". # templates Type of template instantiation to perform. Can be one of # automatic, used. Defaults to automatic. # threads Build with thread support. # trio Indicate build with trio; adds PLATFORM_TRIO_CPPFLAGS # to CPPFLAGS, PLATFORM_TRIO_LDFLAGS to LDFLAGS, and # PLATFORM_TRIO_LIBS to LIBS. For more information on # trio, see http://sourceforge.net/projects/ctrio/ # xt Build with Xt (X11 Toolkit) support. # fl Build with FlTk (Fast Light Toolkit) support. # fox Build with Fox Toolkit support. # tk Build with Tk (Tcl/Tk) support. # qt Build with Qt (Trolltech Qt) support. # ssl Build with OpenSSL support. # rapi Build with RAPI # stlport Build with STLPort support # rwho Build with rwho, this results in building apps/drwho # pipes Build with pipe support, resulting in adding -pipe to the # compiler options. # sctp Build support for TAO SCIOP and for ACE SCTP # wrapper-facades. The sctp macro should be set to a string # value representing a particular SCTP implementation. # Recognized values include: openss7 lksctp # # versioned_so Add versioning to libraries. Defaults to 1 (true). If 0, # no version number is appended to shared library names. # If versioned_so is 1 (enabled), the SOVERSION make # variable can also be set to specify the version info # to append to the name - it should have a leading '.' - # else it defaults to .ACE_MAJOR.ACE_MINOR.ACE_MICRO. If 2, # the version will be appended to the name but *before* the # $(SOEXT) - it should have a lead '-' - else it defaults to # -ACE_MAJOR.ACE_MINOR.ACE_MICRO. # If versioned_so is 3, then set the SONAME, but without a # version. # wfmo Build with wfmo support (Win32 only) # winregistry Build with windows registry support (Win32 only) # winnt Build WinNT-specific projects (Win32 only) # link_groups This indicates that statically linked executable library # names will be surrounded by -Wl,--start-group and # -Wl,--end-group for the GNU compiler only. # # Usually, users do not need to be concerned with make targets. # Just enter "make" on the command line to build. A few notable # targets are listed below. # # Target Description # ------ ----------- # show_statics Lists all static objects in object files built for # current directory. Only supported for g++. # show_uninit Lists all uninitialized in object files built for # current directory. Only supported for g++. # # The following describes the ACE wrapper macros: # # Variable Description # -------- ----------- # ARFLAGS Flags for the archive utility (ar) # CC C compiler command # CXX C++ compiler command # RC Resource compiler command # COMPILE.c Flags for compiling with C # COMPILE.cc Flags for compiling with C++ # COMPILE.rc Flags for compiling with the resource compiler # CPPFLAGS C pre-processor flags # CFLAGS C compilation flags # CCFLAGS C++ compilation flags # DCFLAGS C compilation flags for debugging # DCCFLAGS C++ compilation flags for debugging # DEFFLAGS C++ preprocessor flag for defining symbols # DLD Name of dynamic linker # LD Name of linker # IDL Name of the CORBA IDL compiler # INSBIN Binary (executable) installation directory # INSINC Include file installation directory # INSMAN Manpage installation directory # INSLIB Library installation directory # LDFLAGS ld linker flags # LINK.c Flags for linking with C # LINK.cc Flags for linking with C++ # MAKEFLAGS Flags that are passed into the compilation from the commandline # OCFLAGS Optimizing C compilation flags # OCCFLAGS Optimizing C++ compilation flags # PCFLAGS C compilation flags for profiling # PCCFLAGS C++ compilation flags for profiling # PLATFORM_XT_CPPFLAGS # Platform CPP options for X11 (some require -I...) # PLATFORM_XT_LDFLAGS # Platform LD options for X11 (some require -L...) # PLATFORM_XT_LIBS # Platform libraries require with X11 # PLATFORM_SSL_CPPFLAGS # Platform CPP options for OpenSSL (may need -I...) # PLATFORM_SSL_LDFLAGS # Platform LD options for OpenSSL (may need -L...) # PLATFORM_SSL_LIBS # Platform libraries required with OpenSSL # PLATFORM_RAPI_CPPFLAGS # Platform CPP options for RAPI # PLATFORM_RAPI_LDFLAGS # Platform LD options for RAPI # PLATFORM_RAPI_LIBS # Platform libraries required with RAPI # PLATFORM_SCTP_CPPFLAGS # Platform CPP options required for SCTP # PLATFORM_SCTP_LDFLAGS # Platform LD options required for SCTP # PLATFORM_SCTP_LIBS # Platform libraries required for SCTP # PRELINK Executable to precede linking, such as quantify # PREPROCESS.c Command to preprocess C # PREPROCESS.cc # Command to preprocess C++ # PURELINK If set, contains purify executable as well as all options # PURE_CACHE_BASE_DIR # The base directory in which Pure products will produce # instrumented libraries. If you don't want that to be below # /tmp, set this variable in your environment or on the make # command line. # PURE_CACHE_DIR # The full name of the directory in which Pure produces will # produce instrumented libraries. # PWD Command to get the current working directory # PTDIRS Pathnames of directories containing template code # RM Name of program to use to remove files # ACE_MKDIR Name of program to (recursively) create directories # SOFLAGS Flags used to build a shared library # SOLINK.cc Link line necessary to build a share library # VAR Variant identifier suffix # VDIR Directory for object code # VSHDIR Directory for shared object code # ACE_ROOT Pathname for the root of the build tree # #---------------------------------------------------------------------------- # Platform-dependent macro definitions # (link to the appropriate platform-specific config file). #---------------------------------------------------------------------------- #### Default to building shared libraries only. Set it here to give the #### platform a chance to override. ifndef shared_libs shared_libs = 1 endif # shared_libs ifndef static_libs static_libs = 0 endif # static_libs #### Set up the build ACE version in case the platform_macros.GNU wants it. ifeq (cmd,$(findstring cmd,$(SHELL))) ACE_MAJOR_VERSION := $(shell awk "/ACE_MAJOR_VERSION/ { print $$3}" ${ACE_ROOT}/ace/Version.h) ACE_MINOR_VERSION := $(shell awk "/ACE_MINOR_VERSION/ { print $$3}" ${ACE_ROOT}/ace/Version.h) ACE_MICRO_VERSION := $(shell awk "/ACE_MICRO_VERSION/ { print $$3}" ${ACE_ROOT}/ace/Version.h) ACE_BETA_VERSION := $(shell awk "/ACE_MICRO_VERSION/ { print $$3}" ${ACE_ROOT}/ace/Version.h) else ACE_MAJOR_VERSION := $(shell awk '/ACE_MAJOR_VERSION/ { print $$3}' ${ACE_ROOT}/ace/Version.h) ACE_MINOR_VERSION := $(shell awk '/ACE_MINOR_VERSION/ { print $$3}' ${ACE_ROOT}/ace/Version.h) ACE_MICRO_VERSION := $(shell awk '/ACE_MICRO_VERSION/ { print $$3}' ${ACE_ROOT}/ace/Version.h) ACE_BETA_VERSION := $(shell awk '/ACE_MICRO_VERSION/ { print $$3}' ${ACE_ROOT}/ace/Version.h) endif ACE_VERSION = $(ACE_MAJOR_VERSION).$(ACE_MINOR_VERSION).$(ACE_MICRO_VERSION) # Define some variables to silence warnings SHR_FILTER ?= # Include this before the below variables to make it possible for # platform_macros.GNU to set default values for them. ifneq ($(alternate_platform_macros),) include $(alternate_platform_macros) else include $(ACE_ROOT)/include/makeinclude/platform_macros.GNU endif # alternate_platform_macros # Define some variables to silence warnings GHS ?= # $(ACE_PLATFORM_CONFIG) is used in dependency rules and corresponds to the # platform dependent config-*.h file included in config.h, and can be set # in your platform_*.GNU file or platform_macros.GNU. ACE_PLATFORM_CONFIG ?= config.h ifeq ($(threads),0) ifneq ($(findstring -DACE_MT_SAFE=0,$(CPPFLAGS)),-DACE_MT_SAFE=0) CPPFLAGS += -DACE_MT_SAFE=0 endif # -DACE_MT_SAFE=0 endif # threads #### #### Defaults are fast off (0), threads on (1) #### and versioned_so on (1). #### fast ?= 0 versioned_so ?= 1 use_dep_libs ?= 1 threads ?= 1 symlinks ?= relative link_groups ?= 0 mcpp ?= 0 root_is_symlink ?= 0 SOVERSION ?= SONAME ?= ifeq ($(root_is_symlink),1) ifneq ($(symlinks),relative) warn_output:=$(warning WARNING: You should really use relative library symlinks with symlinked root) endif use_pwd_call = 1 ### use 'real' pwd command from shell; internal make command resolves symlinks ifeq ($(PWD),) PWD=$(shell $(SHELL) -c pwd) endif else ifeq ($(PWD),) PWD=$(shell pwd) endif endif ifeq ($(ACE_MKDIR),) MKDIR = mkdir -p else MKDIR = $(ACE_MKDIR) endif #---------------------------------------------------------------------------- # Platform-independent macro definitions #---------------------------------------------------------------------------- INCLDIRS ?= DEFFLAGS ?= ifeq ($(debug),0) DEFFLAGS += -DNDEBUG endif CPPFLAGS += $(DEFFLAGS) $(INCLDIRS) # Define default extensions for IDL-generated files IDL_CLIENT_HDR_EXT ?= C.h IDL_CLIENT_INL_EXT ?= C.inl IDL_CLIENT_SRC_EXT ?= C.cpp IDL_SERVER_HDR_EXT ?= S.h IDL_SERVER_SRC_EXT ?= S.cpp IDL_SERVER_THDR_EXT ?= S_T.h IDL_SERVER_TINL_EXT ?= S_T.inl IDL_SERVER_TSRC_EXT ?= S_T.cpp IDL_GEN_FILES_DIR ?= . ifeq (default,$(origin LEX)) LEX = flex endif EXEEXT ?= ifndef COMSPEC ifdef ComSpec #### ACE+TAO use COMSPEC, but ComSpec is defined. COMSPEC = $(ComSpec) endif # ComSpec endif # ! COMPSPEC ifdef COMSPEC #### Assume we're on a WIN32 host. ACE_NUL = $(if $(findstring /bin/sh,$(SHELL)),/dev/null,nul) else # ! WIN32 ACE_NUL = /dev/null endif # ! WIN32 #### Redirect stderr to nul device, and mask exit status. ACE_NUL_STDERR = 2>$(ACE_NUL) || true PCFLAGS += #### set in platform_macros.GNU file, e.g., -p PCCFLAGS += #### set in platform_macros.GNU file, e.g., -p VAR ?= # User-written makefiles that are not MPC-generated often use LIB to specify # what to build. This is in contrast to MPC-generated files that use # LIB_CHECKED for this purpose. LIB causes conflicts on Windows with gmake # and Visual Studio which uses the LIB environment variable as a search path # for libraries to link. So, to allow non-MPC makefiles to keep working, set # LIB_CHECKED based on LIB if the former is not set and the latter is. ifndef COMSPEC LIB_CHECKED ?= $(LIB) endif # ! COMPSPEC (and, therefore, assumed !Windows # default to not using an architecture-specific output directory ARCH ?= ifdef ARCH INSLIB := $(INSLIB:%=%/$(ARCH)) # ADD_ARCH is a function used with $(call) to "ARCHIFY" a variable which # contains the name and path of an executable or library. If the file is not # located in the ARCH subdir, the non-ARCH location is used. First we need # some helper functions to deal with quoting/protecting spaces. # ADD_ARCH can return a path containing a space, the caller must quote it or # escape the space, depending on the context. PROT_SPC = $(subst $(SPACE),?,$(1)) UNPROT_SPC = $(subst ?,$(SPACE),$(1)) FILE_EXISTS = $(wildcard $(subst $(SPACE),\$(SPACE),$(1))) ADD_ARCH_HLP = $(call UNPROT_SPC,$(dir $(1))$(ARCH)/$(notdir $(1))) ARCH_FILE = $(call FILE_EXISTS,$(call ADD_ARCH_HLP,$(call PROT_SPC,$(1)))) ADD_ARCH = $(if $(call ARCH_FILE,$(1)),$(call ARCH_FILE,$(1)),$(call FILE_EXISTS,$(1))) ARCH_BIN = $(if $(BIN),$(ARCH)/$(BIN)) ARCH_BIN2 = $(if $(BIN2),$(ARCH)/$(BIN2)) ARCH_LIB = $(if $(LIB_CHECKED),$(ARCH)/$(LIB_CHECKED)) ARCH_LIB2 = $(if $(LIB2),$(ARCH)/$(LIB2)) ARCH_SHLIB = $(if $(SHLIB),$(ARCH)/$(SHLIB)) ARCH_SHLIB2 = $(if $(SHLIB2),$(ARCH)/$(SHLIB2)) ARCH_SHLIBA = $(if $(SHLIBA),$(ARCH)/$(SHLIBA)) ARCH_SHLIBA2 = $(if $(SHLIBA2),$(ARCH)/$(SHLIBA2)) else #ARCH is not defined ADD_ARCH = $(1) ARCH_BIN = $(BIN) ARCH_BIN2 = $(BIN2) ARCH_LIB = $(LIB_CHECKED) ARCH_LIB2 = $(LIB2) ARCH_SHLIB = $(SHLIB) ARCH_SHLIB2 = $(SHLIB2) ARCH_SHLIBA = $(SHLIBA) ARCH_SHLIBA2 = $(SHLIBA2) endif #ARCH # for use with the result of ADD_ARCH ADD_QUOTE = $(if $(findstring $(SPACE),$(1)),"$(1)",$(1)) INSINC ?= $(ACE_ROOT)/ace INSLIB ?= $(ACE_ROOT)/lib INSMAN ?= $(ACE_ROOT)/man ifeq (,$(findstring -L$(INSLIB),$(LDFLAGS))) LDFLAGS += -L$(INSLIB) endif #ifdef ARCH # LDFLAGS_ARCH := $(LDFLAGS:-L%=-L%/$(ARCH)) # LDFLAGS += $(LDFLAGS_ARCH) #endif # Set the cleanup targets. These targets are used by realclean even if # the component isn't being built, i.e., the decision to build it was based # on components built in another makefile and written a file (that might no # longer be available) and accessed by $(ACE_ROOT)/bin/ace_components. # # If a component should always be built, just use the normal BIN, LIB, or # SHLIB variables. If it's dependent on a component, use the BIN2 or # BIN_UNCHECKED variety, then assign that to BIN if the required component # is available. BIN_UNCHECKED ?= CLEANUP_BIN ?= ifdef BIN CLEANUP_BIN = $(ARCH_BIN) endif # !BIN ifdef BIN2 CLEANUP_BIN += $(ARCH_BIN2) endif # !BIN2 ifneq ($(BIN_UNCHECKED),) CLEANUP_BIN += $(BIN_UNCHECKED) endif # !BIN_UNCHECKED LIB_UNCHECKED ?= CLEANUP_LIB ?= ifdef LIB_CHECKED CLEANUP_LIB = $(ARCH_LIB) endif # !LIB_CHECKED ifdef LIB2 CLEANUP_LIB += $(ARCH_LIB2) endif # !LIB2 ifneq ($(LIB_UNCHECKED),) CLEANUP_LIB = $(LIB_UNCHECKED) endif # !LIB_UNCHECKED SHLIB_UNCHECKED ?= CLEANUP_SHLIB ?= ifdef SHLIB CLEANUP_SHLIB = $(ARCH_SHLIB) endif # !SHLIB ifdef SHLIB2 CLEANUP_SHLIB += $(ARCH_SHLIB2) endif # SHLIB2 ifneq ($(SHLIB_UNCHECKED),) CLEANUP_SHLIB += $(SHLIB_UNCHECKED) endif # ! SHLIB_UNCHECKED SHLIBA_UNCHECKED ?= CLEANUP_SHLIBA ?= ifdef SHLIBA CLEANUP_SHLIBA = $(ARCH_SHLIBA) endif # SHLIBA ifdef SHLIBA2 CLEANUP_SHLIBA = $(ARCH_SHLIBA2) endif # SHLIB2A ifneq ($(SHLIBA_UNCHECKED),) CLEANUP_SHLIBA = $(SHLIBA_UNCHECKED) endif # SHLIBA_UNCHECKED # Let users override the default VDIR directories VDIR_PRJ ?= ifdef ARCH VDIR ?= $(ARCH)/.obj/$(VDIR_PRJ) VSHDIR ?= $(ARCH)/.shobj/$(VDIR_PRJ) else VDIR ?= .obj/$(VDIR_PRJ) VSHDIR ?= .shobj/$(VDIR_PRJ) endif # NOTE: VLDLIBS is defined below, in case it is overridden for static- # or shared-only builds. ifeq (default,$(origin YACC)) YACC = bison endif #---------------------------------------------------------------------------- # Platform-dependent macros that require platform_macros.GNU. #---------------------------------------------------------------------------- OBJEXT ?= o SOEXT ?= so LIBEXT ?= a LIB_PREFIX ?= lib CC_OUTPUT_FLAG ?= -o SO_OUTPUT_FLAG ?= -o LINK_OUTPUT_FLAG ?= -o #---------------------------------------------------------------------------- # make flags #---------------------------------------------------------------------------- ifeq ($(optimize),0) override optimize = endif # optimize ifneq ($(optimize),) CFLAGS += $(OCFLAGS) CCFLAGS += $(OCCFLAGS) endif # optimize ifeq ($(debug),0) override debug = endif # debug ifeq ($(debug),) CPPFLAGS += -DACE_NDEBUG else CFLAGS += $(DCFLAGS) CCFLAGS += $(DCCFLAGS) endif # debug dmalloc ?= ifeq ($(dmalloc),0) override dmalloc = endif # dmalloc ifdef dmalloc CPPFLAGS += $(PLATFORM_DMALLOC_CPPFLAGS) LDFLAGS += $(PLATFORM_DMALLOC_LDFLAGS) LIBS += $(PLATFORM_DMALLOC_LIBS) endif # dmalloc mtrace ?= ifeq ($(mtrace),0) override mtrace = endif # mtrace ifdef mtrace CPPFLAGS += $(PLATFORM_MTRACE_CPPFLAGS) endif # mtrace ifeq ($(threads),0) override threads = endif # threads trio ?= ifeq ($(trio),0) override trio = endif # trio ifdef trio CPPFLAGS += -DACE_HAS_TRIO $(PLATFORM_TRIO_CPPFLAGS) LDFLAGS += $(PLATFORM_TRIO_LDFLAGS) LIBS += -ltrio $(PLATFORM_TRIO_LIBS) ACE_MAKE_OPTIONS += trio endif # trio # ace_for_tao subsetting is disabled by default. ace_for_tao ?= ifeq ($(ace_for_tao),0) override ace_for_tao = endif # ace_for_tao ifneq ($(ace_for_tao),) ACE_MAKE_OPTIONS += ace_for_tao endif # ace_for_tao ifeq ($(xt),0) override xt = endif # xt ifneq ($(xt),) override x11=1 override xt=1 override ace_xtreactor=1 override tao_xtresource=1 ACE_MAKE_OPTIONS += xt endif # xt fl ?= ifeq ($(fl),0) override fl = endif # fl ifneq ($(fl),) override x11=1 override gl=1 override ace_flreactor=1 override tao_flresource=1 ACE_MAKE_OPTIONS += fl endif # fl tk ?= ifeq ($(tk),0) override tk = endif # tk ifneq ($(tk),) override x11=1 override tk=1 override ace_tkreactor=1 override tao_tkresource=1 ACE_MAKE_OPTIONS += tk endif # tk qt ?= ifeq ($(qt),0) override qt = endif # qt ifneq ($(qt),) override qt=1 override ace_qtreactor=1 override tao_qtresource=1 ACE_MAKE_OPTIONS += qt endif # qt gtk_reactor ?= ifeq ($(gtk_reactor),0) override gtk_reactor = endif # gtk_reactor ifneq ($(gtk_reactor),) override ace_with_gtk=1 CPPFLAGS += -DACE_HAS_GTK $(PLATFORM_GTK_CPPFLAGS) LIBS += $(PLATFORM_GTK_LIBS) LDFLAGS += $(PLATFORM_GTK_LDFLAGS) ACE_MAKE_OPTIONS += gtk_reactor endif # gtk_reactor fox ?= ifeq ($(fox),0) override fox = endif # fox ifneq ($(fox),) override x11=1 override gl=1 override ace_foxreactor=1 override tao_foxresource=1 ACE_MAKE_OPTIONS += fox endif #fox QTDIR ?= ifneq ($(QTDIR),) MOC = ${QTDIR}/bin/moc else MOC = moc endif rapi ?= ifeq ($(rapi),0) override rapi = endif #rapi ifneq ($(rapi),) CPPFLAGS += -DACE_HAS_RAPI $(PLATFORM_RAPI_CPPFLAGS) LIBS += $(PLATFORM_RAPI_LIBS) LDFLAGS += $(PLATFORM_RAPI_LDFLAGS) ACE_MAKE_OPTIONS += rapi endif # rapi sctp ?= ifeq ($(sctp),0) override sctp = endif #rapi # if any sctp implementation is present then add ifneq ($(sctp),) CPPFLAGS += -DACE_HAS_SCTP $(PLATFORM_SCTP_CPPFLAGS) LDFLAGS += $(PLATFORM_SCTP_LDFLAGS) LIBS += $(PLATFORM_SCTP_LIBS) ACE_MAKE_OPTIONS += sctp endif gl ?= ifeq ($(gl),0) override gl = endif # gl ifneq ($(gl),) ACE_MAKE_OPTIONS += gl endif # gl ssl ?= 0 ifeq ($(ssl),0) override ssl = else ifneq ($(SSL_ROOT), /usr) ifneq ($(SSL_ROOT),) ifneq ($(SSL_INCDIR),) PLATFORM_SSL_CPPFLAGS += -I$(SSL_INCDIR) else PLATFORM_SSL_CPPFLAGS += -I$(SSL_ROOT)/include endif ifneq ($(SSL_LIBDIR),) PLATFORM_SSL_LDFLAGS += -L$(SSL_LIBDIR) else PLATFORM_SSL_LDFLAGS += -L$(SSL_ROOT)/lib endif endif endif PLATFORM_SSL_LIBS ?= -lssl -lcrypto ACE_MAKE_OPTIONS += ssl endif ## These are related to MPC. When 'requires' is used in a project ## it controls whether or not the project is generated. There is also ## a second level of control in platform macros and thus requires ## some features to be set here as well. ec_typed_events ?= 1 zlib ?= 1 valgrind ?= ifeq ($(valgrind),1) CPPFLAGS += -DACE_HAS_VALGRIND # Does the valgrind version support --keep-debug-info, if not # we disable dlclose in ACE to get complete callstacks valgrind_keep_debuginfo ?= ifeq ($(valgrind_keep_debuginfo),0) CPPFLAGS += -DACE_LACKS_DLCLOSE endif endif profile ?= ifeq ($(profile),0) override profile = endif # profile ifneq ($(profile),) CFLAGS += $(PCFLAGS) CCFLAGS += $(PCCFLAGS) endif # profile inline ?= 1 ifeq ($(inline),0) CPPFLAGS += -DACE_NO_INLINE else ifeq ($(inline),1) CPPFLAGS += -D__ACE_INLINE__ endif # inline eq 1 endif # inline eq 0 ifeq ($(shared_libs),0) override shared_libs = endif # shared_libs ifeq ($(static_libs),0) override static_libs = endif # static_libs shared_libs_only ?= ifeq ($(shared_libs_only),0) override shared_libs_only = endif # shared_libs_only static_libs_only ?= ifeq ($(static_libs_only),0) override static_libs_only = endif # static_libs_only ifdef shared_libs_only ifdef static_libs_only $(error Both static_libs_only and shared_libs_only defined.) else override shared_libs = 1 override static_libs = endif endif # shared_libs_only ifdef static_libs_only override shared_libs = override static_libs = 1 endif # static_libs_only ifdef shared_libs ifndef static_libs override shared_libs_only = 1 endif ACE_MAKE_OPTIONS += shared_libs endif ifdef static_libs ifndef shared_libs override static_libs_only = 1 endif ACE_MAKE_OPTIONS += static_libs endif ACE_SHLIBS ?= ifdef shared_libs ifdef SHLIBA LDLIBS := $(LDLIBS:-l%=-l%shr) ACE_SHLIBS := $(ACE_SHLIBS:-l%=-l%shr) endif # SHLIBA else # ! shared_libs ifdef static_libs #### Don't build shared libs. PIC = SHLIB = SOEXT = o VSHDIR = $(VDIR) VLDLIBS = $(LDLIBS:%.so=%.o) endif # static_libs endif # shared_libs VLDLIBS = $(LDLIBS) $(LIBS) probe ?= ifeq ($(probe),0) override probe = endif # probe ifeq ($(probe),1) CPPFLAGS += -DACE_COMPILE_TIMEPROBES endif # probe purify ?= ifeq ($(purify),0) override purify = endif # purify ifdef purify PURE_CACHE_BASE_DIR = /tmp/purifycache PURE_CACHE_DIR = $(PURE_CACHE_BASE_DIR)-$(LOGNAME)-$(notdir $(CXX) ) #### Pick up Purify directory from the users PATH. ACE_PURIFY_DIR := \ $(shell type purify | sed -e 's/.* is //' -e 's%/purify$$%%') #### You might want to adjust the Purify options below. #### -best-effort is undocumented but supported, and seems #### to help avoid occasional link failure. PURELINK += purify -best-effort -cache-dir=$(PURE_CACHE_DIR) \ -chain-length=20 -fds-inuse-at-exit=no \ -inuse-at-exit -max_threads=100 $(PLATFORM_PURIFY_OPTIONS) CPPFLAGS += -DACE_HAS_PURIFY -I$(ACE_PURIFY_DIR) endif # purify quantify ?= ifeq ($(quantify),0) override quantify = endif # quantify ifdef quantify #### Pick up Quantify directory from the users PATH. ACE_QUANTIFY_DIR := \ $(shell type quantify | sed -e 's/.* is //' -e 's%/quantify$$%%') #### You might want to adjust the Quantify options below. #### -best-effort is undocumented but supported, and seems #### to help avoid occasional link failure. PURELINK += quantify -best-effort -cache-dir=$(PURE_CACHE_DIR) \ -max_threads=100 $(PLATFORM_QUANTIFY_OPTIONS) CPPFLAGS += -DACE_HAS_QUANTIFY -I$(ACE_QUANTIFY_DIR) endif # quantify repo ?= ifeq ($(repo),0) override repo = endif # repo ifdef repo #### Remove -fno-implicit-templates from, and add -frepo to, CCFLAGS. CCFLAGS := $(strip $(subst -fno-implicit-templates,,$(CCFLAGS))) CCFLAGS += -frepo CPPFLAGS += -DACE_HAS_GNU_REPO # ace_lib_prelink := 1 endif # repo # If pipes is not set, we default to 0 pipes ?= 0 # If pipes is set to 1 then add the compiler flag -pipe. This uses pipe instead # of intermediate files. This can be disabled by setting pipes to 0 in the # platform_macros.GNU file. ifeq ($(pipes),1) FLAGS_C_CC += -pipe endif # pipes # RMCast is turned on by default rmcast ?= 1 ifeq ($(rmcast),1) ACE_MAKE_OPTIONS += rmcast endif # If not explicitly is set that we don't have rwho, assume we have it. rwho ?= 1 # If not explicitly is set that we don't have stlport, assume we # don't have it. stlport ?= 0 ifeq ($(stlport),1) CPPFLAGS += -DACE_HAS_STLPORT $(PLATFORM_STLPORT_CPPFLAGS) CCFLAGS += $(PLATFORM_STLPORT_CCFLAGS) LDFLAGS += $(PLATFORM_STLPORT_LDFLAGS) LIBS += $(PLATFORM_STLPORT_LIBS) endif # If not explicitly is set that we have wfmo, assume we don't have it. wfmo ?= 0 # If not explicitly is set that we have winregistry, assume we don't have it. winregistry ?= 0 # If not explicitly is set that we have winnt, assume we don't have it. winnt ?= 0 # In MPC, these are now features that are enabled by default. ace_other ?= 1 ace_codecs ?= 1 ace_token ?= 1 ace_svcconf ?= 1 ace_uuid ?= 1 ace_filecache ?= 1 acexml ?= 1 # Icecream distributed compilation support ifeq ($(icecream),1) # check availability of icecc ifneq ($(ICECC_ROOT),) ICECC_PROG := $(ICECC_ROOT)/icecc else ICECC_PROG := $(shell which icecc 2>/dev/null) endif ICECC_VERTEST := $(shell test -x "$(ICECC_PROG)" && $(ICECC_PROG) --version) ifneq (ICECC,$(findstring ICECC,$(ICECC_VERTEST))) # not good, try alternative install location ICECC_PROG := /opt/icecream/bin/icecc ICECC_VERTEST := $(shell test -x "$(ICECC_PROG)" && $(ICECC_PROG) --version) ifneq (ICECC,$(findstring ICECC,$(ICECC_VERTEST))) override icecream := 0 $(error Cannot locate valid Icecream compiler.) endif endif ifeq ($(icecream),1) # force LD and DLD to be 'normal' tools override LD := $(LD) override DLD := $(DLD) # define tools that icecc should call for local jobs ICECC_CC := $(CC) ICECC_CXX := $(CXX) export ICECC_CC ICECC_CXX # let all compilation go through icecc CC := $(ICECC_PROG) CXX := $(ICECC_PROG) endif endif #---------------------------------------------------------------------------- # Conditional macro definitions #---------------------------------------------------------------------------- PTDIRS ?= PRELINK ?= POSTLINK ?= PURELINK ?= MVCMD ?= PREPROCESS_OPT ?= -E PREPROCESS_SUFFIX ?= i COMPILE.c = $(CC) $(CFLAGS) $(FLAGS_C_CC) $(CPPFLAGS) -c COMPILE.cc = $(CXX) $(CCFLAGS) $(FLAGS_C_CC) $(CPPFLAGS) $(PTDIRS) -c PREPROCESS.c ?= $(CC) $(PREPROCESS_OPT) $(CFLAGS) $(CPPFLAGS) PREPROCESS.cc ?= $(CXX) $(PREPROCESS_OPT) $(CCFLAGS) $(CPPFLAGS) RC ?= COMPILE.rc = $(RC) $(RCFLAGS) COMPILE-NO_DASH_G.cc = `echo $(COMPILE.cc) | sed 's/-g //'` # 960905 Marius Kjeldahl # Added the line below to be used for compiling executable shared objects COMPILEESO.cc = $(CXX) $(CCFLAGS) $(FLAGS_C_CC) $(CPPFLAGS) $(PTDIRS) ifeq ($(LINK.c),override) LINK.c = $(LINK.c.override) else LINK.c = $(PURELINK) $(PRELINK) $(LD) $(CFLAGS) $(FLAGS_C_CC) $(CPPFLAGS) $(LDFLAGS) \ $(LDLIBS) $(LIBS) endif # LINK.c.override ifeq ($(LINK.cc),override) LINK.cc = $(LINK.cc.override) else LINK.cc = $(PURELINK) $(PRELINK) $(LD) $(CCFLAGS) $(FLAGS_C_CC) $(CPPFLAGS) $(PTDIRS) endif # LINK.cc.override ifeq ($(SOLINK.cc),override) SOLINK.cc = $(SOLINK.cc.override) else SOLINK.cc = $(PRELINK) $(DLD) $(SOFLAGS) endif # SOLINK.cc.override ace-8.0.4+dfsg.orig/include/makeinclude/macros.GNU0000644000175000017500000000114215027201773020730 0ustar sudipsudip#-*- Makefile -*- #---------------------------------------------------------------------------- # # # Local and nested target definitions #---------------------------------------------------------------------------- TARGETS_LOCAL = \ all.local \ debug.local \ profile.local \ optimize.local \ install.local \ binout.local \ clean_binout.local \ clean_binaries.local \ clean_idl_stubs.local \ clean.local \ realclean.local \ clobber.local \ depend.local \ rcs_info.local \ idl_stubs.local \ svnignore.local \ $(PRIVATE_TARGETS_LOCAL) TARGETS_NESTED = \ $(TARGETS_LOCAL:.local=.nested) ace-8.0.4+dfsg.orig/include/makeinclude/platform_freebsd.GNU0000644000175000017500000000430215027201773022763 0ustar sudipsudip# -*- Makefile -*- # platform_freebsd.GNU ## See /usr/ports/Mk/bsd.port.mk for sample usage of the OSVERSION ## variable, especially with respect to defining the correct compiler ## flags for threads. OSVERSION := $(shell sysctl -n kern.osreldate) OSMAJOR := $(firstword $(subst ., ,$(shell sysctl -n kern.osrelease))) debug ?= 1 optimize ?= 1 threads ?= 1 versioned_so ?= 1 ifneq ($(filter 10 11,$(OSMAJOR)),) CC ?= clang CXX ?= clang++ CCFLAGS += -fdelayed-template-parsing else CC ?= gcc CXX ?= g++ endif AR = ar ARFLAGS = ruv CPPFLAGS += -I/usr/local/include DCFLAGS += -g DCCFLAGS += $(DCFLAGS) DLD = $(CXX) LD = $(CXX) LDFLAGS += -L/usr/local/lib OCFLAGS += -O2 OCCFLAGS = $(OCFLAGS) PIC = -fpic PRELIB = @true RANLIB = ranlib SOFLAGS += -shared ifeq ($(threads),1) FLAGS_C_CC += -pthread SOFLAGS += -pthread endif # threads PLATFORM_X11_CPPFLAGS = -I/usr/X11R6/include PLATFORM_X11_LIBS = -lX11 PLATFORM_X11_LDFLAGS = -L/usr/X11R6/lib PLATFORM_XT_CPPFLAGS = PLATFORM_XT_LIBS = -lXt PLATFORM_XT_LDFLAGS = PLATFORM_FL_CPPFLAGS = PLATFORM_FL_LIBS = -lfltk -lfltk_forms -lfltk_gl PLATFORM_FL_LDFLAGS = PLATFORM_GL_CPPFLAGS = -I/usr/X11R6/include PLATFORM_GL_LIBS = -lGL PLATFORM_GL_LDFLAGS = -L/usr/X11R6/lib PLATFORM_GTK_CPPFLAGS = $(shell gtk-config --cflags) PLATFORM_GTK_LIBS = $(shell gtk-config --libs) PLATFORM_GTK_LDFLAGS = PLATFORM_FOX_CPPFLAGS ?= -I/usr/local/include/fox-1.6 PLATFORM_FOX_LIBS ?= -lFOX-1.6 PLATFORM_FOX_LDFLAGS ?= PLATFORM_TK_CPPFLAGS=$(shell . /usr/local/lib/tk8.*/tkConfig.sh && echo -n $$TK_INCLUDE_SPEC) PLATFORM_TK_LIBS=$(shell . /usr/local/lib/tk8.*/tkConfig.sh && echo -n $$TK_LIB_FLAG) PLATFORM_TK_LDFLAGS= PLATFORM_TCL_CPPFLAGS=$(shell . /usr/local/lib/tcl8.*/tclConfig.sh && echo -n $$TCL_INCLUDE_SPEC) PLATFORM_TCL_LIBS=$(shell . /usr/local/lib/tcl8.*/tclConfig.sh && echo -n $$TCL_LIB_FLAG) PLATFORM_TCL_LDFLAGS= # Test for template instantiation, add to versioned_so if versioned_so set, # add -E to LDFLAGS if using GNU ld # include $(ACE_ROOT)/include/makeinclude/platform_g++_common.GNU ace-8.0.4+dfsg.orig/include/makeinclude/platform_macosx_yosemite.GNU0000644000175000017500000000067615027201773024573 0ustar sudipsudipinclude $(ACE_ROOT)/include/makeinclude/platform_macosx_mavericks.GNU ## The following is to circumvent the restriction of System Integrity Protection (SIP) ## by embedding the path information of dynamic libraries into the executables. SOFLAGS += -install_name @rpath/$(notdir $@) space := $(subst ,, ) LDFLAGS += $(foreach libpath,$(LIBPATHS),-rpath $(if $(filter "/%,$(subst $(space),;,$(libpath))),$(libpath),@executable_path/$(libpath))) ace-8.0.4+dfsg.orig/include/makeinclude/platform_linux_icc.GNU0000644000175000017500000000461215027201773023332 0ustar sudipsudip # This file should allow ACE to be built on Linux, using the Intel compiler. AR = xiar include $(ACE_ROOT)/include/makeinclude/platform_linux_common.GNU fast ?= 0 ipo ?= 0 ifeq ($(insure),0) CC = icc CXX = icpc endif ifndef CXX_VERSION CXX_VERSION := $(shell $(CXX) --version) endif ifeq (8.0,$(findstring 8.0,$(CXX_VERSION))) CFLAGS += -wd1476,1505 endif ifeq (8.1,$(findstring 8.1,$(CXX_VERSION))) CFLAGS += -wd1476,1505,1572 -no-gcc endif ifeq (9.0,$(findstring 9.0,$(CXX_VERSION))) CFLAGS += -wd1684 endif ifeq (9.1,$(findstring 9.1,$(CXX_VERSION))) CFLAGS += -wd1684 endif ifeq (10.0,$(findstring 10.0,$(CXX_VERSION))) CFLAGS += -wd1684 endif ifeq (10.1,$(findstring 10.1,$(CXX_VERSION))) CFLAGS += -wd1684 endif ifeq (11.0,$(findstring 11.0,$(CXX_VERSION))) CFLAGS += -wd1684 endif ifeq (12.0,$(findstring 12.0,$(CXX_VERSION))) no_hidden_visibility ?= 0 endif no_hidden_visibility ?= 1 ifeq ($(inline),0) CPPFLAGS += -fno-inline endif ifeq ($(fast),1) CPPFLAGS += -fast endif ifeq ($(ipo),1) CPPFLAGS += -ipo endif CFLAGS += -w1 ifeq ($(threads),1) CPPFLAGS += -D_REENTRANT endif # threads CCFLAGS += $(CFLAGS) -ip DCFLAGS += -g -debug full DLD = $(CXX) LD = $(CXX) LIBS += -ldl ifeq ($(threads),1) LIBS += -lpthread LIBS += -lrt endif OCFLAGS += -O3 # Disable floating point optimizer solves problem with # min/max float values in the TAO_IDL compiler tests # If these options are not passed we can get overflows # when testing min/max CPPFLAGS += -fp-model double ifeq ($(coverage),1) FLAGS_C_CC += -prof-gen endif ifeq ($(optimize),0) # Disable all optimizing in code CPPFLAGS += -O0 endif SOFLAGS += $(CPPFLAGS) -shared SOBUILD = $(COMPILE.cc) $(PIC) -o $(VSHDIR)$*.so $<; \ $(SOLINK.cc) -o $@ $(LDFLAGS) $(VSHDIR)$*.o PRELIB = @true ifeq ($(shared_libs), 1) ifneq ($static_libs_only), 1) LDFLAGS += -Wl,-E ifneq ($(no_hidden_visibility),1) CCFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden else CPPFLAGS += -DACE_HAS_CUSTOM_EXPORT_MACROS=0 endif # no_hidden_visibility endif endif # Added line below to support "Executable Shared Object" files (as # needed by the service configurator). # Marius Kjeldahl ifeq ($(threads),1) ESOBUILD = $(COMPILEESO.cc) $(PIC) -shared -o $(VSHDIR)$*.so $< ifndef PRELIB PRELIB = @true endif # ! PRELIB endif ace-8.0.4+dfsg.orig/include/makeinclude/rules.common.GNU0000644000175000017500000000165115027201773022072 0ustar sudipsudip# -*- Makefile -*- #---------------------------------------------------------------------------- # # # Common targets #---------------------------------------------------------------------------- .PHONY: __prebuild__ all: __prebuild__ all.nested all.local debug: debug.nested debug.local profile: profile.nested profile.local binout: binout.nested binout.local clean_binout: clean_binout.nested clean_binout.local clean_binaries: clean_binaries.nested clean_binaries.local clean_idl_stubs: clean_idl_stubs.nested clean_idl_stubs.local clean: clean.nested clean.local realclean: realclean.nested realclean.local clobber: clobber.nested clobber.local depend: depend.nested depend.local depend_idl.local rcs_info: rcs_info.nested rcs_info.local idl_stubs: idl_stubs.nested idl_stubs.local svnignore: svnignore.nested svnignore.local ace-8.0.4+dfsg.orig/THANKS0000644000175000017500000034063215027201773014112 0ustar sudipsudipACKNOWLEDGEMENTS 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 Alexander Babu Arulanthu Shawn Atkins Jaiganesh Balasubramanian Krishnakumar Balasubramanian Matt Braun Darrell Brunsch Dante J. Cannarozzi Sharath R. Cholleti Chris Cleeland Angelo Corsaro Gan Deng Mayur Deshpande Eric Ding George Edwards Sergio Flores-Gaitan Chris Gill Andrew G. Gilpin Aniruddha Gokhale Priyanka Gontla Pradeep Gore Matthew P. Hampton Tim Harrison John Heitmann James Hill Shawn Hannan Don Hinton Joe Hoffert James Hu Huang-Ming Huang Frank A. Hunleth Prashant Jain Shanshan Jiang Vishal Kachroo Michael Kircher Boris Kolpackov Arvind S. Krishna Yamuna Krishnamurthy Fred Kuhns David Levine Tao Lu Mike Moran Sumedh Mungee Balachandran Natarajan Will Otte Kirthika Parameswaran Krishnakumar Pathayapura Stoyan Paunov Carlos O'Ryan Ossama Othman Jeff Parsons Irfan Pyarali Nilabja Roy Lucas Seibert Diego Sevilla Ruiz Nishanth Shankaran Marina Spivak Venkita Subramonian Nagarajan Surendran Cassia Tatibana Sumant Tambe Gabriele Trombetti Emre Turkay Nanbor Wang Seth Widoff Jules White Friedhelm Wolf Torben Worm Ming Xiong I would also like to thank all the following people who have also contributed to ACE, TAO, CIAO, and DAnCE over the years: Paul Stephenson Olaf Kruger Ed Brown Lee Baker Alex Ranous Mark Patton Steffen Winther Sorensen Troy Warner Stacy Mahlon Charles Eads Mark Frutig Todd Hoff George Brad Needham Leslee Xu Detlef Becker Bruce Worden Chris Tarr Bill Sears Greg Lavender Steve Warwick Mats Sundvall Andreas Ueltschi Nigel Hooke Medhi Tabatabai Stuart Powell Bin Mu Andrew McGowan Ken Konecki John P. Hearn Giang Hoang Nguyen Carlos Garcia Braschi Jam Hamidi Eric Vaughan Karlheinz Dorn Gerhard Lenzer Steve Ritter Chandra Venkatapathy Matt Stevens Bob Vistica David Trumble George Reynolds Hans Rohnert Alex V. Maclinovsky Todd Blanchard Rob Clairmont Christian Millour Neil B. Cohen Dieter Quehl Reginald S. Perry James Morris Mark Seaborn Phil Brooks E. Jason Scheck Daniel Proulx Bill Tang John Huchinson Jack Erickson Byron Walton Bill Lear Mark Zusman Aurelio Nocerino Walt Akers Greg Baker Alexandre Karev Pramod Kumar Singh Bryon Rigg Brad Brown Patty Genualdi Eshel Liran Mick Adams Chris Eich Mike Flinn Audun Tornquist Sandeep Joshi Bernd Hofner Craig Perras Kirk Sinnard Matthew Newhook Gerolf Wendland Phil Mesnier Ross Dargahi Richard Orr Rich Ryan Jan Rychter Tom Marrs <0002104588 at mcimail dot com> Bob Olson Jean-Francois Ripouteau Ajit Sagar Ashish Singhai David Sames Gonzalo Diethelm Raj Darrin Edelman Steve Weismuller Eric C. Newton Andres Kruse Ramesh Nagabushnam Antonio Tortorici Nigel Lowe Tom Leith Michael Fortinsky Marco Sommerau Gary Salsbery Eric Beser Alfred Keller John Lu James Mansion Jesper S. M|ller Chris Lahey Michael R"uger Istvan Buki Greg Wilson Garrett Conaty Brad Flood Marius Kjeldahl Steve Huston Eugene K. Plaude Joseph DeAngelis Kim Gillies Luca Priorelli Alan Stewart Hani Yakan William L. Gerecke Craig Johnston Pierre-Yves Duval Rochi Febo Dommarco Jonathan Biggar Scott Shupe Chuck Gehr Avi Nash Padhu Ramalingam Jay Denkberg Ayman Farahat Tilo Christ rev Hamutal Yanay Vital Aza Alex Villazon David Artus Todd Barkalow Alexander Smundak Thilo Kielmann Matthias Kerkhoff Fred LaBar Hanan Herzog Eric Parker James Michael Dwyer Arun Katkere Bob Dunmire Sandro Doro Robert Lyng Phil Logan John Cosby Wayne Vucenic Harry Gunnarsson James CE Johnson Samuel_Bercovici Per Andersson Anthony McConnell Mark Rabotnikov John Bossom Rino Simioni Slawomir Kuzniar Rob Jordan Michael Maxie John Cosby Nigel Owen Jorn Jensen Paul Roman Dave Mayerhoefer Bert Craytor Joey Zhu Arthur J. Lewis Michael R. MacFaden Paul Han Jeff Morgan Arturo Montes Elliot Lau Mark Wright Michael Newton Kumar Neelakantan Scott Halstead Jean-Marc Strauss Adam Porter Hakan Kallberg Eric Dean Russell Daniel Montalibet Norbert Rapp Ganesh Pai Berni Merkle Tom Wright Torbjorn Lindgren Mike Bernat Brian Mendel Jeremy Buch Kevin Boyle Kevin Martindale Luis Lopes Adrian Salt Hongbo Xu Michael Hartman Tom Dobridge Rich Christy Satoshi Ueno Eugene R. Somdahl Robert Head Ivan Murphy Jan Perman Shankar Krishnamoorthy Reza Roodsari Jim Crossley Johannes Gutleber Yigong Liu Erik Urdang Mike Schweiger Anthony Mutiso Jeff R. Hayes David Brackman Dave Moore Joseph Cross Cherif Sleiman Stefan Ericsson Thanh Ma Oleg Krivosheev Stephen Coy Bob Laferriere Satheesh Kumar MG Karen Amestoy Jeff Richard Samuel Melamed Vladimir Schipunov Felix Popp Billy Quinn Michael McKnight Huiying Shen Alex Chan Aaron Valdivia Edan Ayal Jeffrey Peterson Neil Lavelle Steven Wohlever Manojkumar Acharya Evgeny Beskrovny Kirill Rybaltchenko Laura Paterno Ben Eng Mike Kamrad Marios Zikos Mark L Boriack Mark Hyett Valik Solrzano Barboza John Connett Tom Arbuckle Stephen Henry Dani Flexer Michael Hoffman John Lindal Dustin Laurence Ernie Makris Timothy A. Brown Pat McNerthney Lori Anderson Erik Margraf Bryan Doerr Adam Miller Thomas Jordan Keith Nicewarner Frederic Andres Achint Sandhu Mitch Kuninsky Alex Chan Jeff Hellzen Thomas Venturella Philippe O'Reilly Stan Leeson Richard Keizer Edgar Villanueva Oliver Kellogg Dave Meyer Thomas Hampson Jay Kistler Scott Snyder Mark Evans Todd Pack Mark Maris Jason Katz Jim Penny Chris Ryan J dot Russell Noseworthy Carol Sanders Jerry Bickle Paul von Behren Sudish Joseph Loren Rittle Alexander Ovsiankin Ravi Nagabhyru Tom Brusehaver Dave Tallman Monish Rajpal Garry Brother Andreas Schuelke Ganapathi James Garrison Brad Walton Paul Motuzenko Kurt Sussman Rob Thornton Chanaka Liyanaarachchi Saneyasu Steve Kay Greg White Ki-hyun Yoon Umar Syyid Bill Fulton Amancio Hasty Zoran Ivanovic Sree Oggu James Risinger Leo Modica Bob Scott Mark Kettner Kent Watsen Chris Healey Philippe Klein William S. Lear John Geiss Ernesto Guisado Stuart Myles Lothar Werzinger Andrew Harbick Pavel Motuzenko Ross J. Lillie Sam Hauer Frank J. Hodum David Miron Anton van Straaten Joe Covalesky Bill Backstrom Jeff Franks John Mulhern <9107 at mn3 dot lawson dot lawson dot com> Johan Lundin Eric Powers Gabriel Lima Doug Anderson Hongyin Quan Maximilian Hoferer Kevin Stanley Jeff Greif Jeff McDaniel Andreas Geisler Bob McWhirter Daniel Winder Zheng Han Christa Schwanninger Byron Harris Barney Dalton Peter Gorgia Dirk Broer Joseph E. LaPrade Goran Lowkrantz Susan Liebeskind Dana Hackman Margherita Vittone Wiersma Priya Narasimhan Jeff Hopper Mats Nilsson Dongwook Kim Don Davis Alberto Villarica XuYifeng Tom Shields Krishna Padmasola Andre Folkers Paul Sexton Marc Lehmann Anne Blankert Raja Ati Clinton Carr Peter Liqun Na Frank Adcock Xu Yifeng Valery Arkhangorodsky Alan Scheinine Andrew G. Harvey Dann Corbit James Jason Milley Ulf Jaehrig Peter Nordlund Mark Weel Tres Seaver Erik Koerber Eric R. Medley David O'Farrell Amir Bahmanyari Ian Wright David Janello Rich Wellner Fernando D. Mato Mira Jonathan Reis Seung-Lee Hoon Russell L. Carter Bill Hall Brian Gilstrap Balaji Srinivasan Anders W. Tell Larry Lachman Terry Rosenbaum Rainer Blome Kirk Ellett Sunil Kumar T Stach Ron Barack Daniel Nieten Paul K. Fisher Jim Buck Olivier Lau Achim Stindt Fredrik Lindahl Joseph Weihs Serge Kolgan James Megquier Martin Krumpolec Michael Thomas Vicentini Emanuele Bob Price Ramiro Penataro Blanco Sigg Pascal Ivan Leong Virginie Amar Tom Ziomek Hamish Friedlander Mark De Jong Knut Johannessen Leif Jakobsmeier Jon Lindgren Steve Vinoski Christian Mueffling Victor Yu Jeff Donner Joe Loyall Stanislav Meduna Christian Korn Ron Barack Steve Totten Faron Dutton Gary York Patty Hair Ivan Pascal William A. Hoffman Mark Lucovsky Greg Holtmeyer Jody Hagins Patrice Bensoussan Keith Brown Barry Hoggard Peter J. Mason Jerry D. De Master Greg Gallant wym Karel Zuiderveld Mike Goldman Peter Gross Greg Ross Stanford S. Guillory Peter Weat Magnus Karlsson Andreas Tobler John Aughey Knut-Havard Aksnes Eric Mitchell Tommy Andreasen Slava Galperin Jeff Olszewski Sudhanshu Garg Mike Preradovic Greg Harrison Sangwoo Jin Jacques Salerian Steve Coleman Diethard Ohrt Jacob Jones Phil Ruelle Sush Bankapura Eric Covington Darren Whobrey Mason Taube Rod Joseph Hans Horsmann Kevin Royalty Souhad Mcheik Mark Little Tim Stack Marc Engel Uma Markandu Henrik Nordberg Tad Jarosinski Andy Marchewka Neal Norwitz Frederic Maria David Hooker Christian Destor Andrew Hobson Andre Folkers Torsten Kuepper Hao Ruan Alexander Davidovich Cristian Ferretti N Becker Yaolong Lan Elias Sreih Liang Chen Mark Laffoon Ti Z Brian Dance Alexey Gadzhiev Francois Bernier Bill Rizzi Peter Windle Jaepil Kim Dmitry Goldshtain Carl Grinstead Henric Jungheim Michael Preobrazhensky Gregory D. Fee Roland Gigler Frank Buschmann Eric Eide Don Busch Thomas Lockhart David Hauck Keith Rohrer Tim Rose Sam Rhine Chris Schleicher Margaret Reitz Thomas Mehrkam Erik Ivanenko Sarmeesha Reddy Steven Tine Dave Steele Simeon Simeonov David H. Whittington Ian MacDonald Hans Ridder Todd Mullanix Hai Vu Paul Francis Kristopher Johnson Dave Butenhof Dominic Williams Srikumar Kareti Ian Pepper Kevin Lyda James D. Rucker Brian Wallis Sandeep Goyal English Malc Frank O'Dwyer Long Hoang Steven D. Chen Alain Magloire Jim Rogers Nick Sawadsky David Brownell Richard Stallman Casey Lucas Brian C. Olson Joseph A. Condlin Serge Du Mike Mazurek Christian Schuderer John R. Taylor Bill Tovrea Wallace Owen Vyacheslav A. Batenin Edwin D. Windes Christopher Kohlhoff Andreas Terstegge Stefaan Kiebooms Keith Nichol Rebecca Sanford Ram Vishnuvajjala Tom Bradley Shaun Ohagan Dale Wood Robert Flanders Gul Onural Stephen E Blake Eric S Rosenthal Sridevi Subramanian Bruce Trask Jake Hamby Rick Weisner Dennis C. De Mars V dot Lakshmanan Hata Yoshiaki Vidya Narayanan Sean Landis Youzhong Liu John Weald Gilbert Roulot Gildo Medeiros Junior Brian Peterson Fabrice Podlyski Darren DeRidder John Tucker Oleg Orlov Timothy Canham Randy Heiland Joyce Fu Surender Kumar Pradeep Avasthi Guicheney Christophe Madhu Konety Isaac Stoddard Alvarez Peter Brandstrom Eugene Surovegin Thaddeus Olczyk John Chludzinski Pedro Alves Ferreira Bruce Edge Dan Butler Ron MacKenzie Craig Rodrigues Phil Y. Wang David Brock John Morey Dwayne Burns Denis Ouellet Stefan Ullrich Brian Raven Gheorghe Aprotosoaie Carsten Zerbst Paul Calabrese Stephane Chatre James Whitledge Erik Johannes Alex Hornby Riaz Syed Clarence M. Weaver Roger Egbers Ralf Kluthe Ruud Diterwich Bill Nesbitt Will Skunk David Digby Timothy Schimke Jim Robinson Peter Mueller Raghu Nambiath Mike Gingell David McCann Ruediger Franke Brian Jones Michael Garvin Mike Vitalo Kirk Davies Arno Pernozzoli Trey Grubbs Matthias Schumann John Gathright Alexander Villatora Hoang Duong Michael Roth Craig Anderson Mitsuhiko Hara Weihai Yu Tal Lev-Ami Chris Zimman Rick Wesson Sridhara Rao Dasu Walter Welzel Anthony Shipman Tobin Bergen-Hill Toshio Hori John Mink Duane Binder Randall Sharo Dave Madden Cliff_H_Campbell Narendra Ravi Krishnakumar B. David Sunwall Brian Wright Yosi Sarusi Robert Shewan Skye Sweeney Lars Immisch Stefan Wendt Herbert Clarence Bishop Giga Giguashvili Philipp Slusallek Matthew Davis Janusz Stopa Rusty Conover Phillippe Merle Mark Winrock Boris Kaminer Martin Botzler Lorin Hochstein Wenli Bai Harry Forry Jose Rubio Joerg Pommnitz Mogens Hansen Shafiek Savahl Pierre Grondin John Masiyowski Uwe Landrock Klaus Banzer Probal Bhattacharjya Dmitri Katchalov Alok Gupta Chien Yueh John K. Black Kamen Penev Gregory Yarmit Jarek Tomaszewski Siegurd Weber Fabrizio Giannotti Harald Finster Fritz Bosch Charles Frasch Chris Hafey Rick Hess David Dunn Jaymes Galvin Marat Sergey Nemanov Vladimir Kondratiev John Glynn Raymond Wiker Michael Pitman Joseph Jefferson Engelbert Staller George Ball Dennis Noll Ronald Fischer Marvin Allen Wolfthal Dan Gilboa Sean Boudreau Shalini Yajnik Matt Thompson Peter C Chien Bruce Alderson Christoph Poggemann Travis Shirk Alain Sauron David Delano Boris Sukholitko Brian Mason Thomas Groth Damien Dufour Paulo Breda Vieira Samuel Stickland Bryan Van de Ven Greg Siebers Rob Gabbot Paul Carreiro Jovan Kilibarda Derek Dominish Devesh Kothari Stephen Moon Hani Mawlawi Benedikt Eric Heinen Jason Topaz Alexander Dergatch Airat A. Sadreev Klaus Hofmann Miroslav Koncar Extern Chatterji Zach Frey Ruibiao Qiu Marcelo Matus R Seshardi Stephan Kulow Alexander Belopolsky Ben Bourner Lalitha Chinthamani Thomas Huang Sankaranarayanan K. V Ephraim Vider Reid Spencer Kevin Dalley Jan Nielsen Jochen Linkohr Mirko Brandner Yuval Yosef Chad Elliott David X. Callaway Soren Ilsoe Eric Hopper Martin Johnson Pierre Oberson Chris Uzdavinis Ishay Green Andrey Nechypurenko Charlie Duke Jonathan Luellen Andrew Psaltis Erik Jones Ted Burghart Mike Winter Judy Ward Ken Block Jamshid Afshar Jerry Jiang Rob Ruff Hugh Arnold Hessel Idzenga Mark C. Barnes Suresh Kannan Alex Scholte Greg Jansen Raj Narayanaswamy Iain Melville Daniel Lang
Chris Leishman Klemen Zagar Rick Ohnemus Adamo, Vince Defang Zhou Dave Zumbro Ted Nolan Jianfei Xu Alvin C. Shih J dot Scott Evans Alex Luk Kenneth Osenbroch Jason Czavislak Alex Chachanashvili Gilbert Grosdidier James Briggs Herbert Wang Anders Olsson Sergey Gnilitsky David Wicks Girish Birajdar Hajdukiewicz Markus Gerwin Robert Alia Atlas David Hall Todd Gruhn John Hickin Alex Brown Rich Seibel Jim Scheller Bob Bouterse Sandeep Adwankar W Craig Trader Bruce McIntosh Natarajan Kalpathy David O'Farrell Bob Bouterse Malcolm Spence Dong-Yueh Liu Craig Ball Norbert Krain Adrian Miranda Cody Dean Hans Scharkowitz Charles Meier Tim Sim Shalabh Bhatnagar Charles Scott Espen Harlinn mulder Richard L. Johnson Tam Nguyen Jeff Graham Ralph Loader Ji Wuliu Wada Hiroshi Sal Amander Torsten Pfuetzenreuter John M. Mills David McWeeny Florian Lackerbauer Manuel Benche Steve Luoma Roger Tragin Alex Bangs Yangfen Qiu Johnny Chen John Foresteire Larry Peacock Francisco Bravo Antti Valtokari John Smyder Mathew Samuel Conrad Hughes John Rodgers Charles Taurines James Lacey Nick Pratt Xiaojun Wu George Lafortune Aoxiang Xu Dima Skvortsov Moore Y. Cao Wai Keung Fung Michael Laing Benoit Viaud Ken Weinert Ferran Boladeres Salvad Steve Vranyes Jim Melton Ron Klein Anuj Singhal Henrik Kai Dominic Hughes Lior Shalev Charlie Duke William Horn Greg Hall Aviad Eden Vianney Lecroart Russell Mora Samir Shaikh Eric Yee Matt Emerson Yiu L. Lee Pedro Brandao Hakon Innerdal Sami Aario Ingo Dahm Vijay Aswadhati Xiaowen Wang Warren Miller Youngkwan Cho Dorr H. Clark Dave McNeely Eric Malenfant Roland Fischer Alexander Libman Roger Larsson Martin Stack Michael Ravits Derek Viljoen Hamed Azizadah Keo Kelly Joachim Achtzehnter Tomer Amiaz Sergey Osokin Nick Logvinov Viatcheslav Batenine Shashi Bhushan Javier Corrales J dot Randy Pitz Richard Reitmeyer Xavier Montet Letha Etzkorn James Dabbs Matej Sekoranja Mattias Eriksson Nicoletta Viale George Reid Kim Lester Wilson Chan William Rucklidge Victor Krebss Chander P. Thareja John Mills Haifeng Lee Hans Utz Askok Kumar Kalanithi Chris Able John Hiltenbrand Steve Hespelt Peter Fischer Madhu Ramachandran Caleb Epstein Bruno Marconi Ken Childress Michael Kramer Johnny Willemsen Jonathan Astle Javier Lopez Sanchez Nir Drang Albert Wijnja Marcel Van Der Weert Mervyn Quah Giovanni Zito Matthew Adams Sameer Schabungbam Jeff Butler Roland R�denauer John Buckman Guy Rosen Bennett R. Stabile Paul Caffrey Low Aik long Michael Rinne Jaffar Shaikh Roger Beck Trueman Bill Harold Bien Mateu Batle Philip Miller Base V Paul Evghenii Filippov Mike Curtis Jessie Ragsdale Shourya Sarcar Eric Crampton Sandip Patel ChenXu Vsevolod Novikov Brendan Corcoran Steve Sivier Rick Schneeman Klaus H. Wolf Jean-Christophe Dubois Michael Hampel Wei Zheng Bernd Annamaier Joachim Tremouroux Momchil Velikov Munagala Ramanath Kevin Marshall David Channon Andy Guy Oscar Rodriquez Jonathan Cano Alain Decamps Paul Rubel Jon Loeliger Ricardo Chan Sarabjeet Duhra Michael Rushton Arno Pernozzoli Calum Mitchell Jerry Odenwelder Kent Stewart Alexander Kogan Michael Lindner Arnaud Compan Michael Searles Bogdan Jeram Sebastian Schubert Li Zhou Shivakumar Patil Steve Olson Allen Broadman Yuriy Zaporozhets Joe Guan Attilio Dona McGanahan Skjellifetti Matthias Wittig David Allen Edwin McKay Scott Bolin Mike Anderson David Singer Nick Lin Ron Hashimshony Max Khon Jonas Nordin Jonathan Stockdale Jean-Francois Daune Wei Chiang Rick Stille Kirill Kuolechov Edwin Wrench Yung Trinh Richard Eperjesi Ben Strong David Karr Sathish Tiptur Lu Yunhai Christian Ewald Samuel Qi Luo Sergey Logvin Orlando Ribeiro Doug Warner Kevin Regan Andy Olson Max Voronoy Alexandr Gavrilov Scott Gunn Mason Deaver Richard Huber Glen Osterhout YingLi Haka Sam Chong Virgilijus Globis Stefan Scherer Pim Philipse Michael Grove John Mackenzie Ricky Marek Patrick Maassen Christian Schuhegger David L Smith Rainer Doerntge Tompa Derek Horton Shameek Basu Dipti Jain Eric Zuur Jeffrey J. Persch Rahul Shukla Pierre Fayolle Greg McCain Matt Cheers Benjamin Fry Ram Ben-Yakir Eric Desamore John Ashmun Przemyslaw Marciniak Carsten Madsen David Sperry Ted Horst Diana Arroyo Benny Prijono Roland Ziegler Stelios Sfakianakis Mike Letchworth Brian Gilmer James Dunham Juergen Pfreundt Joel Sherrill Jules Colding Stephane Pion Raghu Narayan Richard Goold Nathalie D'Amours Albert Pariante Stephen Torri Philippe Perrin Gunnar Buason David Hanvey Jeff McNiel Georg Lohrer Rachel G Smith Tom Lake Logan Modahala Jean Malenfant Victor Poznyak Juan Jose Comellas James Dorsey Benot Desmeules Tom Moog Stan Pinte Dayisi Peter Georgakakis Richard Hardgrave Mark Drijver Guy Bolton King Carlton Teel Alexandre Cervieri Darren Griffith Sam Mok Josh Curry Norman Wilson Itzhak Briskman James Kanyok Corey Trager Kirat Singh Oleg Pavliv Frederick Niemi Andrew Munro Nicolas Huynh Kevin Burge Wayne Erchak Yew Khong See Greg Thompson Mike Pyle Kobi Cohen-Arazi Israel Illescas Gomez Brodie Thiesfield Erik Toubro Nielsen Masaoud T. Moonim Steve Witten Gil Rapaport Boris Temkin Steve Perkins Jerry Thomas cuma Ron Heald Andrew Finnell Dan Levi Rob Andzik James Maynard Francois Rioux Ophir Bleiberg Allen Kelly Victor Pitchouc Srikanth Vedire J Shane Culpepper Steffen Hieber Craig L. Ching Ben Howard Rich Newman Kelly F. Hickel David Trusty Burkhard Neppert Crawford Lodge Scott Gaa Jenny Kowald Oren Zeev-Ben-Mordehai Holger P. Krekel Glenn Popelka Tibor Kiss Robert Davidson Peter Crowther Mouna Seri Vladimir Chovanec Alexander Rieger Glen Coakley Scott Plant Wilfried Reinoehl Sangeetha Ramadurai Victor Chernenko Frank Wolf Christophe Galerne Scott Harris Stefan Kluehspies Egon Wuchner Ugendreshwar Kudupudi Ekkehard Hoffmann Ted Krovetz Grzegorz Sikora Fabris Christina Junru Patrick Rabau Hyman Rosen Torbjorn Backstrom Robert Burke Olivier Brunet Bret Clark Steve Rahn Bertrand Motuelle Blair Zajac Gary Duzan Garry Shamis Eamonn Saunders Yev Omenzel John E Hein Tino Schwarze Gergely Timar Peter Phillips Yury Kuznesov Daniel Manfis Massimo Pichini Eyal Neuman Dave Hale Giulio Agostini Werner Buchert Kevin Cline Mahesh Varadarajan Olof Lindfors Tom Wagner Kyle Brost Vincent Nicolas Jonathan Wackley Jan Kalin Andreas Huggel Alain Totouom Tushar Nair Sunny Leung Bonifides Bautista Brad Hoskins Donald Acton Hagen Ulrich Adrian Mercieca Lars Steubesand Heping He Leo Kov Suresh N David Arndt Tad Hetke Graeme Clark Gu Song Chris Hughes Fikri Pribadi Ioulia Passynkova Steve Osselton Doron Rajwan Stuart Jones Guillaume Renaud Tommy Svensson Jstwo Hartmut Quast Ulrich Voigt Syed Wasim Ali Bo Balder Michael Sawczyn Ildar Gabdulline David Yongqiang Wang Shahzad Aslam-Mir Andrew Foster C Chan Alexey Chalimov Andrea Bernicchia Praphul Menon Patrick N Garth Watney Jim Connelly Eyal Lubetzky Gaoyan Xie Michael Brinkmann Chatchai Khumboa Andrey Shkinev Michael Graf Justin Michel Robert Martin Charles Meidinger Petr Tuma Greg Burley Marvin Greenberg Mike Connors Ben Flight Bob Jolliffe Jesse Robert Handl Keith Snively Ahmed Riza Miljenko Norsic David Robison Preston Elder Eric Peters Edward A Thompson Eugene Alterman Patrick Cosmo Ran Kohavi Harvinder Sawhney Sorin Iordachescu Mahesh Vedantam Brian Olson Roy Sharon Charlie Grames Tom Howard Michael Gillmann Yaniv Ben Ari Victor Terber David Sanders Yoram Zini Sean McCauliff Shmulik Regev Andrew L. Shwaika Gerhard Voss Gregor Bruce Ian Cahoon Alexei I. Adamovich Sohail Husain Jerome Julius William R Volz Koushik Banerjee Zoran Cetusic Patrick Bennett Felix Wyss Tim Rydell Petr Shelomovsky Juliana Diniz Yuval Cohen Timothy Kilbourn Marc Walrave Petru Marginean Paresh Raote Donna Maskell Steve Ige Marco Kranawetter Christian Veleba Olli Savia Bhaskara Rao G M Schulze John Michael Zorko Ami Bar David Smith Peter van Merkerk Bill Dyer Rodney Morris Mark Hoffmann Markus Wild Joe Hayes Chip Jones Patrick J Lardieri Ken O'Brien Daniel Troesser Ivan Pazymenko Dan Green Cyrille Chepelov Peter Heitman Paxton Mason Yan Dai Sean I. Luzader Renjie Tang Max V. Zinal Stan Sosnovsky Ariel Peltz Carsten Prescher Raghuram Shetty Val Dumiterscu Oleg Kraynov Stephan Gudmundson Frank Kuhlman Denis Otchenashko Marc M Adkins Jon Lambert Rainer Lucas Allan S Iverson Jeffrey Shaffer Oleg Burlachenko Jian Chen Jeff Paciga Laurent Sabourin Frank Rybak Tim Iskander Michele Amoretti Ido Yellin Eric Page Kevin Heifner James Haiar Pavel Repin Whitney Kew Tom Phan Andrew Guy Bharathi Kangatharan Jean Quinsat Ma Ting Chong Andrew Sutton Ansgar Konermann Amir Kunst Daniel Garrido Andy Alvarez Soeren Gerlach Vitaly Prapirny Sasha Agranov Ruwanganie Gunatilleke Peter Kullmann

Lyn Headley Jeff Adams Alexander Maack Timothy Culp Oleg Terletsky Bill Tonseth Frank Pilhofer Eric Quere Keith Thornton Nathan Krasney Marek Maleta David Smith Dimitrije Jankovic Frank O. Flemisch Cary Steinmetz Ty Tenait Nitin Mallya Nick Cross Christopher W. Midgley Wanjia Shanliang Cheng Andy Ling Stephen Howard Carsten T. Nielsen Adee Ran Davide Pasetto Michael Hornok Wim van den Boogaard Carol Hunsicker Joseph Sarbak Ruslan Zasukhin Colin Weaver Kew Whitney Sean Ogle Tim Bradley Kier Schmitt George Varsamis Alan Tanga Bertin Colpron Jeff Wilson Dmitry Khrapov Francois Laxmikant Bopalkar Steven Gardner Ronald Berger Jeremy Altavilla Brian Appel Lan Zhineng Leen Van Kampen James Beale Mark Xu Umberto Mascia Marcel Loose Christian Klutz Ville Lehtiniemi Chumsu Kim Schone Mullerin Cemal Yimaz Newton Aird Frederic Motte Roger Weeks Gautam Thaker Christophe Juniet Jeff W Geir Berset Ken Sedgwick Vince Mounts Vladislav Zverev Erich Hochmuth Nick S. Petrov Dmitry Botcharnikov Philippe Haussy

K2 Eric Frias Antonio Saraiva Sean M. Paus Yuanfang Zhang Jonathan Franklin Cristian Ungureanu Tommy Persson Christian Barheine Ole Husgaard Victor Kirk Sandeep Neema Mike Curtis Artashes Ghazaryan Ashok Sadasivan Andreas Koehler Thomas Devanneaux Paul Marquis Ed Skees Marc Alter Martin Geliot Simon McQueen Jason Pasion Philipp Leibfried Erwin Rol Dirk Moermans Huseyin Calgin Jaroslaw Nozderko Sharon Caspi Thomas Natterer Wilbur Lang Rick Marlborough David-A O-Brien Shelton Tang Frederic Langlet Antonio Leonforte Pablo d'Angelo Christophe Vedel Uwe Jaeger Viktor Ransmayr Daniel Bell Mathias Waack Mike Nordell Tufan Oruk Tim Smith Andy King Eric Strennen Abhay Kulkarni Ron Muck Ma Weida Terry Lao Volker Boerchers Tim Pullen Marc Tardif Guan Joe Petr Ferschmann Greg Mulyar Max F. Bilyk Danile White Andrew Marlow Michael F"olsl Vincent Chau Theo Landman Igor Pisarenko Dima Scub Volodymyr Orlenko Grigory Michael Soden Dennis Sporcic Emmanuel Thevenot Beaufort Denis Parnaland Matthias Blankenhaus Wolfgang Schroeder Mario Hofmann Bruce MacDonald Jeffrey Graham Otis Nyandoro Ray Limpus Dmitri Belogaj Will Christof Ferran Boladeres Salvad Juan Carlos Montes Costa Edward Scott Steve Spencer Fukasawa Mitsuo Martin Brown Terry Mihm Jeff Gray Rob Eger Leonid Kvetnyi Rudolf Weber Sergei Pimenov David Kinder Sebastien Lalonde Jia Wan Bertin Colpron Weston Markham Bryan Thrall Subhabrata Biswas Dave Ryan Zsolt Zsoldos Tongzhe Cui Braden McDaniel Richard Woodring Andras Lang Scott Gammil Nick Lewycky Ira Burton Thomas Wiegert Craig Watcham Pit Linnartz Peder Norgaard David Ohlemacher Ken Kane Bill Church Udo Berninger Vincent Korkos Martin Corino Terry Lacy Branko Mijic Jeff Kelley Daniel Hannum Jason Cohen Nick Kukuczka Andrew Voumard Anand D.J. Dwyer Douglas A Stuart Victor N. Francesco Baldi Michael Rice Jesse Greenwald Raymond Hoofman Jason Smith Danta Cannarozzi Valery Salamakha Karim Fodil-Lemelin Wenlong Tang Manish Jain Robin Farine Roland Schimmack Roy Pollock Eric Held Kees van Marle Dieter Knueppel Amol Tambe Emiliano Berenbaum Scott Clarke Sunil Rottoo Martin Habets Todd Cooper Serkan Unsal Milan Cvetkovic Didier Becu Dan Halbert Jerome Waibel Stephan Frenzel Bruce Jones Tim Hawes Philip Leishman Alexander Jasper Gerard Grant Trevor Fields Jeff Dugan Jeff Mirwaisi Alain Dupont Stephan Bettermann David McKen Adam Fanello Matthieu Vansteene Sean Rooney Enrico Detoma Onopin V. Mikhail Edward R. Mulholland Brian Buesker Vladimir Naylov Ted Mules Mike Hepburn Dale Wilson Thomas Girard Malcolm McRoberts Dror Tirosh Chris Sontag Moran Levi UV Wildner Alan l Batongbacal Gary Maxey Yoav Borer Andre Kleibeuker Andy Bellafaire John Fletcher Terry Ware Pierre Pacchioni Roger Beathard Konstantinos Margaritis Stephen Procter Christoph Liebig Andre Kostur Markus Stenberg Jonathan Pollack Si Mong Park Hakim Souami Paul Morrison John Poplett Heiko Bachmann Andrew Metcalfe Simon Dutkowski Mickael P. Golovin Shannon Barber Brad Orner Michelangelo Nottoli Peter Bekiesch Martin Kaul Lukas Gruetzmacher Robert Schiele Matthew Grosso Akim Boyko Nils Sandoy Daniel Miranda Hans-Peter Bock Dmitri Hrapof Denny Kolb Daniel Buchs Matt Murphy Brian Nelson Avi Ouziel Matthew Gillen Chris Reed Andrew Reid Praveen Sharma Yi Zuo Raphael Bossek Richard G. Hash Karl Tredwell Norm Whitehead Jiang Wei Kevin Bryan Zvika Ashani Thomas Costa Dom Monteiro Jean-Marc Prud'homme Yury Osadchy Pavan Mandalkar Scott Willey David Calkins Wu Yongwei Karen L. Regner Michel Drapeau Hans Bos Kevin Stacy Liat Andreas Wagner Steven Xie Kris Dekeyser Matthew Harris Abhijit Sachdev Mikael Lundqvist Peter Hercek Jay Welch Angel Roman Jessica Pistole Paolo Carlini Eric Whorter Vincent Seignole Jingbin An Roland Meub Marek Brudka Levente Torok Panagiotis Issaris Mehrdad Nazari Pierre Bisaillon Rob Boyer Scott Gammill Bayu Hendradjaya Randy Hammon Bill Cassanova Matthew Corey Vinod Kumar Mirek Pabich Christian Egeler J.T. Conklin Dale Hawkins Bill Hopkins David Fleeman Merlin Ran Kevin Christian Trina Wisler Bae-Sik Chon Benjamin Bronk Dave Craig Ofira Shaer Ciaran Moran Thomas Rohner Ken Descoteaux Claas-Hinrich Dommreis Yateen Joshi Sergei Kuchin Theckla Louchios Randy Secrest Patrice Marques Stanislaw Trytek Mattias Nilsson Michael Hollins Dave Knox Lance Paine Brian Waltersdorf Johann Kandlbauer Adam Rymarczuk Heiko Nardmann J. Abelardo Gutierrez Roger Sala Razi Ben-Yehuda Geo Sebastian Simon Massey Rich Shapiro Ramiro Morales Andrew Athan Sebastien Roy Matthew Townsend Rick Robinson John D. Robertson Paul Lew Eider Oliveira Jeff Jones Jean-Christophe Cota Paul Vincent Newsum Vasili Goutas Iliyan Jeliazkov Shlomi Yaakobovich Todd Marshall Ciju John Yuk Ming Kwok Honorato Saavedra Domingos Monteiro Bill Somerville Bjorn Roald Michi Henning Xue Yong Zhi Ertugrul Sorar Simone Viani Rohan Mars Robert S. Iakobashvili Chris Hammond Vincent Spano Nuno Silva Greg Bostrum Dipa Suri Adam Howell Steven Frare Dave Dalapati Arjun Thounaojam Michael Altmann Steven Patrick Pete McCann William Nagel M. C. Gahan Thia Chang Chao Gao Xianchao Huang Rui Sam Abbe Mike McGahan David Michael Steve D. Baker Martina Yen Kim ByeongSu Doug McCorkle YiQing Xiong Peter Falsh Don Sharp Arto Jalkanen Scott Zionic Diana Ukleja Shaun Cooley Aapo M�kinen Matt Emerson Sean Parker Mark Wilson Joerg Rockel Phil Chen Stefan Morrow Bruce Elliot Mitscher Dubreus Brian O'Connor Ron Wilson Peter Grotrian Alex Ott D. J. Stachniak Slava Gorelik Wolfgang Fischer Nicholas Todd Arno Wilhelm Andreas Schuler Altaf Aali Vemund Handeland Mario Di Giacomo Raoul Gough Aaron Rohini Madhavan Alan Balasuar Will Chai Paul Koch Dave Giovannini Dave Varnell Howard Finer Mark Callaghan Hanson Lu Gavin Yu Srikanth Gopal Like Ma Alvin Msg Angela Ziegenhorn Sam Mesh Felix Perez Alamillo Steven T. Hatton Yevgen Galchenko Timothy Wayne Gomez Ventimiglia Chere Frederick Heckel Ian Zagorskih Olivier Gu�rin Abdel Rigumye James Damour Alan Anderson Vito Bico Aldo Texier J H Choi Mike Chartier Nikolay Metchev Anand Rathi Vitaly Belekhov Dorian Hileaga Steve Williams Paul Friberg

Zachi Klopman Jin Zhi Ye David Carlton Feng Li Michael van der Westhuizen Jan Zima Francesco Salvestrini Sandeep Deshpande Hubert Talbot Oh Yoon Sik Anton Bakanovskiy Toha Bakanovsky David Faure Robert Hancock Peter Oslej Yongming Wang Vadim Iosevich Mike Knight Nathan Anderson Eyal Car Jonathan Sprinkle Vladimir Panov Volker Lukas Bryan Cassell Guy Peleg Wallace Zhang Richard Ward Alan Stokes Rick Taylor Tobias Herzke Paul Felix Jan Ohlenburg Eric Tiangang David Hawkins Michael Klein Sandro Santos Andrade Richard Spence Thomas E Lackey luxi78 at gmail dot com John Lilley Abdullah Sowayan Nathan Bamford Zoltan Molnar William Byrne Karl Schmitt Ron DeAngelis Alex Sheh Daniel Wagner <__daniel___ at icg do tu-graz dot ac dot at> Nemoy Michael Marc Brown Andrew Keane Martin Kolleck Tino Riethmueller Adam Mitz Frank Rehberger Aaron Scamehorn Alan Kierstead Sven-Uwe Sieler-Hornke Spencer Vanroekel Dan Pozdol Yauheni Akhotnikau Axter Roopa Pundaleeka JR Andreassen Mockey Chen Vincent Joseph Igor Mammedov Yuan Adrian Tulloch Dmitriy Kuznetsov Steve Orner Bob Ronak Aleksandar Vukajlovic esIgnacio Alvarez Sergey Zubarev Qingbo Cai David White Jason Zhang Mark Paulus Willie Chen Martin Cornelius Mohit Kapoor David Gibbs Gary Fernandez Jason Zhao Keith Muzzioli John Black David Chu Kevin Hu Yasser Zabuair Phlip Michelle Zheng Gerolf Reinwardt Paul Robinson Popeye Cai David Highley Sonicfly Zhou Phil Billingham Paul Daugherty Robert Schwebel William Cote Ben Creech Michael Reed Heesuk Shin Hong Xing Winston Zhang Stefan Naewe Graeme Bell Eric Danielou Wei Jiang Dale Boan Christoph Schmalhofer Amnon Berger Ephy Levy Don Meek Liu Qian Nzer Zaidenberg Birgit Platt Andy Salnikov Hieu Ngyuen Andriy Gapon Andy Wang Zhamak Dehghani Charles Calkins Manuel Traut Drew Reynaud Artur DeEsperanto Scott Mitchell Thomas Vanier N Johnson Adam Nagel Robert Neumann Venkat Juraj Ivancic Daniel Black Richard Ridgway Vadym Ridosh Viola Wang Ray Lischner Sergey Kosenko Pavel Zaichenko Paul Riley Nelson Filipe Ferreira Gon�alves Harry Goldschmitt Sail Zeng Markus Henschel Asif Lodhi Andrew Schnable Grigoriy Zeleniy Yves Alloyer Waba Scott Mark Bjoern Rasmussen Ian C White Dennis Chernoivanov Werner Burger Andres Hurtis Joe French M. Arshad Khan Hans van't Hag Roland Sun Vance Maverick John McCabe Andres Oportus Olof Granered Eric Hughes Zhenghao Shi Alexander Kornienko Ben Mohlenhoff Bill Bruns Dmitriy Nikitinskiy Ravi Kanth Ian Roberts Patrick Spiering Duane Beck Kanghee Yoon Xu Liang Leo Lei Jules d'Entremont Rajiv K. Shukla Haibin Zhang Vikram Karandikar Kim J. Schmock Venkat Forums James Marsh Shaolong Xiang Christoph Hofmann Vladimir Zykov Daniel de Angelis Cordeiro Hal Black Peter Korf Norbert Thoden Premkumar P David Beck Hayim Shaul Erman Balcik Torsten Saliwada Nathan Glasser Gr�gor Boirie Alex Solan Venkat Sidhabathuni Nathan Ernst Kun Niu Karl-Heinz Wind Oliver Spang Hu Yi Joe Seward Tom Callaway Alick Nie Douglas Atique Nayeem Khan Sorin Voicu-Comendant Andi Heusser Paul Carter Michael Carter Alain Kocelniak Alvaro Vega Garcia Fernando C. Jeronymo Stephen Mouring Tim Thomas Brownridge June Fang Bill Kendall Ittehad Shaikh Michael Doubez Namrata Gandhi <...> Michael Guntli Frank F�rster Roger Leblanc Bob Fiske Julien Vintrou Jonathan Brannan antred Nathalie D'Amours Mele Giovanni Philipp Thomas Mark Hebbel Tim Pollock Jack Lavender Alexandre Skrzyniarz E Vahala Christian Fromme Daniel Lang Greg Bothe Anand Kumar Joe Pallas Marcel Smit Florent Vial Pan Kai Luna Jesus Martinez Martin Gaus Steve Stallion Ron van Hoof Joe Lihn Jani Hakala Marcus Monaghan Kashif Khan JD Robertson Andreas Drescher Alon Diamant Igor Rayak Shai Kedem Steve Ramsay Skrzyniarz Alexandre Rob Beekmans Steven Hartmann Dicky Boyan Kasarov Brendan Murphy Ryan Carmichael Koh Onishi Markus Gaugusch Annette Wilson Sharon Mizrahi William Glenn Christian Ehrlicher Hui Zhang Marijke Hengstmengel Christian Freund Chris Shaw Matthew Carter Denis Budko Gaurav Kulshreshtha Wolfgang Pickartz Joost Kraaijeveld Pau Garcia i Quiles Sail Zeng Dirk Bonekaemper Sreejith Guillaume Lahaye Andrew Kaplan Alexander Mintz Jennifer Kahng Trent Nadeau Nick Meyer Olivier Langlois Patrick Soboljew Tim Pinkawa Ed Blackmond Dave Inma Perea David Ward Anatoli Sakhnik Max Zhou Daynesh Mangal Robert Shectman Rafi Kannan Ramaswamy Brian Johnson Catherine L. Paquin Susan Finster Frank Preischl Matthew Waller Elez Ranjit Hande Van Vuong Mark Wendsomde Yameogo Shi John Helmut Böing Andrew Hill Henk Jan Priester Glenn Zickert Chris Galli Laura Autn Garca Jonathan Saxton Remko Duppen Paul Fitzpatrick Chad Beaulac Jochen Meier Thomas Pauli Qiao Zhiqiang JaeSung Lee Chong Wuk Pak Michael Frommberger Andrey Karpov Dmytro Ovdiienko Andrea Sormanni Thomas Stegemann David Simmonds Andreas Drscher Markus Manck Deux deVille Mohsin Zaidi Milind Pangarkar Ali Akbar Zarezadeh Andrs Senac Gonzlez Peng Xu Sergey Onuchin Michael Ganz Phillip LaBanca Journeyer J. Joh Rudy Pot Neil Youngman Andreas Florath Clyde Gerber George Chen Piotr Kow Yogesh Sharma Mike McKnerney Mike Ketchen Erik Sohns Winston Jenks Colin Shen Alexey Zubko Michael Dille Sebastian Perk David Lifshitz Milo H. Fields Thomas Schmidt Joe Zendle Cesar Mello I would particularly like to thank Paul Stephenson, who worked with me at Ericsson in the early 1990's. Paul devised the recursive Makefile scheme that underlies the ACE distribution and also spent countless hours with me discussing object-oriented techniques for developing distributed application frameworks. Finally, I'd also like to thank Todd L. Montgomery , fellow heavy metal head, for fulfilling his quest to get ACE to compile with GCC! In conclusion, our goal is to see ACE+TAO+CIAO continue to evolve and become a more comprehensive, robust, and well-documented C++ class library that is freely available to researchers and developers. If you have any improvements, suggestions, and or comments, we'd like to hear about it. Please see the instructions in $ACE_ROOT/PROBLEM-REPORT-FORM $TAO_ROOT/PROBLEM-REPORT-FORM $CIAO_ROOT/PROBLEM-REPORT-FORM $DANCE_ROOT/PROBLEM-REPORT-FORM for instructions on submitting suggestions or fixes. Thanks, Douglas C. Schmidt d.schmidt at vanderbilt.edu ace-8.0.4+dfsg.orig/VERSION.txt0000644000175000017500000000042615027201773015057 0ustar sudipsudipThis is ACE version 8.0.4, released Thu Jun 26 10:19:50 CEST 2025 If you have any problems with or questions about ACE, please open a issue or discussion on the ACE_TAO github project at https://github.com/DOCGroup/ACE_TAO using the form found in the file PROBLEM-REPORT-FORM. ace-8.0.4+dfsg.orig/docs/0000755000175000017500000000000015046037655014126 5ustar sudipsudipace-8.0.4+dfsg.orig/docs/index.html0000644000175000017500000000564315027201773016124 0ustar sudipsudip ACE Documentation Home


ACE Documentation Home

Everything you've always wanted to know about ACE, but were afraid to ask.


ACE Documentation


ACE Structure


Technical Papers and Tutorials

  • Technical Papers - Postscript versions of many ACE papers.
  • Tutorial on C++ Network Programming with Patterns, Frameworks, and ACE[pdf]
  • ACE FMM - ACE "Frequently Made Mistakes"

Bug Reports


ACE Development


Other Stuff

ace-8.0.4+dfsg.orig/docs/ACE-FMM.html0000644000175000017500000001673315027201773016024 0ustar sudipsudip ACE FMM
ACE Frequently Made Mistakes

symptom ACE_Task::getq() returns the error resource temporarily unavailable
probable cause Your Task is a subclass of ACE_Task<ACE_NULL_SYNCH> and you are using it in a multithreaded program.
solution Try using ACE_Task<ACE_MT_SYNCH> instead so that the associated Message_Queue is configured for access by multiple threads.

symptom ACE_Task::wait() throws an assert violation
probable cause When you activate()d your Task, you specified THR_DETACHED, which causes wait() to be unable to perform what you want it to.
solution Make sure you specify the flag THR_JOINABLE when activating your ACE_Task object.

symptom Apparent race conditions when spawning threads (or activating Tasks) from within a constructor.
probable cause You are not guaranteed to have a valid this pointer until the constructor has exited. Threads spawned from a constructor are free to run immediately, and may attempt to use an invalid this pointer.
solution Move your Task activations and other thread-spawning activities out of the constructor.

symptom Compiler issues warnings/erros regarding using too few template arguments, such as "'ACE_Svc_Handler' : too few template arguments".
probable cause Instead of using the appropriate macro, you supplied an actual class name as a parameter. This will fail depending upon platform and compiler, due to the way templates are handled.
solution Instead of instantiating a template class like ACE_Svc_Handler<ACE_SOCK_Stream, ACE_NULL_SYNCH>, use the form of ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> which circumvents the platform peculiarities by using the macro. This also applies to some other template classes.

symptom Unable to compare ACE_thread_t variables (such as ACE_Thread::self()) using operator== ().
probable cause On some platforms, thread ids are numeric, and on some, they aren't. On some implementations, simple a == b comparisons are legal and sane. Some are not.
solution Use the ACE_OS::thr_equal() function to reliably compare thread ids, regardless of platform.

symptom ACE_Reactor::run_event_loop() does not seem to function correctly for a Reactor created in your application.
probable cause You have not set the ACE_Reactor::instance() to refer to your new reactor. run_event_loop only functions on the reactor currently installed as the global Singleton.
solution Use the ACE_Reactor::instance(ACE_Reactor *, int delete_reactor = 0) static method to install your reactor as the global Singleton before calling run_event_loop().

symptom Infinite recursion when you invoke ACE_Reactor::remove_handler()
probable cause You are invoking remove_handler() from within handle_close() (or a method invoked by handle_close()) but you have not specified the DONT_CALL flag.
solution Be sure to OR in the DONT_CALL flag in this situation.
e.g. --
    int MyHandler::handle_close (ACE_HANDLE handle,
                                 ACE_Reactor_Mask close_mask)
    {
        ...
        my_reactor_->remove_handler( this,
                                    ACE_Event_Handler::READ_MASK |
                                    ACE_Event_Handler::DONT_CALL );
        ...
        return 0;
    }
    

symptom Application crashes after deleting Event_Handler.
probable cause You left a dangling pointer to the Event_Handler in the Reactor. It is the application's responsibility to remove all pending notifications, timer events and completely remove the event handler I/O registrations before removing the event handler. Also, the application should remove the event handler from the reactor before closing the underlying file descriptor / handle. Otherwise:
  • The reactor does not know how to remove the event handler, because the handle is used as the identifier for the event handlers
  • The file descriptor / handle may be reused by another thread, leading to nasty race conditions.
solution
  • Use reference counted event handlers. The reactor and the application cooperate to remove the event handler when the last reference goes away.
  • Remember to call purge_pending_notifications(), remove_handler() and cancel_timer() before deleting the event handler.

maintained by bob@werken.com
Back to ACE Documentation Home. ace-8.0.4+dfsg.orig/docs/wchar.txt0000644000175000017500000001134415027201773015767 0ustar sudipsudip /** @page wchar Wide Character/Unicode support in ACE Here's a first stab at some sort of documentation for the magic wide-character (wchar) stuff in ACE. It should be possible to compile ACE with wchar support on most platforms that ACE runs on. In some cases, we don't enable wchar support by default since it increases the footprint a bit. If you run into any problems, please use the $ACE_ROOT/PROBLEM-REPORT-FORM to let us know. @subsection wchar_overview Overview There are three different wchar configurations that ACE can use. These are no support mode, regular support mode, and full support mode (well, those are the best names I can come up with for now). @subsection wchar_nosupport No Support By default, ACE will not use wchar_t at all. This is for platforms where wchar_t does not exist or support for it is pretty flakey. @subsection wchar_regular Regular Support If ACE_HAS_WCHAR is defined, then ACE classes will be expanded to have extra methods which take in wchar_t strings. Note that all the methods available with No Support are also available here. This is the default in Windows right now, and has been tested to work on Linux and VxWorks (well, only been tested to compile/link of VxWorks). @subsection wchar_full Full Support Full support is turned on if ACE_HAS_WCHAR and ACE_USES_WCHAR are defined. Like Regular Support, both char and wchar_t versions of some methods are available, but unlike Regular Support, other methods that have char arguments or return values may have wchar_t arguments or return values. This has been tested on Windows and Linux. @subsection wchar_othermacros Other Important Macros In addition to the ACE_HAS_WCHAR and ACE_USES_WCHAR mentioned above, there are several other macros that are important when using wide character support in ACE. These other macros are used in code to conditionally switch between char and wchar_t. ACE_TCHAR is a char normally and wchar_t when ACE_USES_WCHAR is defined. ACE_TEXT ("foo") expands to "foo" normally and L"foo" when ACE_USES_WCHAR is defined. ACE_TEXT_CHAR_TO_TCHAR and ACE_TEXT_WCHAR_TO_TCHAR are used when a string that is always a char or wchar_t string needs to be converted to a ACE_TCHAR string. On the same note, ACE_TEXT_ALWAYS_CHAR is used when a string is ACE_TCHAR * and needs to be a char * string. ACE_TEXT_WIDE ("foo") is unique in that it always maps to L"foo". It is not a conditional macro. For string constants in code, ACE_TEXT is used to put the Unicode prefix (Usually 'L') before the string when needed. This is controlled by ACE_USES_WCHAR. Finally, on Windows there are a bunch of ACE_TEXT_Apicall type macros which are used to choose the correct version of a Win32 API function depending on ACE_USES_WCHAR. I'm hoping to remove these by adding a new ACE_OS_Win32 class to perform the same task, but until then these ugly macros get the job done. @subsection wchar_logmsg ACE_Log_Msg support One of the more troublesome aspect of supporting wide and Ansi strings is the fact that the format strings for ACE_DEBUG and family always had to have ACE_TEXT around them. Now this should not be the case, since ACE_Log_Msg was extended to support both types of format strings concurrently. This is okay, but when strings are printed out via the format_string, care has to be taken. It is interesting how Unix and Windows treats the format specifiers differently, based on their history. Win32 uses %s, %c, %S and %C, whereas Linux seems to use %s, %c, %ls, and %lc. And they even treat %s and %c differently. The route ACE takes is a bit of a mixture of both: - %c: prints out an Ansi character - %C: prints out an Ansi string - %s: prints out an ACE_TCHAR string - %w: prints out a Wide character - %W: prints out a Wide string An example, which will also function correctly even when ACE_USES_WCHAR is defined: @verbatim void print (char *a_str, wchar_t *w_str, ACE_TCHAR *t_str) { ACE_DEBUG ((LM_DEBUG, "%C %s %W\n", a_str, t_str, w_str)); } @endverbatim @subsection wchar_win32macros Relation to Win32's UNICODE and _UNICODE macros It used to be that in previous versions of ACE that the Win32 macros affected ACE in some way. This has been all removed in favor of the ACE_USES_WCHAR and ACE_HAS_WCHAR macros. Along with this, the definition of some of the Win32 string types (LPTSTR, LPCSTR, etc.) have been also removed. Since this isn't a direct concern of ACE, they will have to be defined separately if they are needed on non-Win32 platforms. The way I'd recommend doing this is to add the typdefs to config.h. @subsection wchar_legacy Legacy Support Most of the old macros (ACE_HAS_UNICODE, ACE_HAS_MOSTLY_UNICODE_APIS) are ignored by default by ACE, since the new macros replaced them. */ ace-8.0.4+dfsg.orig/docs/run_test.txt0000644000175000017500000001731515027201773016532 0ustar sudipsudip/** @page run_test_howto How to write a run_test.pl ACE/TAO's auto_builds expect run_test.pl's to follow some guidelines that are needed to keep the auto_builds from hanging and to make sure the run_test.pl works on all platforms - The run_test must not hang or block. - The run_test must clean up any temporary files when it is done. - The run_test must not require any user input - The run_test should return a non-zero value if the test failed - When an executable can't be spawned the test should directly exit and not wait for a fail to be created by that executable - The processes should support that files names are passed through the commandline Following is an example @subsection example Example @verbatim eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; # -*- perl -*- use lib "$ENV{ACE_ROOT}/bin"; use PerlACE::TestTarget; $status = 0; my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; $plain_server_ior = "server.ior"; my $iorbase = "server.ior"; my $server_iorfile = $server->LocalFile ($iorbase); my $client_iorfile = $client->LocalFile ($iorbase); $server->DeleteFile($iorbase); $client->DeleteFile($iorbase); $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); $CL = $client->CreateProcess ("client", "-k file://$client_iorfile"); $server_status = $SV->Spawn (); if ($server_status != 0) { print STDERR "ERROR: server returned $server_status\n"; exit 1; } if ($server->WaitForFileTimed ($iorbase, $server->ProcessStartWaitInterval()) == -1) { print STDERR "ERROR: cannot find file <$server_iorfile>\n"; $SV->Kill (); $SV->TimedWait (1); exit 1; } if ($server->GetFile ($iorbase) == -1) { print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; $SV->Kill (); $SV->TimedWait (1); exit 1; } if ($client->PutFile ($iorbase) == -1) { print STDERR "ERROR: cannot set file <$client_iorfile>\n"; $SV->Kill (); $SV->TimedWait (1); exit 1; } $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); if ($client_status != 0) { print STDERR "ERROR: client returned $client_status\n"; $status = 1; } $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); if ($server_status != 0) { print STDERR "ERROR: server returned $server_status\n"; $status = 1; } $server->GetStderrLog(); $client->GetStderrLog(); $server->DeleteFile($server_iorfile); $client->DeleteFile($client_iorfile); exit $status; @endverbatim @subsection details Example Details @verbatim eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec perl -S $0 $argv:q' if 0; @endverbatim This is the standard header stuff. The eval is a trick used to get the perl script to run if it a unix shell treats it as a shell script. The SVN ID string is the usual one we put in. @verbatim use lib "$ENV{ACE_ROOT}/bin"; use PerlACE::TestTarget; @endverbatim The use lib line is used to tell Perl where the PerlACE modules are. It should NOT be a relative path to the bin directory. This is how it used to be done, but doing so would be incompatible with the "flat" directory layout of ACE+TAO. The correct way is demonstrated above. After the "use lib" line, always use $PerlACE::TAO_ROOT to reference the location of TAO. Use either $ENV{ACE_ROOT} or $PerlACE::ACE_ROOT to reference the location of ACE. And PerlACE::Run_Test is a module to be used by all run_test.pl's. It does a couple of things, including parsing some common command line arguments (like -Config and -ExeSubDir) and also brings in the PerlACE::Process module. @verbatim my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n"; @endverbatim We need to have two targets to run the tst on @verbatim my $iorbase = "server.ior"; my $server_iorfile = $server->LocalFile ($iorbase); my $client_iorfile = $client->LocalFile ($iorbase); $server->DeleteFile($iorbase); $client->DeleteFile($iorbase); @endverbatim We need to have a fully qualified path to all *.ior and *.conf files. We unlink the file immediately because we use WaitForFileTimed later. @verbatim $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile"); @endverbatim The server we have to spawn @verbatim $CL = $client->CreateProcess ("client", "-k file://$client_iorfile"); $server_status = $SV->Spawn (); if ($server_status != 0) { print STDERR "ERROR: server returned $server_status\n"; exit 1; } @endverbatim The PerlACE::Process is created with an executable and arguments. @note Unlike the old Process module, the process isn't started until one of the Spawn methods is used. We check the result of the spawn, if we couldn't spawn the process we directly exit the script. @verbatim if ($server->WaitForFileTimed ($iorbase, $server->ProcessStartWaitInterval()) == -1) { print STDERR "ERROR: cannot find file <$server_iorfile>\n"; $SV->Kill (); $SV->TimedWait (1); exit 1; } @endverbatim The WaitForFileTimed method waits until the file is created. In this way, we know when to start the client. If no IOR file is used, then you'd need to use Perl's sleep method. @verbatim if ($server->GetFile ($iorbase) == -1) { print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n"; $SV->Kill (); $SV->TimedWait (1); exit 1; } if ($client->PutFile ($iorbase) == -1) { print STDERR "ERROR: cannot set file <$client_iorfile>\n"; $SV->Kill (); $SV->TimedWait (1); exit 1; } @endverbatim This transfers the file from the server to the client in case that is needed with the used test targets. @verbatim $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval()); if ($client_status != 0) { print STDERR "ERROR: client returned $client_status\n"; $status = 1; } @endverbatim Here is an example of starting the client. SpawnWaitKill will start the process and wait for the specified number of seconds for the process to end. If the time limit is reached, it will kill the process and return -1. The return value of SpawnWaitKill is the return value of the process, unless it timed out. You don't need to check for the timeout, since SpawnWaitKill will print out a timeout error. Instead, just check for != 0. @verbatim $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval()); if ($server_status != 0) { print STDERR "ERROR: server returned $server_status\n"; $status = 1; } @endverbatim Here is the termination of the server. Servers are usually terminated either by TerminateWaitKill or just WaitKill. TerminateWaitKill is used when the server doesn't shut down itself. WaitKill is used when it does (such as when the client calls a shutdown method). Once again, we check the return status. @verbatim $server->GetStderrLog(); $client->GetStderrLog(); $server->DeleteFile($server_iorfile); $client->DeleteFile($client_iorfile); exit $status; @endverbatim This example illustrates how to get the host name within the cross platform test. In your test program add functionality to handle a command line argument to pass the host name of the target. In the run_test.pl script you can use the following code as example. @verbatim my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; my $hostname = $server->HostName(); $SV = $server->CreateProcess ("server", "-ORBEndpoint iiop://$hostname:43210"); $CL = $server->CreateProcess ("client", " -p 43210 -h $hostname"); @endverbatim And finally, we unlink any files that were created and then just exit with $status. */ ace-8.0.4+dfsg.orig/docs/ACE-categories.html0000644000175000017500000013446415027201773017534 0ustar sudipsudip ACE Class Categories

ACE Class Categories

This document groups each file in $ACE_ROOT/ace into its appropriate class category and provides a link to the C++ source code and HTML versions of the relevant manual pages.

[ACE]


Back to the ACE documentation page. ace-8.0.4+dfsg.orig/docs/ACE-lessons.html0000644000175000017500000003117415027201773017067 0ustar sudipsudip Lessons Learned Building Reusable OO Telecommunication Software


Lessons Learned Building Reusable OO Telecommunication Software Frameworks

Douglas C. Schmidt
Department of Computer Science
Washington University, St. Louis
http://www.dre.vanderbilt.edu/~schmidt/
d.schmidt@vanderbilt.edu

The following article appeared in the Lucent Bell Labs ``Multiuse Express'' magazine, Vol. 4, No. 6, December, 1996.


The Distributed Software Crisis

Developing complex software systems is expensive and error-prone. Object-oriented (OO) programming languages [Stroustrup:91,Gosling:96], components [Box:97], and frameworks [Lewis:95] are heavily touted technologies for reducing software cost and improving software quality. When stripped of their hype, the primary benefits of OO stem from the emphasis on modularity and extensibility, which encapsulate volatile implementation details behind stable interfaces and enhance software reuse.

Developers in certain well-traveled domains have successfully applied OO techniques and tools for years. For instance, the Microsoft MFC GUI framework and OCX components are de facto industry standards for creating graphical business applications on PC platforms. Although these tools have their limitations, they demonstrate the productivity benefits of reusing common frameworks and components.

Software developers in more complex domains like telecom have traditionally lacked standard off-the-shelf middleware components. As a result, telecom developers largely build, validate, and maintain software systems from scratch. In an era of deregulation and stiff global competition, this in-house development process is becoming prohibitively costly and time consuming. Across the industry, this situation has produced a ``distributed software crisis,'' where computing hardware and networks get smaller, faster, and cheaper; yet telecom software gets larger, slower, and more expensive to develop and maintain.

The challenges of building distributed software stem from inherent and accidental complexities [Brooks:87] associated with telecom systems:

  • Inherent complexity stems from the fundamental challenges of developing telecom software. Chief among these is detecting and recovering from network and host failures, minimizing the impact of communication latency, and determining an optimal partitioning of service components and workload onto processing elements throughout a network.

  • Accidental complexity stems from limitations with tools and techniques used to develop telecom software. A common source of accidental complexity is the widespread use of algorithmic decomposition, which results in non-extensible and non-reusable software designs and implementations.

The lack of extensibility and reuse in-the-large is particularly problematic for complex distributed telecom software. Extensibility is essential to ensure timely modification and enhancement of services and features. Reuse is essential to leverage the domain knowledge of expert developers to avoid re-developing and re-validating common solutions to recurring requirements and software challenges.

While developing high quality reusable software is hard enough, developing high quality extensible and reusable telecom software is even harder. Not surprisingly, many companies attempting to build reusable middleware fail -- often with enormous loss of money, time, and marketshare. Those companies that do succeed, however, reap the benefits resulting from their ability to develop and deploy complex applications rapidly, rather than wrestling endlessly with infrastructure problems. Unfortunately, the skills required to successfully produce telecom middleware remain something of a "black art," often locked in the heads of expert developers.


Lessons Learned Building Reusable OO Communication Software Frameworks

Over the past decade, I've worked with many companies (including Motorola Iridium, Ericsson, Siemens, Bellcore, Kodak, and McDonnell Douglas) building reusable OO communication software [Schmidt:96]. In these projects, we've applied a range of OO middleware tools including OMG CORBA (an emerging industry standard for distributed object computing) and the ACE framework (a widely used C++ framework that implements many strategic and tactical design patterns for concurrent communication software). The following are lessons learned from developing and deploying reusable OO communication software components and frameworks in practice:

  • Successful reuse-in-the-large requires non-technical prerequisites --

    Many political, economical, organizational, and psychological factors can impede successful reuse in telecom companies. I've found that reuse-in-the-large works best when (1) the marketplace is competitive (i.e., time-to-market is crucial, so leveraging existing software substantially reduces development effort), (2) the application domain is non-trivial (i.e., repeatedly developing complete solutions from scratch is too costly), and (3) the corporate culture is supportive of an effective reuse process (e.g., developers are rewarded for taking the time to build robust reusable components). When these prerequisites don't apply, I've found that developers often fall victim to the "not-invented-here" syndrome and rebuild everything from scratch.

  • Iteration and incremental growth is essential --

    Expanding on the corporate culture theme, I've observed that it's crucial for software managers to openly support the fact that good components, frameworks, and software architectures take time to craft and hone. For reuse to succeed in-the-large, management must have the vision and resolve to support the incremental evolution of reusable software. In general, an 80% solution that can be evolved is often preferable to trying to achieve a 100% solution that never ships. Fred Brook's observation that ``Plan to throw the first one away, you will anyway'' [Brooks:75] applies as much today as it did 20 years ago.

  • Integrate infrastructure developers with application developers --

    Truly useful components and frameworks are derived from solving real problems, e.g., telecommunications, medical imaging, avionics, OLTP, etc. Therefore, a time honored way of producing reusable components is to generalize from working systems and applications. In particular, resist the temptation to create ``component teams'' that build reusable frameworks in isolation from application teams. I've learned the hard way that without intimate feedback from application developers, the software artifacts produced by a component team won't solve real problems and will not be reused.

  • Industry ``standards'' are not panaceas --

    Expecting emerging industry standards (like CORBA or TINA) to eliminate telecom software complexity today is very risky. For instance, although some CORBA ORB implementations are suited for certain telecom tasks (such as managing network elements), the semantics of higher level OMG services (such as the Common Object Services) are still too vague, under-specified, and non -interoperable. Although CORBA isn't yet suited to address certain demanding real-time performance and reliability requirements in the telecom domain, over the next 2 years we'll see CORBA-based products emerge that support such features [Schmidt:96].

  • Beware of simple(-minded) solutions to complex software problems --

    Apply simple solutions to complex problems that sound too good to be true typically are... For example, translating code entirely from high-level specifications or using trendy OO design methodologies and programming languages is no guarantee of success. In my experience, there's simply no substitute for skilled software developers, which leads to the following final ``lesson learned.''

  • Respect and reward quality developers --

    Ultimately, reusable components are only as good as the people who build and use them. Developing robust, efficient, and reusable telecom middleware requires teams with a wide range of skills. We need expert analysts and designers who have mastered design patterns, software architectures, and communication protocols to alleviate the inherent and accidental complexities of telecom software. Moreover, we need expert programmers who can implement these patterns, architectures, and protocols in reusable frameworks and components. In my experience, it is exceptionally hard to find high quality software developers. Ironically, many telecom companies treat their developers as interchangeable, "unskilled labor" who can be replaced easily. I suspect that over time, companies who respect and reward their high quality software developers will increasingly outperform those who don't.


Concluding Remarks

Developing reusable OO middleware components and frameworks is not a silver bullet. Software is inherently abstract, which makes it hard to engineer its quality and to manage its production. The good news, however, is that OO component and framework technologies are becoming mainstream. Developers and users are increasingly adopting and succeeding with object-oriented design and programming.

On the other hand, the bad news is that (1) existing OO components and frameworks are largely focused on only a few areas (e.g., GUIs) and (2) existing industry standards still lack the semantics, features, and interoperability to be truly effective throughout the telecom software domain. Too often, vendors use industry standards to sell proprietary software under the guise of open systems. Therefore, it's essential for telecom companies to work with standards organizations and middleware vendors to ensure the emerging specifications support true interoperability and define features that meet telecom software needs.

Finally, to support the standardization effort, it's crucial for us to capture and document the patterns that underlie the successful telecom software components and frameworks that do exist. Likewise, we need to reify these patterns to guide the creation of standard frameworks and components for the telecom domain. I'm optimistic that the next generation of OO frameworks and components will be a substantial improvement over those we've worked with in the past.

For more information on building reusable OO communication software frameworks with CORBA and ACE, see the following WWW URLs:

http://www.dre.vanderbilt.edu/~schmidt/corba.html

http://www.dre.vanderbilt.edu/~schmidt/ACE.html.


References

[Box:97] Don Box, "Understanding COM," Addison-Wesley, Reading, MA, 1997.

[Brooks:75] Frederick P. Brooks, "The Mythical Man-Month," Addison-Wesley, Reading, MA, 1975.

[Brooks:87] Frederick P. Brooks, "No Silver Bullet: Essence and Accidents of Software Engineering," IEEE Computer, Volume 20, Number 4, April 1987, 10-19.

[Gosling:96] The Java Programming Language, Addison-Wesley, Reading, MA, 1996.

[Lewis:95], Ted Lewis et al., "Object Oriented Application Frameworks," IEEE Computer Society Press, 1995.

[OMG:95] Object Management Group, The Common Object Request Broker: Architecture and Specification 2.0, July, 1995.

[Schmidt:96] Douglas C. Schmidt, "A Family of Design Patterns for Application-Level Gateways," Theory and Practice of Object Systems, Wiley and Sons, 1996.

[Schmidt:97] Aniruddha Gokhale, Douglas C. Schmidt, Tim Harrison, and Guru Parulkar, "Towards Real-time CORBA," IEEE Communications Magazine, Volume 14, Number 2, February 1997.

[Stroustrup:91] Bjarne Stroustrup, The C++ Programming Language, 2nd Edition, Addison-Wesley, Reading, MA, 1991.


Back to ACE home page.
Back to ACE Documentation Home. ace-8.0.4+dfsg.orig/docs/ace_guidelines.vsmacros0000644000175000017500000020600015027201773020634 0ustar sudipsudipࡱ> z , !"#$%&'()*+-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQSTUVWXYZ[\]^_`abcdefghijklmnopqstuvwxy{|}~Root Entrykw VSM_Project_MetaData*&VSM_Project_Data"pkwVSMp!uVSMPROJ r VSM7PROJEXPITMMANIFEST2FUR4K72WILP5183HK3AB876Q7DQC01@*"VSMPE R?VSMPDB mm  !"#$%&ace_guidelinesModule1>C8GX300E066L4IMAA37Q63O04OYDGDM"EnvironmentEvents>2FUR4K72WILP5183HK3AB876Q7DQC01EnvironmentEvents,500,DTEEvents,EnvDTE,DTEEvents,EnvDTE.DTEEvents EnvironmentEvents,502,DocumentEvents,EnvDTE,DocumentEvents,EnvDTE.DocumentEvents EnvironmentEvents,501,WindowEvents,EnvDTE,WindowEvents,EnvDTE.WindowEvents EnvironmentEvents,503,TaskListEvents,EnvDTE,TaskListEvents,EnvDTE.TaskListEvents EnvironmentEvents,505,FindEvents,EnvDTE,FindEvents,EnvDTE.FindEvents EnvironmentEvents,504,OutputWindowEvents,EnvDTE,OutputWindowEvents,EnvDTE.OutputWindowEvents EnvironmentEvents,510,SelectionEvents,EnvDTE,SelectionEvents,EnvDTE.SelectionEvents EnvironmentEvents,511,BuildEvents,EnvDTE,BuildEvents,EnvDTE.BuildEvents EnvironmentEvents,506,SolutionEvents,EnvDTE,SolutionEvents,EnvDTE.SolutionEvents EnvironmentEvents,512,SolutionItemsEvents,EnvDTE,ProjectItemsEvents,EnvDTE.ProjectItemsEvents EnvironmentEvents,513,MiscFilesEvents,EnvDTE,ProjectItemsEvents,EnvDTE.ProjectItemsEvents EnvironmentEvents,514,DebuggerEvents,EnvDTE,DebuggerEvents,EnvDTE.DebuggerEvents #Region "Automatically generated code, Microsoft C/C++ MSF 7.00 DS748w 18.1xI0eQJF( w 18:lB$JEK?O:lB$JEK?ODvsmacros://e%3A/proj/ace_tao_ciao/ace/docs/ace_guidelines.vsmacros/EnvironmentEventsvsmacros:\\e%3a\proj\ace_tao_ciao\ace\docs\ace_guidelines.vsmacros\environmenteventsvsmacros://e%3A/proj/ace_tao_ciao/ace/docs/ace_guidelines.vsmacros/_Startupvsmacros:\\e%3a\proj\ace_tao_ciao\ace\docs\ace_guidelines.vsmacros\_startupVW0Ā (0 }HVeW(0 }HVWe2* ^SetSite ^$ace_guidelines._Utility&$ace_guidelines._ApplicationObjects&$ace_guidelines.EnvironmentEvents$ace_guidelines$Microsoft.VisualBasic"$Microsoft.VisualBasic.VBMath"$Microsoft.VisualBasic.Constants"$Microsoft.VisualBasic.Strings&$Microsoft.VisualBasic.Interaction&$Microsoft.VisualBasic.Information"$Microsoft.VisualBasic.Globals"$Microsoft.VisualBasic.Financial&$Microsoft.VisualBasic.FileSystem&$Microsoft.VisualBasic.DateAndTime&$Microsoft.VisualBasic.Conversion$ace_guidelines&$ace_guidelines._ApplicationObjects2*P gSetTitleL g$ace_guidelines._Utility&$ace_guidelines._ApplicationObjects&$ace_guidelines.EnvironmentEvents$ace_guidelines$Microsoft.VisualBasic"$Microsoft.VisualBasic.VBMath"$Microsoft.VisualBasic.Constants"$Microsoft.VisualBasic.Strings&$Microsoft.VisualBasic.Interaction&$Microsoft.VisualBasic.Information"$Microsoft.VisualBasic.Globals"$Microsoft.VisualBasic.Financial&$Microsoft.VisualBasic.FileSystem&$Microsoft.VisualBasic.DateAndTime&$Microsoft.VisualBasic.Conversion$ace_guidelines&$ace_guidelines._ApplicationObjects2*pSetHandleTp$ace_guidelines._Utility&$ace_guidelines._ApplicationObjects&$ace_guidelines.EnvironmentEvents$ace_guidelines$Microsoft.VisualBasic"$Microsoft.VisualBasic.VBMath"$Microsoft.VisualBasic.Constants"$Microsoft.VisualBasic.Strings&$Microsoft.VisualBasic.Interaction&$Microsoft.VisualBasic.Information"$Microsoft.VisualBasic.Globals"$Microsoft.VisualBasic.Financial&$Microsoft.VisualBasic.FileSystem&$Microsoft.VisualBasic.DateAndTime&$Microsoft.VisualBasic.Conversion$ace_guidelines&$ace_guidelines._ApplicationObjects" _Vb_t_record_0>* PushVBHostIntoLibrary  $ace_guidelines._Utility&$ace_guidelines._ApplicationObjects&$ace_guidelines.EnvironmentEvents$ace_guidelines$Microsoft.VisualBasic"$Microsoft.VisualBasic.VBMath"$Microsoft.VisualBasic.Constants"$Microsoft.VisualBasic.Strings&$Microsoft.VisualBasic.Interaction&$Microsoft.VisualBasic.Information"$Microsoft.VisualBasic.Globals"$Microsof' ' @file ace_guidelines.vsmacros ' ' $Id$ ' ' @author James H. Hill <hillj@isis.vanderbilt.edu> ' ' This file contains macros for Visual Studio .NET 2003 that format ' a file according to the ACE guidelines. The following are features ' of this marco project. ' ' - Inserts two (2) spaces for every tab character ' - Removes trailing white spaces from each line ' Option Strict Off Option Explicit Off Imports EnvDTE Imports System.Diagnostics Imports System Public Module EnvironmentEvents Private bypass_ As Boolean = False #Region "Automatically generated code, do not modify" 'Automatically generated code, do not modify 'Event Sources Begin <System.ContextStaticAttribute()> Public WithEvents DTEEvents As EnvDTE.DTEEvents <System.ContextStaticAttribute()> Public WithEvents DocumentEvents As EnvDTE.DocumentEvents <System.ContextStaticAttribute()> Public WithEvents WindowEvents As EnvDTE.WindowEvents <System.ContextStaticAttribute()> Public WithEvents TaskListEvents As EnvDTE.TaskListEvents <System.ContextStaticAttribute()> Public WithEvents FindEvents As EnvDTE.FindEvents <System.ContextStaticAttribute()> Public WithEvents OutputWindowEvents As EnvDTE.OutputWindowEvents <System.ContextStaticAttribute()> Public WithEvents SelectionEvents As EnvDTE.SelectionEvents <System.ContextStaticAttribute()> Public WithEvents BuildEvents As EnvDTE.BuildEvents <System.ContextStaticAttribute()> Public WithEvents SolutionEvents As EnvDTE.SolutionEvents <System.ContextStaticAttribute()> Public WithEvents SolutionItemsEvents As EnvDTE.ProjectItemsEvents <System.ContextStaticAttribute()> Public WithEvents MiscFilesEvents As EnvDTE.ProjectItemsEvents <System.ContextStaticAttribute()> Public WithEvents DebuggerEvents As EnvDTE.DebuggerEvents 'Event Sources End 'End of automatically generated code #End Region Private Sub DocumentEvents_DocumentSaved(ByVal document As EnvDTE.Document) _ Handles DocumentEvents.DocumentSaved If document.Name.EndsWith(".mk") Or _ document.Name.EndsWith(".xsd") Or _ document.Name.EndsWith(".resx") Or _ document.Name.EndsWith(".rc") Or _ document.Name.EndsWith(".pfy") Then Return End If If Not bypass_ Then Try ' We should not convert the tabs of a MPC template file to ' spaces. The current layout of the template is well-defined ' and making any modifications to spacing is prohibited. If Not document.Name.EndsWith(".mpd") Then DTE.Find.FindReplace(vsFindAction.vsFindActionReplaceAll, _ "\t", _ vsFindOptions.vsFindOptionsRegularExpression, _ " ", _ vsFindTarget.vsFindTargetCurrentDocument, , , _ vsFindResultsLocation.vsFindResultsNone) End If ' Remove all the trailing whitespaces. DTE.Find.FindReplace(vsFindAction.vsFindActionReplaceAll, _ ":Zs+$", _ vsFindOptions.vsFindOptionsRegularExpression, _ String.Empty, _ vsFindTarget.vsFindTargetCurrentDocument, , , _ vsFindResultsLocation.vsFindResultsNone) ' We really don't care about the result of the operation. If this method ' is being executed, then it means you are saving the document. So, it ' will not matter if we save it again for safety sake. Plus, I can't seem ' to figure out how to get this method to return anything other than ' vsFindResult.vsFindResultFound regardless of the replacement succeeding. bypass_ = True document.Save() Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OKOnly, "ACE Guideline Macros") End Try Else bypass_ = False End If t.VisualBasic.Financial&$Microsoft.VisualBasic.FileSystem&$Microsoft.VisualBasic.DateAndTime&$Microsoft.VisualBasic.Conversion$ace_guidelines&$ace_guidelines._ApplicationObjects:* % GetParentWindow %$ace_guidelines._Utility&$ace_guidelines._ApplicationObjects&$ace_guidelines.EnvironmentEvents$ace_guidelines$Microsoft.VisualBasic"$Microsoft.VisualBasic.VBMath"$Microsoft.VisualBasic.Constants"$Microsoft.VisualBasic.Strings&$Microsoft.VisualBasic.Interaction&$Microsoft.VisualBasic.Information"$Microsoft.VisualBasic.Globals"$Microsoft.VisualBasic.Financial&$Microsoft.VisualBasic.FileSystem&$Microsoft.VisualBasic.DateAndTime&$Microsoft.VisualBasic.Conversion$ace_guidelines&$ace_guidelines._ApplicationObjects" GetParentWindow6*t GetWindowTitle p $ace_guidelines._Utility&$ace_guidelines._ApplicationObjects&$ace_guidelines.EnvironmentEvents$ace_guidelines$Microsoft.VisualBasic"$Microsoft.VisualBasic.VBMath"$Microsoft.VisualBasic.Constants"$Microsoft.VisualBasic.Strings&$Microsoft.VisualBasic.Interaction&$Microsoft.VisualBasic.Information"$Microsoft.VisualBasic.Globals"$Microsoft.VisualBasic.Financial&$Microsoft.VisualBasic.FileSystem&$Microsoft.VisualBasic.DateAndTime&$Microsoft.VisualBasic.Conversion$ace_guidelines&$ace_guidelines._ApplicationObjects" GetWindowTitle2*8 get_Handlex4 $ace_guidelines._Utility&$ace_guidelines._ApplicationObjects&$ace_guidelines.EnvironmentEvents$ace_guidelines$Microsoft.VisualBasic"$Microsoft.VisualBasic.VBMath"$Microsoft.VisualBasic.Constants"$Microsoft.VisualBasic.Strings&$Microsoft.VisualBasic.Interaction&$Microsoft.VisualBasic.Information"$Microsoft.VisualBasic.Globals"$Microsoft.VisualBasic.Financial&$Microsoft.VisualBasic.FileSystem&$Microsoft.VisualBasic.DateAndTime&$Microsoft.VisualBasic.Conversion$ace_guidelines&$ace_guidelines._ApplicationObjects Handle6* StartupHelper<$ace_guidelines._Utility&$ace_guidelines._ApplicationObjects&$ace_guidelines.EnvironmentEvents$ace_guidelines$Microsoft.VisualBasic"$Microsoft.VisualBasic.VBMath"$Microsoft.VisualBasic.Constants"$Microsoft.VisualBasic.Strings&$Microsoft.VisualBasic.Interaction&$Microsoft.VisualBasic.Information"$Microsoft.VisualBasic.Globals"$Microsoft.VisualBasic.Financial&$Microsoft.VisualBasic.FileSystem&$Microsoft.VisualBasic.DateAndTime&$Microsoft.VisualBasic.Conversion$ace_guidelines&$ace_guidelines._ApplicationObjects6* ShutdownHelper$ace_guidelines._Utility&$ace_guidelines._ApplicationObjects&$ace_guidelines.EnvironmentEvents$ace_guidelines$Microsoft.VisualBasic"$Microsoft.VisualBasic.VBMath"$Microsoft.VisualBasic.Constants"$Microsoft.VisualBasic.Strings&$Microsoft.VisualBasic.Interaction&$Microsoft.VisualBasic.Information"$Microsoft.VisualBasic.Globals"$Microsoft.VisualBasic.Financial&$Microsoft.VisualBasic.FileSystem&$Microsoft.VisualBasic.DateAndTime&$Microsoft.VisualBasic.Conversion$ace_guidelines&$ace_guidelines._ApplicationObjects2*T?StartupP?$ace_guidelines._Utility&$ace_guidelines._ApplicationObjects&$ace_guidelines.EnvironmentEvents$ace_guidelines$Microsoft.VisualBasic"$Microsoft.VisualBasic.VBMath"$Microsoft.VisualBasic.Constants"$Microsoft.VisualBasic.Strings&$Microsoft.VisualBasic.Interaction&$Microsoft.VisualBasic.Information"$Microsoft.VisualBasic.Globals"$Microsoft.VisualBasic.Financial&$Microsoft.VisualBasic.FileSystem&$Microsoft.VisualBasic.DateAndTime&$Microsoft.VisualBasic.Conversion$ace_guidelines&$ace_guidelines._ApplicationObjects TempObj2*ShutdownX$ace_guidelines._Utility&$ace_guidelines._ApplicationObjects&$ace_guidelines.EnvironmentEvents$ace_guidelines$Microsoft.VisualBasic"$Microsoft.VisualBasic.VBMath"$Microsoft.VisualBasic.Constants"$Microsoft.VisualBasic.Strings&$Microsoft.VisualBasic.Interaction&$Microsoft.VisualBasic.Information"$Microsoft.VisualBasic.Globals"$Microsoft.VisualBasic.Financial&$Microsoft.VisualBasic.FileSystem&$Microsoft.VisualBasic.DateAndTime&$Microsoft.VisualBasic.Conversion$ace_guidelines&$ace_guidelines._ApplicationObjects^  $0<HT`^ggppvsmacros://e%3A/proj/ace_tao_ciao/ace/docs/ace_guidelines.vsmacros/_Startup^+g/p37AIQVXt<^ 0+,-7 <g 0/011 <p03451$ H<79 :<$G l%`ABCDE#F$G0  < 0IJ Ku< 0QR S 0$VW h\XY Z[\%]0^7_B`IaTb[cfdmexfghijklmnopqrs6(;-9+;-7)?1<.8*;-@2<.;- ?@ txz#{&|2}4~5PS_ab}14@BC^amop!#$>M#) R#. P#, R#. N#* V#2 S#/ O#+ R#. W#3 S#/ R#. ) TH " X0H`x$<Xp $rying to work with has a syntax error.You need to have an active C/C++ document open with the function prototype sele6* StopDebugging $ace_guidelines._Utility&$ace_guidelines._ApplicationObjects&$ace_guidelines.EnvironmentEvents$ace_guidelines$Microsoft.VisualBasic"$Microsoft.VisualBasic.VBMath"$Microsoft.VisualBasic.Constants"$Microsoft.VisualBasic.Strings&$Microsoft.VisualBasic.Interaction&$Microsoft.VisualBasic.Information"$Microsoft.VisualBasic.Globals"$Microsoft.VisualBasic.Financial&$Microsoft.VisualBasic.FileSystem&$Microsoft.VisualBasic.DateAndTime&$Microsoft.VisualBasic.Conversion$ace_guidelines&$ace_guidelines._ApplicationObjects:*\!ReleaseIfComObjectX!$ace_guidelines._Utility&$ace_guidelines._ApplicationObjects&$ace_guidelines.EnvironmentEvents$ace_guidelines$Microsoft.VisualBasic"$Microsoft.VisualBasic.VBMath"$Microsoft.VisualBasic.Constants"$Microsoft.VisualBasic.Strings&$Microsoft.VisualBasic.Interaction&$Microsoft.VisualBasic.Information"$Microsoft.VisualBasic.Globals"$Microsoft.VisualBasic.Financial&$Microsoft.VisualBasic.FileSystem&$Microsoft.VisualBasic.DateAndTime&$Microsoft.VisualBasic.Conversion$ace_guidelines&$ace_guidelines._ApplicationObjects6* !=ReleaseObject`!=$ace_guidelines._Utility&$ace_guidelines._ApplicationObjects&$ace_guidelines.EnvironmentEvents$ace_guidelines$Microsoft.VisualBasic"$Microsoft.VisualBasic.VBMath"$Microsoft.VisualBasic.Constants"$Microsoft.VisualBasic.Strings&$Microsoft.VisualBasic.Interaction&$Microsoft.VisualBasic.Information"$Microsoft.VisualBasic.Globals"$Microsoft.VisualBasic.Financial&$Microsoft.VisualBasic.FileSystem&$Microsoft.VisualBasic.DateAndTime&$Microsoft.VisualBasic.Conversion$ace_guidelines&$ace_guidelines._ApplicationObjects e^!!==^vsmacros://e%3A/proj/ace_tao_ciao/ace/docs/ace_guidelines.vsmacros/_Startup! =< 0 0 T!H    -B>  l=!` '  <Xp.*.cctor&$ace_guidelines.EnvironmentEvents$ace_guidelines._Utility&$ace_guidelines._ApplicationObjects $System$System.Diagnostics $EnvDTE$ace_guidelines$Microsoft.VisualBasic"$Microsoft.VisualBasic.VBMath"$Microsoft.VisualBasic.Constants"$Microsoft.VisualBasic.Strings&$Microsoft.VisualBasic.Interaction&$Microsoft.VisualBasic.Information"$Microsoft.VisualBasic.Globals"$Microsoft.VisualBasic.Financial&$Microsoft.VisualBasic.FileSystem&$Microsoft.VisualBasic.DateAndTime&$Microsoft.VisualBasic.Conversion$ace_guidelines&$ace_guidelines._ApplicationObjectsF* )DocumentEvents_DocumentSaved &$ace_guidelines.EnvironmentEvents$ace_guidelines._Utility&$ace_guidelines._ApplicationObjects $System$System.Diagnostics $EnvDTE$ace_guidelines$Microsoft.VisualBasic"$Microsoft.VisualBasic.VBMath"$Microsoft.VisualBasic.Constants"$Microsoft.VisualBasic.Strings&$Microsoft.VisualBasic.Interaction&$Microsoft.VisualBasic.Information"$Microsoft.VisualBasic.Globals"$Microsoft.VisualBasic.Financial&$Microsoft.VisualBasic.FileSystem&$Microsoft.VisualBasic.DateAndTime&$Microsoft.VisualBasic.Conversion$ace_guidelines&$ace_guidelines._ApplicationObjects  exvsmacros://e%3A/proj/ace_tao_ciao/ace/docs/ace_guidelines.vsmacros/EnvironmentEvents-$ % -0W5]6^8h9i={>DGTUVWXYZ [ \P /    ;RN  "O    < /Y=qY%I%y1a ==q @@@ $0<HT`lx ,8DP\ht%SetSite)06000005%SetTitle)06000006%TSetHandle)T06000007"% PushVBHostIntoLibrary) 06000008% GetParentWindow) 06000009% GetWindowTitle) 0600000a%xget_Handle)x0600000b%<StartupHelper)<0600000c%ShutdownHelper)0600000d%Startup) /05%SetTitle)06000006%TSetHandle)T06000007"% PushVBHostIntoLibrary) 06000008% GetParentWindow) 06000009% GetWindowTitle) 0600000a%xget_Handle)x0600000b%<StartupHelper)<0600000c%ShutdownHelper)0600000d%Startup)0600000e%XShutdown)X0600000f%StopDebugging)06000001"%ReleaseIfComObject)06000002%`ReleaseObject)`06000003%.cctor)06000010*%DocumentEvents_DocumentSaved)06000029w 1 84, LXace_guidelines.EnvironmentEventsAC07EF50 $$ace_guidelines._Utility3888771C lL ace_guidelines._Startup6C9A922E-.  !=!^ g p%  ? Lvsmacros://e%3A/proj/ace_tao_ciao/ace/docs/ace_guidelines.vsmacros/_Startupvsmacros://e%3A/proj/ace_tao_ciao/ace/docs/ace_guidelines.vsmacros/EnvironmentEvents .1xI0eQJF( /LinkInfo/names/src/headerblock/src/files/vsmacros:\\e%3a\proj\ace_tao_ciao\ace\docs\ace_guidelines.vsmacros\environmentevents/src/files/vsmacros:\\e%3a\proj\ace_tao_ciao\ace\docs\ace_guidelines.vsmacros\_startup v "98StHH(' ,T2/01   !"#$%&'()*+-,.3MZ@ !L!This program cannot be run in DOS mode. $PELxI!  ~? @@ `0?K@  H.text  `.reloc @0@B`?H(hP "*b~,~,*0 ~ +*0 ~ +*0F~,~)s o ~,~)s o *0 ~  +*b~ , ~ ,*b~,~,*0 ~ +*0 ~  +*b~ , ~ ,*0 ~ +*b~,~,*0 ~ +*b~,~,*0 ~ +*b~,~,*b~ , ~ ,*0 ~  +*0 ~  +*b~ , ~ ,*0 ~  +*b~ , ~ ,*b~,~,*0 ~ +*0  o rpo o r po `o rpo `o rpo `o r'po `,8~:o r1po -(~o r;prAprGprGpo &~o rIp~ rGprGpo &rGpo &!%( o rUp( &( +*iw!:( o *v( ( , ( ( &*0"( (%( ( *&( **}**}*0( }*Vs }( *0&|~ '( , ++ +*0 { +*0 { +**0(((((((((((((((((((((((( (!(("(#(($(&((%('(((~(*0@o {rprpo ( ,t( {rprpo ( ,t( {rprpo ( ,t ( {rprpo ( ,t( {rpr po ( ,t ( {rpr#po ( ,t( {rprIpo ( ,t( {rpripo ( ,t (  {rprpo ( ,t (" {rprpo ( ,t ($ {rprpo ( ,t (% {rprpo ( ,t(( {rpo t*v{(}o *BSJB v1.1.4322l<#~#StringsD#UST#GUIDd#BlobW 3))"  g` /77J) o`<`[`t`````$`K`l`[```g0g@`N`[`h`u``     M-ng-gq^)S$[(f+|.,SKWg[_cgk_o7s[wv{0$@$`$$D $2$8$=$ $fB0%fGH%f K`% d% \& (  P x \   !   0!  L! d!# |! 2 !A ! X !o !  " "  P"4" h"" "  "!"5" H#d DBH H'G7{E(G D D8D !! )11 D 9D=1D 1B9)+9.G!K)5)LADID!.. Cscss{{z{i!!{PA{@Aaa{,{{{{{!{!8=NSX]bglqqv+(+Ol <$K[$)..3        "!#$&%'(5;=   )7 L `g n umscorlibMicrosoft.VisualBasicMicrosoft.VsaSystem.Windows.FormsVsMacroHierarchyLibEnvDTESystemOfficeVSLangProj_Utilityace_guidelines_ApplicationObjects_StartupEnvironmentEventsObjectStopDebuggingReleaseIfComObjectoReleaseObject_DTEDTEMicrosoft.VisualBasic.CompilerServicesIVbHostIWin32Window.ctorIVsaSitem_pSitem_strTitlem_HandleHostServicesm_VBHostSetSiteSetTitlestrSetHandleintPushVBHostIntoLibraryGetParentWindowGetWindowTitleget_HandleStartupHelperShutdownHelperStartupShutdownHandleDocumentEvents_DocumentEventsTaskListEvents_TaskListEventsBuildEvents_BuildEventsProjectItemsEvents_SolutionItemsEventsFindEvents_FindEventsSolutionEvents_SolutionEvents.cctorWindowEvents_WindowEvents_MiscFilesEventsDebuggerEvents_DebuggerEventsOutputWindowEvents_OutputWindowEventsSelectionEvents_SelectionEventsDTEEvents_DTEEventsbypass_get_DTEEventsset_DTEEventsWithEventsValueget_DocumentEventsset_DocumentEventsset_WindowEventsget_WindowEventsset_TaskListEventsget_TaskListEventsget_FindEventsset_FindEventsget_OutputWindowEventsset_OutputWindowEventsget_SelectionEventsset_SelectionEventsget_BuildEventsset_BuildEventsget_SolutionEventsset_SolutionEventsget_SolutionItemsEventsset_SolutionItemsEventsset_MiscFilesEventsget_MiscFilesEventsget_DebuggerEventsset_DebuggerEventsDocumentDocumentEvents_DocumentSaveddocumentSolutionItemsEventsMiscFilesEvents_dispDocumentEvents_DocumentSavedEventHandler_dispDocumentEvents_Eventremove_DocumentSavedadd_DocumentSavedExceptionget_NameStringEndsWithFindget_FindvsFindResultvsFindActionvsFindTargetvsFindResultsLocationFindReplaceEmptyvsSaveStatusSaveProjectDataSetProjectErrorget_MessageInteractionMsgBoxResultMsgBoxStyleMsgBoxClearProjectErrorStandardModuleAttributeSystem.Runtime.CompilerServicesAccessedThroughPropertyAttributeContextStaticAttributeSystem.ThreadingThreadget_CurrentThreadAbortRuntimeHelpersGetObjectValueSystem.Runtime.InteropServicesMarshalIsComObjectReleaseComObjectIntPtrset_VBHostZeroEqualsGetEventSourceInstanceGetGlobalInstanceSystem.DiagnosticsDebuggableAttributeVsaModuleVBAssembly.mk .xsd .resx.rc .pfy .mpd\t  :Zs+$)ACE Guideline Macros#EnvironmentEventsDTEEventsDocumentEventsWindowEventsTaskListEventsFindEvents%OutputWindowEventsSelectionEventsBuildEventsSolutionEvents'SolutionItemsEventsMiscFilesEventsDebuggerEventsDTE 5'J'?=P'z\V4?_ :        (!%)-159=AEEE55!!--==AA%%11))99IE5!-=A%1)9E  M5!-=A%1)9  ] aeim qU }U WindowEvents DTEEventsSelectionEventsOutputWindowEventsDocumentEventsMiscFilesEventsSolutionEvents FindEventsSolutionItemsEvents BuildEventsTaskListEventsDebuggerEvents      UX?n? `?_CorDllMainmscoree.dll% @0 ?<VisualStudioProject> <VisualBasic Version = "7.10.6030" MVID = "{546929F9-EB3D-456E-A33F-5E0AF0F46467}" ProjectType = "Local" ProductVersion = "7.10.6030" SchemaVersion = "2.0" > <Build> <Settings DefaultNamespace = "ace_guidelines" OptionCompare = "0" OptionExplicit = "1" OptionStrict = "0" ProjectName = "ace_guidelines" ReferencePath = "" TreatWarningsAsErrors = "false" WarningLevel = "1" RootNamespace = "ace_guidelines" > <Config Name = "Debug" DefineConstants = "" DefineDebug = "true" DefineTrace = "true" DebugSymbols = "true" RemoveIntegerChecks = "false" /> </Settings> <References/> <Imports> <Import Namespace = "Microsoft.VisualBasic" /> </Imports> </Build> <Files> <Include> <VSAAppGlobal VSAAppGlobalName = "DTE" ItemType = "1" VSAAppGlobalType = "EnvDTE._DTE" /> <File RelPath = "EnvironmentEvents" BuildAction = "Compile" ItemType = "2" VSAESItemType = "2" > <VSAEventSource VSAEventSourceName = "DTEEvents" VSAEventSourceType = "EnvDTE.DTEEvents" /> <VSAEventSource VSAEventSourceName = "DocumentEvents" VSAEventSourceType = "EnvDTE.DocumentEvents" /> <VSAEventSource VSAEventSourceName = "WindowEvents" VSAEventSourceType = "EnvDTE.WindowEvents" /> <VSAEventSource VSAEventSourceName = "TaskListEvents" VSAEventSourceType = "EnvDTE.TaskListEvents" /> <VSAEventSource VSAEventSourceName = "FindEvents" VSAEventSourceType = "EnvDTE.FindEvents" /> <VSAEventSource VSAEventSourceName = "OutputWindowEvents" VSAEventSourceType = "EnvDTE.OutputWindowEvents" /> <VSAEventSource VSAEventSourceName = "SelectionEvents" VSAEventSourceType = "EnvDTE.SelectionEvents" /> <VSAEventSource VSAEventSourceName = "BuildEvents" VSAEventSourceType = "EnvDTE.BuildEvents" /> <VSAEventSource VSAEventSourceName = "SolutionEvents" VSAEventSourceType = "EnvDTE.SolutionEvents" /> <VSAEventSource VSAEventSourceName = "SolutionItemsEvents" VSAEventSourceType = "EnvDTE.ProjectItemsEvents" /> <VSAEventSource VSAEventSourceName = "MiscFilesEvents" VSAEventSourceType = "EnvDTE.ProjectItemsEvents" /> <VSAEventSource VSAEventSourceName = "DebuggerEvents" VSAEventSourceType = "EnvDTE.DebuggerEvents" /> </File> </Include> </Files> <Folders> <Include/> </Folders> </VisualBasic> </VisualStudioProject> ourceName = "WindowEvents" VSAEventSourceType = "EnvDTE.WindowEvents" /> <VSAEventSource VSAEventSourceName = "TaskListEvents" VSAEventSoEnd Sub End Module ace-8.0.4+dfsg.orig/docs/ACE-development-process.html0000644000175000017500000001700215027201773021371 0ustar sudipsudip ACE+TAO Development and Release Process


The ACE+TAO Development and Release Process

To improve the quality of our software and minimize development effort, we try to follow the structured development and release process described below.

An important concept to keep in mind is risk. Before you commit any change to ACE+TAO, please consider the effects that it will have. Could it possibly cause a build failure, on any platform? Could it possibly cause different run-time behavior? And so on. If so, it is your responsibility to adequately build and test with the change, in order to verify that it has no unintended effects.

Please keep in mind the cost of committing a mistake. It may take you only a few seconds to fix, but its cost to the group may be much larger. With our large group, workspace updates and builds are likely to happen at any time. If one break, it can take hours to rebuild it. And each developer that was waiting for a successful build would be blocked for the duration of the broken build, the fix, and the rebuild.


The ACE+TAO Development Process

The ACE+TAO development process looks like:

  1. Every change to ACE+TAO must have a bug report. Change includes fixes, enhancements, updates, and so on.
  2. Create a an issue.
  3. Accept the bug report if you are going to implement the change.
  4. Implement the change in your workspace(s) using a branch. Clearly document each commit because that information is gathered into our changelog
  5. Test the change sufficiently to demonstrate that it both does what is intended, and doesn't break anything. The test may be as simple as building and running the ACE+TAO tests on at least two platforms. Or as complicated as rebuilding and test all of ACE+TAO on all platforms that we have.
  6. Merge the changes only to master when you are available the next 3 days to resolve any issues. If you aren't available, hold your merge until you are available
  7. Respond to the requester of the change, if any. Please do this after merging your change.
  8. Make sure that the requester is listed in the THANKS file.
  9. Update the bug report to indicate resolution.
  10. Monitor the next round of build/tests for problems with your change. Because there are slow systems it can take up to 4 days to get all builds done.
  11. Respond immediately to reports of problems with your changes.


Bug Lifecycles

A bug should typically follow this life cycle:

Submitter: Enters problem
Bugmaster: Assigns
Owner: Accepts
Owner: Reproduces problem - if it needs a new test, write it and put it in the regression tests. If it can't be reproduced, set to Resolved/CANT_FIND.
If it's a duplicate, set it to Resolved/DUPLICATE. Fix code, commit changes, set to Resolved.
Submitter: Tests it again; set to Verified (pass) or Reopened (fail)
Owner: After next release is done, re-test; sets to Closed or Reopened.


The Role of the Build Czar

At all times, we'll have a build czar. The role may be shared by multiple people. The build czar is responsible for ensuring that the next kits are clean, i.e., it builds and runs cleanly on all platforms. The status of all ACE+TAO builds is tracked automatically online.

A comprehensive summary of the build czar's role is available here. This role is briefly summarized below:

  • Remind people to check build logs. Developers are still responsible for verifying that their changes are clean.
  • Trigger other developers to fix problems caused by compilation errors. All problems should be fixed by the developers who caused them. The build czar should help track down the guilty parties.
  • Freeze the source repository when it's decided to no more non-critical changes will be accepted for the next kits. The build czar has the final say over when the freeze is implemented. The tendency to implement a freeze sooner than later is intentional, desirable, beneficial, and the "Right Thing"[TM] to do.
  • Verifies that the final round of builds/tests are clean.
  • Creates the kits.
  • Unfreezes the source repository.
  • Sends email to appropriate news groups announcing the new kits.
  • Passes the mantle on to the next build czar.

If another developer interferes with the build czar's duties, the build czar has the unilateral authority to pass the mantle to the violator. This is also intentional, desirable, beneficial, and the Right Thing[TM] to do.


The ACE+TAO Release Process

Minor releases of ACE+TAO occur periodically, typically twice a year. Minor releases have two-digit numbers, e.g., 5.3. Major releases are released infrequently, typically once a year. Major releases are 1-digit numbers, e.g.,5, that include substantially new functionality. Both major and minor releases are carefully tested on all platforms the ACE+TAO run on. In particular, we do not put out major or minor releases of ACE+TAO until all the compilations and regression tests work successful on all the platform we support.

Between major/minor releases, we release micro releases periodically, e.g., 3-4 times per year, so that ACE+TAO users can download and test our latest work in progress. ACE+TAO micro release kits have three-digit numbers, e.g., 5.3.1. Micro releases often contain important fixes that aren't in the major/minor releases and will compile cleanly and pass most tests on most platforms. They are not, however, necessarily concerned with ensuring API compatibilities between micro releases, e.g., new features may be changed or removed between the micro releases.


Contributions from the Open-Source Community

Over the years, ACE+TAO have benefited significantly from contributions by thousands of developers in the open-source community. To avoid fragmentation of the code base, by submitting comments, suggestions, code, code snippets, techniques (including that of usage) and algorithms (collectively ``Submissions''), submitters acknowledge that they have the right to do so, that any such Submissions are given freely and unreservedly, and that they waive any claims to copyright or ownership. In addition, submitters acknowledge that any such Submission might become part of the copyright maintained on the overall body of code that comprises the open-source DOC Group software. By making a Submission, submitter agree to these terms. Moreover, submitters acknowledge that the incorporation or modification of such Submissions is entirely at the discretion of the moderators of the open-source DOC software projects or their designees.


Last modified .


Back to ACE Documentation Home. ace-8.0.4+dfsg.orig/docs/ACE-porting.html0000644000175000017500000001504115027201773017056 0ustar sudipsudip Porting ACE and TAO to a New OS Platform

Porting ACE and TAO to a New OS Platform

ACE and TAO have been ported to many OS platforms. Porting ACE and TAO to new platforms is fairly easy. The following document describes the step-by-step process to use when porting the various components and layers in ACE to a new OS platform. Once ACE is ported, it is straightforward to port TAO as well.

Before starting a port that you plan to contribute back to the ACE+TAO open-source community, we recommend that you do the following:

  • Read and follow the programming style guidelines we use when writing ACE and TAO code, which will make it much easier to integrate and maintain your port in the source tree.

  • Contact Douglas C. Schmidt and let him know that you're planning to contribute a port, which will make it make easier to work out the logistics of when/how the port will be integrated.


Create a config.h Header File for the Target OS Platform

A config-*.h header file exists in $ACE_ROOT/ace for each platform to which ACE has been ported. This file contains the portability macros for each particular configuration of ACE. A description of most of the existent macros can be found in the $ACE_ROOT/ace/README file.

Currently, you must edit this file by hand to port it to new OS platforms. It's a good idea to use the config-*.h files for platforms with similar characteristics as examples.


Port the ACE_OS Namespace

The ACE_OS namespace encapsulates most of variation between the different OS implementations, e.g., UNIX, Win32, and various real-time operating systems. It is the core of the ACE OS abstraction layer. Most work required to port ACE to a new OS platform resides in this namespace. There are many examples of how ACE has been ported to other operating systems in the ACE_OS class in the $ACE_ROOT/ace/OS_NS_*.{h,inl,cpp} files.

Optional features in pthreads are covered by ACE_HAS_* and/or ACE_LACKS_* macros, which are described in the $ACE_ROOT/ace/README file. Particular platform features, such as DCE pthreads calls that end in _np, should be bracketed by platform defines rather than by inventing more ACE_HAS_* or ACE_LACKS_* definitions.

An important part of porting ACE to a new platform is to map the threading API correctly. Currently, ACE has support for the following thread APIs:

  • POSIX Pthreads (ACE_HAS_PTHREADS) -Final standard (also called draft 10) [MIT, Linux].

  • Win32 Threads (ACE_HAS_WTHREADS) - Windows NT, Windows '95/98

  • VxWorks Tasks (ACE_VXWORKS) - VxWorks

If your OS platform does not support any of these threading packages, you must port the ACE_OS::thr_* functions.


Port the C++ Wrapper Facade Components

After porting the ACE_OS namespace, the next step is to port all of the ACE C++ wrapper facade components, such as sockets, threads, synchronization mechanisms. A full list of the categories and classes can be found in the $ACE_ROOT/ACE-categories file. It is easiest to concentrate on porting one category at the time. The ACE release contain a regression test suite in the $ACE_ROOT/tests/ directory. These tests can be used to validate the correctness of the various ACE C++ wrapper facades as they are ported.


Port the Higher-level Framework Components of ACE

Having ported (and tested) all the components of the ACE OS adaptation layer and C++ wrapper facades, you can proceed to port the higher level components of ACE, such as the Reactor, Service Configurator, Connector, Acceptor, and Streams frameworks. At this point, it should be relatively easy to port the rest of ACE because most of the platform-dependent code is localized in the lower layers of ACE.


Port TAO

After porting and successfully testing all the ACE framework components, it should be straightforward to port and install TAO because the bulk of their platform-dependent code is localized in ACE. Typically, the only problems that arise when porting TAO is bugs and limitations with C++ compilers.


C++ Features Required to Port ACE and TAO

ACE and TAO have been ported to most C++ compilers. The following is a list of which C++ features a compiler must support in order to compile ACE and TAO:
  • Templates -- The C++ compiler must support templates. Any template feature as part of C++17 may be used.

  • Multiple inheritance and dynamic binding -- The C++ compiler must support multiple inheritance and dynamic binding.

  • Namespaces -- ACE+TAO utilizes C++ namespaces, so the C++ compiler must support them.

  • ANSI casts and RTTI -- ACE+TAO uses the ANSI C++ casts, so the C++ compiler must support them, which implies support for RTTI.

  • Exceptions -- The ACE library requires C++ exception support.

  • STL -- ACE requires C++17 or newer, any C++17 STL feature can be used in ACE.


Back to the ACE documentation page.
Back to ACE Documentation Home. ace-8.0.4+dfsg.orig/docs/FAQ0000644000175000017500000021462115027201773014457 0ustar sudipsudipThere are many changes and improvements in the new version of ACE. The ChangeLog file contains complete details about all of them. I've tested ACE thoroughly on Solaris 2.3 and 2.4 with the SunC++ 4.x compiler and Centerline 2.x. I've also tested it with the SunC++ 3.x compiler on the SunOS 4.x platform. However, I've not been able to test it on other platforms. If anyone has time to do that, and can report the results back to me I'd appreciate that. Please let me know if you have any questions or comments. Doug ---------------------------------------- 1. SIGHUP > 1) Where the heck does the HUP signal get registered for the > $ACE_ROOT/tests/Service_Configurator/server stuff? I looked there and > in $ACE_ROOT/libsrc/Service_Configurator. No luck. I guess I am > just blind from reading. Take a look in ./libsrc/Service_Configurator/Service_Config.h. The constructor for Service_Config is where it happens: Service_Config (int ignore_defaults = 0, size_t size = Service_Config::MAX_SERVICES, int signum = SIGHUP); ---------------------------------------- 2. Multi-threaded Signal_Handler support > It appears Signal_Handler is > not setup for multi-threaded apps. How do you handle signals > in different threads? Do I have to put in the hooks in my app or should > it go in the Threads arena? Ah, good question... My design follows the approach espoused by Sun. Basically, they suggest that you implement per-thread signal handling atop of the basic UNIX signal handlers (or in the case of ACE, the handle_signal() callbacks on Event_Handler subclasses) by using the thread id returned by thr_self() to index into a search structure containing the handlers. This should be pretty straight forward to layer atop the existing ACE Signal_Handler mechanisms. However, you might ask yourself whether you really want (1) separate signal handler *functionality* in different threads or (2) different threads that mask out certain signals. The latter might be easier to implement and reason about! ---------------------------------------- 3. Problems compiling ACE with G++ > I substituted -lg++ for -lC in macro_wrappers.GNU and ran make. > > Most stuff seemed to build. Continually got messages like the following: > ld: /usr2/tss/jvm/ACE_wrappers/lib/libASX.a: warning: archive has no table of c > ontents; add one using ranlib(1) > ld: /usr2/tss/jvm/ACE_wrappers/lib/libThreads.a: warning: archive has no table > of contents; add one using ranlib(1) > ld: /usr2/tss/jvm/ACE_wrappers/lib/libSPIPE.a: warning: archive has no table of > contents; add one using ranlib(1) > ld: /usr2/tss/jvm/ACE_wrappers/lib/libASX.a: warning: archive has no table of c > ontents; add one using ranlib(1) > ld: /usr2/tss/jvm/ACE_wrappers/lib/libThreads.a: warning: archive has no table > of contents; add one using ranlib(1) > ld: /usr2/tss/jvm/ACE_wrappers/lib/libSPIPE.a: warning: archive has no table of > contents; add one using ranlib(1) > no matter how many times I used ranlib or removed the libraries and re-compiled > or whatever. Perhaps these are System V specific and will not work on 4.1.3? Yes, that's exactly right. If you look at the files, they all contain ifdef's for features that aren't included in the ./include/makeinclude/wrapper_macros.GNU file. To make this more obvious, I've enclosed the following message in the ACE-INSTALL.html file: * Sun OS 4.1.x Note that on SunOS 4.x you may get warnings from the linker that "archive has no table of contents; add one using ranlib(1)" for certain libraries (e.g., libASX.a, libThreads.a, and libSPIPE.a). This occurs since SunOS 4.x does not support these features. > never able to get .so -- assume these are shared libraries that gcc can not > deal with. Yes, if you use the stock gcc/gas/gnu ld compiler/assembler/linker, you won't get shared libraries to work. It is possible to hack this by using the "collect" version of g++. However, as usual, I strongly advise people to stay away from g++ if you want to use shared libraries or templates. > got some linker errors as follows: > > g++ -g -DACE_NTRACE -DACE_HAS_MT_SAFE_SOCKETS -DACE_HAS_NO_T_ERRNO -DACE_HAS_ > OLD_MALLOC -DACE_HAS_POLL -DACE_HAS_SEMUN -DACE_HAS_SETOWN -DACE_HAS_STRBUF_T - > DACE_HAS_STREAMS -DACE_HAS_SVR4_DYNAMIC_LINKING -DACE_HAS_TIUSER_H -DACE_HAS_SY > S_FILIO_H -DACE_PAGE_SIZE=4096 -DACE_HAS_ALLOCA -DACE_HAS_CPLUSPLUS_HEADERS -DA > CE_HAS_SVR4_SIGNAL_T -DACE_HAS_STRERROR -DMALLOC_STATS -I/usr2/tss/jvm/ACE_wrap > pers/include -I/usr2/tss/jvm/ACE_wrappers/libsrc/Shared_Malloc -o test_malloc > .obj/test_malloc.o -L/usr2/tss/jvm/ACE_wrappers/lib -Bstatic -lSemaphores -lS > hared_Malloc -lShared_Memory -lReactor -lThreads -lMem_Map -lLog_Msg -lFIFO -lI > PC_SAP -lMisc -lnsl -lg++ > ld: /usr2/tss/jvm/ACE_wrappers/lib/libThreads.a: warning: archive has no table > of contents; add one using ranlib(1) > ld: Undefined symbol > _free__t6Malloc2Z18Shared_Memory_PoolZ13PROCESS_MUTEXPv > _free__t6Malloc2Z17Local_Memory_PoolZ10Null_MutexPv > _malloc__t6Malloc2Z18Shared_Memory_PoolZ13PROCESS_MUTEXUl > _malloc__t6Malloc2Z17Local_Memory_PoolZ10Null_MutexUl > _remove__t6Malloc2Z17Local_Memory_PoolZ10Null_Mutex > ___t6Malloc2Z17Local_Memory_PoolZ10Null_Mutex > _print_stats__t6Malloc2Z17Local_Memory_PoolZ10Null_Mutex > _remove__t6Malloc2Z18Shared_Memory_PoolZ13PROCESS_MUTEX > ___t6Malloc2Z18Shared_Memory_PoolZ13PROCESS_MUTEX > _print_stats__t6Malloc2Z18Shared_Memory_PoolZ13PROCESS_MUTEX > collect2: ld returned 2 exit status > gcc: file path prefix `static' never used > make[2]: *** [test_malloc] Error 1 > make[2]: Leaving directory `/usr2/tss/jvm/ACE_wrappers/tests/Shared_Malloc' > <======== End all: /usr2/tss/jvm/ACE_wrappers/tests/Shared_Malloc That looks like a problem that G++ has with templates. I don't know of any reasonable solution to this problem using g++. > Finally decided there was enough stuff that it looked like I might have some > thing so I tried to run some tests and could not find so much as one piece > of documentation that might give me some clue about running tests. You should take a look at ./tests/Service_Configurator/server/README file. That explains how to run the more complicated tests. As for the other tests, it is pretty straight forward if you look at the ./tests/IPC_SAP/SOCK_SAP and ./tests/Reactor/* directory code to figure out how to run the tests. I don't have a Q/A department, so any documentation has to come from volunteers. ---------------------------------------- 4. Is there any docs or man pages on the Log_Record class? There is a paper in the C++_wrappers_doc.tar.Z file on ics.uci.edu called reactor2.ps that has some examples of using Log_Record. The ./apps/Logger directories show several examples using Log_Record. Finally, the source code for Log_Record is pretty short (though it clearly could be commented better ;-)). ---------------------------------------- 5. Signal handling prototypes > According to the man page on sigaction on our system, that line > should look something like the following: > > sa.sa_handler = SIG_DFL; The problem is that most versions of UNIX I've come across don't have a correct prototype for this field of struct sigaction. That's why I define two variants of signal handler typedefs: one that is a typedef of the "correct version" (which I call SignalHandler) and one of which is a typedef of the "incorrect version" (which I call SignalHandlerV). You might check out the sysincludes.h file to see how it is defining SignalHandlerV and make sure this matches what your OS/Compiler defines in ---------------------------------------- 6. Omitting shared libraries > Can anyone tell me a way to turn off the creation of the shared libraries > in the ACE build. You can simply comment out the LIB target in the $ACE_ROOT/ace/Makefile or change the BUILD target from BUILD = $(VLIB) $(VSHLIB) $(SHLIBA) to BUILD = $(VSHLIB) $(SHLIBA) ---------------------------------------- 7. DCE threading and signal handling >Reading the DCE docs leaves me confused as to how to make everyone >work together in a happy hormonious whole. May basic need is to catch >asynchronous signals so i can release some global resources before >the process exits. You need to spawn a separate thread to handle signals. As part of your init, do this: pthread_create(&tid, thread_attr, signal_catcher, NULL); pthread_detach(&tid); Where signal_catcher is like this: static void * signal_catcher(void *arg) { static int catch_sigs[] = { SIGHUP, SIGINT, SIGQUIT, SIGTERM, SIGCHLD }; sigset_t catch_these; int i; error_status_t st; for ( ; ; ) { sigemptyset(&catch_these); for (i = 0; i < sizeof catch_sigs / sizeof catch_sigs[0]; i++) sigaddset(&catch_these, catch_sigs[i]); i = sigwait(&catch_these); /* Note continue below, to re-do the loop. */ switch (i) { default: fprintf(stderr, "Caught signal %d. Exiting.\n", i); CLEANUP_AND_EXIT(); /* NOTREACHED */ #if defined(SIGCHLD) case SIGCHLD: srvrexec__reap(); continue; #endif /* defined(SIGCHLD) */ } } return NULL; } ---------------------------------------- 8. > I have installed ACE2.15.5 on SunOS 4.1.3 with gcc2.6.0. I run the test program > ---server_test. The static is OK, but error found when I commented out the first > one and uncommented out the second one in the svc.conf file: > > #static Svc_Manager "-d -p 3912" > dynamic Remote_Brdcast Service_Object * .shobj/Handle_Broadcast.so:remote_broad > cast "-p 10001" > > The error goes like this: > > ----------- > jupiter[12] %server_test -d > starting up daemon server_test > opening static service Svc_Manager > did static on Svc_Manager, error = 0 > signal signal 1 occurred > beginning reconfiguration at Sat Feb 25 13:40:29 1995 > Segmentation fault (core dumped) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ My guess is that the code generated by GCC on SunOS 4.x does not correctly initialize static variables from shared libraries. The SunC++ 4.0.x compiler does this correctly on Solaris 2.x (though I believe that on SunOS 4.x it doesn't work without some extra coaxing). In general, I try to avoid using ACE's explicit dynamic linking mechanisms on SunOS 4.x and GCC. You can write plenty of interesting and useful code with ACE without using those features. Those tests are mostly there to illustrate the "proof of concept." ---------------------------------------- 9. > a) I noticed the default constructor for the reactor does an open w/ defaults. > Does this mean I need to close it if I wish to re-open it with different > size and restart values? No. With the latest versions of ACE, you can now just call open() with a new size and it will correctly resize the internal tables to fit. > b) What is the usage difference between the normal FD_Set objects > (rd/wr/ex_handle_mask_) and the ready FD_Set objects > (rd/wr/ex_handle_mask_ready)? The normal FD_Sets (now called Handle_Set in ACE 3.0.5) holds the "waitable" descriptors (these are the descriptors given to select() or poll()). In contrast, the ready FD_Sets may be set by Event_Handler subclasses (by called the set_ready() API) to indicate to the Reactor that they want to be redispatched on the next go-round *without* blocking. If you look at the Reactor code, you'll see that the wait_for() method checks the ready sets first and doesn't block if there are any bits set in those masks. This features makes it possible for Event_Handlers to control subsequent dispatching policies of the Reactor. > c) What does the positive return value do from an event handler callback: > -1 detaches the event handler for that mask > 0 does nothing - keeps the event handler registered for that mask > >0 resets a bit in the current dispatching mask (I think) - does this mean > this event will be called again before the current dispatch cycle is done? Almost... (it's tied in with my description of the ready sets above). It means that once the Reactor finishes cycling through the set of descriptors it got back from select() or poll(), it will redispatch the ready set descriptors before sleeping. > Without direct access to the bit masks in X, I'm not sure I could emulate > this activity - what do you think? I'm not sure. I'm not enough of an X guru. Maybe someone else on the list knows the answer to this? > d) If I let X do the select blocking, will that have any affect on > the Reactor performing signal handling? Yes, I think that will cause problems since the Reactor relies on a "handshake" between its Signal_Handler component and its handle_events loop to properly handle signals. > e) Is the Poll method preferred over Select if it is available - why? For systems that implement select() in terms of poll() (e.g., Solaris 2.x) then it may be somewhat faster. Otherwise, it doesn't really matter since (1) they (should) do the same thing and (2) the end user shouldn't notice any change in behavior. ---------------------------------------- 10. > I would very much like to evaluate/use the ACE Toolkit, > but am limited as to disk space on our system. > What is the total disk space required for a compiled, > usable toolkit? The source code itself is around 2 Meg, uncompressed. The compiled version of ACE is around 90 Meg compiled with the SunC++ 4.x compiler (naturally, this will differ with other compilers). However, of this amount, about 40 meg are for the libraries, and another 50 meg are for the test programs. Naturally, you don't need to keep the test programs compiled. The postscript documentation is around 5 Meg, compressed. ---------------------------------------- 11. > This is regarding the newer release of ACE and pertaining to the library > archive file. My question is, if all the ".o" files are archived into one > single "libACE.a", does it increase the size of the executable program? No. The use of a *.a file allows the linker to extract out only those *.o files that are actually used by the program. > If it does, then does a large executable program mean possibility of it being > slower? No. ---------------------------------------- 12. > What happens if I have several reactors in a process (e.g. in different > threads)? > > Programmer 1 decides to register at reactor 1 in his thread 1 a signal handler > for SIGUSR. > Programmer 2 decides to register at reactor 2 in his thread 2 a signal handler > for SIGUSR. Naturally, the behavior of this all depends on the semantics of the threads package... In Solaris 2.x, signal handlers are shared by all threads. Moreover, the Reactor uses a static table to hold the thread handlers. Thus, only one of the handler's would be registered (i.e., whichever one was registered second). > Programmer 3 designs the process and decides to have thread 1 and thread 2 > running in the same process and also makes use of a third party software library > that internally has also registered a signal handler (not at the reactor) for > SIGUSR. Now you've got big problems! This is an example of a limitation with UNIX signal handlers... In general, it's a bad idea to use signal handlers if you can avoid it. This is yet another reason why. > When looking into Ace/ACE_wrappers/tests/Reactor/misc/signal_tester.C you > have shown a way to do this by marking the dummy file_descriptor of the > Sig_Handler object ready for reading asynchronously. The handle_input() > routine of Sig_Handler object will then be dispatched synchronously. > But what happens if I have several reactors. > The asynchronously dispatched > handle_signal() routine does not know via which reactor it has been registered > so in which reactor to modify the dummy file_descriptor. > Is your suggestion to have just one process global reactor in such a case? Yes, precisely. I would *strongly* recommend against using several reactors within separate threads within the same process if you are going to be having them handle signals. Can you use 1 reactor and/or have one reactor handle signals within a process? > One thing we want to do is the priorization of Event_Handlers. I.e. in case > of concurrent events the sequence in which the Event_Handler methods will be > activated depends on their priority relative to each other. > We have two choices: > - complete priorization, which means a high priority Input Event_Handler may > be activated prior to a lower prioritized Output Event_Handler (and doing > so violating the 'hardcoded rule' that output must be done prior to input). > - priorization only in categories, which means all Output Event_handler are > ordered by their priority regardless of priorities for the category of Input > Event_Handlers. The priority is fixed between the categories, i.e. first > output then input then out-of-band. > > Right now I would think that we have to use the second choice if we want to > use the feature of asynchronous output with automatical re-queueing. Am I right > ? Hum, that's an interesting problem. It might be better to subclass the Reactor to form a new class called Priority_Reactor. This subclass would override the Reactor's dispatch method and dispatch the event handlers in "priority" order. I've never done that, but I don't think it would be all that difficult. ---------------------------------------- 13. > Is the Orbix (aka CORBA) version still around? Nope, IONA does not support Orbix-2.X nor Orbix-3.0 anymore (the versions of Orbix that the ACE code was based upon). Plus we didn't maintain this code for ages, so it probably was broken too. ---------------------------------------- 14. > We are using your ACE software and ran into a problem which may or may not > be related to the mutex locks. The question may have more to do with how > mutex locks should be used. We had a class which was using your mutex > lock wrapper. Each member function of the class acquired the lock before > processing and released on exiting the function. Some member functions may > call other member functions. The following is an example: > > class foo { > > void a() > { > MT( Mutex_Block m( this->lock_ )); > > if( cond ) > b(); > } > > void b() > { > MT( Mutex_Block m( this->lock_ )); > > if( cond ) > a(); > } > > }; > > Is this valid ? My assumtpion is that the mutex lock is recursive and > the same thread can acquire the lock multiple times in different member > functions. Ah, that's a great question since there are subtle and pernicious problems lurking in the approach you are trying above. Basically, Solaris mutex locks are *not* recursive (don't ask why...) Thus, if you want to design an application like the one above you'll need to use one or more of the following patterns: ---------------------------------------- A. Use recursive mutexes. Although these are not available in Solaris directly they are supported in the later versions of ACE. You might want to take a look at the latest version (./gnu/ACE-3.1.9.tar.Z). It's got lots of new support for threading and synchronization. In that case, you simply do the following: class Foo { public: void a() { MT( Guard > m( this->lock_ )); b (); } void b() { MT( Guard > m( this->lock_ )); b_i (); } }; The advantage with this is that it requires almost no changes to existing code. The disadvantage is that recursive locks are just slightly more expensive. B. Have two layers of methods (a) which are public and acquire the Mutex and then call down to methods in layer (b), which are private and do all the work. Methods in layer b assume that the locks are held. This avoids the deadlock problem caused by non-recursive mutexes. Here's what this approach looks like (using the more recent ACE class names): class Foo { public: void b() { MT( Guard m( this->lock_ )); b_i (); } void b_i() { if( cond ) a_i(); } void a_i() { if( cond ) b_i(); } void a() { MT( Guard m( this->lock_ )); a_i (); } }; The advantage here is that inline functions can basically remove all performance overhead. The disadvantage is that you need to maintain two sets of interfaces. C. Yet another approach is to release locks when calling other methods, like this: class Foo { public: void b() { MT( Guard m( this->lock_ )); m.release (); a (); m.acquire (); } void a() { MT( Guard m( this->lock_ )); m.release (); b (); m.acquire (); } }; The disadvantage with this, of course, is that you greatly increase your locking overhead. In addition, you need to be very careful about introducing race conditions into the code. The primary reason for using this approach is if you need to call back to code that you don't have any control over (such as OS I/O routines) and you don't want to hold the lock for an indefinite period of time. ---------------------------------------- BTW, all three of these patterns are used in the ACE Reactor class category. The Reactor has a number of fairly complex concurrency control and callback issues it must deal with and I've found it useful to use all three of these patterns jointly. I'd be interested to hear any comments on these approaches. Doug ---------------------------------------- 15. > I am working on Solaris 2.3 and trying to understand how to get around > the problem of trying to open a Socket connection to a remote host that > is "dead". Of course you get a nice long process block if the socket > is in Blocking mode (TCP lets you know when you can continue - how polite). > > So how does a non-blocking connect work with respect to using > the Reactor and a SOCK_Stream object to coordinate the opening > of the connection? Do I wait on the OUTPUT event for the FD? > How do I know if the connect worked or possibly timed-out? Is > this a reliable approach (I read somewhere that this will only > work if the STREAMS module is at the top of the protocol stack > - MAN page I think)? An example of implementing this is in the Gateway sample application in the new ACE. It's also encapsulated in the Connector<> pattern of the Connection class category in ./libsrc/Connection. You may want to take a look at those two things for concrete usage examples. However, the basics of getting non-blocking to work are: - set socket to non-blocking - initiate connect() request - if connect() returned 0 you're connected - if connect() returned -1 and errno is EWOULDBLOCK (or EAGAIN, depending on where you are), then register an event handler for read and write events on the socket - any other errno value is fatal When an event is returned - no matter which event you get back (read or write), you may have gotten the event out of error. Thus, re-attempt the connect() and check to see if errno is EISCONN (if it's not there's a problem!) - if errno was EISCONN, the connection is ready to go, otherwise you must handle an error condition If you want to "time out" after a certain period of time, consider registering for a timer event with Reactor. If the timer goes off before the connection succeeds, close down the appropriate socket. > Is using a separate thread to make the connection a better way to avoid > the potentialy long block in the main thread during the connect call? You could do that, but it can all be accomplised in a single process using the facilities available. ---------------------------------------- 16. > I was wondering, does the Reactor class have the ability to prioritize > activity on the registered event handlers? The default strategy for the Reactor's dispatch routine (Reactor::dispatch) does not prioritize dispatching other than to dispatch callbacks in ascending order from 0 -> maxhandlep1. > We have a requirment to be able to process both real-time, as well as, stored > telemetry and ERMs concurrently. Real-time needs to be processed at a higher > priority than stored data. Our design is based on both real-time and stored > data coming into our process via separate sockets. I can think of several ways to do this: 1. Use dup() or dup2() to organize your sockets such that the higher priority sockets come first in the Handle_Sets that the Reactor uses to dispatch sockets. This is pretty easy if you don't want to muck with the Reactor code at all. 2. You could subclass Reactor::dispatch() and revise it so that it dispatches according to some other criteria that you define in order to ensure your prioritization of sockets. BTW, I'm not sure what you mean by "real-time" but I assume that you are aware that there is no true "real-time" scheduling for network I/O in Solaris. However, if by "real-time" you mean "higher priority" then either of the above strategies should work fine. ---------------------------------------- 17. > I compiled the new ACE 3.2.0 's apps/Gateway. The compiling went > through without any errors. But I could not get it running, neither single > threaded nor multi-threaded. The cc_config and rt_config files entries are given > below. Also the machine configurations are given below. Does it need some more > settings or some patch !!?? I believe you are seeing the effects of the dreaded Sun MP bug with non-blocking connects. The easy work around for now is simply to give the "-b" option to the Gateway::init() routine via the svc.conf file: dynamic Gateway Service_Object *.shobj/Gateway.so:_alloc_gatewayd() active "-b -d -c cc_config -f rt_config" If you check line 137 of the Gateway::parse_args() method you'll see what this does. ---------------------------------------- 18. How to get ACE to work with GCC C++ templates. The first and foremost thing to do is to get the latest version of GCC (2.7.2) and also get the template repository patches from ftp://ftp.cygnus.com/pub/g++/gcc-2.7.1-repo.gz This will get the ball rolling... Here is some more info on G++ templates courtesy of Medhi TABATABAI : Where's the Template? ===================== C++ templates are the first language feature to require more intelligence from the environment than one usually finds on a UNIX system. Somehow the compiler and linker have to make sure that each template instance occurs exactly once in the executable if it is needed, and not at all otherwise. There are two basic approaches to this problem, which I will refer to as the Borland model and the Cfront model. Borland model Borland C++ solved the template instantiation problem by adding the code equivalent of common blocks to their linker; template instances are emitted in each translation unit that uses them, and they are collapsed together at run time. The advantage of this model is that the linker only has to consider the object files themselves; there is no external complexity to worry about. This disadvantage is that compilation time is increased because the template code is being compiled repeatedly. Code written for this model tends to include definitions of all member templates in the header file, since they must be seen to be compiled. Cfront model The AT&T C++ translator, Cfront, solved the template instantiation problem by creating the notion of a template repository, an automatically maintained place where template instances are stored. As individual object files are built, notes are placed in the repository to record where templates and potential type arguments were seen so that the subsequent instantiation step knows where to find them. At link time, any needed instances are generated and linked in. The advantages of this model are more optimal compilation speed and the ability to use the system linker; to implement the Borland model a compiler vendor also needs to replace the linker. The disadvantages are vastly increased complexity, and thus potential for error; theoretically, this should be just as transparent, but in practice it has been very difficult to build multiple programs in one directory and one program in multiple directories using Cfront. Code written for this model tends to separate definitions of non-inline member templates into a separate file, which is magically found by the link preprocessor when a template needs to be instantiated. Currently, g++ implements neither automatic model. The g++ team hopes to have a repository working for 2.7.0. In the mean time, you have three options for dealing with template instantiations: 1. Do nothing. Pretend g++ does implement automatic instantiation management. Code written for the Borland model will work fine, but each translation unit will contain instances of each of the templates it uses. In a large program, this can lead to an unacceptable amount of code duplication. 2. Add `#pragma interface' to all files containing template definitions. For each of these files, add `#pragma implementation "FILENAME"' to the top of some `.C' file which `#include's it. Then compile everything with -fexternal-templates. The templates will then only be expanded in the translation unit which implements them (i.e. has a `#pragma implementation' line for the file where they live); all other files will use external references. If you're lucky, everything should work properly. If you get undefined symbol errors, you need to make sure that each template instance which is used in the program is used in the file which implements that template. If you don't have any use for a particular instance in that file, you can just instantiate it explicitly, using the syntax from the latest C++ working paper: template class A; template ostream& operator << (ostream&, const A&); This strategy will work with code written for either model. If you are using code written for the Cfront model, the file containing a class template and the file containing its member templates should be implemented in the same translation unit. A slight variation on this approach is to use the flag -falt-external-templates instead; this flag causes template instances to be emitted in the translation unit that implements the header where they are first instantiated, rather than the one which implements the file where the templates are defined. This header must be the same in all translation units, or things are likely to break. *See Declarations and Definitions in One Header: C++ Interface, for more discussion of these pragmas. 3. Explicitly instantiate all the template instances you use, and compile with -fno-implicit-templates. This is probably your best bet; it may require more knowledge of exactly which templates you are using, but it's less mysterious than the previous approach, and it doesn't require any `#pragma's or other g++-specific code. You can scatter the instantiations throughout your program, you can create one big file to do all the instantiations, or you can create tiny files like #include "Foo.h" #include "Foo.cc" template class Foo; for each instance you need, and create a template instantiation library from those. I'm partial to the last, but your mileage may vary. If you are using Cfront-model code, you can probably get away with not using -fno-implicit-templates when compiling files that don't `#include' the member template definitions. 4. Placing a function that looks like this near the top of a .C file that uses any inline template member functions permits proper inlining: // #ifdef __GNUG__ // This function works around the g++ problem with inline template member // calls not being inlined ONLY in the first block (in a compilation // unit) from which they are called. // This function is inline and is never called, so it does not produce // any executable code. The "if" statements avoid compiler warnings about // unused variables. inline void gcc_inline_template_member_function_instantiator() { if ( (List *) 0 ); } // #endif // __GNUG__ other prerequisites: -- All inline template member functions should be defined in the template class header. Otherwise, g++ will not inline nested inline template member function calls. -- Template .h and .C files should NOT include iostream.h (and therefore debugging.h). This is because iostream.h indirectly includes other GNU headers that have unprotected #pragma interface, which is incompatible with -fno-implicit-templates and optimal space savings. -- inline virtual destructors will not be inlined, unless necessary, if you want to save every last byte -- be sure that -Winline is enabled ---------------------------------------- 19. > 1. when are dynamically loaded objects removed from the Service_Config. The Service Configurator calls dlclose() when a "remove Service_Name" directive is encountered in the svc.conf file (or programmatically when the Service_Config::remove() method is invoked). Check out the code in ./libsrc/Service_Config/Service_Repository.i and ./libsrc/Service_Config/Service_Config.i to see exactly what happens. > 2. In the Service Configurator, when an item is entered in the svc.conf > how dow you know which items will be invoked as threads and > which items are forked. I know that static items are executed > internally. No! It's totally up to the subclass of Service_Object to decide whetehr threading/forking/single-threading is used. Check out the ./apps/Logger/Service_Configurator_Logger for examples of single-threaded and multi-threaded configuration. ---------------------------------------- 20. > I have been reading the Service Configurator Logger. I was wondering about > cleanup of new objects. In the handle_input method for the Acceptor a new > svc_handler is allocated for each new input request and deleted in the > handle_close. I was wondering how handle close was called when a client who > has created a socket terminates the connection (i.e., when is handle_close > called). handle_close() is automatically called by the Reactor when a handle_input()/handle_output()/etc. method returns -1. This is the "hook" that instructs the Reactor to call handle_**() and then remove the Event_Handler object from its internal tables. ---------------------------------------- 21. > How does the Logger know to remove the client socket and the svc_handler object. > Does he recieve an exception. No. when the client terminates the underlying TCP/IP implementation sends a RESET message to the logger host. This is delivered to the logger process as a 0-sized read(). It then knows to close down. > What I am worried about is a leak. Where by alot of clients connect and > disconnect and the server does not cleanup correctly. Such as a core dump > from the client where he cannot close correctly. That's handled by the underlying TCP (assuming it is implemented correctly...). > What I am doing is attempting to convert the logger example into an alarm > manager for remote nodes. In this application a node may be powered down > there by terminating a Logger/Alarm server connection abnormally, this could > leave the Logger with many dangling sockets and allocated svc_handler objects. If the TCP implementation doesn't handle this correctly then the standard way of dealing with it is to have an Event_Handler use a watchdog timer to periodically "poll" the client to make sure it is still connected. BTW, PCs tend to have more problems with this than UNIX boxes since when they are turned off the TCP implementation may not be able to send a RESET... ---------------------------------------- 22. Using templates with Centerline. Centerline uses ptlink to process the C++ templates. ptlink expect the template declarations and definitions (app.h and app.C) to reside in the same directory. This works fine for the ACE hierarchy since everything is a link to the appropriate src directory (include/*.[hi] --> ../src/). When a users of the ACE distribution attempts to include the ACE classes in an existing application hierarchy this problem will arise if ptlink is used. The solution is to create a link to the declaration file from the definition file directory and use the "-I" to point to the definition directory. ---------------------------------------- 23. > When I try to compile $ACE_ROOT/src/Message_Queue.C on a Solaris > 5.3 system using SUNPro CC 4.0, the compiler aborts with a Signal 10 > (Bus Error). Our copy of CC 4.0 is over a year old and I do not > know if any patches or upgrades exist for it. If they do, then we > have not applied them to our compiler. Several other people have run across this as well. It turns out that there is a bug in the Sun 4.0.0 C++ compiler that will get a bus error when -g is used. If you compilg Message_Queue.C *without* -g then it works fine. The later versions of SunC++ don't have this bug. I'd recommend that you upgrade as soon as possible. ---------------------------------------- 24. > I have added a dynamic service to the Service Configurator. This new service > fails on the load because it uses application libraries that are not shared > object libraries (i.e., objects in libApp.a). I am assuming from the error > message that the problem is the mix match of shared and non-shared objects. Right, exactly. > I was wondering if there is an easy way to add static services to the > Service Configurator. The example directory listing static service is > very tightly coupled with the Service_Config object. Is there another > way of adding static services. Sure, that's easy. The best way to do this is to use the interfaces of the Service_Respository class to configure static services into the Service_Config. A good example of how to do this is in Service_Config.[Chi]: int Service_Config::load_defaults (void) { for (Static_Svc_Descriptor *sl = Service_Config::service_list_; sl->name_ != 0; sl++) { Service_Type *stp = ace_create_service_type (sl->name_, sl->type_, (const void *) (*sl->alloc_)(), sl->flags_); if (stp == 0) continue; const Service_Record *sr = new Service_Record (sl->name_, stp, 0, sl->active_); if (Service_Config::svc_rep->insert (sr) == -1) return -1; } return 0; } ---------------------------------------- 25. > 8. Do you have examples of the SYNC/ASYNC pattern? Yes. Check out the following: 1. The latest version of ./apps/Gateway/Gateway has an example of this when you compile with the USE_OUTPUT_MT flag. In this case, the Reactor performs the "Async" processing, which multiplexes all incoming messages from peers arriving on Input_Channels. These messages are then queued up at the appropriate Output_Channels. Each Output_Channel runs in a separate thread, performing the "Sync" processing. 2. Also, the latest version of the OOCP-tutorial4.ps.gz file available from wuarchive.wustl.edu in the directory /languages/c++/ACE/ACE-documentation shows an example of using the Half-Sync/Half-Async pattern to build an Image Server. I'm using this as an example in my tutorials these days. ---------------------------------------- 26. > We had a discussion about something we saw in the new ACE code. > I thing there was a member function of a class that was doing a > "delete this". Is this safe? In general it is safe as long as (1) the object has been allocated dynamically off the heap and (2) you don't try to access the object after it has been deleted. You'll note that I tend to use this idiom in places where an object is registered with the Reactor, which must then must ensure the object cleans itself up when handle_close() is called. Note that to ensure (1) I try to declare the destructor "private" or "protected" so that the object must be allocated off the heap (some compilers have a problem with this, so I may not be as consistent as I ought to...). ---------------------------------------- 27. > 5. What is the correct way for building a modified ACE library? > Changing in "libsrc" or in "include" directory? > When I make a complete new directory, how can I get introduced > the dependencies within my new makefile, can you give a short hint? Sure, no problem. For instance, here's what I did tonight when I added the new Thread_Specific.[hiC] files to ACE: 1. Created three new files Thread_Specific.[hiC] in ./libsrc/Threads. 2. cd'd to ../../include/ace and did a % ln -s ../../libsrc/Threads/Thread_Specific.[hi] . 3. cd'd to ../../src and did a % ln -s ../../libsrc/Threads/Thread_Specific.C . 4. then I did % make depend on the ./src directory, which updated the dependencies. ---------------------------------------- 28. The following is from Neil B. Cohen (nbc@metsci.com), who is writing about how to work around problems he's found with HP/UX. I've been trying to compile the latest beta (3.2.9) on an HP running HPUX9.05 for the past week or so. I've had problems with templates up and down the line. I finally discovered (after some discussions with the HP support people) that they have made numerous changes to their C++ compiler recently to fix problems with templates and exceptions. If you are trying to compile ACE under HPUX with anything less than version 3.70 of the HP compiler, you may have serious problems (we were using v3.50 which came with the machine when we bought it a few months ago). Also, unlike earlier ACE versions, I was forced to add the following line to the rules.lib.GNU file to "close" the library - ie. force the various template files to be instantiated and linked to the ACE library itself. I don't know if this is necessary, or the only way to make things work, but it seems to do the job for my system. in rules.lib.GNU... $(VLIB): $(VOBJS) - CC -pts -pth -ptb -ptv -I$(ACE_ROOT)/include $(VOBJS) $(AR) $(ARFLAGS) $@ $? ./ptrepository/*.o -$(RANLIB) $@ -chmod a+r $@ I added the CC line, and added the "./ptrepository/*.o" to the $(AR) cmd. Sun has an -xar option, I believe that does something similar to this. Also - note that I'm not sure that the "-ptb" option is necessary. I added that before we upgraded the compiler, so it may not be needed now... ---------------------------------------- 29. > I just ran my program with Purify, and it is telling me that there > is at least one large (~4k) memory leak in > ACE_Thread_Specific. This may or may not be serious, > but it is probably worth looking into. Right, that's ok. This is data that's allocated on a "per-thread" basis the first time a thread makes a call using the LM_ERROR or LM_DEBUG macros. The data isn't freed-up until the thread exits. ---------------------------------------- 30. > In my trying to use the Reactor pattern for my application I > noticed that I had to couple my eventHandler derived objects with a > specific IPC_SAP mechanism. To use some of your own examples your > Client_Stream object contains a TLI_Stream object to use in data > transfer. My application calls for determining the communication > mechanism at run time. To do this my eventHandler must be able to > create the appropriate IPC_Stream object at run time and use its > methods through a super class casting. The problem is that there is no > super class with the virtual methods for send, recv, etc. To solve my > problem I will create that super class and have the TLI ( as well as > other wrapper objects) inherit from it instead of IPC_SAP. My question > is I am suspicious of why ACE wasn't designed with that in mind? Is my > application that unique ? or is there a better way to do this that I > am not aware of ? Your help in this matter will be much appreciated. ACE was developed using static binding for IPC_SAP in order to emphasize speed of execution over dynamic flexibility *in the core infrastructure*. To do otherwise would have penalized the performance of *all* applications in order to handle the relatively infrequent case where you want to be able to swap mechanisms at run-time. Since it is straightforward to create an abstract class like the one you describe above I decided to make this a "layered" service rather than use this mechanism in the core of ACE. BTW, I would not modify TLI_SAP and SOCK_SAP to inherit from a new class. Instead, I would use the Bridge and Adapter patterns from the "Gang of Four" patterns catalog and do something like this: ---------------------------------------- // Abstract base class class ACE_IPC_Stream { public: virtual ssize_t recv (void *buf, size_t bytes) = 0; virtual ssize_t send (const void *buf, size_t bytes) = 0; virtual ACE_HANDLE get_handle (void) const = 0; // ... }; ---------------------------------------- and then create new classes like ---------------------------------------- template class ACE_IPC_Stream_T : public ACE_IPC_Stream { public: virtual ssize_t recv (void *buf, size_t bytes) { return this->ipc_.recv (buf, bytes); } virtual ssize_t send (const void *buf, size_t bytes) { return this->ipc_.send (buf, bytes); } virtual ACE_HANDLE get_handle (void) { return this->ipc_.get_handle (); } // ... private: IPC ipc_; // Target of delegation // (e.g., ACE_SOCK_Stream or ACE_TLI_Stream). } ---------------------------------------- Then you could write code that operated on ACE_SAP *'s to get a generic interface, but that reused existing code like SOCK_SAP and TLI_SAP, e.g., ---------------------------------------- class My_Event_Handler : public ACE_Event_Handler { public: My_Event_Handler (void) { // Figure out which IPC mechanism to use somehow: if (use_tli) this->my_ipc_ = new ACE_SAP_IPC; else if (use_sockets) this->my_ipc_ = new ACE_SAP_IPC; else ... } private: ACE_IPC_Stream *my_ipc_; }; ---------------------------------------- There are obviously details left out here, but this is the general idea. ---------------------------------------- 31. > I was trying to view your 'Writting example applications in CORBA' article > /tutorial using ghostview but the .ps file seems to be corrupted ( I tried to > ftp it more than once). Any help would be much appreciated. There are two solutions to this problem (which seems to be caused by a weird interaction between ghostview and the "psnup" program I use to generate the slides 4-up on a page): 1. If you want to print them or view them 1-up on a page you can edit the postscript file and remove the first 551 lines or so (which are generated by the psnup script). This will cause the document to be printed 1-up rather than 4-up. 2. You can try to print the 4-up file on a postscript printer. Believe it or not, this typically works, even though ghostview can't handle it! ---------------------------------------- 32. > We would like to use the Reactor class as a static member on some of > our classes (one per process) so that we can see and use the Reactor > witnin each process on a global level. We are using it to set > timers several levels down in our class trees and don't want to pass > a pointer to it through all of our constructors. My question is: > are there any static initialization dependencies that you know of > when using the default "do nothing" constructor of the Reactor that > could prevent use from using it as a static member variable? Thanks > for any advice on this issue. The only problems you'll have are the typical ones about "order of initialization" of statics in separate files. You'll also have to live with the default size of the I/O handler table, which probably isn't a problem since the max is something like 1024 or so. BTW, I solve this problem in ACE via the Service_Config::reactor, which is a static *pointer* to a Reactor. If you really wanted to make this work nicely, you could use the Singleton pattern from the "Gang of Four" patterns catalog. That should solve your problem even more elegantly! ---------------------------------------- 33. > I just got the ACE-3.3 version and am trying it on the HP-UX. > I run into a small problem while cloning the directories that > might be worth fixing. > > I made a directory called ACE_WRAPPERS/HP-UXA.09.05-g1, cd to it > and run "make -f ../Makefile clone". when I look in src, I have: > Acceptor.C@ -> ../libsrc/Connection/Acceptor.C > > However, ../libsrc does not exist. It is not one of the CLONE > variables in ACE_WRAPPERS/Makefile. I don't think you'd want to > clone libsrc too, since its files don't change. I think you can solve this problem as follows: % cd ACE_WRAPPERS % setenv ACE_ROOT $cwd % cd HP-UXA.09.05-g1 % make -f ../Makefile clone % setenv ACE_ROOT $cwd % make That should build the links correctly since they'll point to the absolute, rather than relative, pathnames! ---------------------------------------- 34. > Our quality personal has asked me the following questions for which > I think you are the right guy for answering that: > o How long is ACE used in industrial products? It was first used at Ericsson starting in the fall of 1992, so that makes it about 3 years now. > o What are reference projects comparable to ours that use ACE? The ones I have directly worked with include: Motorola -- satellite communication control Kodak Health Imaging Systems -- enterprise medical imaging Siemens -- enterprise medical imaging Ericsson/GE Mobile Communications -- telecommunication switch management Bellcore -- ATM switch signal software In addition, there are probably about 100 or more other companies that have used ACE in commercial products. The current mailing list has about 300 people from about 230 different companies and universities. If you'd like additional info, please let me know. > o How many persons have contributed on testing and writing error > reports for ACE? Around 60 or so. All the contributors are listed by name and email address at the end of the README file distributed with the ACE release. > o How many bug fixes have been made since ACE was public domain? All information related to bug fixes is available in the ChangeLog file distributed with the ACE release (I could count these for you if you need that level of detail). > o How many literature is there on ACE? All articles published about ACE are referenced in the BIBLIOGRAPHY file in the top-level directory of ACE. ---------------------------------------- 35. > We are currently evaluating ACE for use on a new telecom switch. > Many of us like ACE but are having trouble convincing some team > members that wrappers are better than using the direct Unix > system calls. > I have read your papers that came with ACE, but was wondering if there > are other papers that address the benefits (or problems) of wrappers? This topic has been discussed in other places, most notably the book by Erich Gamma and Richard Helm and Ralph Johnson and John Vlissides called "Design Patterns: Elements of Reusable Object-Oriented Software" (Addison-Wesley, 1994), where it is described in terms of the "Adapter" pattern. Very briefly, there are several key reasons why you should *not* use UNIX system calls directly (regardless of whether you use ACE or not). 1. Portability -- Unless you plan to develop code on only 1 UNIX platform (and you never plan to upgrade from that platform as it goes through new releases of the OS) you'll run across many, many non-portable features. It's beyond the scope of this FAQ to name them all, but just take a look at ACE sometime and you'll see all the #ifdefs I've had to add to deal with non-compatible OSs and compilers. Most of these are centralized in one place in ACE (in the ace/OS.*files), but it took a lot of work to factor this out. By using wrappers, you can avoid most of this problem in the bulk of your application code and avoid revisiting all of these issues yourself. In addition, ACE is now ported to other platforms (e.g., Windows NT and Windows 95). If you want to write code that is portable across platforms, wrappers are a good way to accomplish this. 2. Ease of programming -- I'd go as far as to say that anyone who wants to program applications using C-level APIs like sockets or TLI is not serious about developing industrial strength, robust, and easy to maintain software. Sockets and TLI are *incredibly* error-prone and tedious to use, in addition to being non-portable. I've got a paper that discusses this in detail at URL http://www.cs.wustl.edu/~schmidt/PDF/COOTS-95.pdf 3. Incorporation with higher-level patterns and programming methods -- Here's where the Adapter pattern stuff really pays off. For example, by making all the UNIX network programming interfaces and synchronization mechanisms have the same API I can write very powerful higher-level patterns (e.g., Connector and Acceptor) that generalize over these mechanisms. For proof of this, take a look at the ./tests/Connection/non_blocking directory in the latest ACE-beta.tar.gz at wuarchive.wustl.edu in the /languages/c++/ACE directory. It implements the same exact program that can be parameterized with sockets, TLI, and STREAM pipes *without* modifying any application source code. It is literally impossible to do this without wrappers. ---------------------------------------- 36. > How can I use a kind of "Reactor" in such a way that a reading > thread can notice the arrival of new data on several shared memory > areas ? Ah, that is a tricky issue! The underlying problem is that UNIX is inconsistent with respect to the ability to "wait" on different sources of events. In this case, Windows NT is much more consistent (but it has its own set of problems...). > Poll, Select and Reactor (so far I read) assume that file > descriptors are present, which is not the case with shared memory. That's correct (though to be more precise, the Reactor can also deal with signals, as I discuss below). > Is there a common and efficient way to deal with that kind of > situation, or do I have to insert extra ipc mechanisms (based on > descriptors) ? There are several solutions: 1. Use the Reactor's signal handling capability (see the ./tests/Reactor/misc/signal_tester.C for an example) and have the process/thread that writes to shared data send a signal to the reader process(es). The disadvantage of this is that your code needs to be signal-safe now... 2. Use a combination of SPIPE_Streams and the Reactor to implement a simple "notification protocol," e.g., the receiver process has an Event_Handler with a SPIPE_Stream in it that can be notified when the sender process writes data to shared memory. The disadvantage here is that there's an extra trip through the kernel, though the overhead is very small since you only need to send 1 byte. 3. Use threads and either bypass the Reactor altogether or integrate the threads with the Reactor using its Reactor::notify() mechanism (see the ./tests/Reactor/misc/notification.C file for an example of how Reactor::notify() works). The disadvantage of this approach is that it won't work for platforms that lack threads. ---------------------------------------- 37. > What do you think about wrapping communication methodologies in C++ streams? > What I mean is having defining a stream and extractor/insertor functions > which the underlying implementation reads/writes on comm mechanisms instead of > files. I would think this to be a very general interface for all comms > implementations. All user code would look the same, but the underlying stream > implementations would be different. Whether the stream functionality would > be defined by the stream itself (eg tcpstream) or with manipulators > (eg commstream cs; cs << tcp;) is up for grabs in my mind. > > Anyhow, I was wondering your input... That technique has been used for a long time. In fact, there are several freely available versions of iostreams that do this and RogueWave also sells a new product (Net.h++) that does this. I think this approach is fine for simple applications. However, it doesn't really work well if you need to write sophisticated distributed applications that must use features like non-blocking I/O, concurrency, or that must be highly robust against the types of errors that occur in a distributed system. For these kinds of systems you either need some type of ORB, or you need to write the apps with lower-level C++ wrappers like the ones provided by ACE. ---------------------------------------- 38. > What is the difference between cont() and next() in an ACE_Message_Block? Ah, good question. cont() gives you a pointer to the next Message_Block in a chain of Message_Block fragments that all belong to the same logical message. In contrast, next() (and prev()) return pointers to the next (and previous) Message_Block in the doubly linked list of Message_Blocks on a Message_Queue. BTW, this is *exactly* the same structure as in System V Streams... > Which would I use if I wanted to add a header and a trailer, each stored in > ACE_Message_Blocks of their own, to another ACE_Message_Block? You should use cont() for that. Does that make sense? ---------------------------------------- 39. > I think that your site is cool, but it's being a terrible tease in > that I really want to read the contents, but don't know anything > about x-gzip formatting. I'm running Netscape 2.0 under MS Windows > NT. To view PostScript files under Win32 you will need a PostScript viewer such as GSview. You can find GSview and Ghostscript (which is needed to run GSview) at http://www.cs.wisc.edu/~ghost/. It seems that both Netscape and Internet Explorer mangles the names of downloaded files to reflect their content type, so *.ps.gz files are saved as *_ps.ps instead. Fortunately, GSview as of version 2.2 supports gzip compressed postscript. When set up as a viewer for Postscript files, files with mangled names can be viewed by GSview without any preprocessing. ---------------------------------------- 40. > What I am doing is > 1. Making an ACE_SOCK_Dgram and let it choose the next available port number. > 2. Making a message that will be broadcasted to X number of servers. This > message has a port number which the server will use to send its reply. > 3. Broadcast the message to a fixed port number. > 4. Wait for replies from the servers. > > > It looks like I need "ACE::bind_port" to return the port number that > it picked and "ACE_SOCK_Dgram::shared_open" will need it store the > port number so I could call some function like > ACE_SOCK_Dgram::get_port_number or it would need to return the port > number instead of the handle(I could always call > ACE_SOCK_Dgram::get_handle if I needed the handle). > > Is there I way to get the port number that I have missed? Sure, can't you just do this: // Defaults to all "zeros", so bind will pick port. ACE_INET_Addr dg_addr; ACE_SOCK_Dgram dg; dg.open (dg_addr); dg.get_local_addr (dg_addr); dg_addr.get_port_number (); ---------------------------------------- 41. How can you rename a core file? new_disposition.sa_handler = &Handle_Coredump_Signal; sigemptyset(&new_disposition.sa_mask); sigaddset(&new_disposition.sa_mask,SIGCHLD); new_disposition.sa_flags = 0; sigaction(SIGSEGV,&new_disposition,&old_disposition); ***************** void Handle_Coredump_Signal(void) { int status; pid_t child; char new_core_name[64]; if(0 == (child = fork())) { abort(); } else { if(-1 == waitpid(child,&status,NULL)) { exit(-1); } sprintf(new_core_name,"core_%d",getpid()); rename("core",new_core_name); exit(0); } } ---------------------------------------- 42. > I have seen 2 different inlining policies in ACE > > 1) The .i file is included unconditionally by both the .h and .C file > and all functions in the .i file carry the "inline" keyword. Right. Those are for cases where I *always* want to inline those methods. I do this mostly for very short wrapper methods (e.g., read() or write()) that are likely to be on the "fast path" of an application. > 2) The .i file is included by the .h file ONLY if __INLINE__ is defined > for the compile. This causes the functions in the .i file to be > compiled as inline functions (INLINE translates to inline in this case). > If __INLINE__ is not defined, the .i file is only included by the .C > file and the functions do NOT carry the "inline" keyword. I do this for cases where it's really not essential to have those methods inline, but some users might want to compile ACE that was if they want to eliminate all the wrapper function-call overhead. For instance, I'll typically do this when I'm running benchmarks. ---------------------------------------- 43. Integrating ACE and CORBA > Our goal is to implement a CORBA-II compliant application. I am > trying to conceptually visualize the applicability to ACE to this > attempt (which we're pretty excited about), and I was hoping you'd > offer any opinions / observations that you might have. We've successfully integrated ACE with several implementations of CORBA (in particular Orbix 1.3 and 2.0) and used it in a number of commercial applications. In these systems, we use ACE for a number of tasks, including the following: 1. Intra-application concurrency control, threading, and synchronization via the ACE_Thread_Manager and Synch* classes. 2. Dynamic linking of services via the ACE_Service_Config. 3. Integration of event loops via the ACE_Reactor. 4. Management of shared memory via ACE_Malloc. 5. High-performance network I/O via the ACE_SOCK* wrappers. plus many more. You can find out more info about the ACE/CORBA integration and the performance issues associated with it in the following paper: http://www.cs.wustl.edu/~schmidt/PDF/COOTS-96.pdf ---------------------------------------- 44. > Can the Reactor's event loop be called recursively? This is not advisable. The Reactor's dispatch() method is not reentrant (though it is thread-safe) since it maintains state about the active descriptors it is iterating over. Therefore, depending on the descriptors you're selecting on, you could end up with spurious handle_*() callbacks if you make nested calls to the Reactor::handle_events() method. > For example, if I have a program that sets up some event handlers > and then calls, in an infinite loop, ACE_Reactor::handle_events(). > Can one of the event handlers call handle_events() again if it needs > to block, while allowing other event handlers a chance to run? I'm not sure if this is really a good idea, even if the Reactor were reentrant. In particular, what good does it do for one Event_Handler to "block" by calling handle_events() again? The event the handler is waiting for will likely be dispatched by the nested handle_events() call! So when you returned back from the nested call to handle_events() it will be tricky to know what state you were in and how to proceed. Here's how I design my single-threaded systems that have to deal with this: 1. I use a single event loop based on the Reactor, which acts a cooperative multi-tasking scheduler/dispatcher. 2. I then program all Event_Handler's as non-blocking I/O objects. This is straightforward to do for both input and output using the ACE_Reactor::schedule_wakeup() and ACE_Reactor::cancel_wakeup() methods (available with the latest version of ACE). 3. Then, whenever an Event_Handler must block on I/O, it queues up its state on an ACE_Message_Queue, calls ACE_Reactor::schedule_wakeup(), and returns to the main event loop so that other Event_Handlers can be dispatched. When the I/O is ready, the Reactor will call back to the appropriate handle_* method, which can pick up the state it left in the Message_Queue and continue. There are a number of places to find more information on this sort of design: 1. $ACE_ROOT/apps/Gateway/Gateway/Channel.cpp -- This Gateway application example shows the C++ code. 2. http://www.cs.wustl.edu/~schmidt/PDF/TAPOS-00.pdf -- This paper describes the underlying patterns. 3. http://www.cs.wustl.edu/~schmidt/PDF/OONP-tutorial4.pdf -- This tutorial explains the source code and the patterns. BTW, I'll be describing patterns for this type of design challenge in my tutorial at USENIX COOTS in June. Please check out http://www.cs.wustl.edu/~schmidt/COOTS-96.html for more info. ---------------------------------------- 45. > In one of my programs, a process needs to receive input from > multiple input sources. One of the input sources is a file > descriptor while another is a message queue. Is there a clean way to > integrate this a message queue source into the Reactor class so that > both inputs are handled uniformly? Do you have multiple threads on your platform? If not, then life will be *very* tough and you'll basically have to use multiple processes to do what you're trying to do. There is *no* portable way to combine System V message queues and file descriptors on UNIX, unfortunately. If you do have threads, the easiest thing to do is to have a thread reading the message queue and redirecting the messages into the Reactor via its notify() method. Please take a look at the program called examples/Reactor/Misc/notification.cpp for an example. ---------------------------------------- 46. > I'm writing a program to find out the address for a socket. The > idea is that we open an ACE_Acceptor (and will eventually perform > accept() on it.) Before we can do that we need to find out the > address of the ACE_Acceptor so that we can publish it (for others to > be able to connect to it.) The trouble is that the call > ACE_INET_Addr::get_host_name () prints "localhost" as the host name > while I would like to principal host name to be printed instead. All ACE_INET_Addr::get_host_name() is doing is calling ACE_OS::gethostbyaddr(), which in turn will call the socket gethostbyaddr() function. I suspect that what you should do is something like the following: ACE_Acceptor listener (ACE_Addr::sap_any); ACE_INET_Addr addr; listener.get_local_addr (addr); char *host = addr.get_host_name (); if (::strcmp (host, "localhost") == 0) { char name[MAXHOSTNAMELEN]; ACE_OS::hostname (name, sizeof name); cerr << name << endl; } else cerr << host << endl; ---------------------------------------- 47. > Could you please point me to stuff dealing with asynchronous cross > platform socket calls. I want to use non blocking socket calls on > both UNIX and NT. Sure, no problem. Take a look at the ./examples/Connection/non_blocking/ directory. There are a number of examples there. In addition, there are examples of non-blocking connections in ./examples/IPC_SAP/SOCK_SAP/CPP-inclient.cpp The code that actually enables the non-blocking socket I/O is in ace/IPC_SAP.cpp ---------------------------------------- 48. > Is ACE exception-safe? If I throw an exception out of event > handler, will the Reactor code clean itself? Yes, that should be ok. In general, the two things to watch out for with exceptions are: 1. Memory leaks -- There shouldn't be any memory leaks internally to the Reactor since it doesn't allocate any memory when dispatching event handlers. 2. Locks -- In the MT_SAFE version of ACE, the Reactor acquires an internal lock before dispatching Event_Handler callbacks. However, this lock is controlled by an ACE_Guard, whose destructor will release the lock if exceptions are thrown from an Event_Handler. ---------------------------------------- 49. > I am building a Shared memory manager object using MMAP and MALLOC > basically as: > > typedef ACE_Malloc SHMALLOC; > > I noticed that the ACE_MMAP_Memory_Pool class provides for the users > to specify a Semaphore key. However, once I use it via the > ACE_Malloc<..>::ACE_Malloc(const char* poolname) constructor, I lose > this option. Yes, that is correct. That design decision was made to keep a clean interface that will work for all the various types of memory pools. > Is there any recommended way to specialize ACE classes to allow this > key to be overridden? Yes indeed, you just create a new subclass (e.g., class My_Memory_Pool) that inherits from ACE_MMAP_Memory_Pool and then you pass in the appropriate key to the constructor of ACE_MMAP_Memory_Pool in the constructor of My_Memory_Pool. Then you just say: typedef ACE_Malloc SHMALLOC; Please check out the file: examples/Shared_Malloc/Malloc.cpp which illustrates more or less how to do this. ---------------------------------------- 50. > What is the best way to turn on TRACE output in ACE. I commented > out the #define ACE_NTRACE 1 in config.h and rebuilt ACE and the > examples. The best way to do this is to say #define ACE_NTRACE 0 in config.h. > When I run the CPP-inserver example in examples/IPC_SAP/SOCK_SAP, I > get some trace output but not everything I would expect to see. Can you please let me know what you'd expect to see that you're not seeing? Some of the ACE_TRACE macros for the lower-level ACE methods are commented out to avoid problems with infinite recursion (i.e., tracing the ACE_Trace calls...). I haven't had a chance to go over all of these indepth, but I know that it should be possible to turn many of them back on. > It would be nice to have a runtime option for turning trace on and > off. There already is. In fact, there are two ways to do it. If you want to control tracing for the entire process, please check out ACE_Trace::start_tracing() and ACE_Trace::stop_tracing(). If you want to control tracing on a per-thread basis please take a look at the ACE_Log_Msg class. There are methods called stop_tracing() and start_tracing() that do what you want. ---------------------------------------- 51. > I've been using an acceptor and a connector in one (OS-) process. > What does happen, if a signal is sent to this process? Is the signal > processed by every ACE_Event_Handler (or its descendants) that is > around? The manual page simply states that handle signal is called > as soon as a signal is triggered by the OS. How this signal is handled depends on several factors: 1. Whether your using ACE_Sig_Handler or ACE_Sig_Handlers to register the signal handlers. 2. If you're using ACE_Sig_Handler, then the ACE_Event_Handler * that you've most recently registered to handle the signal will have it's handle_signal() method called back by the Reactor. 3. If you're using ACE_Sig_Handlers, then all of the ACE_Event_Handler * that you've register will be called back. For examples of how this works, please check out $ACE_ROOT/examples/Reactor/Misc/test_signals.cpp This contains a long comment that explains precisely how everything works! ace-8.0.4+dfsg.orig/docs/msvc_notes.txt0000644000175000017500000001532415027201773017045 0ustar sudipsudip /** @page msvc Miscellaneous Notes for ACE/TAO and Microsoft Visual C++ Here are just some random information about ACE/TAO with Microsoft Visual C++. This is more a collection of ideas right now, so it may not be as polished as other ACE documentation. @subsection msvc_configurations Configurations MSVC workspace and solution files come with several configurations. The main two are Debug and Release. Debug produces libraries and executables with debugging symbols and doesn't enable inlining. The Release configuration enables optimizations and leaves out debugging symbols. All projects contain both configurations. If you want to build static or mfc versions of the library you need to use different project and solution files. Project files with _Static extension denote workspaces for building static libraries. Different configurations produce different libraries and executables. For example, Debug versions of dynamic libraries are always named *d.dll (like aced.dll) and the executables are placed in the current directory. Release versions of dynamic libraries are named *.dll (such as ace.dll) and their executables are usually placed in the Release subdirectory. Other common suffixes include *sd.lib for Static Debug and *s.lib for Static Release. Projects only use the same configuration versions of the libraries. The Debug version of an ACE example only uses debug version of ACE library. @subsection msvc_otheroptions How to Set Other Options Other compile time options are set or unset via the config.h file. For example, to turn on a compile time definition, #define it at the beginning of config.h. Unsetting a definition just requires #define ACE_FOO 0 or a #undef at the end of the file (after including config-win32.h). Different macros require different techniques. @subsection msvc_libraries ACE/TAO Libraries I don't think we have any documents really giving any info on what libraries are produced by the MSVC project files. So unlike the Unix platforms, Win32 libraries do not have a prefix of "lib", instead it is used as an extension. For example, the debug version of the dynamic ace library is aced.lib (which is a stub for aced.dll). The three ACE libraries are: - ace - ACE_RMCast - ACE_SSL - ACE_TMCast And for TAO we have the main TAO library and several sub libraries which contain extra features of TAO that aren't always needed (such as the POA in TAO_PortableServer). And finally we have the orbsvcs libraries. Each ORB service is contained in its own library. More libraries may be needed to be linked in, since some services require the use of others (such as TAO_AV requiring TAO_CosTrading and TAO_CosProperty). The *.lib and *.dll files are located in ACE_wrappers/lib. You need to point your PATH to $ACE_ROOT/lib for running the applications. I hesitate to put down explicit instructions on what libraries need to be linked in, considering that the libraries are being split apart more and more for footprint purposes. For most ACE stuff, you will only need to link in ace.lib. For plain TAO clients TAO.lib is enough. TAO servers also require TAO_PortableServer.lib for the POA. If the TAO application uses Dynamic Anys, TAO_DynamicAny.lib is also needed. Then if any of the ORB Services are used, more libraries are needed. For example, a client that uses the Name Service would need to link TAO_CosNaming.lib. And note that the release versions of the libraries are listed above. For debug configurations the libraries would be aced.lib, TAOd.lib, etc. @subsection msvc_external_projects External ACE/TAO Projects It is a little difficult for us to list how exactly one should create projects that use ACE/TAO but are external to the ACE_wrappers tree. Since most projects we create are in that tree, we can make assumptions about directory structure that doesn't always apply for external projects. In other words, we have ideas how they should work, but they usually remain a bit, um, untested. :-) There are three main dependencies a project would have on ACE/TAO. - Include paths: Since all the headers use a subdirectory way of referring to include files (such as "ace/OS.h" instead of just "OS.h"). In order to make this work either the path to ACE_wrappers (and ACE_wrappers\TAO and ACE_wrappers\TAO\orbsvcs, etc.) to the additional include paths of the project or in MSVC. I believe it is a better idea to add them to the global MSVC directories. That way the path to ACE on a machine doesn't get hard coded into the project itself (this should make it easier to move the project between machines where ACE is installed in different places). - Libraries and library paths: Depending on what features are needed, different libraries are needed to be linked in. (This is covered more in an above section). These libraries are specified in the project, but can be specified in different ways. The first is the hard coded way (a full path, such as "C:\ACE_wrappers\ace\aced.lib"). The second is listing only the library (such as "aced.lib") and then specify the path either in the project or via MSVC global settings. Just like for the include paths, MSVC global settings is probably the more robust way of specifying this. - TAO_IDL: TAO's IDL compiler resides in ACE_wrappers\bin. If the external project contains IDL files, then a custom build configuration can be used to automatically call TAO_IDL. Note that the location of the release version of the compiler is in ACE_wrappers\bin\Release (although it doesn't matter which version you use, they both produce the same output). If ACE_wrappers\bin is included in the path, then the build command can just refer to tao_idl and it can be found via the path. The other options are to refer to tao_idl via an absolute hard coded path or to add ACE_wrappers\bin to the MSVC's global executable path settings. Either way the bin directory must be in the path or in the global settings so tao_idl can find aced.dll. So I guess in summary we would recommend adding most of the settings to Visual C++'s global settings (include paths, library paths, and executable paths) and just refer to the libraries without any paths. @subsection msvc_aceroot ACE_ROOT ACE_ROOT is an interesting environment variable. Even though it is heavily used on Unix (in fact, ACE/TAO will not compile without it) it really isn't needed for MSVC. The reason for this is that we were interested in making configuration and setup really easy for Visual C++ on Windows. In retrospect it might have made quite a few things easier to specify if ACE_ROOT was required. One thing you might notice is that TAO_IDL will display a message if ACE_ROOT isn't set, but it is only a problem if the IDL file includes and you don't use -I to specify where orb.idl is. */ ace-8.0.4+dfsg.orig/docs/Download.html0000644000175000017500000004125015027201773016556 0ustar sudipsudip Obtaining ACE, TAO, CIAO and DAnCE


Obtaining ACE, TAO, CIAO, and DAnCE

Welcome to the download page for ACE, TAO, CIAO, and DAnCE which are open-source middleware developed by the DOC group that provide that following capabilities:

  • ACE is an open-source framework that provides many components and patterns for developing high-performance, distributed real-time and embedded systems. ACE provides powerful, yet efficient abstractions for sockets, demultiplexing loops, threads, synchronization primitives.

  • TAO (The ACE ORB) is an open-source implementation of a CORBA Object Request Broker (ORB) built using components and patterns in the ACE framework.

  • CIAO (Component Integrated ACE ORB) is an open-source implementation of the CORBA Component Model (CCM) built on top of TAO.

  • DAnCE is an open-source implementation of the Deployment and Configuration standard (D&C) built on top of TAO.

  • After downloading a distribution we strongly advice to subscribe at least to release notifications on github to stay informed about new releases.

    Commercial support for ACE, TAO, CIAO, and DAnCE is available from a number of companies.

    Doxygen documentation for releases of ACE/TAO/CIAO/DAnCE can be browsed online.


    Downloading Freely Available Versions of ACE, TAO, CIAO, and DAnCE

    Our process for developing and releasing ACE, TAO, and CIAO, as well as the role of major, minor, and micro release is described in detail in the DOC group's development and release process document. Please check that document to decide which version below is more appropriate for your case. You may want to understand the DOC group's bug fixing policies when you make this decision.

    The full packages do contain all sources with pre generated makefiles for GNU make, Visual Studio 2019/2022. The sources-only packages just contain the source code, you have to generate your own makefiles with MPC.

    If you are using Windows download a package with a .zip extension, these packages have Windows line feeds. For all other platforms download a .gz/.bz2 package.

    • Latest ACE+TAO Micro Release. The latest micro release is ACE 8.0.3 and TAO 4.0.3, please use the links below to download it.

      FilenameDescriptionFullSources only
      ACE+TAO.tar.gz ACE+TAO (tar+gzip format) [HTTP] [FTP] [HTTP] [FTP]
      ACE+TAO.tar.bz2 ACE+TAO (tar+bzip2 format) [HTTP] [FTP] [HTTP] [FTP]
      ACE+TAO.zip ACE+TAO (zip format) [HTTP] [FTP] [HTTP] [FTP]
      ACE-html.tar.gz Doxygen documentation for ACE+TAO (tar+gzip format) [HTTP] [FTP]
      ACE-html.tar.bz2 Doxygen documentation for ACE+TAO (tar+bzip2 format) [HTTP] [FTP]
      ACE-html.zip Doxygen documentation for ACE+TAO (zip format) [HTTP] [FTP]
      ACE.tar.gz ACE only (tar+gzip format) [HTTP] [FTP] [HTTP] [FTP]
      ACE.tar.bz2 ACE only (tar+bzip2 format) [HTTP] [FTP] [HTTP] [FTP]
      ACE.zip ACE only (zip format) [HTTP] [FTP] [HTTP] [FTP]

    • Latest ACE+TAO Minor Release. The latest minor release is ACE 7.1.0 and TAO 3.1.0 (ACE+TAO x.1.0), please use the links below to download it.

      FilenameDescriptionFullSources only
      ACE+TAO-7.1.0.tar.gz ACE+TAO (tar+gzip format) [HTTP] [FTP] [HTTP] [FTP]
      ACE+TAO-7.1.0.tar.bz2 ACE+TAO (tar+bzip2 format) [HTTP] [FTP] [HTTP] [FTP]
      ACE+TAO-7.1.0.zip ACE+TAO (zip format) [HTTP] [FTP] [HTTP] [FTP]
      ACE-html-7.1.0.tar.gz Doxygen documentation for ACE+TAO (tar+gzip format) [HTTP] [FTP]
      ACE-html-7.1.0.tar.bz2 Doxygen documentation for ACE+TAO (tar+bzip2 format) [HTTP] [FTP]
      ACE-html-7.1.0.zip Doxygen documentation for ACE+TAO (zip format) [HTTP] [FTP]
      ACE-7.1.0.tar.gz ACE only (tar+gzip format) [HTTP] [FTP] [HTTP] [FTP]
      ACE-7.1.0.tar.bz2 ACE only (tar+bzip2 format) [HTTP] [FTP] [HTTP] [FTP]
      ACE-7.1.0.zip ACE only (zip format) [HTTP] [FTP] [HTTP] [FTP]

    • Latest CIAO Micro Release. The latest version of the CIAO micro release is available for download below.

      FilenameDescriptionSources only
      CIAO.tar.gz CIAO (tar+gzip format) [HTTP] [FTP]
      CIAO.tar.bz2 CIAO (tar+bzip2 format) [HTTP] [FTP]
      CIAO.zip CIAO (zip format) [HTTP] [FTP]

    • Latest DAnCE Micro Release. The latest version of the DAnCE micro release is available for download below.

      FilenameDescriptionSources only
      DAnCE.tar.gz DAnCE (tar+gzip format) [HTTP] [FTP]
      DAnCE.tar.bz2 DAnCE (tar+bzip2 format) [HTTP] [FTP]
      DAnCE.zip DAnCE (zip format) [HTTP] [FTP]

    Older versions of ACE+TAO are also available via HTTP at this location . This location has a few of the previous major and minor releases. This location will house all major, minor, and micro releases distributed after ACE+TAO-5.2+1.2.

    Other Sources for ACE+TAO

    ace-8.0.4+dfsg.orig/docs/README.tutorials0000644000175000017500000000035415027201773017026 0ustar sudipsudipACE tutorials can be found in the following directories: . examples/C++NPv1 - C++ Network Programming Volume 1 examples. . examples/C++NPv2 - C++ Network Programming Volume 2 examples. . examples/APG - ACE Programmer's Guide examples ace-8.0.4+dfsg.orig/docs/exceptions.html0000644000175000017500000005467515027201773017207 0ustar sudipsudip Using ACE Exception Handling Macros to Enhance CORBA Portability


    Using ACE Exception Handling Macros to Enhance CORBA Portability

    CORBA Environment arguments provide a way to handle exceptions when native c++ exception handling is unavailable or undesirable. However, writing portable code using both native C++ exception handling and CORBA::Environment objects is very hard. If you plan to write portable code that must run on platforms that do not have native C++ exceptions, therefore, we recommend you use the ACE exception macros. This document explains how these macros can help alleviate much of the accidental complexity. However, keep in mind macros cannot solve all problems perfectly.

    Before reading the rest of this document, we recommend you check out pages 307 through to 322 in the book, Advanced Corba Programming with C++ by Michi Henning & Steve Vinoski. Likewise, we recommend that you read the Error Handling chapter from the TAO Developer's Guide.


    Table of Contents


    ACE Exception Macros in a Nutshell

    This section explains some simple rules of writing programs for platforms with and without native exception support using ACE's exception macros.

    ACE exception macros are modelled like C++ language exceptions and can be used like them, but with a small difference. These macros rely on the CORBA::Environment variable to handle exceptions on platforms that do not support exception handling. (Please note that native exceptions can be turned on or off at COMPILE time as an option to your make) The exception macros have been modelled with some extra rules to ensure this works even on platforms without native exception support. See some quick examples on how to use ACE exception macros.

    1. Declaration of CORBA::Environment Parameter at Methods
      On platforms lacking native exceptions, all CORBA methods take an extra parameter added at the end of their argument list. This last parameter holds the CORBA::Environment variable. However, on systems with native exceptions, no such extra method parameter is added.
      In order for both configurations to work with the same source code, following macros are defined. In native exception configurations, they all resolve to empty.

      • ACE_ENV_ARG_DECL

        in the pseudo exception configuration resolves to
                , CORBA::Environment ACE_TRY_ENV
                
        It is used for declaring the extra Environment parameter at CORBA methods that take one or more regular parameters. The fact that the comma is part of the macro substitution caters for the hiding of this added argument when native exceptions are used. However, by the same virtue its usage is a bit peculiar -
        Example: a CORBA IDL defined method
                void mymethod (in boolean b);
                
        may be declared as follows in C++:
                void mymethod (CORBA::Boolean b  ACE_ENV_ARG_DECL);
                
        Notice the missing comma before the ACE_ENV_ARG_DECL. This notation is necessary because when using native exceptions, also the presence of the comma before the (non-existent) CORBA::Environment parameter must be hidden.

      • ACE_ENV_SINGLE_ARG_DECL

        is similar to ACE_ENV_ARG_DECL, but is used when the method takes no other parameters. It is necessary as a separate macro because it does not contain the leading comma that ACE_ENV_ARG_DECL does. Example: a CORBA IDL defined method
                void mymethod ();
                
        may look like this in C++:
                void mymethod (ACE_ENV_SINGLE_ARG_DECL);
                
      • ACE_ENV_ARG_DECL_WITH_DEFAULTS,

      • ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS

        are similar to the above two macros but add a default value to the parameter declaration. In case of TAO, the default value is TAO_default_environment().

        Notice that these macros are only used at the declaration of methods (usually in header files), not at their definition (usually in implementation files.) At the definition, instead use the corresponding macro without "_WITH_DEFAULTS". Example: the CORBA IDL defined method

                void mymethod ();
                
        in the C++ header file looks like this:
                void mymethod (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
                
        and in the C++ implementation file may look something like:
                void mymethod (ACE_ENV_SINGLE_ARG_DECL)
                {
                  // ...
                }
                

    2. Passing the CORBA::Environment Parameter into Method Calls
      Now that we've seen how to declare methods with Environment parameters, let's see how to invoke such methods.

      • ACE_ENV_ARG_PARAMETER

        in the pseudo exception configuration resolves to
                , ACE_TRY_ENV
                
        and is written as the last parameter of a method call that takes one or more regular parameters. Again we need to omit the comma that would normally precede this last parameter, as the comma is already part of the macro definition. For example, the CORBA IDL method
                void mymethod (in boolean b);
                
        would be invoked as follows:
                some_var.mymethod (bparam  ACE_ENV_ARG_PARAMETER);
                
      • ACE_ENV_SINGLE_ARG_PARAMETER

        is similar to ACE_ENV_ARG_PARAMETER but is used for calling methods that don't take any regular parameters. Our example of a CORBA IDL method
                void mymethod ();
                
        we would invoke as follows:
                some_var.mymethod (ACE_ENV_SINGLE_ARG_PARAMETER);
                

    3. Definition of the CORBA::Environment variable
      We have seen how to declare methods with the CORBA::Environment parameter, and how to invoke such methods. However, where does the variable to pass into methods as the CORBA::Environment parameter come from in the first place?

      An environment variable can be defined in the needed scope (for example, in the main program, or in a more local scope) by the statement

            ACE_DECLARE_NEW_CORBA_ENV;
            

      You can then invoke the methods on the servant from the client side as

            object_reference->func_name (x, y  ACE_ENV_ARG_PARAMETER);
            
      Even if you are interested in making calls within the client side, you can define your method like this
            int AN_OBJ::foobar (int a, int b  ACE_ENV_ARG_DECL);
            
    4. Throwing exceptions:
      Use ACE_THROW and ACE_THROW_RETURN to throw exceptions. They should never be used within a try block; please use ACE_TRY_THROW instead.

    5. Propagating exceptions:
      To simulate native exceptions on platforms without native exception handling, every function call that may throw exceptions must be followed by ACE_CHECK or ACE_CHECK_RETURN.

      Exception-throwing functions include the following categories:

      1. Any function that takes a CORBA_Environment argument.

      2. ACE_NEW_THROW_EX. Notice that you should not use ACE_NEW_THROW, ACE_NEW_THROW_RETURN, ACE_NEW_TRY_THROW anymore because they don't work right with ACE try macros. Instead, use ACE_NEW_THROW with appropriate ACE_CHECK* macros.

      3. ACE_GUARD_THROW_EX, ACE_READ_GURAD_THROW_EX, and ACE_WRITE_THROW_EX.

      4. ACE_TRY blocks. Follow every ACE_ENDTRY with appropriate ACE_CHECK* macros.

      You should pass ACE_TRY_ENV to these functions.

      Be very careful not to combine exception throwing functions in one statement like this:

                x = obj1->callme (ACE_ENV_SINGLE_ARG_PARAMETER)
                  + obj2->dare_me (ACE_ENV_SINGLE_ARG_PARAMETER);
                ACE_CHECK;
            

      This example may work differently when native exception handling is enabled/disabled.

    6. Catching exceptions:
      Use ACE_TRY to catch exceptions if there's an ACE_TRY_ENV available. Otherwise, you should use ACE_DECLARE_NEW_CORBA_ENV to create one at proper scope. The use of ACE_TRY_NEW_ENV is considered depricated because it can't deal with the case when you have multiple TRY blocks in the scope of ACE_TRY_NEW_ENV. If there are more than one try blocks in a function, use ACE_TRY_EX for all subsequence try blocks to avoid name clashing of labels.

      • Within a ACE_TRY block, use the variable ACE_TRY_ENV to pass down the CORBA_Environment (see this example.)

      • Follow every exception throwing function with ACE_TRY_CHECK. If you are using a TRY block within another try block add a ACE_TRY_CHECK at the end of this TRY block ie. after ACE_ENDTRY.

      • Use ACE_CATCH to catch exceptions of certain type.

      • ACE_CATCHANY catches any exceptions of type CORBA_Exception. The caught exception is stored in a variable call ACE_ANY_EXCEPTION.

      • ACE_CATCHALL emulate the catch (...) c++ statement. It is identical to ACE_CATCHANY on platforms without native exception support. You can not access the caught exception within the ACE_CATCHALL block.

      • Use ACE_RE_THROW to rethrow the same exception within a ACE_CATCH or ACE_CATCHANY block.

      • A ACE_TRY block must be terminated with a ACE_ENDTRY statement.

      • Throw an exception within a ACE_TRY block or ACE_CATCH block using ACE_TRY_THROW.

    7. Printing out exceptions. Use ACE_PRINT_EXCEPTION (EX,INFO) to print out an exception. The macro takes two arguments, a reference to an exception (EX) and a char * string (INFO) which provides more information on the exception. Since there's no portable way to print out exceptions, you can redefine ACE_PRINT_EXCEPTION to fit your need (or define it to null.) You should always print out the exception itself, not the CORBA_Environment that carries the exception.

    8. Name of CORBA::Environment variable
      A function that may throw a CORBA::Exception needs a CORBA::Environment variable to pass up exceptions (to throw in the C++ sense) and to gather (catch () in the C++ sense) exceptions from functions it called. By default, ACE exception macros assume that the variable is named ACE_TRY_ENV. ACE_TRY_ENV itself is also a macro which can be redefined.

      You can redefine the name of the variable to something else to avoid name clashing. Alternatively, there's another macro (ACE_ADOPT_CORBA_ENV) that allow you to use another variable name as the default CORBA::Environment within a function.


    Examples

    Refer to $ACE_ROOT/ace/CORBA_macros.h for complete definitions of macros discussed here.

    General Guidelines for Exception Handling

    • Don't catch an exception just to rethrow it. Exceptions cost you performance.

    • When exceptions occur, make sure an object's is still in a valid state or change to a state that can be safely destructed.

    • Watch out for side effect in the expression which may cause exceptions. In the following example, what should i be if an exception does occur?

            ACE_TRY
              {
                  obj[i++] = foo_bar_method (a, b  ACE_ENV_ARG_PARAMETER);
              }
      

    • Make sure an exception doesn't cause resource leak (memory, socket, ...) (hint: Use std::unique_ptr to avoid memory leak, and ACE_Guard for locks.)

    • Don't catch any exception that you don't know how to handle.

    • Never throw an exception from destructor (unless you know what it implies.)

    • Use exceptions to provide more information about the error.

    • Rethrow a different exception only to provide more information. Do not catch an exception just to rethrow, say, unknow_exception.


    Transition from ACE_TRY_ENV usage to the ACE_ENV_ARG macros

    Before TAO version 1.2.2, IDL defined methods were declared using direct mentions of CORBA::Environment ACE_TRY_ENV. The problem with this approach was that the ACE_TRY_ENV had to be passed into ORB core method calls even when native exceptions are supported. The TAO internal usage of the ACE_ENV_ARG family of macros fixes this.

    For people who want to continue to use their old code that uses the old ACE_TRY_ENV macros, they can define ACE_ENV_BKWD_COMPAT in their config.h file.

    CORBA applications that do not need support for emulated exceptions can use direct C++ exception handling and omit the CORBA::Environment parameter entirely.
    On the other hand, applications that shall support environments without C++ exceptions (such as all applications that are part of to TAO itself) should use the ACE_ENV_ARG macros.
    The script $ACE_ROOT/bin/subst_env.pl can assist in the conversion from the direct ACE_TRY_ENV usage to the ACE_ENV_ARG macros. Here is a list of the substitutions that the script does. For context, two sample IDL methods are used:

            void noargs ();
            void withargs (in boolean b);
    
    At each example, first the old usage is given, then its subsitution.

    Method declaration

    • void noargs (CORBA::Environment &);

      void noargs (ACE_ENV_SINGLE_ARG_DECL_NOT_USED);

    • void noargs (CORBA::Environment &ACE_TRY_ENV);

      void noargs (ACE_ENV_SINGLE_ARG_DECL);

    • void noargs (CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ());

      void noargs (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);

    • void withargs (CORBA::Boolean b, CORBA::Environment &);

      void withargs (CORBA::Boolean b ACE_ENV_ARG_DECL_NOT_USED);

    • void withargs (CORBA::Boolean b, CORBA::Environment &ACE_TRY_ENV);

      void withargs (CORBA::Boolean b ACE_ENV_ARG_DECL);

    • void withargs (CORBA::Boolean b, CORBA::Environment & ACE_TRY_ENV = TAO_default_environment ());

      void withargs (CORBA::Boolean b ACE_ENV_ARG_DECL_WITH_DEFAULTS);

    Method invocation

    • noargs (ACE_TRY_ENV);

      noargs (ACE_ENV_SINGLE_ARG_PARAMETER);

    • withargs (bparam, ACE_TRY_ENV);

      withargs (bparam ACE_ENV_ARG_PARAMETER);


    Caveats

    As we already mentioned no set of macros can cover all cases and preserve the semantics between native C++ exceptions and the CORBA::Environment based mapping. Some of the problems that our macros are described below:

    • Using the macros in loops can produce problems with break and continue statements, for example:

          for (int i = 0; i < 10; ++i)
          {
            ACE_TRY
              {
                if (x[i] == 0)
                  continue; // will *not* work
                if (x[i] == -1)
                  break; // will *not* work either
              }
            ACE_CATCH (CORBA::Exception, ex)
              {
              }
            ACE_ENDTRY;
            ACE_CHECK;
          }
            


    Back to the ACE documentation page.
    Back to ACE Documentation Home. ace-8.0.4+dfsg.orig/docs/ACE-monotonic-timer.html0000644000175000017500000003343215027201773020523 0ustar sudipsudip

    Author: M.J.N. Corino Copyright © 2012, Remedy IT

    Date: November 06, 2012 The Netherlands

    Monotonic timer support for ACE conditions and events

    Introduction

    This document describes how to use the changes to the ACE API which provide support to use monotonic timers for condition and event variables to solve the problem of system timeshift vulnerability of the ACE Condition and Event variable timeout functionality.

    Background

    ACE Condition and Event variables implement an API to wait for the condition or event to be signalled with a maximum wait timeout value. This timeout value must be specified as absolute time (this API spec has been derived from the POSIX threading API, pthread, the most widely available, standardized, threading API available) or, in the case of events, optionally as relative time (converted to absolute time by ACE on certain platforms).

    Currently ACE expects the timeout value to be based on the system time clock through the ACE API support for that clock (ACE_OS::gettimeofday ()) which is also the default for the POSIX API (originally POSIX did not support anything else).

    This dependency on the system time clock however makes ACE Condition and Event variables vulnerable to system clock time shifts since a change in the system clock time setting after an absolute time value has been determined (based on the unchanged system clock) will influence the outstanding wait operations based on these time values.

    The ACE implementation for the Windows platform does not use the POSIX interface but is still potentially vulnerable because the ACE implementation itself performs a conversion from absolute to relative time before executing wait operation on a Condition variable (as this is what the Win32 API expects). Since this conversion is based on the system time clock here also a vulnerability exists.

    To resolve this vulnerability the notion of MONOTONIC timer sources should be integrated into the ACE Condition and Event support. MONOTONIC timers are timer sources which are independent of the system time clock and will always return time values which are correct relative to previously returned time values (at least within the lifetime of a single running process).

    The customer encountered this problem while making use of the ACE_Message_Queue classes in the implementation of their application. The enqueue/dequeue functionality of the message queues makes heavy use of the ACE Condition variable timed wait support. The customer also used ACE_Event derived classes which suffer from the same vulnerability.

    Requirements

    Prerequisites for the solution are:

    • maintain backward compatibility (as for all changes made to the ACE API) and cross platform stability (if not full support on all platforms);

    • create an implementation that allows for integration in the customers application with minimal code changes;

    • create an implementation allowing for staged completion in the full ACE API, i.e. only change those parts of ACE now that are essential to the solution of the customer problem and postpone any non-essential changes without losing library consistency and stability.

    Solution

    The implemented solution involves adding support for the ACE Time_Policy traits in the ACE Condition and Event APIs and those classes directly related to the ACE Condition and Event timed wait functionality that are used by the customer (like ACE_Event, ACE_Message_Queue and ACE_Task). Also some classes tightly linked to those classes have been updated.

    The newly added monotonic time policy, ACE_Monotonic_Time_Policy, provides support for monotonic time values (on Windows and any POSIX platform providing the necessary support like recent versions of Linux).

    New (virtual) functionality in ACE_Time_Value combined with a derived template class (ACE_Time_Value_T<>) provide time policy awareness in time values.

    Using the combination of these changes it is now possible to set up message queues that support monotonic time values for timed wait methods in a portable way as will be shown in the following section.

    User Code Changes

    The following are examples of user code changes required to update an application to support monotonic timed message queues.

    Message_Queue and Task class templates have been provided with an additional template argument to specify the Time_Policy to use for condition variables. To use monotonic time values the new ACE_Monotonic_Time_Policy should be used.

    So, where an existing application declared a Message_Queue as:

    ACE_Message_Queue<ACE_MT_SYNCH> msg_queue_;

    this would need to change to:

    ACE_Message_Queue<ACE_MT_SYNCH, ACE_Monotonic_Time_Policy> msg_queue_;

    The changes for task are similar:

    class MyTask : public ACE_Task<ACE_MT_SYNCH>
    {
      …
    };

    should change to:

    class MyTask : public ACE_Task<ACE_MT_SYNCH, ACE_Monotonic_Time_Policy>
    {
      …
    };

    To specify timeout values to these message queues on the enqueue/dequeue operations you would have to use time values that are Time_Policy aware. To that end a templated derivative of ACE_Time_Value has been implemented allowing one to declare a time value as:

    ACE_Time_Value_T<ACE_Monotonic_Time_Policy> timeout_;

    The updated Message_Queue and Task classes provide a convenience method to initialize such a time value with the time policy based time of day as follows:

    ACE_Time_Value_T<ACE_Monotonic_Time_Policy> 
    	timeout_ (msg_queue_.gettimeofday ());
    // or
    ACE_Time_Value_T<ACE_Monotonic_Time_Policy> timeout_;
    timeout_ = msg_queue_.gettimeofday ();

    The return type of this method is a time policy specific time value as follows:

    template <ACE_SYNCH_DECL, class TIME_POLICY>
    class ACE_Message_Queue : public ACE_Message_Queue_Base
    {
    …
    ACE_Time_Value_T<TIME_POLICY> gettimeofday () const;
    …
    };

    To define a wait timeout of 5 sec and execute an enqueue operation the following would apply:

    ...
    ACE_Time_Value_T<ACE_Monotonic_Time_Policy> timeout_;
    timeout_ = msg_queue_.gettimeofday ();
    timeout_ += ACE_Time_Value (5,0);
    msg_queue_.enqueue (msg_block, &timeout_);
    …

    Similar changes apply to the refactored ACE_Event classes. In addition to the added support for time policies also a new base class is introduced to allow for generic use of an Event variable after instantiation of a specific time policy based type.

    …
    // declare an Event variable
    ACE_Event_Base &evt;
    …
    // initialize Event variable
    ACE_Manual_Event_T<ACE_Monotonic_Time_Policy> mono_evt;
    evt = mono_evt;
    …
    // wait 5 sec for event to be signalled
    ACE_Time_Value_T<ACE_Monotonic_Time_Policy> timeout_;
    timeout_ = timeout_.now ();
    timeout_ += ACE_Time_Value (5,0);
    evt.wait (&timeout_);
    …
    // OR (using relative timeout)
    …
    ACE_Time_Value_T<ACE_Monotonic_Time_Policy> timeout_ (5,0);
    evt.wait (&timeout_, 0);
    

    NOTE: To function properly the ACE_Time_Value pointer passed to the timed wait methods MUST be the address of an ACE_Time_Value_T<TIME_POLICY> instance which matches the TIME_POLICY of the message queue or task. This is because the lower layers now rely on the new time policy aware virtual methods of the ACE_Time_Value classes to perform time calculations (to_relative_time (), to_absolute_time (), now ()).
    Unfortunately due to backward compatibility issues it was not possible to change the signatures of the timed wait methods to type safe versions accepting only correct time value instances.

    NOTE2: Please be aware of the differences in behaviour of the time calculation operations.

    • unary calculations (-=, += ,*=, –, ++) maintain time policy awareness, i.e. these operations always return a time policy aware time value (ACE_Time_Value_T<> instance; which may a reference to the time value itself);

    • binary calculations (+, -, *) always return a default ACE_Time_Value instance and thus loose time policy awareness. The basic numeric time values contained in these instances should only be used for comparative purposes or to update the value of a time policy based instance like:

    ACE_Time_Value_T<ACE_Monotonic_Time_Policy> t1, t2;
    … // t1 and t2 get assigned values
    // calculate difference between t1 and t2
    ACE_Time_Value tdiff = t2 – t1;
    …
    // at some point calculate new absolute time based on tdiff
    ACE_Time_Value_T<ACE_Monotonic_Time_Policy> tv;
    // now () returns an ACE_Time_Value representing current time according
    // to the active time policy of tv
    tv = tv.now () + tdiff;

    More examples code can be found in the following regression tests

    • $ACE_ROOT/tests/Bug_4055_Regression

    • $ACE_ROOT/tests/Monotonic_Task_Test

    • $ACE_ROOT/tests/Monotonic_Message_Queue_Test

    • $ACE_ROOT/tests/Monotonic_Manual_Event_Test

    Testing for Monotonic Time Support

    Support for monotonic time in ACE can be determined by testing for the existence of these two preprocessor macros that would be defined by ACE platform headers:

    • The ACE_HAS_MONOTONIC_TIME_POLICY preprocessor macro is defined when ACE_Monotonic_Time_Policy by itself should be supported.

    • The ACE_HAS_MONOTONIC_CONDITIONS preprocessor macro is defined when ACE_Conditions should support waiting for a monotonic point in time using ACE_Condition_Attributes<ACE_Monotonic_Time_Policy>.


    ace-8.0.4+dfsg.orig/docs/usage-bugzilla.html0000644000175000017500000000710115027201773017717 0ustar sudipsudip DOC Center Bug Tracking System Usage

    DOC Center Bug Tracking System Usage

    The Center for Distributed Object Computing used the Bugzilla bug tracking system to keep track of existing problems and enhancement requests. Currently github issues are used

    To streamline our development process, you can now use it to enter problem reports or make a request for a particular feature that you'd like to see integrated into ACE, TAO or CIAO.

    You can also use it to track the status of a particular bug or enhancement. In addition, the bug tracking system can be used to add comments and attachments that contain solutions or simple test cases.

    The bug tracking system is located at the following web site: http://bugzilla.dre.vanderbilt.edu/

    If all you want to do is browse through the bugs in our bug tracking system or view bug summary reports, then you can use the bug tracking system right away.

    Upon entering a bug or enhancement request for the first time, you will be asked to enter an e-mail address. Once you've done that, you will be mailed a password that you can use to log on to the bug tracking system. You will only be asked to do this once. Any changes to bug reports you submit will be mailed to the e-mail address you provide.

    Once you've logged on, you will have to ask for permissions through the ACE mailing list to obtain permissions to enter bug reports and modify existing ones. Other than adding comments, fixes and attachments, please do not modify bug reports you haven't submitted.

    The bug tracking system is fairly straightforward to use. When entering bug reports or enhancement requests, enter as much information as possible. Most of the bug form fields provide help if you are unsure what a particular field is used for.

    For more information about using Bugzilla, and about bug reporting in general, please see the following web sites:

    http://www.mozilla.org/bugs/
    http://www.mozilla.org/quality/bug-writing-guidelines.html

    Keep in mind that the Bugzilla installation at the above web site is not the same Bugzilla installation at the Center for Distributed Object Computing. All bug reports and enhancement requests for ACE and TAO should be done at the Center for Distributed Object Computing's Bugzilla web site.


    Ossama Othman
    Last modified:
    Back to ACE Documentation Home. ace-8.0.4+dfsg.orig/docs/ACE-bug-process.html0000644000175000017500000002006515027201773017627 0ustar sudipsudip ACE, TAO, CIAO and DAnCE Bug Fixing Policies

    ACE, TAO, CIAO, and DAnCE Bug Fixing Policies

    As ACE, TAO, CIAO, and DAnCE have grown in popularity the volume of mail on the mailing lists has grown considerably. While this increase is healthy, and a natural consequence of the larger number of ACE, TAO, and CIAO users, it is straining the resources of the researchers in the DOC group at Washington University, UC Irvine, and ISIS to respond to all the traffic immediately. Prompt bug fixes from the DOC group also discourage the creation of a larger community of users and commercial support companies who have deep knowledge of how ACE, TAO, and CIAO work and can help provide bug fixes and new features.


    Process for Reporting a Bug

    To ensure the continued growth and maturation of ACE, TAO, and CIAO, and to allow the user and vendor communities to evolve, please make it a point to abide by the following policies:
    • All bug reports to the github project lists should be submitted using the appropriate bug report form in $ACE_ROOT/PROBLEM-REPORT-FORM (for ACE), $TAO_ROOT/PROBLEM-REPORT-FORM (for TAO), $CIAO_ROOT/PROBLEM-REPORT-FORM (for CIAO), $DAnCE_ROOT/PROBLEM-REPORT-FORM (for DAnCE). Please use these forms since bug reports that are not submitted in this form are likely to fall through the cracks. Here is our policy for addressing these bug reports:

      1. If a report is from someone sponsoring our work we will respond to it in a very timely manner. Please contact me if you'd like to become a sponsor.

      2. If it's a bug report that pertains to the latest release and it also contains a fix we will try to apply this in a timely manner. In general, people who submit good bug reports with fixes tend to get much better help from the core DOC group team, irrespective of whether they are sponsors or not since they are helping our overall effort move ahead.

      3. If it's a bug report for the latest release that prevents ACE, TAO, or CIAO from working on a popular platform used by ourselves or our sponsors we'll try to fix it as time permits.

    • You should also consider entering your bug report into a github issue so that it's archived for future processing. As usual, we try to address these bugs as time permits, but may not get to them for a while unless it affects our work or the work of our sponsors.

      We encourage bug reports for those without support to be posted initially to the github issues or discussions.

    • While the core DOC group development team participates on github , we cannot response to all postings. Therefore, if you post something and don't get a reply, please do the following:

      • When you haven't received a reply this probably means that either no one knows the answer or no one has time to answer it. As always, if you need more predictable help please contact one of commercial support companies for ACE+TAO.

    • If you find a problem with a version of TAO that was released by OCI then please report it to taosupport@ociweb.com. Likewise, if you find a problem with a version of TAO that was released by Micro Focus then please report it to MicroFocus. Their versions of TAO are different from the DOC group's version of TAO and thus they provide their own support.

    • If it's a general question about how to use ACE, TAO, or CIAO feature we'll try to respond as time permits, though we will also rely on the experience of the open-source user community to field these types of questions, as well. You should first check out the online FAQ or CORBA Programmers Guide to see if your question has already been answered. If you require consulting support for ACE, TAO, or CIAO, please contact one of the companies that provides commercial support.


    Process for Submitting a Bug Fix

    We encourage other ACE, TAO, and CIAO users to continue to help provide fixes and advice in response to github issues and discussions. If you have a patch that fixes a problem you've found with our software here's the process for submitting it:
    1. Use the latest contents of git repository, i.e., what's available from

      https://github.com/DOCGroup/ACE_TAO

    2. Create a fork of the ATCD repository and prepare your fixes including documentation changes and automated unit tests. For any change in ACE create (or augment) a test program that validates your patch and integrate it into the ACE_ROOT/tests directory. Clearly document each commit because that information will end up in the ATCD ChangeLog. When you have tested your changes at least on Windows and Linux prepare a pull request.

    3. Create a github pull reuquest at

      https://github.com/DOCGroup/ACE_TAO

    4. If your patch is for a platform/compiler that aren't part of our autobuild scoreboard please consider contributing one or more autobuilds that can be used to keep track of changes to your platform/compiler combination and ensure things continue to work as the ACE+TAO source code evolves.

    5. By submitting bug fixes submitters acknowledge that they have the right to do so, that any such submissions are given freely and unreservedly, and that they waive any claims to copyright or ownership. In addition, submitters acknowledge that any such submission might become part of the copyright maintained on the overall body of code that comprises the DOC software. By making a bug fix submission, submitter agree to these terms. Moreover, submitters acknowledge that the incorporation or modification of such submissions is entirely at the discretion of the moderators of the open-source DOC software projects or their designees.

    Please be sensitive to the fact that the core DOC group team is very busy, so we often don't have time to address problems reported by non-sponsors. If you'd like an immediate response, please contact me about becoming a sponsor or contact one of the companies that provides commercial support for ACE, TAO, and CIAO.


    Back to the ACE page.
    Back to ACE Documentation Home. ace-8.0.4+dfsg.orig/docs/Symbol_Versioning.html0000644000175000017500000002005615027201773020460 0ustar sudipsudip Symbol Versioning in ACE

    Symbol Versioning in ACE

    To provide a means for ACE-based application developers to avoid symbol conflicts when multiple versions of ACE are linked to an application ACE supports versioned namespaces. When enabled (disabled by default), ACE's versioned namespace support causes all ACE symbols (classes, free functions, etc) to be placed within a C++ namespace of the form "namespace ACE_5_5_1". For example, the ACE_Reactor would end up being placed in the versioned namespace like so:

            namespace ACE_5_5_1
            {
              class ACE_Reactor
              {
                ...
              };
            }
            using namespace ACE_5_5_1;
    

    Notice that a using clause exposes the ACE types embedded in the versioned namespace back to the global namespace. This maximizes source code compatibility. ACE itself does this through the use of two macros:

    • ACE_BEGIN_VERSIONED_NAMESPACE_DECL
      • Expands to "namespace ACE_VERSIONED_NAMESPACE NAME {", where ACE_VERSIONED_NAMESPACE_NAME by defaults to namespace name of the form ACE_major_minor_beta. Users may override the default by defining the ACE_VERSIONED_NAMESPACE_NAME preprocessor symbol in their ace/config.h header file.
    • ACE_END_VERSIONED_NAMESPACE_DECL
      • Expands to "} using namespace ACE_VERSIONED_NAMESPACE_NAME;", where ACE_VERSIONED_NAMESPACE_NAME is described above.

    Things ACE-based Application Developers Should Know

    Every effort has been made to make the versioned namespace support in ACE as transparent as possible, including transparent versioned symbol support in the ACE_Service_Configurator when the ACE_Service_Configurator macros, such as e.g., ACE_FACTORY_DECLARE, are used appropriately. No changes to service configurator directives are necessary. For example, the ACE_Service_Configurator will transparently mangle the factory function name in a service configurator directive on-the-fly, meaning it will only load a "versioned" factory function name. This allows multiple service object factory functions, for example, to coexist in the same process space.

    There is, however, at least one caveat with respect to source code compatibility: any forward declarations of ACE symbols must also be placed within the versioned namespace. For example, if you have a forward declaration for ACE_Reactor in your application code, you will need to place it within the configured ACE versioned namespace as follows:

            ACE_BEGIN_VERSIONED_NAMESPACE_DECL
            class ACE_Reactor;
            ACE_END_VERSIONED_NAMESPACE_DECL
    

    This must only be done once, as these macros hide the versioned namespace name details from the application. Alternatively, you could place the forward declaration in a namespace that is an alias of the ACE versioned namespace, e.g.:

            namespace Foo = ACE_VERSIONED_NAMESPACE_NAME;
            namespace Foo {
              class ACE_Reactor;
            }
            using namespace Foo;
    

    Versioned namespace support in ACE may be enabled by adding versioned_namespace=1 to your MPC default.features file.

    Things ACE Developers Should Know

    ACE developers should place all ACE symbols that are potentially exposed to the user, including forward declarations in a versioned namespace using the ACE_BEGIN_VERSIONED_NAMESSPACE_DECL and ACE_END_VERSIONED_NAMESPACE_DECL macros. Free functions that are declared to have a C calling convention (i.e., extern "C") should have their names mangled using the ACE_PREPROC_CONCATENATE preprocessor. For example:

            void ACE_func (void) { ... }
            ...
            ACE_func(); // Call ACE_func()
    

    becomes:

            #if (defined (ACE_HAS_VERSIONED_NAMESPACE) \
                 && ACE_HAS_VERSIONED_NAMESPACE == 1) \
              && !(defined (_MSC_VER) && _MSC_VER <= 1200)
            // MSVC++ 6's preprocessor can't handle macro expansions
            // required by the versioned namespace support.  *sigh*
    
            # define ACE_FOO_FUNC_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_foo_func)
    
            #else
    
            # define ACE_FOO_FUNC_NAME ACE_foo_func
    
            #endif  /* ACE_HAS_VERSIONED_NAMESPACE == 1 */
    
            ...
            void ACE_FOO_FUNC_NAME (void) { ... }
    
            ACE_FOO_FUNC_NAME();  // Call mangled ACE_foo_func().
    

    The ACE_PREPROC_CONCATENATE is used rather than a straight ## preprocessor concatenation since in the latter case preprocessor symbols like ACE_VERSIONED_NAMESPACE_NAME will not be expanded if they are concatenated. ACE_PREPROC_CONCATENATE forces the preprocessor to expand them during the argument prescan by calling a macro that itself calls another that performs the actual concatenation.

    General Guidelines

    • Versioned namespace macro/support must be added to all new files added to ACE.
    • Do not place include directives between ACE_BEGIN_VERSIONED_NAMESPACE_DECL and ACE_END_VERSIONED_NAMESPACE_DECL macros. Doing so will cause nested namespace to be created, which is not the desired affect.
    • Be aware of preprocessor conditional blocks when placing the versioned namespace macros. For example, if you open versioned namespace within a given preprocessor condition block, you'll most likely want to close it in the same block.
    • If necessary, reopen and close the versioned namespace multiple times in the same file by using the macros multiple times to address the concerns described in the above two items.
    • The $ACE_ROOT/bin/fuzz.pl script has a sanity checking test for versioned namespaces that may be of use when debugging nested namespace issues, and for detecting BEGIN/END mismatches.

    Versioned namespace support in ACE may be enabled by adding versioned_namespace=1 to your MPC default.features file. Additional information about versioned namespaces is available from the Riverace website.


    Ossama Othman
    Last modified: ace-8.0.4+dfsg.orig/docs/ACE-SSL.html0000644000175000017500000000321715027201773016037 0ustar sudipsudip ACE+SSL

    What is ACE+SSL?

    ACE plus SSL is an addition to the core classes which allow the use of the Secure Socket Layer with the ACE framework. The following are the core classes conditionally compiled in when you run make ssl=1:

    • ACE_SSL contains the interface to the ssl library OpenSSL.
    • ACE_SSL_SOCK_Stream uses an interface and behavior nearly identical to ACE_SOCK_Stream, only with the additional ssl layer functionality.
    • ACE_SSL_SOCK_Acceptor/Connector are again similar to their ACE_SOCK counterparts.

    The SSL/TLS library we use is OpenSSL which is available at http://www.openssl.org/. This library must be installed in order to use ACE+SSL. We cannot answer all of the questions you may have about OpenSSL, but hopefully through using the ACE+SSL interface your questions will be reduced.

    How do I get ACE+SSL?

    Due to the relaxation of export restrictions we have gained permission to distribute ACE+SSL along with the normal ACE distribution. It can be found in $ACE_ROOT/ace/SSL. An SSL pluggable transport for can be found in $TAO_ROOT/orbsvcs/orbsvcs/SSLIOP.


    Back to ACE home page.

    ace-8.0.4+dfsg.orig/docs/bczar/0000755000175000017500000000000015046037655015227 5ustar sudipsudipace-8.0.4+dfsg.orig/docs/bczar/bczar.html0000644000175000017500000005540715027201773017222 0ustar sudipsudip The realm of the build czar

    Build Czar Duties

    The main duties of the Build Czar are summarized as follows

  • Continuously monitor the builds using the Scoreboard as one of the primary source of information.
  • Notify developers who broke compilation to fix the errors as soon as possible, ideally by the next day. A red color in the "Compile" column is not at all acceptable - the Build Czar needs to ensure that these problems are identified and fixed in a timely manner. If possible, the Build Czar should let developers know what the source of problems might be. It is quite possible that developers who checked in the code or users who provided the patch may not have resources to investigate the issues, so the Builds Czar's help is essential to keep things moving ahead.
  • Keep an eye on the tests that are run in every build. Anything abnormal needs to be notified to the right developer. The Build Czar should try helping the developer by providing stack traces (in case of crashes) or other details like printouts with debugging level turned on.
  • Some tests fail in the daily builds for many reasons like known bugs, transient timeouts etc. Make sure that no new test failures show up. This guy knows most of the information. Ask him to help you out with known problems. Keep the builds ticking. Any red on the "Last Finished" column in the Scoreboard should be fixed. The link to the "Build Name" indicates the machine where the build is being run.
  • The builds don't cover all the possible configurations. If you get a bug report about a compile error in a particular configuration, try setting up a build to make sure that it doesn't show up again if it has been fixed.

    The document here talks about the powers of a build Czar.

    The Build Czar is empowered to set up more builds on his own for his convenience. This page has a step by step instructions on how to do that.

    The build czar can get the build configuration by looking at the config portion of the scoreboard.

    Pro-active involvement by the build czar is necessary. Being a pro-active build czar requires monitoring the git repository carefully and responding quickly to suspected changes to keep the repo stays stable.

    After an email from the Coverity scan project check the Coverity project and check that there are no new errors reported. If so, contact the person who introduced the error.

    Check the daily test statistics email to determine any drop in test failures. Do note that when there are a lot of compile errors the test results are really unusable.


    Recipe for Cutting a Minor Kit

    The build czar is also in charge for the release of the micro. Cutting a micro is as simple as cutting butter if things go well. Here is the procedure followed while cutting a micro:

    1. The whole process takes somewhere between 2-3 hours.
    2. We suggest you take advantage of GNU Screen so that even if your SSH session is interrupted, the cutting process can continue. This command must be installed on the machines we use to cut the release.
      • type screen to start screen.
      • execute commands as normal. Note that Ctrl-A is special in screen, so you need to type Ctrl-A-A to send a Ctrl-A to the shell
      • should your session be interrupted, reconnect and type screen -x
      • when finished, just type exit twice
    3. After login check that you can,
      ssh bczar@download.dre.vanderbilt.edu
      to ensure that this succeeds. If not fix the problem, if ok exit again back to
    4. Prior to starting this, gather aggregate release notes from all developers. This is usually in the form of an email plea asking to update all NEWS files in the archive. These NEWS files are used as part of the release notes for the release.
    5. Make sure your release system has all the needed tools. This can be achieved on Fedora using:
      • yum install perl screen automake doxygen bzip2 tar gzip openssh graphviz zip libtool GitPython python3
      • yum update
      or on OpenSuSE
      • zypper install perl screen automake doxygen bzip2 tar gzip openssh graphviz zip libtool python-gitpython python3
      • zypper update
      If you want to perform a full build with qt support, than run:
      • yum install deltarpm ntp rubygem-rmagick bison xerces-c-devel psmisc yum-utils gdb unzip glibc-devel libasan bison redhat-lsb perl-Pod-Usage rubygems clang make patch libcgroup-devel ant setuptool system-config-network-tui system-config-firewall-tui lcov gnuplot java-1.8.0-openjdk perl screen automake doxygen bzip2 tar gzip openssh graphviz zip libtool gcc-c++ boost-devel valgrind openssl-devel gcc qt4 fltk-devel bzip2-devel rsync openssl lzo-devel zziplib-devel acpid acpi nfs-utils java xerces-c xerces-c-devel mc qt qt-devel icecream ruby ruby-devel lksctp-tools-devel git telnet GitPython NetworkManager wget mailx python3
      For some optional i686 packages run
      • yum install openssl-devel.i686 xerces-c-devel.i686 glibc-devel.i686 glibc.i686 libstdc++.i686 ncurses-libs.i686 zlib.i686
    6. Setup your ssh access to github according to the github ssh documentation
    7. Checkout a new workspace on a Fedora system with the last public release and with all patches installed.
      • The best place to create the workspace is under /export/anduriltmp/bczar (if you are on anduril). Don't use the home directory itself, it is an NFS share and not really fast.
      • Checkout like this:
        • git clone https://github.com/DOCGroup/ACE_TAO.git ACE_TAO
        • git clone https://github.com/DOCGroup/MPC.git MPC
    8. Set $DOC_ROOT to point to the new workspace you checked out.
    9. Change directories to $DOC_ROOT
    10. Checkout the correct branch you want to release on, the default is master but you can also check out an different branch ace6tao2 for the ACE 6.x/TAO 2.x releases.
    11. Tag the release by executing
      ACE/bin/make_release.py --micro --update --tag --push
      This will only take a couple minutes to complete and once done successfully, you can carry on with BOTH creating the kits and generating the doxygen documentation in parallel. NOTE that --micro should be replaced with --minor or --major as appropriate.

    12. After the repository has been tagged check each file listed below to make sure version numbers are updated as expected.

      In the EXTREMELY unlikely event that something goes wrong during the tagging of the repo, the following files must be returned to the state they were in before the release process started and then checked back into git:
      • ACE/PROBLEM-REPORT-FORM
      • ACE/VERSION.txt
      • TAO/PROBLEM-REPORT-FORM
      • TAO/VERSION.txt
      • TAO/tao/Version.h
      • ace/Version.h
      The tag will also need to be removed (both in Middleware and MPC): ACE+TAO-X_Y_Z (where X is the ACE Major version number, and Y & Z are the Minor and Micro release numbers of the release that is to be restarted).

      E.g.:
      cd ACE_TAO && git tag -d ACE+TAO-X_Y_Z
      cd MPC && git tag -d ACE+TAO-X_Y_Z

      Note that this only needs to be done if the tagging fails. If kit creation fails, simply restart that process.

    13. Create the kits by executing
      ACE/bin/make_release.py --kit
      This will take somewhere around 1 hours to complete.
      • These commands only tags and creates the kits for the software itself, not documentation, this can be started in parallel with this activity.
      • The kits end up in $DOC_ROOT/packages

      To summarize, the following is a transcript of the steps up to this point executing successfully:

      $ ssh ..
      No default printer
      screen
      cd $HOME
      rm -rf DOC_ROOT
      mkdir DOC_ROOT
      cd DOC_ROOT
      export DOC_ROOT=$PWD
      git clone https://github.com/DOCGroup/ACE_TAO.git ACE_TAO
      git clone https://github.com/DOCGroup/MPC.git MPC
      cd ACE_TAO
      git checkout master
      ACE/bin/make_release.py --micro --update --verbose
      ACE/bin/make_release.py --micro --tag --verbose
      ACE/bin/make_release.py --micro --push --verbose
      ACE/bin/make_release.py --kit

      Feel free to cut and paste with suitable edits.

    14. The packages end up by default under $DOC_ROOT/package-<PID>, you can copy them to the webserver using the following commands. (Note that <PID> needs to be the numerical pid of the process that created the kit, use
      ls -ald to determine the correct filename.) At the moment you execute these commands all users can download these packages.
    15. scp $DOC_ROOT/package-<PID>/ACE* bczar@download.dre.vanderbilt.edu:/export/www/download.dre/ACE+TAO-distribution
      When releasing from a branch of master the resulting packages shouldn't be uploaded to ACE+TAO-distribution but only the versioned packages should be uploaded to bczar@download.dre.vanderbilt.edu:/export/www/download.dre/previous_versions using scp $DOC_ROOT/package-<PID>/ACE*6* bczar@download.dre.vanderbilt.edu:/export/www/download.dre/previous_versions
    16. After the repository is tagged you can also start generating the doxygen documentation in parallel with the kit generation above.
      • Login to a release system you prepared with the same packages as above:
        screen
      • After login check that you can,
        ssh bczar@download.dre.vanderbilt.edu
        to ensure that this succeeds. If not fix the problem, if ok exit again back to your release system.
      • cd /tmp
        and remove the contents of the doxygen directory and recreate it again with

      • rm -rf doxygen
        mkdir doxygen
        cd doxygen
        If you create the doxygen documentation on naboo.dre.vanderbilt.edu than make sure you use /web/users/isisbuilds/tmp/ACE_wrappers as working directory
      • Update the workspace with the right version tag (replace the X_Y_Z with the ACE version number being released e.g. 7_0_5)
        git clone https://github.com/DOCGroup/ACE_TAO.git --depth 1 --branch ACE+TAO-7_0_5 ACE_TAO
      • Change to the ACE_TAO directory using
        cd ACE_TAO
      • Set the needed environment variables using
        export ACE_ROOT=$PWD/ACE
        export TAO_ROOT=$PWD/TAO
        export CIAO_ROOT=
        export DANCE_ROOT=
        export DDS_ROOT=
      • Check the doxygen version at the shell by executing the command:
        doxygen --version This should be at least 1.6.2

      • Now you are ready to create documentation
      • cd $ACE_ROOT
        $ACE_ROOT/bin/generate_rel_manpages
        When this is ready copy the resulting files using
        scp ACE-html.tar.gz ACE-html.tar.bz2 ACE-html.zip ACE-html.tar.gz.md5 ACE-html.tar.bz2.md5 ACE-html.zip.md5 bczar@download.dre.vanderbilt.edu:/export/www/download.dre/ACE+TAO-distribution
      screen
      cd $HOME
      rm -rf doxygen
      mkdir doxygen
      cd doxygen
      git clone https://github.com/DOCGroup/ACE_TAO.git --depth 1 --branch ACE+TAO-7_0_9 ACE_TAO
      cd ACE_TAO
      export ACE_ROOT=$PWD/ACE
      export TAO_ROOT=$PWD/TAO
      export CIAO_ROOT=
      export DANCE_ROOT=
      export DDS_ROOT=
      cd ACE
      $ACE_ROOT/bin/generate_rel_manpages
      scp ACE-html.tar.gz ACE-html.tar.bz2 ACE-html.zip ACE-html.tar.gz.md5 ACE-html.tar.bz2.md5 ACE-html.zip.md5 bczar@download.dre.vanderbilt.edu:/export/www/download.dre/ACE+TAO-distribution

    17. While doxygen churns, format a release announcement, including the release notes gathered from developers.
    18. On naboo.dre.vanderbilt.edu once the doxygen generation has finished, update the documentation at www.dre.vanderbilt.edu/Doxygen.
      • Create a temporary directory. eg. tmp and change Directory to this-
      • scp file from the download server
      • Unzip and untar the files
      • back out of the temporary directory
      • Create directory 'Current Version No' for example 6.3.4 and change directory into this new one
      • Move contents of the temporary directory's html to this directory -
      • Now back our of this directory and remove the already existing softlink to the "Micro" directory -
      • Create softlink "Micro" linking it to new Documentation using -. If this is a minor release also update the Stable link.
      • Remove the directory tmp
      • cd /web/www/Doxygen
        mkdir tmp
        cd tmp
        scp bczar@download.dre.vanderbilt.edu:/export/www/download.dre/ACE+TAO-distribution/ACE-html.tar.bz2 .
        bunzip2 ACE-html.tar.bz2;tar -xvf ACE-html.tar
        cd ..
        mkdir 7.0.8
        cd 7.0.8
        mv ../tmp/html .
        cd ..
        rm Micro
        ln -s 7.0.8/html Micro
        rm -rf tmp

    19. On download.dre.vanderbilt.edu where the kit was uploaded to and once BOTH the kit and doxygen generation have finished their work, you should also move the packages to the previous versions directory with the appropriate decorators.
      • cd /export/www/download.dre/ACE+TAO-distribution
      • Check that the packages in this directory are all from today
      • Modify /export/anduriltmp/bczar/copy_script.sh to use the correct ACE version X.Y.Z and run it.
      • Update the copy_script.sh file for the new micro release

    20. Update ACE_wrappers/bin/copy-local-script.sh for use the latest version number and use this script to rename all packages locally to include the version number. After this is done upload the versioned packages to the github release page
    21. Validate the packages on the webserver whether they are really containing the new release. Make at least one build where you run the TAO Hello world test and check if the libraries are having the correct version number.
    22. Update the ACE_wrappers repo:
      • docs/Download.html to show the new release.
      • etc/index.hml to show the new doxygen package you installed
      • bin/diff-builds-and-group-fixed-tests-only.sh to give the correct default old_date for this release.
    23. Update the ACE/NEWS and TAO/NEWS files to have a new section for the next release.
    24. Put the release details also on the github release page for this latest release, see https://github.com/DOCGroup/ACE_TAO/releases
    25. Update openSUSE Build service using
      osc checkout devel:libraries:ACE:micro ACE
      cd "devel:libraries:ACE:micro/ACE"
      osc rm ACE+TAO-src-*.tar.gz
      cp $DOC_ROOT/package-<PID>/ACE+TAO-src-*.tar.gz .
      osc commit
    26. Make a new pull request for homebrew-core to update ACE to the new release, see https://github.com/Homebrew/homebrew-core/blob/master/Formula/ace.rb
    27. Make a new pull request to Microsoft vcpkg to update ACE to the new release, see https://github.com/Microsoft/vcpkg/tree/master/ports/ace
    28. Mail the approved release announcement out to, at minimum the following: tao-users@list.isis.vanderbilt.edu, tao-announce@list.isis.vanderbilt.edu, ace-users@list.isis.vanderbilt.edu, ace-announce@list.isis.vanderbilt.edu. Do this as yourself (not as bugzilla). N.B. You will not be able to post to the users' lists unless you are subscribed to them. Odds are you will not be able to post to the announce lists at all. Ask someone else (like Doug or Johnny) to do this step.


    Tips to being a Build Czar

    1. Trust no one.
    2. Be careful with this guy, he is notorious in breaking builds (and fixing them as well...rumour has it that it's actually a super-scalar, super-pipelined processor capable of out-of-order execution, in human incarnation).
    3. Don't forgive people who break ACE :-)
    4. If a build hasn't run in a long time (symptoms are a "red" in the Last Run column of the build scoreboard), delete the .disable file in /path/to/build/directory/BUILD_NAME/ by hand.
    5. Think of the group who wrote the scoreboard update script, every time you catch an otherwise not so obvious error with the help of the scoreboard. Tell DEVO group about it.
    6. Compile once on Win32 and Linux before cutting a micro.
    7. Trust the release script when making a release. Don't make tar balls by hand.
    8. When all hell breaks loose, don't wait for the nightly builds to monitor improvement. Instead manually start the builds.
    9. Don't hesitate to ask for help.
    10. Install your public key to the different machines you have frequent access to avoid typing password.
    11. Update this page if you have any more tips for future build czars :-). This page is in git under ACE/docs/bczar/bczar.html

    The Realm of the Build Czar


    Build Czar Arthur

    Many years have passes since the days of the legendary Build Czar Arthur. His duties were given to him by the mystical Lady of the Lake, who outlined the first responsibilities of the Build Czar.


    Then bespake the Lady of the Lake,
    And these were the words said shee:
    "I knoweth of thy deeds, thou noble Arthur,
    but thy task hath not finished for thee"

    "Thou shalt feitch thy trusty steed,
    And cleanse thy builds againe;
    Then shallt thy ryde hath finnished,
    When new kits released thee cann."

    Then bespake him noble Arthur
    And these were the words said he:
    "With what weapons shallt I use,
    To asure these from the devil free?"

    Then appeered before noble Arthur,
    Uppon the ground a sacred scroll
    Conjurred by the Lady of the Lake
    Borne of the earth in a roll.

    She saies, "Clasp this to thine selfe
    For thee shallt find need for it.
    It shall keep others in the cold,
    Only to be ressurected when thee sees fit."

    "Others shall join thy person,
    To ryde with thee in thy quest;
    Thee shallt be thankful of theire help,
    And to alsoe hold them steadfast."

    "But if theire talke too lodly rise,
    And causeth much damage to thine cuntry,
    He must come forth, and make proclamation,
    For the next one he shall be."

    So hath Arthur to the Lady spoke:
    "For I sweare, and save my othe,
    While enimes and evils I seeke,
    I shall fight against them bothe.


    ace-8.0.4+dfsg.orig/docs/bczar/privileges.html0000644000175000017500000000503315027201773020260 0ustar sudipsudip Build Czar powers

    Powers with the Build Czar

    This document grants extensive privileges and powers to the Czar, but those privileges impose several responsibilities that must be fulfilled, failure to do so may result in some form of revolution (picture a firing squad).

    Previous generations of the honorable royal family have automated the build process as much as possible, but all machines require attention: the build Czar must keep a constant vigil, lest some runaway process stops working and a critical bug escapes into the wild.

    Typically a runaway build is detected because on its next execution an email indicating that the build is DISABLED is received. The same email is also sent when a build is abruptly terminated (for example because the machine running the build crashed). Most of the time, a test is not making progress and must be terminated, the build then runs to completion. If the machine crashed then it is necessary to go into the build directory and remove the auto_compile/.disable file, so the next execution can complete successfully. Occasionally the build fails because there is a CVS conflict, there is not enough disk space or some similar problem, in these cases the build Czar is encouraged to request advised from previous generations in the royal family they will be happy to come back from retirement to provide advice and help if needed.

    The build Czar should also investigate the errors and warnings reported by a build, contact the person or persons responsible for the failed build and prompt them to fix the situation. If that process above fails the build Czar should request help from a volunteer or proceed to fix the problem himself/herself. If there is no available backup/volunteer and the build Czar is busy, he/she will be forced to excomunicate the original developer and report him or her to the highest court of the land for whatever punishment is deemed appropriate (lashing or bone breaking where not prohibited by law).

    It is extremely important to fix broken builds within the day, otherwise the errors tend to accumulate and once the process breaks down it is extremely hard to recover, in other words, the term as a build Czar can extend beyond your expectations if the builds are not clean again.


    ace-8.0.4+dfsg.orig/ace/0000755000175000017500000000000015046037655013726 5ustar sudipsudipace-8.0.4+dfsg.orig/ace/WFMO_Reactor.inl0000644000175000017500000010056515027201773016661 0ustar sudipsudip// -*- C++ -*- #include "ace/Handle_Set.h" #include "ace/Reactor.h" #include "ace/Thread.h" #include "ace/Sig_Handler.h" #include "ace/OS_NS_errno.h" #if defined (ACE_WIN32) ACE_BEGIN_VERSIONED_NAMESPACE_DECL /************************************************************/ ACE_INLINE int ACE_Wakeup_All_Threads_Handler::handle_signal (int /* signum */, siginfo_t * /* siginfo */, ucontext_t *) { // This will get called when wakeup_all_threads_> event // is signaled. There is nothing to be done here. // ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) waking up to get updated handle set info\n"))); return 0; } /************************************************************/ ACE_INLINE void ACE_WFMO_Reactor_Handler_Repository::Common_Info::reset () { this->event_handler_ = nullptr; this->io_entry_ = false; this->io_handle_ = ACE_INVALID_HANDLE; this->network_events_ = 0; this->delete_event_ = false; this->delete_entry_ = false; this->close_masks_ = ACE_Event_Handler::NULL_MASK; } ACE_INLINE void ACE_WFMO_Reactor_Handler_Repository::Common_Info::set (bool io_entry, ACE_Event_Handler *event_handler, ACE_HANDLE io_handle, long network_events, bool delete_event, bool delete_entry, ACE_Reactor_Mask close_masks) { this->event_handler_ = event_handler; this->io_entry_ = io_entry; this->io_handle_ = io_handle; this->network_events_ = network_events; this->delete_event_ = delete_event; this->delete_entry_ = delete_entry; this->close_masks_ = close_masks; } ACE_INLINE void ACE_WFMO_Reactor_Handler_Repository::Common_Info::set (Common_Info &common_info) { *this = common_info; } ACE_INLINE void ACE_WFMO_Reactor_Handler_Repository::Common_Info::dump () const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::Common_Info::dump"); ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("I/O Entry = %d\n"), this->io_entry_)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("Event Handler = %d\n"), this->event_handler_)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("I/O Handle = %d\n"), this->io_handle_)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("Network Events = %d\n"), this->network_events_)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("Delete Event = %d\n"), this->delete_event_)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("Delete Entry = %d\n"), this->delete_entry_)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("Close Masks = %d\n"), this->close_masks_)); ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } /************************************************************/ ACE_INLINE void ACE_WFMO_Reactor_Handler_Repository::Current_Info::set (bool io_entry, ACE_Event_Handler *event_handler, ACE_HANDLE io_handle, long network_events, bool delete_event, bool delete_entry, ACE_Reactor_Mask close_masks, bool suspend_entry) { this->suspend_entry_ = suspend_entry; Common_Info::set (io_entry, event_handler, io_handle, network_events, delete_event, delete_entry, close_masks); } ACE_INLINE void ACE_WFMO_Reactor_Handler_Repository::Current_Info::set (Common_Info &common_info, bool suspend_entry) { this->suspend_entry_ = suspend_entry; Common_Info::set (common_info); } ACE_INLINE void ACE_WFMO_Reactor_Handler_Repository::Current_Info::reset () { this->suspend_entry_ = false; Common_Info::reset (); } ACE_INLINE void ACE_WFMO_Reactor_Handler_Repository::Current_Info::dump (ACE_HANDLE event_handle) const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::Current_Info::dump"); ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); Common_Info::dump (); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("Event Handle = %d\n"), event_handle)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("Suspend Entry = %d\n"), this->suspend_entry_)); ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #else /* !ACE_HAS_DUMP */ ACE_UNUSED_ARG (event_handle); #endif /* ACE_HAS_DUMP */ } /************************************************************/ ACE_INLINE void ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::set (ACE_HANDLE event_handle, bool io_entry, ACE_Event_Handler *event_handler, ACE_HANDLE io_handle, long network_events, bool delete_event, bool delete_entry, ACE_Reactor_Mask close_masks, bool suspend_entry) { this->event_handle_ = event_handle; this->suspend_entry_ = suspend_entry; Common_Info::set (io_entry, event_handler, io_handle, network_events, delete_event, delete_entry, close_masks); } ACE_INLINE void ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::set (ACE_HANDLE event_handle, Common_Info &common_info, bool suspend_entry) { this->event_handle_ = event_handle; this->suspend_entry_ = suspend_entry; Common_Info::set (common_info); } ACE_INLINE void ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::reset () { this->event_handle_ = ACE_INVALID_HANDLE; this->suspend_entry_ = false; Common_Info::reset (); } ACE_INLINE void ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::dump () const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::dump"); ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); Common_Info::dump (); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("Event Handle = %d\n"), this->event_handle_)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("Suspend Entry = %d\n"), this->suspend_entry_)); ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } /************************************************************/ ACE_INLINE void ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::reset () { this->event_handle_ = ACE_INVALID_HANDLE; this->resume_entry_ = false; Common_Info::reset (); } ACE_INLINE void ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::set (ACE_HANDLE event_handle, bool io_entry, ACE_Event_Handler *event_handler, ACE_HANDLE io_handle, long network_events, bool delete_event, bool delete_entry, ACE_Reactor_Mask close_masks, bool resume_entry) { this->event_handle_ = event_handle; this->resume_entry_ = resume_entry; Common_Info::set (io_entry, event_handler, io_handle, network_events, delete_event, delete_entry, close_masks); } ACE_INLINE void ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::set (ACE_HANDLE event_handle, Common_Info &common_info, bool resume_entry) { this->event_handle_ = event_handle; this->resume_entry_ = resume_entry; Common_Info::set (common_info); } ACE_INLINE void ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::dump () const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::dump"); ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); Common_Info::dump (); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("Event Handle = %d\n"), this->event_handle_)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("Resume Entry = %d\n"), this->resume_entry_)); ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } /************************************************************/ ACE_INLINE int ACE_WFMO_Reactor_Handler_Repository::close () { // Let all the handlers know that the is closing down this->unbind_all (); return 0; } ACE_INLINE ACE_HANDLE * ACE_WFMO_Reactor_Handler_Repository::handles () const { // This code is probably too subtle to be useful in the long run... // The basic idea is that all threads wait on all user handles plus // the handle. The owner thread additional // waits on the handle. This is to ensure that only the // thread get to expire timers and handle event on the // notify pipe. if (ACE_Thread::self () == this->wfmo_reactor_.owner_i ()) return this->current_handles_; else return this->current_handles_ + 1; } ACE_INLINE ACE_WFMO_Reactor_Handler_Repository::Current_Info * ACE_WFMO_Reactor_Handler_Repository::current_info () const { if (ACE_Thread::self () == this->wfmo_reactor_.owner_i ()) return this->current_info_; else return this->current_info_ + 1; } ACE_INLINE DWORD ACE_WFMO_Reactor_Handler_Repository::max_handlep1 () const { if (ACE_Thread::self () == this->wfmo_reactor_.owner_i ()) return this->max_handlep1_; else return this->max_handlep1_ - 1; } ACE_INLINE int ACE_WFMO_Reactor_Handler_Repository::scheduled_for_deletion (size_t slot) const { if (ACE_Thread::self () == this->wfmo_reactor_.owner_i ()) return this->current_info_[slot].delete_entry_ == true; else return this->current_info_[slot + 1].delete_entry_ == true; } ACE_INLINE int ACE_WFMO_Reactor_Handler_Repository::invalid_handle (ACE_HANDLE handle) const { ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::invalid_handle"); // It's too expensive to perform more exhaustive validity checks on // Win32 due to the way that they implement SOCKET HANDLEs. if (handle == ACE_INVALID_HANDLE) { errno = EINVAL; return 1; } else return 0; } ACE_INLINE bool ACE_WFMO_Reactor_Handler_Repository::changes_required () { // Check if handles have be scheduled for additions or removal return this->handles_to_be_added_ > 0 || this->handles_to_be_deleted_ > 0 || this->handles_to_be_suspended_ > 0 || this->handles_to_be_resumed_ > 0; } ACE_INLINE int ACE_WFMO_Reactor_Handler_Repository::make_changes () { // This method must ONLY be called by the // change_state_thread_>. We therefore assume that // there will be no contention for this method and hence no guards // are neccessary. // Deletions and suspensions in current_info_ this->make_changes_in_current_infos (); // Deletions and resumptions in current_suspended_info_ this->make_changes_in_suspension_infos (); // Deletions in to_be_added_info_, or transfers to current_info_ or // current_suspended_info_ from to_be_added_info_ this->make_changes_in_to_be_added_infos (); return 0; } ACE_INLINE int ACE_WFMO_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, ACE_Reactor_Mask mask) { if (this->invalid_handle (handle)) return -1; ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->wfmo_reactor_.lock_, -1); bool changes_required = false; int const result = this->unbind_i (handle, mask, changes_required); if (changes_required) // Wake up all threads in WaitForMultipleObjects so that they can // reconsult the handle set this->wfmo_reactor_.wakeup_all_threads (); return result; } ACE_INLINE int ACE_WFMO_Reactor::reset_timer_interval (long timer_id, const ACE_Time_Value &interval) { ACE_TRACE ("ACE_WFMO_Reactor::reset_timer_interval"); if (0 != this->timer_queue_) { long result = this->timer_queue_->reset_interval (timer_id, interval); // Wakeup the owner thread so that it gets the latest timer values this->notify (); return result; } errno = ESHUTDOWN; return -1; } ACE_INLINE long ACE_WFMO_Reactor::schedule_timer (ACE_Event_Handler *handler, const void *arg, const ACE_Time_Value &delay_time, const ACE_Time_Value &interval) { ACE_TRACE ("ACE_WFMO_Reactor::schedule_timer"); if (0 != this->timer_queue_) { long result = this->timer_queue_->schedule (handler, arg, timer_queue_->gettimeofday () + delay_time, interval); // Wakeup the owner thread so that it gets the latest timer values this->notify (); return result; } errno = ESHUTDOWN; return -1; } ACE_INLINE int ACE_WFMO_Reactor::cancel_timer (ACE_Event_Handler *handler, int dont_call_handle_close) { ACE_TRACE ("ACE_WFMO_Reactor::cancel_timer"); if ((0 != this->timer_queue_) && (0 != handler)) return this->timer_queue_->cancel (handler, dont_call_handle_close); return 0; } ACE_INLINE int ACE_WFMO_Reactor::cancel_timer (long timer_id, const void **arg, int dont_call_handle_close) { ACE_TRACE ("ACE_WFMO_Reactor::cancel_timer"); if (0 != this->timer_queue_) return this->timer_queue_->cancel (timer_id, arg, dont_call_handle_close); return 0; } ACE_INLINE int ACE_WFMO_Reactor::register_handler (ACE_Event_Handler *event_handler, ACE_HANDLE event_handle) { // This GUARD is necessary since we are updating shared state. ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); return this->handler_rep_.bind_i (0, event_handler, 0, ACE_INVALID_HANDLE, event_handle, 0); } ACE_INLINE int ACE_WFMO_Reactor::register_handler (ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask) { // This GUARD is necessary since we are updating shared state. ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); return this->register_handler_i (ACE_INVALID_HANDLE, ACE_INVALID_HANDLE, event_handler, mask); } ACE_INLINE int ACE_WFMO_Reactor::register_handler (ACE_HANDLE io_handle, ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask) { // This GUARD is necessary since we are updating shared state. ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); return this->register_handler_i (ACE_INVALID_HANDLE, io_handle, event_handler, mask); } ACE_INLINE int ACE_WFMO_Reactor::register_handler (ACE_HANDLE event_handle, ACE_HANDLE io_handle, ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask) { // This GUARD is necessary since we are updating shared state. ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); return this->register_handler_i (event_handle, io_handle, event_handler, mask); } ACE_INLINE int ACE_WFMO_Reactor::register_handler (const ACE_Handle_Set &handles, ACE_Event_Handler *handler, ACE_Reactor_Mask mask) { // This GUARD is necessary since we are updating shared state. ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); ACE_Handle_Set_Iterator handle_iter (handles); ACE_HANDLE h; while ((h = handle_iter ()) != ACE_INVALID_HANDLE) if (this->register_handler_i (h, ACE_INVALID_HANDLE, handler, mask) == -1) return -1; return 0; } ACE_INLINE int ACE_WFMO_Reactor::schedule_wakeup (ACE_HANDLE io_handle, ACE_Reactor_Mask masks_to_be_added) { // This GUARD is necessary since we are updating shared state. ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); return this->mask_ops_i (io_handle, masks_to_be_added, ACE_Reactor::ADD_MASK); } ACE_INLINE int ACE_WFMO_Reactor::schedule_wakeup (ACE_Event_Handler *event_handler, ACE_Reactor_Mask masks_to_be_added) { // This GUARD is necessary since we are updating shared state. ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); return this->mask_ops_i (event_handler->get_handle (), masks_to_be_added, ACE_Reactor::ADD_MASK); } ACE_INLINE int ACE_WFMO_Reactor::cancel_wakeup (ACE_HANDLE io_handle, ACE_Reactor_Mask masks_to_be_removed) { // This GUARD is necessary since we are updating shared state. ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); return this->mask_ops_i (io_handle, masks_to_be_removed, ACE_Reactor::CLR_MASK); } ACE_INLINE int ACE_WFMO_Reactor::cancel_wakeup (ACE_Event_Handler *event_handler, ACE_Reactor_Mask masks_to_be_removed) { // This GUARD is necessary since we are updating shared state. ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); return this->mask_ops_i (event_handler->get_handle (), masks_to_be_removed, ACE_Reactor::CLR_MASK); } ACE_INLINE int ACE_WFMO_Reactor::remove_handler (ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask) { return this->handler_rep_.unbind (event_handler->get_handle (), mask); } ACE_INLINE int ACE_WFMO_Reactor::remove_handler (ACE_HANDLE handle, ACE_Reactor_Mask mask) { return this->handler_rep_.unbind (handle, mask); } ACE_INLINE int ACE_WFMO_Reactor::remove_handler (const ACE_Handle_Set &handles, ACE_Reactor_Mask mask) { ACE_Handle_Set_Iterator handle_iter (handles); ACE_HANDLE h; bool changes_required = false; ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); while ((h = handle_iter ()) != ACE_INVALID_HANDLE) if (this->handler_rep_.unbind_i (h, mask, changes_required) == -1) return -1; // Wake up all threads in WaitForMultipleObjects so that they can // reconsult the handle set this->wakeup_all_threads (); return 0; } ACE_INLINE int ACE_WFMO_Reactor::suspend_handler (ACE_HANDLE handle) { ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); bool changes_required = false; int const result = this->handler_rep_.suspend_handler_i (handle, changes_required); if (changes_required) // Wake up all threads in WaitForMultipleObjects so that they can // reconsult the handle set this->wakeup_all_threads (); return result; } ACE_INLINE int ACE_WFMO_Reactor::suspend_handler (ACE_Event_Handler *event_handler) { return this->suspend_handler (event_handler->get_handle ()); } ACE_INLINE int ACE_WFMO_Reactor::suspend_handler (const ACE_Handle_Set &handles) { ACE_Handle_Set_Iterator handle_iter (handles); ACE_HANDLE h; bool changes_required = false; ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); while ((h = handle_iter ()) != ACE_INVALID_HANDLE) if (this->handler_rep_.suspend_handler_i (h, changes_required) == -1) return -1; // Wake up all threads in WaitForMultipleObjects so that they can // reconsult the handle set this->wakeup_all_threads (); return 0; } ACE_INLINE int ACE_WFMO_Reactor::suspend_handlers () { bool error = false; int result = 0; ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); // First suspend all current handles bool changes_required = false; // Skip over the notify and wakeup_all_threads handles. These are registered // by ACE_WFMO_Reactor::open(), not by users, and should not be suspended. for (size_t i = 2; i < this->handler_rep_.max_handlep1_ && !error; i++) { result = this->handler_rep_.suspend_handler_i (this->handler_rep_.current_handles_[i], changes_required); if (result == -1) error = true; } // Then suspend all to_be_added_handles for (size_t i = 0; i < this->handler_rep_.handles_to_be_added_ && !error; i++) { if (this->handler_rep_.to_be_added_info_[i].io_entry_) { result = this->handler_rep_.suspend_handler_i (this->handler_rep_.to_be_added_info_[i].io_handle_, changes_required); } else { result = this->handler_rep_.suspend_handler_i (this->handler_rep_.to_be_added_info_[i].event_handle_, changes_required); } if (result == -1) error = true; } // Wake up all threads in WaitForMultipleObjects so that they can // reconsult the handle set this->wakeup_all_threads (); return error ? -1 : 0; } ACE_INLINE int ACE_WFMO_Reactor::resume_handler (ACE_HANDLE handle) { ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); bool changes_required = false; int result = this->handler_rep_.resume_handler_i (handle, changes_required); if (changes_required) // Wake up all threads in WaitForMultipleObjects so that they can // reconsult the handle set this->wakeup_all_threads (); return result; } ACE_INLINE int ACE_WFMO_Reactor::resume_handler (ACE_Event_Handler *event_handler) { return this->resume_handler (event_handler->get_handle ()); } ACE_INLINE int ACE_WFMO_Reactor::resume_handler (const ACE_Handle_Set &handles) { ACE_Handle_Set_Iterator handle_iter (handles); ACE_HANDLE h; bool changes_required = false; ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); while ((h = handle_iter ()) != ACE_INVALID_HANDLE) if (this->handler_rep_.resume_handler_i (h, changes_required) == -1) return -1; // Wake up all threads in WaitForMultipleObjects so that they can // reconsult the handle set this->wakeup_all_threads (); return 0; } ACE_INLINE int ACE_WFMO_Reactor::resume_handlers () { bool error = false; int result = 0; ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); bool changes_required = false; for (size_t i = 0; i < this->handler_rep_.suspended_handles_ && !error; i++) { result = this->handler_rep_.resume_handler_i (this->handler_rep_.current_suspended_info_[i].event_handle_, changes_required); if (result == -1) error = true; } // Then resume all to_be_added_handles for (size_t i = 0; i < this->handler_rep_.handles_to_be_added_ && !error; i++) { if (this->handler_rep_.to_be_added_info_[i].io_entry_) { result = this->handler_rep_.resume_handler_i (this->handler_rep_.to_be_added_info_[i].io_handle_, changes_required); } else { result = this->handler_rep_.resume_handler_i (this->handler_rep_.to_be_added_info_[i].event_handle_, changes_required); } if (result == -1) error = true; } // Wake up all threads in WaitForMultipleObjects so that they can // reconsult the handle set this->wakeup_all_threads (); return error ? -1 : 0; } ACE_INLINE bool ACE_WFMO_Reactor::uses_event_associations () { // Since the WFMO_Reactor does use event associations, this function // always return 1. return true; } ACE_INLINE int ACE_WFMO_Reactor::handle_events (ACE_Time_Value &how_long) { return this->event_handling (&how_long, FALSE); } ACE_INLINE int ACE_WFMO_Reactor::alertable_handle_events (ACE_Time_Value &how_long) { return this->event_handling (&how_long, TRUE); } ACE_INLINE int ACE_WFMO_Reactor::handle_events (ACE_Time_Value *how_long) { return this->event_handling (how_long, FALSE); } ACE_INLINE int ACE_WFMO_Reactor::alertable_handle_events (ACE_Time_Value *how_long) { return this->event_handling (how_long, TRUE); } ACE_INLINE int ACE_WFMO_Reactor::deactivated () { return this->deactivated_; } ACE_INLINE void ACE_WFMO_Reactor::deactivate (int do_stop) { this->deactivated_ = do_stop; this->wakeup_all_threads (); } ACE_INLINE int ACE_WFMO_Reactor::owner (ACE_thread_t *t) { ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); *t = this->owner_i (); return 0; } ACE_INLINE ACE_thread_t ACE_WFMO_Reactor::owner_i () { return this->owner_; } ACE_INLINE int ACE_WFMO_Reactor::owner (ACE_thread_t new_owner, ACE_thread_t *old_owner) { ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1); this->new_owner_ = new_owner; if (old_owner != nullptr) *old_owner = this->owner_i (); // Wake up all threads in WaitForMultipleObjects so that they can // reconsult the new owner responsibilities this->wakeup_all_threads (); return 0; } ACE_INLINE int ACE_WFMO_Reactor::new_owner () { return this->new_owner_ != ACE_thread_t (0); } ACE_INLINE int ACE_WFMO_Reactor::change_owner () { this->owner_ = this->new_owner_; this->new_owner_ = ACE_thread_t (0); return 0; } ACE_INLINE int ACE_WFMO_Reactor::safe_dispatch (DWORD wait_status) { int result = -1; ACE_SEH_TRY { result = this->dispatch (wait_status); } ACE_SEH_FINALLY { this->update_state (); } return result; } ACE_INLINE int ACE_WFMO_Reactor::dispatch_window_messages () { return 0; } ACE_INLINE void ACE_WFMO_Reactor::wakeup_all_threads () { this->wakeup_all_threads_.signal (); } ACE_INLINE int ACE_WFMO_Reactor::notify (ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask, ACE_Time_Value *timeout) { return this->notify_handler_->notify (event_handler, mask, timeout); } ACE_INLINE int ACE_WFMO_Reactor::register_handler (int signum, ACE_Event_Handler *new_sh, ACE_Sig_Action *new_disp, ACE_Event_Handler **old_sh, ACE_Sig_Action *old_disp) { return this->signal_handler_->register_handler (signum, new_sh, new_disp, old_sh, old_disp); } ACE_INLINE int ACE_WFMO_Reactor::register_handler (const ACE_Sig_Set &sigset, ACE_Event_Handler *new_sh, ACE_Sig_Action *new_disp) { int result = 0; #if (ACE_NSIG > 0) for (int s = 1; s < ACE_NSIG; s++) if (sigset.is_member (s) && this->signal_handler_->register_handler (s, new_sh, new_disp) == -1) result = -1; #else ACE_UNUSED_ARG (sigset); ACE_UNUSED_ARG (new_sh); ACE_UNUSED_ARG (new_disp); #endif /* ACE_NSIG */ return result; } ACE_INLINE int ACE_WFMO_Reactor::remove_handler (int signum, ACE_Sig_Action *new_disp, ACE_Sig_Action *old_disp, int sigkey) { return this->signal_handler_->remove_handler (signum, new_disp, old_disp, sigkey); } ACE_INLINE int ACE_WFMO_Reactor::remove_handler (const ACE_Sig_Set &sigset) { int result = 0; #if (ACE_NSIG > 0) for (int s = 1; s < ACE_NSIG; s++) if (sigset.is_member (s) && this->signal_handler_->remove_handler (s) == -1) result = -1; #else ACE_UNUSED_ARG (sigset); #endif /* ACE_NSIG */ return result; } ACE_INLINE int ACE_WFMO_Reactor::handler (int signum, ACE_Event_Handler **eh) { ACE_Event_Handler *handler = this->signal_handler_->handler (signum); if (handler == nullptr) return -1; else if (eh != nullptr) *eh = handler; return 0; } ACE_INLINE int ACE_WFMO_Reactor::mask_ops (ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask, int operation) { ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1); return this->mask_ops_i (event_handler->get_handle (), mask, operation); } ACE_INLINE int ACE_WFMO_Reactor::mask_ops (ACE_HANDLE io_handle, ACE_Reactor_Mask mask, int operation) { ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1); return this->mask_ops_i (io_handle, mask, operation); } ACE_INLINE void ACE_WFMO_Reactor::requeue_position (int) { // Not implemented } ACE_INLINE int ACE_WFMO_Reactor::requeue_position () { // Don't have an implementation for this yet... ACE_NOTSUP_RETURN (-1); } ACE_INLINE bool ACE_WFMO_Reactor::restart () { return false; } ACE_INLINE bool ACE_WFMO_Reactor::restart (bool) { return false; } ACE_INLINE int ACE_WFMO_Reactor::ready_ops (ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask, int ops) { // Don't have an implementation for this yet... ACE_UNUSED_ARG (event_handler); ACE_UNUSED_ARG (mask); ACE_UNUSED_ARG (ops); ACE_NOTSUP_RETURN (-1); } ACE_INLINE int ACE_WFMO_Reactor::ready_ops (ACE_HANDLE handle, ACE_Reactor_Mask, int ops) { // Don't have an implementation for this yet... ACE_UNUSED_ARG (handle); ACE_UNUSED_ARG (ops); ACE_NOTSUP_RETURN (-1); } ACE_INLINE ACE_Event_Handler * ACE_WFMO_Reactor::find_handler (ACE_HANDLE handle) { ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, 0); return this->handler_rep_.find_handler (handle); } ACE_INLINE int ACE_WFMO_Reactor::handler (ACE_HANDLE handle, ACE_Reactor_Mask mask, ACE_Event_Handler **event_handler) { ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); return this->handler_rep_.handler (handle, mask, event_handler); } ACE_INLINE bool ACE_WFMO_Reactor::initialized () { return this->open_for_business_; } ACE_INLINE ACE_Lock & ACE_WFMO_Reactor::lock () { return this->lock_adapter_; } ACE_INLINE size_t ACE_WFMO_Reactor::size () const { // Size of repository minus the 2 used for internal purposes return this->handler_rep_.max_size_ - 2; } ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_WIN32 */ ace-8.0.4+dfsg.orig/ace/Timer_List.h0000644000175000017500000000222215027201773016141 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Timer_List.h * * @author Doug Schmidt */ //============================================================================= #ifndef ACE_TIMER_LIST_H #define ACE_TIMER_LIST_H #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 #endif /* ACE_LACKS_PRAGMA_ONCE */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL // The following typedefs are here for ease of use and backward // compatibility. typedef ACE_Timer_List_T ACE_Timer_List; typedef ACE_Timer_List_Iterator_T ACE_Timer_List_Iterator; ACE_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" #endif /* ACE_TIMER_LIST_H */ ace-8.0.4+dfsg.orig/ace/config-macosx-leopard.h0000644000175000017500000001322515027201773020254 0ustar sudipsudip/* -*- C++ -*- */ // This configuration file is designed to work with the MacOS X operating system. #ifndef ACE_CONFIG_MACOSX_LEOPARD_H #define ACE_CONFIG_MACOSX_LEOPARD_H #include #define ACE_HAS_MAC_OSX #define ACE_HAS_NET_IF_DL_H #define ACE_HAS_VOID_UNSETENV #if ! defined (__ACE_INLINE__) #define __ACE_INLINE__ #endif /* ! __ACE_INLINE__ */ #if !defined (ACE_SIZEOF_LONG_DOUBLE) # define ACE_SIZEOF_LONG_DOUBLE __SIZEOF_LONG_DOUBLE__ #endif // ACE_SIZEOF_LONG_DOUBLE #if defined (__GNUG__) # include "ace/config-g++-common.h" #endif /* __GNUG__ */ #define ACE_ISCTYPE_EQUIVALENT __isctype #define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu" #if !defined (__i386__) # if defined (ACE_HAS_PENTIUM) # undef ACE_HAS_PENTIUM # endif /* ACE_HAS_PENTIUM */ #else // __i386__ # define ACE_HAS_PENTIUM #endif //__i386__ #if !defined (_THREAD_SAFE) #define _THREAD_SAFE #endif /* _THREAD_SAFE */ #define ACE_HAS_GPERF #define ACE_HAS_POSIX_SEM #define ACE_HAS_SIOCGIFCONF #define ACE_HAS_SUNOS4_GETTIMEOFDAY #define ACE_LACKS_STROPTS_H // Platform provides header. #define ACE_HAS_EXECINFO_H // Wcharness.... #define ACE_HAS_WCHAR #define ACE_SIZEOF_WCHAR 4 #define ACE_HAS_3_PARAM_WCSTOK #define ACE_LACKS_ITOW #define ACE_LACKS_WCSICMP #define ACE_LACKS_WCSNICMP #define ACE_LACKS_WCSDUP // Mac lacks the following pthread features #define ACE_LACKS_MUTEXATTR_PSHARED #define ACE_LACKS_CONDATTR_PSHARED // // Compiler/platform defines the sig_atomic_t typedef. #define ACE_HAS_SIG_ATOMIC_T // Compiler/platform supports SVR4 signal typedef #define ACE_HAS_SVR4_SIGNAL_T //Platform/compiler has the sigwait(2) prototype #define ACE_HAS_SIGWAIT #define ACE_HAS_AIO_CALLS #define ACE_HAS_ICMP_SUPPORT 1 //Platform supports sigsuspend() #define ACE_HAS_SIGSUSPEND #define ACE_LACKS_GETPGID #define ACE_LACKS_RWLOCK_T // Optimize ACE_Handle_Set for select(). #define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT #define ACE_HAS_NONCONST_SELECT_TIMEVAL #define ACE_NEEDS_SCHED_H #define ACE_HAS_ALT_CUSERID // Platform supports POSIX timers via struct timespec. #define ACE_HAS_POSIX_TIME #define ACE_HAS_UALARM // Platform defines struct timespec but not timespec_t #define ACE_LACKS_TIMESPEC_T #define ACE_LACKS_STRRECVFD #define ACE_HAS_SOCKADDR_IN_SIN_LEN #define ACE_HAS_SOCKADDR_IN6_SIN6_LEN // Platform supports System V IPC (most versions of UNIX, but not Win32) #define ACE_HAS_SYSV_IPC // Compiler/platform contains the file. #define ACE_HAS_SYS_SYSCALL_H #define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES // 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 correctly calls init()/fini() for shared libraries. #define ACE_HAS_AUTOMATIC_INIT_FINI // platform supports POSIX O_NONBLOCK semantics #define ACE_HAS_POSIX_NONBLOCK // platform supports IP multicast #define ACE_HAS_IP_MULTICAST #define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 // Compiler/platform has the getrusage() system call. #define ACE_HAS_GETRUSAGE // Compiler supports the ssize_t typedef. #define ACE_HAS_SSIZE_T // Compiler/platform provides the sockio.h file. #define ACE_HAS_SYS_SOCKIO_H // Compiler/platform provides the socklen_t type. #define ACE_HAS_SOCKLEN_T // Defines the page size of the system. #define ACE_HAS_GETPAGESIZE // Platform provides header. #define ACE_HAS_SYS_FILIO_H // Platform/compiler supports timezone * as second parameter to gettimeofday(). #define ACE_HAS_TIMEZONE_GETTIMEOFDAY #define ACE_LACKS_SYS_MSG_H #define ACE_LACKS_SYSV_MSQ_PROTOS #define ACE_HAS_MSG #define ACE_HAS_4_4BSD_SENDMSG_RECVMSG #define ACE_HAS_NONCONST_MSGSND #if !defined (ACE_MT_SAFE) # define ACE_MT_SAFE 1 #endif #if ACE_MT_SAFE == 1 // Yes, we do have threads. # define ACE_HAS_THREADS // And they're even POSIX pthreads # define ACE_HAS_PTHREADS # define ACE_HAS_PTHREAD_SCHEDPARAM # define ACE_HAS_THREAD_SPECIFIC_STORAGE #endif /* ACE_MT_SAFE == 1 */ #define ACE_LACKS_THREAD_PROCESS_SCOPING #define ACE_HAS_DIRENT #define ACE_LACKS_POLL_H #define ACE_LACKS_SEARCH_H #define ACE_LACKS_SETSCHED //#define ACE_HAS_RECURSIVE_MUTEXES // Platform has POSIX terminal interface. #define ACE_HAS_TERMIOS #define ACE_HAS_SEMUN #define ACE_HAS_SIGINFO_T #define ACE_LACKS_SIGINFO_H #define ACE_HAS_UCONTEXT_T #define ACE_HAS_GETIFADDRS #define ACE_LACKS_UNNAMED_SEMAPHORE #if !defined (__DARWIN_UNIX03) #define ACE_HAS_VOID_UNSETENV #endif #define ACE_LACKS_CONDATTR_SETCLOCK #ifndef ACE_HAS_IPHONE #if __MAC_OS_X_VERSION_MAX_ALLOWED < 101200 #define ACE_LACKS_CLOCKID_T #define ACE_LACKS_CLOCK_MONOTONIC #define ACE_LACKS_CLOCK_REALTIME #endif #endif // dlcompat package (not part of base Darwin) is needed for dlopen(). // You may download directly from sourceforge and install or use fink // Fink installer puts libraries in /sw/lib and headers in /sw/include // In order to install dlcompat do the following: // - download fink from http://fink.sf.net // - type: // fink install dlcompat // as of Dec 2002, if you use fink you will need to uncomment the next line // #define ACE_NEEDS_DL_UNDERSCORE #define ACE_HAS_SVR4_DYNAMIC_LINKING #define ACE_LD_SEARCH_PATH ACE_TEXT ("DYLD_LIBRARY_PATH") #define ACE_DLL_SUFFIX ACE_TEXT (".dylib") //#define ACE_LACKS_DLCLOSE // gperf seems to need this //#define ACE_HAS_NONSTATIC_OBJECT_MANAGER #define ACE_IOCTL_TYPE_ARG2 unsigned long #if defined(__APPLE_CC__) && (__APPLE_CC__ < 1173) #error "Compiler must be upgraded, see http://developer.apple.com" #endif /* __APPLE_CC__ */ #endif /* ACE_CONFIG_MACOSX_LEOPARD_H */ ace-8.0.4+dfsg.orig/ace/SOCK.cpp0000644000175000017500000001047115027201773015165 0ustar sudipsudip#include "ace/SOCK.h" #include "ace/Log_Category.h" #if defined (ACE_HAS_ALLOC_HOOKS) # include "ace/Malloc_Base.h" #endif /* ACE_HAS_ALLOC_HOOKS */ #if !defined (__ACE_INLINE__) #include "ace/SOCK.inl" #endif /* __ACE_INLINE__ */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_SOCK) void ACE_SOCK::dump () const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_SOCK::dump"); #endif /* ACE_HAS_DUMP */ } ACE_SOCK::ACE_SOCK () { // ACE_TRACE ("ACE_SOCK::ACE_SOCK"); } // Returns information about the remote peer endpoint (if there is // one). int ACE_SOCK::get_remote_addr (ACE_Addr &sa) const { ACE_TRACE ("ACE_SOCK::get_remote_addr"); int len = sa.get_size (); sockaddr *addr = reinterpret_cast (sa.get_addr ()); if (ACE_OS::getpeername (this->get_handle (), addr, &len) == -1) return -1; sa.set_size (len); sa.set_type (addr->sa_family); return 0; } int ACE_SOCK::get_local_addr (ACE_Addr &sa) const { ACE_TRACE ("ACE_SOCK::get_local_addr"); int len = sa.get_size (); sockaddr *addr = reinterpret_cast (sa.get_addr ()); if (ACE_OS::getsockname (this->get_handle (), addr, &len) == -1) return -1; sa.set_type (addr->sa_family); sa.set_size (len); return 0; } // Close down a ACE_SOCK. int ACE_SOCK::close () { ACE_TRACE ("ACE_SOCK::close"); int result = 0; if (this->get_handle () != ACE_INVALID_HANDLE) { result = ACE_OS::closesocket (this->get_handle ()); this->set_handle (ACE_INVALID_HANDLE); } return result; } int ACE_SOCK::open (int type, int protocol_family, int protocol, int reuse_addr) { ACE_TRACE ("ACE_SOCK::open"); int one = 1; this->set_handle (ACE_OS::socket (protocol_family, type, protocol)); if (this->get_handle () == ACE_INVALID_HANDLE) return -1; else if (protocol_family != PF_UNIX && reuse_addr && this->set_option (SOL_SOCKET, SO_REUSEADDR, &one, sizeof one) == -1) { this->close (); return -1; } return 0; } // General purpose constructor for performing server ACE_SOCK // creation. ACE_SOCK::ACE_SOCK (int type, int protocol_family, int protocol, int reuse_addr) { // ACE_TRACE ("ACE_SOCK::ACE_SOCK"); if (this->open (type, protocol_family, protocol, reuse_addr) == -1) ACELIB_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_SOCK::ACE_SOCK"))); } int ACE_SOCK::open (int type, int protocol_family, int protocol, ACE_Protocol_Info *protocolinfo, ACE_SOCK_GROUP g, u_long flags, int reuse_addr) { ACE_TRACE ("ACE_SOCK::open"); this->set_handle (ACE_OS::socket (protocol_family, type, protocol, protocolinfo, g, flags)); int one = 1; if (this->get_handle () == ACE_INVALID_HANDLE) return -1; else if (reuse_addr && this->set_option (SOL_SOCKET, SO_REUSEADDR, &one, sizeof one) == -1) { this->close (); return -1; } else return 0; } ACE_SOCK::ACE_SOCK (int type, int protocol_family, int protocol, ACE_Protocol_Info *protocolinfo, ACE_SOCK_GROUP g, u_long flags, int reuse_addr) { // ACE_TRACE ("ACE_SOCK::ACE_SOCK"); if (this->open (type, protocol_family, protocol, protocolinfo, g, flags, reuse_addr) == -1) ACELIB_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_SOCK::ACE_SOCK"))); } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Malloc_Allocator.h0000644000175000017500000001144015027201773017277 0ustar sudipsudip// -*- C++ -*- //========================================================================== /** * @file Malloc_Allocator.h * * @author Based on code that formerly existed in another ACE file. */ //========================================================================== #ifndef ACE_MALLOC_ALLOCATOR_H #define ACE_MALLOC_ALLOCATOR_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/Malloc_Base.h" #if defined (ACE_HAS_MALLOC_STATS) #if defined (ACE_HAS_THREADS) #include "ace/Process_Mutex.h" #define ACE_PROCESS_MUTEX ACE_Process_Mutex #else #include "ace/SV_Semaphore_Simple.h" #define ACE_PROCESS_MUTEX ACE_SV_Semaphore_Simple #endif /* ACE_HAS_THREADS */ #endif /* ACE_HAS_MALLOC_STATS */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_New_Allocator * * @brief Defines a class that provided a simple implementation of * memory allocation. * * This class uses the new/delete operators to allocate and free up * memory. Please note that the only methods that are supported are * malloc(), calloc(), and free(). All other methods are no-ops that * return -1 and set @c errno to @c ENOTSUP. If you require this * functionality, please use: ACE_Allocator_Adapter >, which will allow you to use the * added functionality of bind/find/etc. while using the new/delete * operators. */ class ACE_Export ACE_New_Allocator : public ACE_Allocator { public: /// These methods are defined. virtual void *malloc (size_t nbytes); virtual void *calloc (size_t nbytes, char initial_value = '\0'); virtual void *calloc (size_t n_elem, size_t elem_size, char initial_value = '\0'); virtual void free (void *ptr); /// These methods are no-ops. virtual int remove (); virtual int bind (const char *name, void *pointer, int duplicates = 0); virtual int trybind (const char *name, void *&pointer); virtual int find (const char *name, void *&pointer); virtual int find (const char *name); virtual int unbind (const char *name); virtual int unbind (const char *name, void *&pointer); virtual int sync (ssize_t len = -1, int flags = MS_SYNC); virtual int sync (void *addr, size_t len, int flags = MS_SYNC); virtual int protect (ssize_t len = -1, int prot = PROT_RDWR); virtual int protect (void *addr, size_t len, int prot = PROT_RDWR); #if defined (ACE_HAS_MALLOC_STATS) virtual void print_stats () const; #endif /* ACE_HAS_MALLOC_STATS */ virtual void dump () const; private: // DO NOT ADD ANY STATE (DATA MEMBERS) TO THIS CLASS!!!! See the // implementation for explanation. }; /** * @class ACE_Static_Allocator_Base * * @brief Defines a class that provided a highly optimized memory * management scheme for allocating memory statically. * * This class manages a fixed-size @c POOL_SIZE of memory. Every * time malloc()/calloc() is called, it simply moves an internal * index forward and returns a pointer to the requested chunk. * All memory is allocated statically (typically via the * ACE_Static_Allocator template) and free() is a no-op. This * behavior is useful for use-cases where all the memory * allocation needs are known in advance and no deletions ever * occur. */ class ACE_Export ACE_Static_Allocator_Base : public ACE_Allocator { public: ACE_Static_Allocator_Base (char *buffer, size_t size); virtual void *malloc (size_t nbytes); virtual void *calloc (size_t nbytes, char initial_value = '\0'); virtual void *calloc (size_t n_elem, size_t elem_size, char initial_value = '\0'); virtual void free (void *ptr); virtual int remove (); virtual int bind (const char *name, void *pointer, int duplicates = 0); virtual int trybind (const char *name, void *&pointer); virtual int find (const char *name, void *&pointer); virtual int find (const char *name); virtual int unbind (const char *name); virtual int unbind (const char *name, void *&pointer); virtual int sync (ssize_t len = -1, int flags = MS_SYNC); virtual int sync (void *addr, size_t len, int flags = MS_SYNC); virtual int protect (ssize_t len = -1, int prot = PROT_RDWR); virtual int protect (void *addr, size_t len, int prot = PROT_RDWR); #if defined (ACE_HAS_MALLOC_STATS) virtual void print_stats () const; #endif /* ACE_HAS_MALLOC_STATS */ virtual void dump () const; protected: /// Don't allow direct instantiations of this class. ACE_Static_Allocator_Base (); /// Pointer to the buffer. char *buffer_; /// Size of the buffer. size_t size_; /// Pointer to the current offset in the . size_t offset_; }; ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Malloc_Allocator.inl" #endif /* __ACE_INLINE__ */ #include /**/ "ace/post.h" #endif /* MALLOC_ALLOCATOR_H */ ace-8.0.4+dfsg.orig/ace/ACE_FOR_TAO.pc.in0000644000175000017500000000037515027201773016456 0ustar sudipsudipprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: ACE_FOR_TAO Description: ADAPTIVE Communication Environment subset for use by TAO Version: @VERSION@ Libs: -L${libdir} -lACE_FOR_TAO @LIBS@ Cflags: -I${includedir} ace-8.0.4+dfsg.orig/ace/Condition_Thread_Mutex.inl0000644000175000017500000000176315027201773021031 0ustar sudipsudip// -*- C++ -*- ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_Condition::remove () { // ACE_TRACE ("ACE_Condition::remove"); // is called in a loop if the condition variable is // BUSY. This avoids a condition where a condition is signaled and // because of some timing problem, the thread that is to be signaled // has called the cond_wait routine after the signal call. Since // the condition signal is not queued in any way, deadlock occurs. int result = 0; if (!this->removed_) { this->removed_ = true; while ((result = ACE_OS::cond_destroy (&this->cond_)) == -1 && errno == EBUSY) { ACE_OS::cond_broadcast (&this->cond_); ACE_OS::thr_yield (); } } return result; } ACE_INLINE ACE_Thread_Mutex & ACE_Condition::mutex () { // ACE_TRACE ("ACE_Condition::mutex"); return this->mutex_; } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/WFMO_Reactor.h0000644000175000017500000013671115027201773016330 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file WFMO_Reactor.h * * @author Irfan Pyarali * @author Tim Harrison * @author Doug Schmidt */ //============================================================================= #ifndef ACE_WFMO_REACTOR_H #define ACE_WFMO_REACTOR_H #include /**/ "ace/pre.h" #include /**/ "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #if defined (ACE_WIN32) #include "ace/Signal.h" #include "ace/Timer_Queue.h" #include "ace/Event_Handler.h" #include "ace/Auto_Event.h" #include "ace/Manual_Event.h" #include "ace/Condition_Thread_Mutex.h" #include "ace/Lock_Adapter_T.h" #include "ace/Reactor_Impl.h" #include "ace/Message_Queue.h" #include "ace/Process_Mutex.h" // If we don't have WinSOCK2, we need these defined #if !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) /* * WinSock 2 extension -- bit values and indices for FD_XXX network events */ #define FD_READ_BIT 0 #define FD_WRITE_BIT 1 #define FD_OOB_BIT 2 #define FD_ACCEPT_BIT 3 #define FD_CONNECT_BIT 4 #define FD_CLOSE_BIT 5 #define FD_QOS_BIT 6 #define FD_GROUP_QOS_BIT 7 #define FD_QOS (1 << FD_QOS_BIT) #define FD_GROUP_QOS (1 << FD_GROUP_QOS_BIT) #define FD_MAX_EVENTS 8 #define FD_ALL_EVENTS ((1 << FD_MAX_EVENTS) - 1) #define WSAEVENT HANDLE typedef struct _WSANETWORKEVENTS { long lNetworkEvents; int iErrorCode[FD_MAX_EVENTS]; } WSANETWORKEVENTS, FAR * LPWSANETWORKEVENTS; int WSAEventSelect (SOCKET s, WSAEVENT hEventObject, long lNetworkEvents); int WSAEnumNetworkEvents (SOCKET s, WSAEVENT hEventObject, LPWSANETWORKEVENTS lpNetworkEvents); #endif /* !defined ACE_HAS_WINSOCK2 */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Forward decl. class ACE_WFMO_Reactor_Test; class ACE_WFMO_Reactor; class ACE_Handle_Set; /** * @class ACE_Wakeup_All_Threads_Handler * * @brief This is a helper class whose sole purpose is to handle events * on wakeup_all_threads_> */ class ACE_Export ACE_Wakeup_All_Threads_Handler : public ACE_Event_Handler { public: /// Called when the wakeup_all_threads_> int handle_signal (int signum, siginfo_t * = nullptr, ucontext_t * = nullptr) override; }; /** * @class ACE_WFMO_Reactor_Handler_Repository * * @internal This class is for internal ACE use only. * * @brief Used to map ACE_HANDLEs onto the appropriate * ACE_Event_Handler * and other information. */ class ACE_Export ACE_WFMO_Reactor_Handler_Repository { public: friend class ACE_WFMO_Reactor; friend class ACE_WFMO_Reactor_Test; /** * @class Common_Info * * @brief This struct contains the necessary information for every * 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 * separate makes sense. */ class Common_Info { public: /// This indicates whether this entry is for I/O or for a regular /// event bool io_entry_ {}; /// The associated 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. ACE_HANDLE io_handle_ { ACE_INVALID_HANDLE }; /** * 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 * 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. */ bool delete_event_ {}; /// This is set when the entry needed to be deleted. bool delete_entry_ {}; /** * 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_ { ACE_Event_Handler::NULL_MASK }; /// Default constructor Common_Info () = default; /// Reset the state of the structure void reset (); /// Set the structure to these new values void set (bool io_entry, ACE_Event_Handler *event_handler, ACE_HANDLE io_handle, long network_events, bool delete_event, bool delete_entry, ACE_Reactor_Mask close_masks); /// Set the structure to these new values void set (Common_Info &common_info); /// Dump the state of an object. void dump () const; }; /** * @class Current_Info * * @brief This structure inherits from the common structure to add * information for current entries. */ class Current_Info : public Common_Info { public: /// This is set when the entry needed to be suspended. bool suspend_entry_ {}; /// Default constructor Current_Info () = default; /// Reset the state of the structure void reset (); /// Set the structure to these new values void set (bool io_entry, ACE_Event_Handler *event_handler, ACE_HANDLE io_handle, long network_events, bool delete_event, bool delete_entry = false, ACE_Reactor_Mask close_masks = ACE_Event_Handler::NULL_MASK, bool suspend_entry = false); /// Set the structure to these new values void set (Common_Info &common_info, bool suspend_entry = false); /// Dump the state of an object. void dump (ACE_HANDLE event_handle) const; }; /** * @class To_Be_Added_Info * * @brief This structure inherits from the common structure to add * information for entries. */ class To_Be_Added_Info : public Common_Info { public: /// Handle for the event ACE_HANDLE event_handle_ { ACE_INVALID_HANDLE }; /// This is set when the entry needed to be suspended. bool suspend_entry_ {}; /// Default constructor To_Be_Added_Info () = default; /// Reset the state of the structure void reset (); /// Set the structure to these new values void set (ACE_HANDLE event_handle, bool io_entry, ACE_Event_Handler *event_handler, ACE_HANDLE io_handle, long network_events, bool delete_event, bool delete_entry = false, ACE_Reactor_Mask close_masks = ACE_Event_Handler::NULL_MASK, bool suspend_entry = false); /// Set the structure to these new values void set (ACE_HANDLE event_handle, Common_Info &common_info, bool suspend_entry = false); /// Dump the state of an object. void dump () const; }; /** * @class Suspended_Info * * @brief This structure inherits from the common structure to add * information for suspended entries. */ class Suspended_Info : public Common_Info { public: /// Handle for the event ACE_HANDLE event_handle_ { ACE_INVALID_HANDLE }; /// This is set when the entry needed to be resumed. bool resume_entry_ {}; /// Default constructor Suspended_Info () = default; /// Reset the state of the structure void reset (); /// Set the structure to these new values void set (ACE_HANDLE event_handle, bool io_entry, ACE_Event_Handler *event_handler, ACE_HANDLE io_handle, long network_events, bool delete_event, bool delete_entry = false, ACE_Reactor_Mask close_masks = 0, bool resume_entry = false); /// Set the structure to these new values void set (ACE_HANDLE event_handle, Common_Info &common_info, bool resume_entry = false); /// Dump the state of an object. void dump () const; }; /// Constructor. ACE_WFMO_Reactor_Handler_Repository (ACE_WFMO_Reactor &wfmo_reactor); /// Destructor. virtual ~ACE_WFMO_Reactor_Handler_Repository (); /// Initialize the repository of the appropriate @a size. int open (size_t size); /// Close down the handler repository. int close (); // = Search structure operations. /// 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, long network_events, ACE_HANDLE io_handle, ACE_HANDLE event_handle, bool delete_event); /// Remove the binding of ACE_HANDLE in accordance with the @a mask. int unbind (ACE_HANDLE, ACE_Reactor_Mask mask); /// Non-lock-grabbing version of unbind int unbind_i (ACE_HANDLE, ACE_Reactor_Mask mask, bool &changes_required); /// Remove all bindings of tuples. void unbind_all (); // = Sanity checking. // Check the @a handle to make sure it's a valid ACE_HANDLE int invalid_handle (ACE_HANDLE handle) const; // = Accessors. /// Maximum ACE_HANDLE value, plus 1. DWORD max_handlep1 () const; /// Pointer to the beginning of the current array of ACE_HANDLE /// *'s. ACE_HANDLE *handles () const; /// Pointer to the beginning of the current array of /// ACE_Event_Handler *'s. Current_Info *current_info () const; /// Check if changes to the handle set are required. virtual bool changes_required (); /// Make changes to the handle set virtual int make_changes (); /// Check to see if @a slot has been scheduled for deletion int scheduled_for_deletion (size_t slot) const; /** * This method is used to calculate the network mask after a mask_op * request to . 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 */ int modify_network_events_i (ACE_HANDLE io_handle, ACE_Reactor_Mask new_masks, ACE_Reactor_Mask &old_masks, long &new_network_events, ACE_HANDLE &event_handle, bool &delete_event, int operation); /// This method is used to change the network mask left (if any) /// after a remove request to ACE_Reactor_Mask bit_ops (long &existing_masks, ACE_Reactor_Mask to_be_removed_masks, int operation); /// Temporarily suspend entry int suspend_handler_i (ACE_HANDLE handle, bool &changes_required); /// Resume suspended entry int resume_handler_i (ACE_HANDLE handle, bool &changes_required); /// Deletions and suspensions in current_info_ int make_changes_in_current_infos (); /// Deletions and resumptions in current_suspended_info_ int make_changes_in_suspension_infos (); /// Deletions in to_be_added_info_, or transfers to current_info_ or /// current_suspended_info_ from to_be_added_info_ int make_changes_in_to_be_added_infos (); /// Removes the ACE_Event_Handler at @a slot from the table. int remove_handler_i (size_t slot, ACE_Reactor_Mask mask); /// Removes the ACE_Event_Handler at @a slot from the table. int remove_suspended_handler_i (size_t slot, ACE_Reactor_Mask mask); /// Removes the ACE_Event_Handler at @a slot from the table. int remove_to_be_added_handler_i (size_t slot, ACE_Reactor_Mask to_be_removed_masks); /** * Return the Event_Handler associated with @a handle. Return 0 if * @a handle is not registered. */ ACE_Event_Handler *find_handler (ACE_HANDLE handle); /** * Check to see if @a handle is associated with a valid Event_Handler * bound to @a mask. Return the @a event_handler associated with this * @a handler if @a event_handler != 0. */ int handler (ACE_HANDLE handle, ACE_Reactor_Mask mask, ACE_Event_Handler **event_handler = 0); /** * Check to see if @a handle is associated with a valid * Event_Handler. Return Event_Handler and associated masks. */ ACE_Event_Handler *handler (ACE_HANDLE handle, long &existing_masks); /// Dump the state of an object. void dump () const; protected: /// Reference to our WFMO_Reactor. ACE_WFMO_Reactor &wfmo_reactor_; /// Maximum number of handles. size_t max_size_; /** * Array of ACE_HANDLEs passed to . This * is not part of the structure as the handle array needs to be * passed directly to . */ ACE_HANDLE *current_handles_; /// Array of current entries in the table Current_Info *current_info_; /// A count of the number of active handles. DWORD max_handlep1_; /// Information for entries to be added To_Be_Added_Info *to_be_added_info_; /// Number of records to be added size_t handles_to_be_added_; /// Currently suspended handles Suspended_Info *current_suspended_info_; /// Number of currently suspended handles size_t suspended_handles_; /// Number of records to be suspended size_t handles_to_be_suspended_; /// Number of records to be resumed size_t handles_to_be_resumed_; /// Number of records to be deleted size_t handles_to_be_deleted_; }; /** * @class ACE_WFMO_Reactor_Notify * * @brief Unblock the ACE_WFMO_Reactor from its event loop, passing * it an optional ACE_Event_Handler to dispatch. * * This implementation is necessary for cases where the * ACE_WFMO_Reactor is run in a multi-threaded program. In * this case, we need to be able to unblock * when updates occur other than in the * main thread. To do this, we signal an * auto-reset event the is listening on. If * an ACE_Event_Handler and ACE_Reactor_Mask is passed to * , the appropriate method is dispatched. */ class ACE_Export ACE_WFMO_Reactor_Notify : public ACE_Reactor_Notify { public: /// Constructor ACE_WFMO_Reactor_Notify (size_t max_notifies = 1024); /// Initialization. @a timer_queue is stored to call gettimeofday(). virtual int open (ACE_Reactor_Impl *wfmo_reactor, ACE_Timer_Queue *timer_queue, int disable_notify = 0); /// No-op. virtual int close (); /** * Special trick to unblock when updates * occur. All we do is enqueue @a event_handler and @a mask onto the * ACE_Message_Queue and wakeup the by signaling * its handle. The ACE_Time_Value indicates how long * to blocking trying to notify the . If @a timeout == * 0, the caller will block until action is possible, else will wait * until the relative time specified in @a timeout elapses). */ virtual int notify (ACE_Event_Handler *event_handler = nullptr, ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK, ACE_Time_Value *timeout = nullptr); /// No-op. virtual int dispatch_notifications (int &number_of_active_handles, ACE_Handle_Set &rd_mask); /// Returns a handle to the ACE_Auto_Event. virtual ACE_HANDLE get_handle () const; /// Returns the ACE_HANDLE of the notify pipe on which the reactor /// is listening for notifications so that other threads can unblock /// the virtual ACE_HANDLE notify_handle (); /// Handle one of the notify call on the . This could be /// because of a thread trying to unblock the virtual int dispatch_notify (ACE_Notification_Buffer &buffer); /// Verify whether the buffer has dispatchable info or not. virtual int is_dispatchable (ACE_Notification_Buffer &buffer); /// Read one of the notify call on the @a handle into the /// @a buffer. This could be because of a thread trying to unblock /// the virtual int read_notify_pipe (ACE_HANDLE handle, ACE_Notification_Buffer &buffer); /** * Set the maximum number of times that the * 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. By default, this is set to * -1, which means "iterate until the queue is empty." Setting this * to a value like "1 or 2" will increase "fairness" (and thus * prevent starvation) at the expense of slightly higher dispatching * overhead. */ void max_notify_iterations (int); /** * Get the maximum number of times that the * 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. */ int max_notify_iterations (); /** * Purge any notifications pending in this reactor for the specified * ACE_Event_Handler object. If @a eh == 0, all notifications for all * handlers are removed (but not any notifications posted just to wake up * the reactor itself). Returns the number of notifications purged. * Returns -1 on error. */ virtual int purge_pending_notifications (ACE_Event_Handler *, ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); /// Dump the state of an object. virtual void dump () const; private: /// Pointer to the wfmo_reactor's timer queue. ACE_Timer_Queue *timer_queue_; /** * Called when the notification event waited on by * is signaled. This dequeues all pending * ACE_Event_Handlers and dispatches them. */ 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 /// thread up (e.g., when the method is called). ACE_Auto_Event wakeup_one_thread_; /// Message queue that keeps track of pending ACE_Event_Handlers. /// This queue must be thread-safe because it can be called by /// multiple threads of control. ACE_Message_Queue message_queue_; /** * Keeps track of the maximum number of times that the * method will iterate and * dispatch the ACE_Event_Handlers that are passed in via the * notify queue before breaking out of its * loop. By default, this is set to * -1, which means "iterate until the queue is empty." */ int max_notify_iterations_; }; /** * @class ACE_WFMO_Reactor * * @brief An object oriented event demultiplexor and event handler. * ACE_WFMO_Reactor is a Windows-only implementation of the ACE_Reactor * interface that uses the WaitForMultipleObjects() event demultiplexer. * * Like the other ACE Reactors, ACE_WFMO_Reactor can schedule timers. * It also reacts to signalable handles, such as events (see the documentation * for WaitForMultipleObjects() for a complete list of signalable handle * types). Therefore, I/O handles are not directly usable for registering * for input, output, and exception notification. The exception to this * is ACE_SOCK-based handles, which can be registered for input, output, and * exception notification just as with other platforms. See Chapter 4 in * C++NPv2 for complete details. * * Note that changes to the state of ACE_WFMO_Reactor are not * instantaneous. Most changes (registration, removal, * suspension, and resumption of handles, and changes in * ownership) are made when the ACE_WFMO_Reactor reaches a stable * state. Users should be careful, especially when removing * handlers. This is because the ACE_WFMO_Reactor will call * handle_close() on the handler when it is finally removed and * not when remove_handler() is called. If the registered handler's pointer * is not valid when ACE_WFMO_Reactor calls ACE_Event_Handler::handle_close(), * use the DONT_CALL flag with remove_handler(). Preferably, use dynamically * allocated event handlers and call "delete this" inside the handle_close() * hook method. * * Note that although multiple threads can concurrently run the * ACE_WFMO_Reactor event loop, the concept of the reactor "owner" is still * important. Only the owner thread can expire timers and wait on the * notifications handle. Thus, be careful to properly set the owner thread * when spawning threads to run the event loop while you are using timers * or notifications. */ class ACE_Export ACE_WFMO_Reactor : public ACE_Reactor_Impl { public: friend class ACE_WFMO_Reactor_Handler_Repository; friend class ACE_WFMO_Reactor_Test; enum { /// Default size of the WFMO_Reactor's handle table. /** * Two slots will be added to the @a size parameter in the * constructor and open methods which will store handles used for * internal management purposes. */ DEFAULT_SIZE = MAXIMUM_WAIT_OBJECTS - 2 }; /// Initialize ACE_WFMO_Reactor with the default size. ACE_WFMO_Reactor (ACE_Sig_Handler * = nullptr, ACE_Timer_Queue * = nullptr, ACE_Reactor_Notify * = nullptr); /** * Initialize ACE_WFMO_Reactor with the specified size. * * @param size The maximum number of handles the reactor can * register. The value should not exceed * ACE_WFMO_Reactor::DEFAULT_SIZE. Two slots will be * added to the @a size parameter which will store handles * used for internal management purposes. */ ACE_WFMO_Reactor (size_t size, int unused = 0, ACE_Sig_Handler * = nullptr, ACE_Timer_Queue * = nullptr, ACE_Reactor_Notify * = nullptr); /** * Initialize ACE_WFMO_Reactor with the specified size. * * @param size The maximum number of handles the reactor can * register. The value should not exceed * ACE_WFMO_Reactor::DEFAULT_SIZE. Two slots will be * added to the @a size parameter which will store handles * used for internal management purposes. */ virtual int open (size_t size = ACE_WFMO_Reactor::DEFAULT_SIZE, bool restart = false, ACE_Sig_Handler * = nullptr, ACE_Timer_Queue * = nullptr, int disable_notify_pipe = 0, ACE_Reactor_Notify * = nullptr); /// Returns -1 (not used in this implementation); virtual int current_info (ACE_HANDLE, size_t & /* size */); /// Use a user specified signal handler instead. virtual int set_sig_handler (ACE_Sig_Handler *signal_handler); /// Set a user-specified timer queue. virtual int timer_queue (ACE_Timer_Queue *tq); /// Return the current ACE_Timer_Queue. virtual ACE_Timer_Queue *timer_queue () const; /// Close down the ACE_WFMO_Reactor and release all of its resources. virtual int close (); /// Close down the ACE_WFMO_Reactor and release all of its resources. virtual ~ACE_WFMO_Reactor (); // = Event loop drivers. /** * This method is not currently implemented. We recommend that you * use handle_events (ACE_Time_Value::zero) to get basically the * same effect, i.e., it won't block the caller if there are no events. */ virtual int work_pending (const ACE_Time_Value &max_wait_time = ACE_Time_Value::zero); /** * This event loop driver blocks for up to @a max_wait_time before * returning. It will return earlier if timer events, I/O events, * or signal events occur. Note that @a max_wait_time can be 0, in * which case this method blocks indefinitely until events occur. * * @a max_wait_time is decremented to reflect how much time this call * took. For instance, if a time value of 3 seconds is passed to * handle_events and an event occurs after 2 seconds, * @a max_wait_time will equal 1 second. This can be used if an * application wishes to handle events for some fixed amount of * time. * * is used as the demultiplexing call * * Returns the total number of I/O and timer ACE_Event_Handlers * that were dispatched, 0 if the @a max_wait_time elapsed without * dispatching any handlers, or -1 if an error occurs. * * The only difference between and * is that in the alertable case, TRUE is passed to * for the option. */ virtual int handle_events (ACE_Time_Value *max_wait_time = nullptr); virtual int alertable_handle_events (ACE_Time_Value *max_wait_time = nullptr); /** * This method is just like the one above, except the * @a max_wait_time value is a reference and can therefore never be * NULL. * * The only difference between and * is that in the alertable case, TRUE is passed to * for the option. */ virtual int handle_events (ACE_Time_Value &max_wait_time); virtual int alertable_handle_events (ACE_Time_Value &max_wait_time); // = Event handling control. /** * Return the status of Reactor. If this function returns 0, the reactor is * actively handling events. If it returns non-zero, and * return -1 immediately. */ virtual int deactivated (); /** * Control whether the Reactor will handle any more incoming events or not. * If @a do_stop == 1, the Reactor will be disabled. By default, a reactor * is in active state and can be deactivated/reactivated as wish. */ virtual void deactivate (int do_stop); // = Register and remove Handlers. /** * Register an ACE_Event_Handler @a event_handler. Since no Event * Mask is passed through this interface, it is assumed that the * @a handle being passed in is an event handle and when the event * becomes signaled, will call handle_signal on * @a event_handler. If @a handle == the * will call the method of * @a event_handler to extract the underlying event handle. */ virtual int register_handler (ACE_Event_Handler *event_handler, ACE_HANDLE event_handle = ACE_INVALID_HANDLE); /** * Register an ACE_Event_Handler @a event_handle. @a mask specifies * the network events that the @a event_handler is interested in. If * @a io_handle == ACE_INVALID_HANDLE the ACE_WFMO_Reactor will * call the method of to extract the * underlying I/O handle. If the @a event_handle == * ACE_INVALID_HANDLE, WFMO_Reactor will create an event for * associating it with the I/O handle. When the @a event_handle is * signalled, the appropriate callback will be invoked on * the Event_Handler */ virtual int register_handler (ACE_HANDLE event_handle, ACE_HANDLE io_handle, ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask); /** * This is a simple version of the above method * where the I/O handle is passed in and the event handle will * always be created by */ virtual int register_handler (ACE_HANDLE io_handle, ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask); /** * This is a simple version of the above method * where the I/O handle will always come from on the * Event_Handler and the event handle will always be created by * */ virtual int register_handler (ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask); /// Register @a event_handler with all the @a handles in the /// . virtual int register_handler (const ACE_Handle_Set &handles, ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask); /** * Register @a new_sh to handle the signal @a signum using the * @a new_disp. Returns the @a old_sh that was previously registered * (if any), along with the @a old_disp of the signal handler. */ virtual int register_handler (int signum, ACE_Event_Handler *new_sh, ACE_Sig_Action *new_disp = nullptr, ACE_Event_Handler **old_sh = nullptr, ACE_Sig_Action *old_disp = nullptr); /// Registers @a new_sh to handle a set of signals @a sigset using the /// @a new_disp. virtual int register_handler (const ACE_Sig_Set &sigset, ACE_Event_Handler *new_sh, ACE_Sig_Action *new_disp = nullptr); /** * Removes @a event_handler from the ACE_WFMO_Reactor. Note that * the ACE_WFMO_Reactor will call the method of * @a event_handler to extract the underlying handle. If @a mask == * ACE_Event_Handler::DONT_CALL then the method of * the @a event_handler is not invoked. Note that the @a handle can * either be the or the */ virtual int remove_handler (ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask); /** * Removes @a handle from the . If @a mask == * ACE_Event_Handler::DONT_CALL then the method of * the is not invoked. Note that the @a handle can * either be the or the * * For the case of I/O entries, this removes the @a mask binding of * Event_Handler whose handle is @a handle from . If * there are no more bindings for this then it is * removed from the WFMO_Reactor. For simple event entries, mask is * mostly ignored and the Event_Handler is always removed from * */ virtual int remove_handler (ACE_HANDLE handle, ACE_Reactor_Mask mask); /** * 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 * of these handles then they are removed from WFMO_Reactor. */ virtual int remove_handler (const ACE_Handle_Set &handle_set, ACE_Reactor_Mask); /** * Remove the ACE_Event_Handler currently associated with @a signum. * @a sigkey is ignored in this implementation since there is only * one instance of a signal handler. Install the new disposition * (if given) and return the previous disposition (if desired by the * caller). Returns 0 on success and -1 if @a signum is invalid. */ virtual int remove_handler (int signum, ACE_Sig_Action *new_disp, ACE_Sig_Action *old_disp = nullptr, int sigkey = -1); /// 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. virtual int suspend_handler (ACE_Event_Handler *event_handler); /// Suspend @a handle temporarily. virtual int suspend_handler (ACE_HANDLE handle); /// Suspend all @a handles in handle set temporarily. virtual int suspend_handler (const ACE_Handle_Set &handles); /// Suspend all handles temporarily. virtual int suspend_handlers (); /// Resume @a event_handler. Use to /// get the handle. virtual int resume_handler (ACE_Event_Handler *event_handler); /// Resume @a handle. virtual int resume_handler (ACE_HANDLE handle); /// Resume all @a handles in handle set. virtual int resume_handler (const ACE_Handle_Set &handles); /// Resume all . virtual int resume_handlers (); /// Does the reactor allow the application to resume the handle on /// its own ie. can it pass on the control of handle resumption to /// the application. A positive value indicates that the handlers /// are application resumable. A value of 0 indicates otherwise. virtual int resumable_handler (); /** * Return true if we any event associations were made by the reactor * for the handles that it waits on, false otherwise. Since the * WFMO_Reactor does use event associations, this function always * return true. */ virtual bool uses_event_associations (); // Timer management. /** * Schedule an ACE_Event_Handler that will expire after an amount * of time. The return value of this method, a timer_id value, * uniquely identifies the event_handler in the ACE_Reactor's * internal list of timers. * This timer_id value can be used to cancel the timer * with the cancel_timer() call. * * @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 */ virtual long schedule_timer (ACE_Event_Handler *event_handler, const void *arg, const ACE_Time_Value &delay, 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_timer_interval (long timer_id, const ACE_Time_Value &interval); /// Cancel all Event_Handlers that match the address of /// @a event_handler. Returns number of handler's cancelled. virtual int cancel_timer (ACE_Event_Handler *event_handler, int dont_call_handle_close = 1); /** * Cancel the single Event_Handler that matches the @a timer_id value * (which was returned from the schedule method). If arg is * non-NULL then it will be set to point to the ``magic cookie'' * argument passed in when the Event_Handler was registered. This * makes it possible to free up the memory and avoid memory leaks. * Returns 1 if cancellation succeeded and 0 if the @a timer_id * wasn't found. */ virtual int cancel_timer (long timer_id, const void **arg = 0, int dont_call_handle_close = 1); // = High-level Event_Handler scheduling operations /** * Add @a masks_to_be_added to the @a event_handler's entry in * WFMO_Reactor. @a event_handler must already have been registered * with WFMO_Reactor. */ virtual int schedule_wakeup (ACE_Event_Handler *event_handler, ACE_Reactor_Mask masks_to_be_added); /** * Add @a masks_to_be_added to the @a handle's entry in WFMO_Reactor. * The Event_Handler associated with @a handle must already have been * registered with WFMO_Reactor. */ virtual int schedule_wakeup (ACE_HANDLE handle, ACE_Reactor_Mask masks_to_be_added); /** * Remove @a masks_to_be_deleted to the '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 @a masks_to_be_deleted to the @a handle's entry in * WFMO_Reactor. The Event_Handler associated with @a handle must * already have been registered with WFMO_Reactor. */ virtual int cancel_wakeup (ACE_HANDLE handle, ACE_Reactor_Mask masks_to_be_deleted); // = Notification methods. /** * Wakeup one thread if it is currently blocked * in . The ACE_Time_Value indicates how * long to blocking trying to notify the . If * @a timeout == 0, the caller will block until action is possible, * else will wait until the relative time specified in @a timeout * elapses). */ virtual int notify (ACE_Event_Handler * = nullptr, ACE_Reactor_Mask = ACE_Event_Handler::EXCEPT_MASK, ACE_Time_Value * = nullptr); /** * Set the maximum number of times that the * method will iterate and * dispatch the ACE_Event_Handlers that are passed in via the * notify queue before breaking out of its * loop. By default, this is set to * -1, which means "iterate until the queue is empty." Setting this * to a value like "1 or 2" will increase "fairness" (and thus * prevent starvation) at the expense of slightly higher dispatching * overhead. */ virtual void max_notify_iterations (int); /** * Get the maximum number of times that the * method will iterate and * dispatch the ACE_Event_Handlers that are passed in via the * notify queue before breaking out of its * loop. */ virtual int max_notify_iterations (); /** * Purge any notifications pending in this reactor for the specified * ACE_Event_Handler object. Returns the number of notifications * purged. Returns -1 on error. */ virtual int purge_pending_notifications (ACE_Event_Handler * = nullptr, ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); // = Assorted helper methods. /** * Return the Event_Handler associated with @a handle. Return 0 if * @a handle is not registered. */ ACE_Event_Handler *find_handler (ACE_HANDLE handle); /** * Check to see if @a handle is associated with a valid Event_Handler * bound to @a mask. Return the @a event_handler associated with this * @a handler if @a event_handler != 0. */ virtual int handler (ACE_HANDLE handle, ACE_Reactor_Mask mask, ACE_Event_Handler **event_handler = nullptr); /** * Check to see if @a signum is associated with a valid Event_Handler * bound to a signal. Return the associated with * this @a handler if != 0. */ virtual int handler (int signum, ACE_Event_Handler ** = nullptr); /// Returns true if WFMO_Reactor has been successfully initialized, else /// false. virtual bool initialized (); /// Returns the current size of the WFMO_Reactor's internal /// descriptor table. virtual size_t size () const; /// Returns a reference to the WFMO_Reactor's internal lock. virtual ACE_Lock &lock (); /// Wake up all threads in WaitForMultipleObjects so that they can /// reconsult the handle set virtual void wakeup_all_threads (); /** * Transfers ownership of the WFMO_Reactor to the @a new_owner. The * transfer will not complete until all threads are ready (just like * the handle set). */ virtual int owner (ACE_thread_t new_owner, ACE_thread_t *old_owner = 0); /// Return the ID of the "owner" thread. virtual int owner (ACE_thread_t *owner); /// Get the existing restart value. virtual bool restart (); /// Set a new value for restart and return the original value. virtual bool restart (bool r); /// Not implemented virtual void requeue_position (int); /// Not implemented virtual int requeue_position (); // = Low-level wait_set mask manipulation methods. /** * Modify @a masks of the @a event_handler's entry in WFMO_Reactor * depending upon . @a event_handler must already have * been registered with WFMO_Reactor. */ virtual int mask_ops (ACE_Event_Handler *event_handler, ACE_Reactor_Mask masks, int operation); /** * Modify @a masks of the 's entry in WFMO_Reactor depending * upon . must already have been registered * with WFMO_Reactor. */ virtual int mask_ops (ACE_HANDLE handle, ACE_Reactor_Mask masks, int ops); // = Low-level ready_set mask manipulation methods. /// Not implemented virtual int ready_ops (ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask, int ops); /// Not implemented virtual int ready_ops (ACE_HANDLE handle, ACE_Reactor_Mask, int ops); /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; /// Dump the state of an object. virtual void dump () const; protected: /// Registration workhorse virtual int register_handler_i (ACE_HANDLE event_handle, ACE_HANDLE io_handle, ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask); /// Event handling workhorse virtual int event_handling (ACE_Time_Value *max_wait_time = nullptr, int alertable = 0); /// Bit masking workhorse virtual int mask_ops_i (ACE_HANDLE io_handle, ACE_Reactor_Mask masks, int operation); /// Return the ID of the "owner" thread. Does not do any locking. virtual ACE_thread_t owner_i (); /// Wait up to @a max_wait_time until it's ok to enter /// WaitForMultipleObjects. Returns 1 (and holding lock_) if ok to wait; /// -1 (and not holding lock_) if not. virtual int ok_to_wait (ACE_Time_Value *max_wait_time, int alertable); /// Wait for timer and I/O events to occur. virtual DWORD wait_for_multiple_events (int timeout, int alertable); /// Check for activity on remaining handles. virtual DWORD poll_remaining_handles (DWORD slot); /// Expire timers. Only the owner thread does useful stuff in this /// function. virtual int expire_timers (); /// Dispatches the timers and I/O handlers. virtual int dispatch (DWORD wait_status); /// Protect against structured exceptions caused by user code when /// dispatching handles virtual int safe_dispatch (DWORD wait_status); /** * Dispatches any active handles from handles_[@a slot] to * handles_[active_handles_] using to poll * through our handle set looking for active handles. */ virtual int dispatch_handles (DWORD slot); /// Dispatches a single handler. Returns 0 on success, -1 if the /// handler was removed. virtual int dispatch_handler (DWORD slot, DWORD max_handlep1); /// Dispatches a single handler. Returns 0 on success, -1 if the /// handler was removed. virtual int simple_dispatch_handler (DWORD slot, ACE_HANDLE event_handle); /// Dispatches a single handler. Returns 0 on success, -1 if the /// handler was removed. virtual int complex_dispatch_handler (DWORD slot, ACE_HANDLE event_handle); /// Dispatches window messages. Noop for WFMO_Reactor. virtual int dispatch_window_messages (); virtual ACE_Reactor_Mask upcall (ACE_Event_Handler *event_handler, ACE_HANDLE io_handle, WSANETWORKEVENTS &events); /// Used to calculate the next timeout virtual int calculate_timeout (ACE_Time_Value *time); /// Update the state of the handler repository virtual int update_state (); /// Check to see if we have a new owner virtual int new_owner (); /// Set owner to new owner virtual int change_owner (); /// Handle signals without requiring global/static variables. ACE_Sig_Handler *signal_handler_ {}; /// Keeps track of whether we should delete the signal handler (if we /// didn't create it, then we don't delete it). bool delete_signal_handler_; /// Defined as a pointer to allow overriding by derived classes... ACE_Timer_Queue *timer_queue_ {}; /// Keeps track of whether we should delete the timer queue (if we /// didn't create it, then we don't delete it). bool delete_timer_queue_; /// Keeps track of whether we should delete the handler repository bool delete_handler_rep_; /// Used when is called. ACE_Reactor_Notify *notify_handler_ {}; /// Keeps track of whether we should delete the notify handler. bool delete_notify_handler_; /** * Synchronization for the ACE_WFMO_Reactor. * * A Process Mutex is used here because of two reasons: * (a) The implementation of ACE_Thread_Mutex uses CriticalSections * CriticalSections are not waitable using ::WaitForMultipleObjects * (b) This is really not a process mutex because it is not * named. No other process can use this mutex. */ ACE_Process_Mutex lock_; /// Adapter used to return internal lock to outside world. ACE_Lock_Adapter lock_adapter_; /// Table that maps to 's. ACE_WFMO_Reactor_Handler_Repository handler_rep_; /// A manual event used to block threads from proceeding into /// WaitForMultipleObjects ACE_Manual_Event ok_to_wait_; /** * A manual event is used so that we can wake everyone up (e.g., * when ACE_Event_Handlers are bounded and unbound from the * handler repository). */ ACE_Manual_Event wakeup_all_threads_; /// Used when is signaled ACE_Wakeup_All_Threads_Handler wakeup_all_threads_handler_; /// The changing thread waits on this event, till all threads are not /// active anymore ACE_Auto_Event waiting_to_change_state_; /// Count of currently active threads size_t active_threads_ {}; /** * The thread which is "owner" of the WFMO_Reactor. The owner * concept is used because we don't want multiple threads to try to * expire timers. Therefore the "owner" thread is the only one * allowed to expire timers. Also, the owner thread is the only * thread which waits on the notify handle. Note that the ownership * can be transferred. */ ACE_thread_t owner_; /// The owner to be of the WFMO_Reactor ACE_thread_t new_owner_; /// This is the thread which is responsible for the changing the /// state of the handle set ACE_thread_t change_state_thread_; /// This is an array of ACE_HANDLEs which keep track of the /// and handles ACE_HANDLE atomic_wait_array_ [2]; /// This flag is used to keep track of whether we are already closed. bool open_for_business_; /// This flag is used to keep track of whether we are actively handling /// events or not. sig_atomic_t deactivated_; private: ACE_WFMO_Reactor (const ACE_WFMO_Reactor &) = delete; ACE_WFMO_Reactor &operator = (const ACE_WFMO_Reactor &) = delete; }; ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/WFMO_Reactor.inl" #endif /* __ACE_INLINE__ */ #endif /* ACE_WIN32 */ #include /**/ "ace/post.h" #endif /* ACE_WFMO_REACTOR_H */ ace-8.0.4+dfsg.orig/ace/Token.h0000644000175000017500000002575315027201773015164 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Token.h * * @author Original author * @author Karl-Heinz Dorn (kdorn@erlh.siemens.de) * @author Ported to ACE by * @author Douglas C. Schmidt (d.schmidt@vanderbilt.edu) */ //============================================================================= #ifndef ACE_TOKEN_H #define ACE_TOKEN_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/Null_Mutex.h" #if defined (ACE_HAS_THREADS) #include "ace/Thread_Mutex.h" #if defined (ACE_WIN32) || defined (ACE_HAS_VXTHREADS) // If platforms support semaphores with timed wait, then we use semaphores instead of c.v. # define ACE_TOKEN_USES_SEMAPHORE #endif /* ACE_WIN32 || ACE_HAS_VXTHREADS */ #if defined (ACE_TOKEN_USES_SEMAPHORE) # include "ace/Semaphore.h" #endif /* ACE_TOKEN_USES_SEMAPHORE */ #include "ace/Condition_Thread_Mutex.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Time_Value; /** * @class ACE_Token * * @brief Class that acquires, renews, and releases a synchronization * token that is serviced in strict FIFO/LIFO ordering and that also * supports (1) recursion and (2) readers/writer semantics. * * This class is a more general-purpose synchronization mechanism * than many native OS mutexes. For example, it implements * "recursive mutex" semantics, where a thread that owns the token * can reacquire it without deadlocking. If the same thread calls * multiple times, however, it must call an * equal number of times before the token is actually released. * Threads that are blocked awaiting the token are serviced in * strict FIFO/LIFO order as other threads release the token * (Pthread mutexes don't strictly enforce an acquisition * order). There are two lists within the class. Write * acquires always have higher priority over read acquires. Which * means, if you use both write/read operations, care must be * taken to avoid starvation on the readers. Notice that the * read/write acquire operations do not have the usual semantic of * reader/writer locks. Only one reader can acquire the token at * a time (which is different from the usual reader/writer locks * where several readers can acquire a lock at the same time as * long as there is no writer waiting for the lock). We choose * the names to (1) borrow the semantic to give writers higher * priority and (2) support a common interface for all locking * classes in ACE. */ class ACE_Export ACE_Token { public: /** * Available queueing strategies. */ enum QUEUEING_STRATEGY { /// FIFO, First In, First Out. FIFO = -1, /// LIFO, Last In, First Out LIFO = 0 }; /// Constructor ACE_Token (const ACE_TCHAR *name = 0, void * = 0); /// Destructor virtual ~ACE_Token (); // = Strategies /// Retrieve the current queueing strategy. int queueing_strategy (); /// Set the queueing strategy. void queueing_strategy (int queueing_strategy); // = Synchronization operations. /** * Acquire the token, sleeping until it is obtained or until the * expiration of @a timeout, which is treated as "absolute" time. If * some other thread currently holds the token then is * called before our thread goes to sleep. This can be * used by the requesting thread to unblock a token-holder that is * sleeping, e.g., by means of writing to a pipe (the ACE * ACE_Reactor uses this functionality). Return values: 0 if * acquires without calling 1 if is * called. 2 if the token is signaled. -1 if failure or timeout * occurs (if timeout occurs errno == ETIME) If @a timeout == * <&ACE_Time_Value::zero> then acquire has polling semantics (and * does *not* call ). */ int acquire (void (*sleep_hook)(void *), void *arg = 0, ACE_Time_Value *timeout = 0); /** * This behaves just like the previous method, except that * it invokes the virtual function called that can be * overridden by a subclass of ACE_Token. */ int acquire (ACE_Time_Value *timeout = 0); /** * This should be overridden by a subclass to define the appropriate * behavior before goes to sleep. By default, this is a * no-op... */ virtual void sleep_hook (); /** * An optimized method that efficiently reacquires the token if no * other threads are waiting. This is useful for situations where * you don't want to degrade the quality of service if there are * other threads waiting to get the token. If == * -1 and there are other threads waiting to obtain the token we are * queued according to the queueing strategy. If * > -1 then it indicates how many entries to skip over before * inserting our thread into the list of waiters (e.g., * == 0 means "insert at front of the queue"). * Renew has the rather odd semantics such that if there are other * waiting threads it will give up the token even if the * nesting_level_ > 1. I'm not sure if this is really the right * thing to do (since it makes it possible for shared data to be * changed unexpectedly) so use with caution... This method * maintians the original token priority. As in , the * @a timeout value is an absolute time. */ int renew (int requeue_position = 0, ACE_Time_Value *timeout = 0); /// Become interface-compliant with other lock mechanisms (implements /// a non-blocking ). int tryacquire (); /// Shuts down the ACE_Token instance. int remove (); /// Relinquish the token. If there are any waiters then the next one /// in line gets it. int release (); /// Behaves like acquire() but at a lower priority. It should probably /// be called acquire_yield() since the semantics aren't really /// what's commonly expected for readers/writer locks. See the class /// documentation above for more details. int acquire_read (); /// Behaves like acquire() but at a lower priority. It should probably /// be called acquire_yield() since the semantics aren't really /// what's commonly expected for readers/writer locks. See the class /// documentation above for more details. int acquire_read (void (*sleep_hook)(void *), void *arg = 0, ACE_Time_Value *timeout = 0); /// Calls acquire(). int acquire_write (); /// Calls acquire(). int acquire_write (void (*sleep_hook)(void *), void *arg = 0, ACE_Time_Value *timeout = 0); /// Lower priority try_acquire(). int tryacquire_read (); /// Just calls . int tryacquire_write (); /// Assumes the caller has acquired the token and returns 0. int tryacquire_write_upgrade (); // = Accessor methods. /// Return the number of threads that are currently waiting to get /// the token. int waiters (); /// Return the id of the current thread that owns the token. ACE_thread_t current_owner (); /// Dump the state of an object. void dump () const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; /// The following structure implements a LIFO/FIFO queue of waiter threads /// that are asleep waiting to obtain the token. struct ACE_Token_Queue_Entry { /// Constructor ACE_Token_Queue_Entry (ACE_Thread_Mutex &m, ACE_thread_t t_id); /// Constructor using a pre-allocated attributes ACE_Token_Queue_Entry (ACE_Thread_Mutex &m, ACE_thread_t t_id, ACE_Condition_Attributes &attributes); /// Entry blocks on the token. int wait (ACE_Time_Value *timeout, ACE_Thread_Mutex &lock); /// Notify (unblock) the entry. int signal (); /// Pointer to next waiter. ACE_Token_Queue_Entry *next_; /// ACE_Thread id of this waiter. ACE_thread_t thread_id_; #if defined (ACE_TOKEN_USES_SEMAPHORE) /// ACE_Semaphore object used to wake up waiter when it can run again. ACE_Semaphore cv_; #else /// ACE_Condition object used to wake up waiter when it can run again. ACE_Condition_Thread_Mutex cv_; #endif /* ACE_TOKEN_USES_SEMAPHORE */ /// Ok to run. int runable_; }; private: enum ACE_Token_Op_Type { READ_TOKEN = 1, WRITE_TOKEN }; struct ACE_Token_Queue { /// Constructor ACE_Token_Queue (); /// Remove a waiter from the queue. void remove_entry (ACE_Token_Queue_Entry *); /// Insert a waiter into the queue. void insert_entry (ACE_Token_Queue_Entry &entry, int requeue_position = -1); /// Head of the list of waiting threads. ACE_Token_Queue_Entry *head_; /// Tail of the list of waiting threads. ACE_Token_Queue_Entry *tail_; }; /// Implements the and methods above. int shared_acquire (void (*sleep_hook_func)(void *), void *arg, ACE_Time_Value *timeout, ACE_Token_Op_Type op_type); /// Wake next in line for ownership. void wakeup_next_waiter (); /// A queue of writer threads. ACE_Token_Queue writers_; /// A queue of reader threads. ACE_Token_Queue readers_; /// ACE_Thread_Mutex used to lock internal data structures. ACE_Thread_Mutex lock_; /// Current owner of the token. ACE_thread_t owner_; /// Some thread (i.e., ) is using the token. We need this /// extra variable to deal with POSIX pthreads madness... int in_use_; /// Number of waiters. int waiters_; /// Current nesting level. int nesting_level_; /// The attributes for the condition variables, optimizes lock time. ACE_Condition_Attributes attributes_; /// Queueing strategy, LIFO/FIFO. int queueing_strategy_; }; ACE_END_VERSIONED_NAMESPACE_DECL #else ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Export ACE_Token { public: int queueing_strategy () { ACE_NOTSUP_RETURN (-1); } void queueing_strategy (int /*queueing_strategy*/) { } int acquire (ACE_Time_Value * = 0) { ACE_NOTSUP_RETURN (-1); } int tryacquire () { ACE_NOTSUP_RETURN (-1); } int remove () { ACE_NOTSUP_RETURN (-1); } int release () { ACE_NOTSUP_RETURN (-1); } }; ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_THREADS */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Export ACE_Noop_Token : public ACE_Null_Mutex { public: /// Queueing strategy enum QUEUEING_STRATEGY { FIFO = -1, LIFO = 0 }; /// Get queueing strategy. int queueing_strategy (); /// Set queueing strategy. void queueing_strategy (int queueing_strategy); int renew (int = 0, ACE_Time_Value * =0); /// Dump the state of an object. void dump () const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; }; ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Token.inl" #endif /* __ACE_INLINE__ */ #include /**/ "ace/post.h" #endif /* ACE_TOKEN_H */ ace-8.0.4+dfsg.orig/ace/Asynch_IO.cpp0000644000175000017500000010767315027201773016255 0ustar sudipsudip#include "ace/Asynch_IO.h" #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) // This only works on platforms with Asynchronous IO #include "ace/Proactor.h" #include "ace/Message_Block.h" #include "ace/INET_Addr.h" #include "ace/Asynch_IO_Impl.h" #include "ace/os_include/os_errno.h" #include "ace/Truncate.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL size_t ACE_Asynch_Result::bytes_transferred () const { return this->implementation ()->bytes_transferred (); } const void * ACE_Asynch_Result::act () const { return this->implementation ()->act (); } int ACE_Asynch_Result::success () const { return this->implementation ()->success (); } const void * ACE_Asynch_Result::completion_key () const { return this->implementation ()->completion_key (); } unsigned long ACE_Asynch_Result::error () const { return this->implementation ()->error (); } ACE_HANDLE ACE_Asynch_Result::event () const { return this->implementation ()->event (); } unsigned long ACE_Asynch_Result::offset () const { return this->implementation ()->offset (); } unsigned long ACE_Asynch_Result::offset_high () const { return this->implementation ()->offset_high (); } int ACE_Asynch_Result::priority () const { return this->implementation ()->priority (); } int ACE_Asynch_Result::signal_number () const { return this->implementation ()->signal_number (); } ACE_Asynch_Result::ACE_Asynch_Result (ACE_Asynch_Result_Impl *implementation) : implementation_ (implementation) { } ACE_Asynch_Result::~ACE_Asynch_Result () { // Proactor deletes the implementation when the finishes. } ACE_Asynch_Result_Impl * ACE_Asynch_Result::implementation () const { return this->implementation_; } // ********************************************************************* int ACE_Asynch_Operation::open (ACE_Handler &handler, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { return this->implementation ()->open (handler.proxy (), handle, completion_key, proactor); } int ACE_Asynch_Operation::cancel () { if (0 == this->implementation ()) { errno = EFAULT; return -1; } return this->implementation ()->cancel (); } ACE_Proactor * ACE_Asynch_Operation::proactor () const { if (0 == this->implementation ()) { errno = EFAULT; return 0; } return this->implementation ()->proactor (); } ACE_Proactor * ACE_Asynch_Operation::get_proactor (ACE_Proactor *user_proactor, ACE_Handler &handler) const { if (user_proactor == 0) { // Grab the singleton proactor if proactor> is zero user_proactor = handler.proactor (); if (user_proactor == 0) user_proactor = ACE_Proactor::instance (); } return user_proactor; } // ************************************************************ ACE_Asynch_Read_Stream::ACE_Asynch_Read_Stream () : implementation_ (0) { } ACE_Asynch_Read_Stream::~ACE_Asynch_Read_Stream () { // Delete the implementation. delete this->implementation_; this->implementation_ = 0; } int ACE_Asynch_Read_Stream::open (ACE_Handler &handler, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { // Get a proactor for/from the user. proactor = this->get_proactor (proactor, handler); // Now let us get the implementation initialized. if ((this->implementation_ = proactor->create_asynch_read_stream ()) == 0) return -1; // Call the method of the base class. return ACE_Asynch_Operation::open (handler, handle, completion_key, proactor); } int ACE_Asynch_Read_Stream::read (ACE_Message_Block &message_block, size_t bytes_to_read, const void *act, int priority, int signal_number) { if (0 == this->implementation_) { errno = EFAULT; return -1; } return this->implementation_->read (message_block, bytes_to_read, act, priority, signal_number); } #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) int ACE_Asynch_Read_Stream::readv (ACE_Message_Block &message_block, size_t bytes_to_read, const void *act, int priority, int signal_number) { if (0 == this->implementation_) { errno = EFAULT; return -1; } return this->implementation_->readv (message_block, bytes_to_read, act, priority, signal_number); } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO */ ACE_Asynch_Operation_Impl * ACE_Asynch_Read_Stream::implementation () const { return this->implementation_; } // ************************************************************ size_t ACE_Asynch_Read_Stream::Result::bytes_to_read () const { return this->implementation ()->bytes_to_read (); } ACE_Message_Block & ACE_Asynch_Read_Stream::Result::message_block () const { return this->implementation ()->message_block (); } ACE_HANDLE ACE_Asynch_Read_Stream::Result::handle () const { return this->implementation ()->handle (); } ACE_Asynch_Read_Stream::Result::Result (ACE_Asynch_Read_Stream_Result_Impl *implementation) : ACE_Asynch_Result (implementation), implementation_ (implementation) { } ACE_Asynch_Read_Stream::Result::~Result () { // Proactor will delete the implementation after is // finished. } ACE_Asynch_Read_Stream_Result_Impl * ACE_Asynch_Read_Stream::Result::implementation () const { return this->implementation_; } // *************************************************** ACE_Asynch_Write_Stream::ACE_Asynch_Write_Stream () : implementation_ (0) { } ACE_Asynch_Write_Stream::~ACE_Asynch_Write_Stream () { // Delete the implementation. delete this->implementation_; this->implementation_ = 0; } int ACE_Asynch_Write_Stream::open (ACE_Handler &handler, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { // Get a proactor for/from the user. proactor = this->get_proactor (proactor, handler); // Now let us get the implementation initialized. if ((this->implementation_ = proactor->create_asynch_write_stream ()) == 0) return -1; // Call the method of the base class. return ACE_Asynch_Operation::open (handler, handle, completion_key, proactor); } int ACE_Asynch_Write_Stream::write (ACE_Message_Block &message_block, size_t bytes_to_write, const void *act, int priority, int signal_number) { if (0 == this->implementation_) { errno = EFAULT; return -1; } return this->implementation_->write (message_block, bytes_to_write, act, priority, signal_number); } #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) int ACE_Asynch_Write_Stream::writev (ACE_Message_Block &message_block, size_t bytes_to_write, const void *act, int priority, int signal_number) { if (0 == this->implementation_) { errno = EFAULT; return -1; } return this->implementation_->writev (message_block, bytes_to_write, act, priority, signal_number); } #endif /* ACE_HAS_WIN32_OVERLAPPED_IO */ ACE_Asynch_Operation_Impl * ACE_Asynch_Write_Stream::implementation () const { return this->implementation_; } // ************************************************************ size_t ACE_Asynch_Write_Stream::Result::bytes_to_write () const { return this->implementation ()->bytes_to_write (); } ACE_Message_Block & ACE_Asynch_Write_Stream::Result::message_block () const { return this->implementation ()->message_block (); } ACE_HANDLE ACE_Asynch_Write_Stream::Result::handle () const { return this->implementation ()->handle (); } ACE_Asynch_Write_Stream::Result::Result (ACE_Asynch_Write_Stream_Result_Impl *implementation) : ACE_Asynch_Result (implementation), implementation_ (implementation) { } ACE_Asynch_Write_Stream::Result::~Result () { // Proactor will delte the implementation when the call // finishes. } ACE_Asynch_Write_Stream_Result_Impl * ACE_Asynch_Write_Stream::Result::implementation () const { return this->implementation_; } // ************************************************************ ACE_Asynch_Read_File::ACE_Asynch_Read_File () : implementation_ (0) { } ACE_Asynch_Read_File::~ACE_Asynch_Read_File () { // Delete the implementation. delete this->implementation_; this->implementation_ = 0; } int ACE_Asynch_Read_File::open (ACE_Handler &handler, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { // Get a proactor for/from the user. proactor = this->get_proactor (proactor, handler); // Now let us get the implementation initialized. if ((this->implementation_ = proactor->create_asynch_read_file ()) == 0) return -1; // Call the method of the base class. return ACE_Asynch_Operation::open (handler, handle, completion_key, proactor); } int ACE_Asynch_Read_File::read (ACE_Message_Block &message_block, size_t bytes_to_read, unsigned long offset, unsigned long offset_high, const void *act, int priority, int signal_number) { if (0 == this->implementation_) { errno = EFAULT; return -1; } return this->implementation_->read (message_block, bytes_to_read, offset, offset_high, act, priority, signal_number); } #if defined (ACE_WIN32) int ACE_Asynch_Read_File::readv (ACE_Message_Block &message_block, size_t bytes_to_read, unsigned long offset, unsigned long offset_high, const void *act, int priority, int signal_number) { if (0 == this->implementation_) { errno = EFAULT; return -1; } return this->implementation_->readv (message_block, bytes_to_read, offset, offset_high, act, priority, signal_number); } #endif /* defined (ACE_WIN32) */ ACE_Asynch_Operation_Impl * ACE_Asynch_Read_File::implementation () const { return this->implementation_; } // ************************************************************ ACE_Asynch_Read_File::Result::Result (ACE_Asynch_Read_File_Result_Impl *implementation) : ACE_Asynch_Read_Stream::Result (implementation), implementation_ (implementation) { } ACE_Asynch_Read_File::Result::~Result () { // Proactor will delete the implementation when call // completes. } ACE_Asynch_Read_File_Result_Impl * ACE_Asynch_Read_File::Result::implementation () const { return this->implementation_; } // ************************************************************ ACE_Asynch_Write_File::ACE_Asynch_Write_File () : implementation_ (0) { } ACE_Asynch_Write_File::~ACE_Asynch_Write_File () { // Delete the implementation. delete this->implementation_; this->implementation_ = 0; } int ACE_Asynch_Write_File::open (ACE_Handler &handler, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { // Get a proactor for/from the user. proactor = this->get_proactor (proactor, handler); // Now let us get the implementation initialized. if ((this->implementation_ = proactor->create_asynch_write_file ()) == 0) return -1; // Call the method of the base class. return ACE_Asynch_Operation::open (handler, handle, completion_key, proactor); } int ACE_Asynch_Write_File::write (ACE_Message_Block &message_block, size_t bytes_to_write, unsigned long offset, unsigned long offset_high, const void *act, int priority, int signal_number) { if (0 == this->implementation_) { errno = EFAULT; return -1; } return this->implementation_->write (message_block, bytes_to_write, offset, offset_high, act, priority, signal_number); } #if defined (ACE_WIN32) int ACE_Asynch_Write_File::writev (ACE_Message_Block &message_block, size_t bytes_to_write, unsigned long offset, unsigned long offset_high, const void *act, int priority, int signal_number) { if (0 == this->implementation_) { errno = EFAULT; return -1; } return this->implementation_->writev (message_block, bytes_to_write, offset, offset_high, act, priority, signal_number); } #endif /* defined (ACE_WIN32) */ ACE_Asynch_Operation_Impl * ACE_Asynch_Write_File::implementation () const { return this->implementation_; } // ************************************************************ ACE_Asynch_Write_File::Result::Result (ACE_Asynch_Write_File_Result_Impl *implementation) : ACE_Asynch_Write_Stream::Result (implementation), implementation_ (implementation) { } ACE_Asynch_Write_File::Result::~Result () { // Proactor will delete the implementation when the call // completes. } ACE_Asynch_Write_File_Result_Impl * ACE_Asynch_Write_File::Result::implementation () const { return this->implementation_; } // ********************************************************************* ACE_Asynch_Accept::ACE_Asynch_Accept () : implementation_ (0) { } ACE_Asynch_Accept::~ACE_Asynch_Accept () { // Delete the implementation. delete this->implementation_; this->implementation_ = 0; } int ACE_Asynch_Accept::open (ACE_Handler &handler, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { // Get a proactor for/from the user. proactor = this->get_proactor (proactor, handler); // Now let us get the implementation initialized. if ((this->implementation_ = proactor->create_asynch_accept ()) == 0) return -1; // Call the method of the base class. return ACE_Asynch_Operation::open (handler, handle, completion_key, proactor); } int ACE_Asynch_Accept::accept (ACE_Message_Block &message_block, size_t bytes_to_read, ACE_HANDLE accept_handle, const void *act, int priority, int signal_number, int addr_family) { if (0 == this->implementation_) { errno = EFAULT; return -1; } return this->implementation_->accept (message_block, bytes_to_read, accept_handle, act, priority, signal_number, addr_family); } ACE_Asynch_Operation_Impl * ACE_Asynch_Accept::implementation () const { return this->implementation_; } // ************************************************************ size_t ACE_Asynch_Accept::Result::bytes_to_read () const { return this->implementation ()->bytes_to_read (); } ACE_Message_Block & ACE_Asynch_Accept::Result::message_block () const { return this->implementation ()->message_block (); } ACE_HANDLE ACE_Asynch_Accept::Result::listen_handle () const { return this->implementation ()->listen_handle (); } ACE_HANDLE ACE_Asynch_Accept::Result::accept_handle () const { return this->implementation ()->accept_handle (); } ACE_Asynch_Accept::Result::Result (ACE_Asynch_Accept_Result_Impl *implementation) : ACE_Asynch_Result (implementation), implementation_ (implementation) { } ACE_Asynch_Accept::Result::~Result () { // Proactor will delete the implementation when the call // completes. } ACE_Asynch_Accept_Result_Impl * ACE_Asynch_Accept::Result::implementation () const { return this->implementation_; } // ********************************************************************* ACE_Asynch_Connect::ACE_Asynch_Connect () : implementation_ (0) { } ACE_Asynch_Connect::~ACE_Asynch_Connect () { // Delete the implementation. delete this->implementation_; this->implementation_ = 0; } int ACE_Asynch_Connect::open (ACE_Handler &handler, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { // Get a proactor for/from the user. proactor = this->get_proactor (proactor, handler); // Now let us get the implementation initialized. if ((this->implementation_ = proactor->create_asynch_connect ()) == 0) return -1; // Call the method of the base class. return ACE_Asynch_Operation::open (handler, handle, completion_key, proactor); } int ACE_Asynch_Connect::connect (ACE_HANDLE connect_handle, const ACE_Addr & remote_sap, const ACE_Addr & local_sap, int reuse_addr, const void *act, int priority, int signal_number) { if (0 == this->implementation_) { errno = EFAULT; return -1; } return this->implementation_->connect (connect_handle, remote_sap, local_sap, reuse_addr, act, priority, signal_number); } ACE_Asynch_Operation_Impl * ACE_Asynch_Connect::implementation () const { return this->implementation_; } // ************************************************************ ACE_Asynch_Connect::Result::Result (ACE_Asynch_Connect_Result_Impl *implementation) : ACE_Asynch_Result (implementation), implementation_ (implementation) { } ACE_Asynch_Connect::Result::~Result () { // Proactor will delete the implementation when the call // completes. } ACE_HANDLE ACE_Asynch_Connect::Result::connect_handle () const { return this->implementation ()->connect_handle (); } ACE_Asynch_Connect_Result_Impl * ACE_Asynch_Connect::Result::implementation () const { return this->implementation_; } // ************************************************************ ACE_Asynch_Transmit_File::ACE_Asynch_Transmit_File () : implementation_ (0) { } ACE_Asynch_Transmit_File::~ACE_Asynch_Transmit_File () { // Delete the implementation. delete this->implementation_; this->implementation_ = 0; } int ACE_Asynch_Transmit_File::open (ACE_Handler &handler, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { // Get a proactor for/from the user. proactor = this->get_proactor (proactor, handler); // Now let us get the implementation initialized. if ((this->implementation_ = proactor->create_asynch_transmit_file ()) == 0) return -1; // Call the method of the base class. return ACE_Asynch_Operation::open (handler, handle, completion_key, proactor); } int ACE_Asynch_Transmit_File::transmit_file (ACE_HANDLE file, Header_And_Trailer *header_and_trailer, size_t bytes_to_write, unsigned long offset, unsigned long offset_high, size_t bytes_per_send, unsigned long flags, const void *act, int priority, int signal_number) { if (0 == this->implementation_) { errno = EFAULT; return -1; } return this->implementation_->transmit_file (file, header_and_trailer, bytes_to_write, offset, offset_high, bytes_per_send, flags, act, priority, signal_number); } ACE_Asynch_Operation_Impl * ACE_Asynch_Transmit_File::implementation () const { return this->implementation_; } // **************************************************************************** ACE_HANDLE ACE_Asynch_Transmit_File::Result::socket () const { return this->implementation ()->socket (); } ACE_HANDLE ACE_Asynch_Transmit_File::Result::file () const { return this->implementation ()->file (); } ACE_Asynch_Transmit_File::Header_And_Trailer * ACE_Asynch_Transmit_File::Result::header_and_trailer () const { return this->implementation ()->header_and_trailer (); } size_t ACE_Asynch_Transmit_File::Result::bytes_to_write () const { return this->implementation ()->bytes_to_write (); } size_t ACE_Asynch_Transmit_File::Result::bytes_per_send () const { return this->implementation ()->bytes_per_send (); } unsigned long ACE_Asynch_Transmit_File::Result::flags () const { return this->implementation ()->flags (); } ACE_Asynch_Transmit_File::Result::Result (ACE_Asynch_Transmit_File_Result_Impl *implementation) : ACE_Asynch_Result (implementation), implementation_ (implementation) { } ACE_Asynch_Transmit_File::Result::~Result () { } ACE_Asynch_Transmit_File_Result_Impl * ACE_Asynch_Transmit_File::Result::implementation () const { return this->implementation_; } // ************************************************************ ACE_Asynch_Transmit_File::Header_And_Trailer::Header_And_Trailer (ACE_Message_Block *header, size_t header_bytes, ACE_Message_Block *trailer, size_t trailer_bytes) : header_ (header), header_bytes_ (header_bytes), trailer_ (trailer), trailer_bytes_ (trailer_bytes) { } ACE_Asynch_Transmit_File::Header_And_Trailer::~Header_And_Trailer () { } void ACE_Asynch_Transmit_File::Header_And_Trailer::header_and_trailer (ACE_Message_Block *header, size_t header_bytes, ACE_Message_Block *trailer, size_t trailer_bytes) { this->header (header); this->header_bytes (header_bytes); this->trailer (trailer); this->trailer_bytes (trailer_bytes); } ACE_Message_Block * ACE_Asynch_Transmit_File::Header_And_Trailer::header () const { return this->header_; } void ACE_Asynch_Transmit_File::Header_And_Trailer::header (ACE_Message_Block *message_block) { this->header_ = message_block; } size_t ACE_Asynch_Transmit_File::Header_And_Trailer::header_bytes () const { return this->header_bytes_; } void ACE_Asynch_Transmit_File::Header_And_Trailer::header_bytes (size_t bytes) { this->header_bytes_ = bytes; } ACE_Message_Block * ACE_Asynch_Transmit_File::Header_And_Trailer::trailer () const { return this->trailer_; } void ACE_Asynch_Transmit_File::Header_And_Trailer::trailer (ACE_Message_Block *message_block) { this->trailer_ = message_block; } size_t ACE_Asynch_Transmit_File::Header_And_Trailer::trailer_bytes () const { return this->trailer_bytes_; } void ACE_Asynch_Transmit_File::Header_And_Trailer::trailer_bytes (size_t bytes) { this->trailer_bytes_ = bytes; } ACE_LPTRANSMIT_FILE_BUFFERS ACE_Asynch_Transmit_File::Header_And_Trailer::transmit_buffers () { // If both are zero, return zero if (this->header_ == 0 && this->trailer_ == 0) { return 0; } else { // Something is valid // If header is valid, set the fields if (this->header_ != 0) { this->transmit_buffers_.Head = this->header_->rd_ptr (); #if defined (ACE_WIN64) || defined (ACE_WIN32) this->transmit_buffers_.HeadLength = ACE_Utils::truncate_cast (this->header_bytes_); #else this->transmit_buffers_.HeadLength = this->header_bytes_; #endif /* ACE_WIN64 || ACE_WIN32 */ } else { this->transmit_buffers_.Head = 0; this->transmit_buffers_.HeadLength = 0; } // If trailer is valid, set the fields if (this->trailer_ != 0) { this->transmit_buffers_.Tail = this->trailer_->rd_ptr (); #if defined(ACE_WIN64) || defined (ACE_WIN32) this->transmit_buffers_.TailLength = ACE_Utils::truncate_cast (this->trailer_bytes_); #else this->transmit_buffers_.TailLength = this->trailer_bytes_; #endif /* ACE_WIN64 || ACE_WIN32 */ } else { this->transmit_buffers_.Tail = 0; this->transmit_buffers_.TailLength = 0; } // Return the transmit buffers return &this->transmit_buffers_; } } // ********************************************************************* ACE_Handler::ACE_Handler () : proactor_ (0), handle_ (ACE_INVALID_HANDLE) { ACE_Handler::Proxy *p; ACE_NEW (p, ACE_Handler::Proxy (this)); this->proxy_.reset (p); } ACE_Handler::ACE_Handler (ACE_Proactor *d) : proactor_ (d), handle_ (ACE_INVALID_HANDLE) { ACE_Handler::Proxy *p; ACE_NEW (p, ACE_Handler::Proxy (this)); this->proxy_.reset (p); } ACE_Handler::~ACE_Handler () { ACE_Handler::Proxy *p = this->proxy_.get (); if (p) p->reset (); } void ACE_Handler::handle_read_stream (const ACE_Asynch_Read_Stream::Result & /* result */) { } void ACE_Handler::handle_write_stream (const ACE_Asynch_Write_Stream::Result & /* result */) { } void ACE_Handler::handle_write_dgram (const ACE_Asynch_Write_Dgram::Result & /* result */) { } void ACE_Handler::handle_read_dgram (const ACE_Asynch_Read_Dgram::Result & /* result */) { } void ACE_Handler::handle_accept (const ACE_Asynch_Accept::Result & /* result */) { } void ACE_Handler::handle_connect (const ACE_Asynch_Connect::Result & /* result */) { } void ACE_Handler::handle_transmit_file (const ACE_Asynch_Transmit_File::Result & /* result */) { } void ACE_Handler::handle_read_file (const ACE_Asynch_Read_File::Result & /* result */) { } void ACE_Handler::handle_write_file (const ACE_Asynch_Write_File::Result & /* result */) { } void ACE_Handler::handle_time_out (const ACE_Time_Value & /* tv */, const void * /* act */) { } void ACE_Handler::handle_wakeup () { } ACE_Proactor * ACE_Handler::proactor () { return this->proactor_; } void ACE_Handler::proactor (ACE_Proactor *p) { this->proactor_ = p; } ACE_HANDLE ACE_Handler::handle () const { return this->handle_; } void ACE_Handler::handle (ACE_HANDLE h) { this->handle_ = h; } ACE_Refcounted_Auto_Ptr & ACE_Handler::proxy () { return this->proxy_; } // ************************************************************ ACE_Service_Handler::ACE_Service_Handler () { } ACE_Service_Handler::~ACE_Service_Handler () { } void ACE_Service_Handler::addresses (const ACE_INET_Addr & /* remote_address */, const ACE_INET_Addr & /* local_address */ ) { } void ACE_Service_Handler::act (const void *) { } void ACE_Service_Handler::open (ACE_HANDLE, ACE_Message_Block &) { } // ************************************************************ ACE_Asynch_Read_Dgram::ACE_Asynch_Read_Dgram () : implementation_ (0) { } ACE_Asynch_Read_Dgram::~ACE_Asynch_Read_Dgram () { // Delete the implementation. delete this->implementation_; this->implementation_ = 0; } int ACE_Asynch_Read_Dgram::open (ACE_Handler &handler, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { // Get a proactor for/from the user. proactor = this->get_proactor (proactor, handler); // Now let us get the implementation initialized. if ((this->implementation_ = proactor->create_asynch_read_dgram ()) == 0) return -1; // Call the method of the base class. return ACE_Asynch_Operation::open (handler, handle, completion_key, proactor); } ssize_t ACE_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block, size_t &number_of_bytes_recvd, int flags, int protocol_family, const void *act, int priority, int signal_number) { if (0 == this->implementation_) { errno = EFAULT; return -1; } return this->implementation_->recv (message_block, number_of_bytes_recvd, flags, protocol_family, act, priority, signal_number); } ACE_Asynch_Operation_Impl * ACE_Asynch_Read_Dgram::implementation () const { return this->implementation_; } // ************************************************************ int ACE_Asynch_Read_Dgram::Result::remote_address (ACE_Addr& addr) const { return this->implementation ()->remote_address (addr); } ACE_Message_Block* ACE_Asynch_Read_Dgram::Result::message_block () const { return this->implementation ()->message_block (); } int ACE_Asynch_Read_Dgram::Result::flags () const { return this->implementation ()->flags (); } size_t ACE_Asynch_Read_Dgram::Result::bytes_to_read () const { return this->implementation ()->bytes_to_read (); } ACE_HANDLE ACE_Asynch_Read_Dgram::Result::handle () const { return this->implementation ()->handle(); } ACE_Asynch_Read_Dgram::Result::Result (ACE_Asynch_Read_Dgram_Result_Impl *implementation) : ACE_Asynch_Result (implementation), implementation_ (implementation) { } ACE_Asynch_Read_Dgram::Result::~Result () { } ACE_Asynch_Read_Dgram_Result_Impl * ACE_Asynch_Read_Dgram::Result::implementation () const { return this->implementation_; } // ************************************************************ ACE_Asynch_Write_Dgram::ACE_Asynch_Write_Dgram () : implementation_ (0) { } ACE_Asynch_Write_Dgram::~ACE_Asynch_Write_Dgram () { // Delete the implementation. delete this->implementation_; this->implementation_ = 0; } int ACE_Asynch_Write_Dgram::open (ACE_Handler &handler, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) { // Get a proactor for/from the user. proactor = this->get_proactor (proactor, handler); // Now let us get the implementation initialized. if ((this->implementation_ = proactor->create_asynch_write_dgram ()) == 0) return -1; // Call the method of the base class. return ACE_Asynch_Operation::open (handler, handle, completion_key, proactor); } ssize_t ACE_Asynch_Write_Dgram::send (ACE_Message_Block *message_block, size_t &number_of_bytes_sent, int flags, const ACE_Addr& remote_addr, const void *act, int priority, int signal_number) { if (0 == this->implementation_) { errno = EFAULT; return -1; } return this->implementation_->send (message_block, number_of_bytes_sent, flags, remote_addr, act, priority, signal_number); } ACE_Asynch_Operation_Impl * ACE_Asynch_Write_Dgram::implementation () const { return this->implementation_; } // ************************************************************ size_t ACE_Asynch_Write_Dgram::Result::bytes_to_write () const { return this->implementation ()->bytes_to_write (); } ACE_Message_Block* ACE_Asynch_Write_Dgram::Result::message_block () const { return this->implementation ()->message_block (); } int ACE_Asynch_Write_Dgram::Result::flags () const { return this->implementation ()->flags (); } ACE_HANDLE ACE_Asynch_Write_Dgram::Result::handle () const { return this->implementation ()->handle (); } ACE_Asynch_Write_Dgram_Result_Impl * ACE_Asynch_Write_Dgram::Result::implementation () const { return this->implementation_; } ACE_Asynch_Write_Dgram::Result::Result (ACE_Asynch_Write_Dgram_Result_Impl *implementation) : ACE_Asynch_Result (implementation), implementation_ (implementation) { } ACE_Asynch_Write_Dgram::Result::~Result () { } ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ ace-8.0.4+dfsg.orig/ace/Intrusive_List_Node.cpp0000644000175000017500000000052115027201773020351 0ustar sudipsudip#ifndef ACE_INTRUSIVE_LIST_NODE_CPP #define ACE_INTRUSIVE_LIST_NODE_CPP #include "ace/Intrusive_List_Node.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #if !defined (__ACE_INLINE__) #include "ace/Intrusive_List_Node.inl" #endif /* __ACE_INLINE__ */ #endif /* ACE_INTRUSIVE_LIST_NODE_CPP */ ace-8.0.4+dfsg.orig/ace/SOCK_Dgram_Mcast.inl0000644000175000017500000000310315027201773017420 0ustar sudipsudip// -*- C++ -*- ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_SOCK_Dgram_Mcast::set_option (int option, char optval) { ACE_TRACE ("ACE_SOCK_Dgram_Mcast::set_option"); if (this->get_handle () == ACE_INVALID_HANDLE) return -1; int level = IPPROTO_IP; #if defined (IPPROTO_IPV6) && !defined (ACE_INTEGRITY) if (this->send_addr_.get_type () == PF_INET6) level = IPPROTO_IPV6; #endif /* IPPROTO_IPV6 */ return this->ACE_SOCK::set_option (level, option, &optval, sizeof (optval)); } ACE_INLINE ssize_t ACE_SOCK_Dgram_Mcast::send (const void *buf, size_t n, int flags) const { ACE_TRACE ("ACE_SOCK_Dgram_Mcast::send"); return this->ACE_SOCK_Dgram::send (buf, n, this->send_addr_, flags); } ACE_INLINE ssize_t ACE_SOCK_Dgram_Mcast::send (const iovec iov[], int n, int flags) const { ACE_TRACE ("ACE_SOCK_Dgram_Mcast::send"); return this->ACE_SOCK_Dgram::send (iov, n, this->send_addr_, 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 ace-8.0.4+dfsg.orig/ace/Recursive_Thread_Mutex.h0000644000175000017500000001360515027201773020515 0ustar sudipsudip// -*- C++ -*- //========================================================================== /** * @file Recursive_Thread_Mutex.h * * @author Douglas C. Schmidt and * Abdullah Sowayan */ //========================================================================== #ifndef ACE_RECURSIVE_THREAD_MUTEX_H #define ACE_RECURSIVE_THREAD_MUTEX_H #include /**/ "ace/pre.h" #include /**/ "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #if !defined (ACE_HAS_THREADS) # include "ace/Null_Mutex.h" #else /* ACE_HAS_THREADS */ // ACE platform supports some form of threading. #include "ace/OS_NS_Thread.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_Recursive_Thread_Mutex * * @brief Implement a C++ wrapper that allows nested acquisition and * release of a mutex that occurs in the same thread. */ class ACE_Export ACE_Recursive_Thread_Mutex { public: /// Initialize a recursive mutex. ACE_Recursive_Thread_Mutex (const ACE_TCHAR *name = 0, ACE_mutexattr_t *arg = 0); /// Implicitly release a recursive mutex. ~ACE_Recursive_Thread_Mutex (); /** * Implicitly release a recursive mutex. Note that only one thread * should call this method since it doesn't protect against race * conditions. */ int remove (); /** * Acquire a recursive mutex (will increment the nesting level and * not deadmutex if the owner of the mutex calls this method more * than once). */ int acquire (); /** * 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 @a tv is assumed to be in "absolute" rather than "relative" * time. The value of @a tv is updated upon return to show the * actual (absolute) acquisition time. */ int acquire (ACE_Time_Value &tv); /** * 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. * The value of <*tv> is updated upon return to show the actual * (absolute) acquisition time. */ int acquire (ACE_Time_Value *tv); /** * Conditionally acquire a recursive mutex (i.e., won't block). * Returns -1 on failure. If we "failed" because someone else * already had the lock, @c errno is set to @c EBUSY. */ int tryacquire (); /** * 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 (); /** * 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_write (); /** * Conditionally acquire mutex (i.e., won't block). This calls * 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 * @c EBUSY. */ int tryacquire_read (); /** * Conditionally acquire mutex (i.e., won't block). This calls * 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 * @c EBUSY. */ int tryacquire_write (); /** * This is only here to make the ACE_Recursive_Thread_Mutex * interface consistent with the other synchronization APIs. * Assumes the caller has already acquired the mutex using one of * the above calls, and returns 0 (success) always. */ int tryacquire_write_upgrade (); /** * Releases a recursive mutex (will not release mutex until all the * nesting level drops to 0, which means the mutex is no longer * held). */ int release (); /// Return the id of the thread that currently owns the mutex. ACE_thread_t get_thread_id (); /** * Return the nesting level of the recursion. When a thread has * acquired the mutex for the first time, the nesting level == 1. * The nesting level is incremented every time the thread acquires * the mutex recursively. Note that if the ACE_HAS_RECURSIVE_MUTEXES * macro is enabled then this method may return -1 on platforms that * do not expose the internal count. */ int get_nesting_level (); /// Returns a reference to the recursive mutex; ACE_recursive_thread_mutex_t &lock (); /// Returns a reference to the recursive mutex's internal mutex; ACE_thread_mutex_t &get_nesting_mutex (); /// Dump the state of an object. void dump () const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; protected: // = This method should *not* be public (they hold no locks...) void set_thread_id (ACE_thread_t t); /// 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 /// 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... bool removed_; private: void operator= (const ACE_Recursive_Thread_Mutex &) = delete; ACE_Recursive_Thread_Mutex (const ACE_Recursive_Thread_Mutex &) = delete; }; ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Recursive_Thread_Mutex.inl" #endif /* __ACE_INLINE__ */ #endif /* !ACE_HAS_THREADS */ #include /**/ "ace/post.h" #endif /* ACE_RECURSIVE_THREAD_MUTEX_H */ ace-8.0.4+dfsg.orig/ace/Functor.h0000644000175000017500000002610715027201773015516 0ustar sudipsudip// -*- C++ -*- //========================================================================== /** * @file Functor.h * * Non-templatized classes and class template specializations for * implementing function objects that are used in various places * in ACE. There are currently two major categories of function * objects in ACE: GoF Command Pattern objects, and STL-style * functors for comparison of container elements. The command objects * are invoked via an execute () method, while the STL-style functors are * invoked via an operator() () method. * Non-templatized classes for implementing the GoF Command Pattern, * also known as functors or function objects. * * @author Chris Gill * @author Based on Command Pattern implementations originally done by * @author Carlos O'Ryan * @author Douglas C. Schmidt * @author Sergio Flores-Gaitan * @author and on STL-style functor implementations originally done by * @author Irfan Pyarali */ //========================================================================== #ifndef ACE_FUNCTOR_H #define ACE_FUNCTOR_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/ACE_export.h" #include "ace/Basic_Types.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL ////////////////////////////////////////////////////////////// // GOF Command Pattern Classes and Template Specializations // ////////////////////////////////////////////////////////////// /** * @class ACE_Command_Base * * @brief Defines an abstract class that allows us to invoke commands * without knowing anything about the implementation. * * This class declares an interface to execute a command * independent of the effect of the command, or the objects used * to implement it. */ class ACE_Export ACE_Command_Base { public: /// Default constructor. ACE_Command_Base (); /// Virtual destructor. virtual ~ACE_Command_Base () = default; /** * Invokes the method encapsulated by the command, passing along the * passed argument (if any). Users of classes derived from this * class must ensure that the resulting invocation can tolerate a * null void pointer being passed, or otherwise ensure that this * will never occur. */ 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() = default; /// Implement the empty execute() member function virtual int execute(void*); }; //////////////////////////////////////////////////////////// // STL-style Functor Classes and Template Specializations // //////////////////////////////////////////////////////////// // Forward declaration since we are going to specialize that template // here. The template itself requires this file so every user of the // template should also see the specialization. template class ACE_Hash; template class ACE_Equal_To; template class ACE_Less_Than; /** * @brief Function object for hashing a char */ template<> class ACE_Export ACE_Hash { public: /// Simply returns t unsigned long operator () (char t) const; }; /** * @brief Function object for hashing a signed char */ template<> class ACE_Export ACE_Hash { public: /// Simply returns t unsigned long operator () (signed char t) const; }; /** * @brief Function object for hashing an unsigned char */ template<> class ACE_Export ACE_Hash { public: /// Simply returns t unsigned long operator () (unsigned char t) const; }; /** * @brief Function object for hashing a short number */ template<> class ACE_Export ACE_Hash { public: /// Simply returns t unsigned long operator () (short t) const; }; /** * @brief Function object for hashing an unsigned short number */ template<> class ACE_Export ACE_Hash { public: /// Simply returns t unsigned long operator () (unsigned short t) const; }; /** * @brief Function object for hashing an int number */ template<> class ACE_Export ACE_Hash { public: /// Simply returns t unsigned long operator () (int t) const; }; /** * @brief Function object for hashing an unsigned int number */ template<> class ACE_Export ACE_Hash { public: /// Simply returns t unsigned long operator () (unsigned int t) const; }; /** * @brief Function object for hashing a long number */ template<> class ACE_Export ACE_Hash { public: /// Simply returns t unsigned long operator () (long t) const; }; /** * @brief Function object for hashing an unsigned long number */ template<> class ACE_Export ACE_Hash { public: /// Simply returns t unsigned long operator () (unsigned long t) const; }; #if (ACE_SIZEOF_LONG == 8) /** * @brief Function object for hashing a long long number */ template<> class ACE_Export ACE_Hash { public: /// Simply returns t unsigned long operator () (long long t) const; }; #endif /* ACE_SIZEOF_LONG == 8 */ #if (ACE_SIZEOF_LONG == 8) /** * @brief Function object for hashing an unsigned long long number */ template<> class ACE_Export ACE_Hash { public: /// Simply returns t unsigned long operator () (unsigned long long t) const; }; #endif /* ACE_SIZEOF_LONG == 8 */ #if (ACE_SIZEOF_LONG < 8) /** * @brief Function object for hashing a signed 64-bit number */ template<> class ACE_Export ACE_Hash { public: /// Simply returns t unsigned long operator () (ACE_INT64 t) const; }; #endif /* ACE_SIZEOF_LONG < 8 */ #if (ACE_SIZEOF_LONG < 8) /** * @brief Function object for hashing an unsigned 64-bit number */ template<> class ACE_Export ACE_Hash { public: /// Simply returns t unsigned long operator () (const ACE_UINT64 &t) const; }; #endif /* ACE_SIZEOF_LONG < 8 */ /** * @brief Function object for hashing a const string */ template<> class ACE_Export ACE_Hash { public: /// Calls ACE::hash_pjw unsigned long operator () (const char *t) const; }; /** * @brief Function object for hashing a string */ template<> class ACE_Export ACE_Hash { public: /// Calls ACE::hash_pjw unsigned long operator () (const char *t) const; }; /** * @brief Function object for hashing a void */ template<> class ACE_Export ACE_Hash { public: unsigned long operator () (const void *) const; }; /** * @brief Function object for determining whether two const strings are equal. */ template<> class ACE_Export ACE_Equal_To { public: /// Simply calls ACE_OS::strcmp int operator () (const char *lhs, const char *rhs) const; }; /** * @brief Function object for determining whether two non-const * strings are equal. */ template<> class ACE_Export ACE_Equal_To { public: /// Simply calls ACE_OS::strcmp int operator () (const char *lhs, const char *rhs) const; }; /** * @brief Function object for determining whether two unsigned * 16 bit ints are equal. */ template<> class ACE_Export ACE_Equal_To { public: /// Simply calls built-in operators int operator () (const ACE_UINT16 lhs, const ACE_UINT16 rhs) const; }; /** * @brief Function object for determining whether two * 16 bit ints are equal. */ template<> class ACE_Export ACE_Equal_To { public: /// Simply calls built-in operators int operator () (const ACE_INT16 lhs, const ACE_INT16 rhs) const; }; /** * @brief Function object for determining whether two unsigned * 32 bit ints are equal. */ template<> class ACE_Export ACE_Equal_To { public: /// Simply calls built-in operators int operator () (const ACE_UINT32 lhs, const ACE_UINT32 rhs) const; }; /** * @brief Function object for determining whether two * 32 bit ints are equal. */ template<> class ACE_Export ACE_Equal_To { public: /// Simply calls built-in operators int operator () (const ACE_INT32 lhs, const ACE_INT32 rhs) const; }; /** * @brief Function object for determining whether two unsigned * 64 bit ints are equal. */ template<> class ACE_Export ACE_Equal_To { public: /// Simply calls built-in operators int operator () (const ACE_UINT64 lhs, const ACE_UINT64 rhs) 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 { public: /// Simply calls ACE_OS::strcmp int operator () (const char *lhs, const char *rhs) const; }; /** * @brief Function object for determining whether the first string * is less than the second string. */ template<> class ACE_Export ACE_Less_Than { public: /// Simply calls ACE_OS::strcmp int operator () (const char *lhs, const char *rhs) const; }; #if defined (ACE_HAS_WCHAR) # if ! defined (ACE_LACKS_NATIVE_WCHAR_T) /** * @brief Function object for hashing a wchar_t */ template<> class ACE_Export ACE_Hash { public: /// Simply returns t unsigned long operator () (wchar_t t) const; }; # endif /* ACE_LACKS_NATIVE_WCHAR_T */ /** * @brief Function object for hashing a const string */ template<> class ACE_Export ACE_Hash { public: /// Calls ACE::hash_pjw unsigned long operator () (const wchar_t *t) const; }; /** * @brief Function object for hashing a string */ template<> class ACE_Export ACE_Hash { public: /// Calls ACE::hash_pjw unsigned long operator () (const wchar_t *t) const; }; /** * @brief Function object for determining whether two const strings are equal. */ template<> class ACE_Export ACE_Equal_To { public: /// Simply calls ACE_OS::strcmp int operator () (const wchar_t *lhs, const wchar_t *rhs) const; }; /** * @brief Function object for determining whether two non-const * strings are equal. */ template<> class ACE_Export ACE_Equal_To { public: /// Simply calls ACE_OS::strcmp int operator () (const wchar_t *lhs, const wchar_t *rhs) 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 { public: /// Simply calls ACE_OS::strcmp int operator () (const wchar_t *lhs, const wchar_t *rhs) const; }; /** * @brief Function object for determining whether the first string * is less than the second string. */ template<> class ACE_Export ACE_Less_Than { public: /// Simply calls ACE_OS::strcmp int operator () (const wchar_t *lhs, const wchar_t *rhs) const; }; #endif // ACE_HAS_WCHAR ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Functor.inl" #endif /* __ACE_INLINE__ */ #include /**/ "ace/post.h" #endif /* ACE_FUNCTOR_H */ ace-8.0.4+dfsg.orig/ace/ACE.pc.in0000644000175000017500000000033015027201773015234 0ustar sudipsudipprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: ACE Description: ADAPTIVE Communication Environment Version: @VERSION@ Libs: -L${libdir} -lACE @LIBS@ Cflags: -I${includedir} ace-8.0.4+dfsg.orig/ace/Task_Ex_T.cpp0000644000175000017500000000754215027201773016254 0ustar sudipsudip#ifndef ACE_TASK_EX_T_CPP #define ACE_TASK_EX_T_CPP #include "ace/Task_Ex_T.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Module.h" #include "ace/Null_Condition.h" #if !defined (__ACE_INLINE__) #include "ace/Task_Ex_T.inl" #endif /* __ACE_INLINE__ */ #if defined (ACE_HAS_ALLOC_HOOKS) # include "ace/Malloc_Base.h" #endif /* ACE_HAS_ALLOC_HOOKS */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE_Tycc (ACE_Task_Ex) template void ACE_Task_Ex::dump () const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_Task_Ex::dump"); ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_mgr_ = %x"), this->thr_mgr_)); this->msg_queue_->dump (); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("delete_msg_queue_ = %d\n"), this->delete_msg_queue_)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nflags = %x"), this->flags_)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nmod_ = %x"), this->mod_)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nnext_ = %x"), this->next_)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\ngrp_id_ = %d"), this->grp_id_)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_count_ = %d"), this->thr_count_)); #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) this->lock_.dump (); #endif /* ACE_MT_SAFE */ ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } // 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_Task_Ex::ACE_Task_Ex (ACE_Thread_Manager *thr_man, ACE_Message_Queue_Ex *mq) : ACE_Task_Base (thr_man), msg_queue_ (0), delete_msg_queue_ (false), mod_ (0), next_ (0) { ACE_TRACE ("ACE_Task_Ex::ACE_Task_Ex"); if (mq == 0) { ACE_NEW (mq, (ACE_Message_Queue_Ex)); this->delete_msg_queue_ = true; } this->msg_queue_ = mq; } template ACE_Task_Ex::~ACE_Task_Ex () { ACE_TRACE ("ACE_Task_Ex::~ACE_Task_Ex"); if (this->delete_msg_queue_) delete this->msg_queue_; // These assignments aren't strickly necessary but they help guard // against odd race conditions... this->delete_msg_queue_ = false; } template ACE_Task * ACE_Task_Ex::sibling () { ACE_TRACE ("ACE_Task_Ex::sibling"); /// @todo FIXME Need to impl ACE_Moudle to support ACE_Task as well. /// Now always return 0 for sibling return 0; /* if (this->mod_ == 0) return 0; else return this->mod_->sibling (this); */ } template const ACE_TCHAR * ACE_Task_Ex::name () const { ACE_TRACE ("ACE_Task_Ex::name"); if (this->mod_ == 0) return 0; else return this->mod_->name (); } template ACE_Module * ACE_Task_Ex::module () const { ACE_TRACE ("ACE_Task_Ex::module"); return this->mod_; } ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_TASK_EX_T_CPP */ ace-8.0.4+dfsg.orig/ace/UPIPE_Stream.h0000644000175000017500000000711115027201773016265 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file UPIPE_Stream.h * * @author Gerhard Lenzer * @author Douglas C. Schmidt */ //============================================================================= #ifndef ACE_UPIPE_STREAM_H #define ACE_UPIPE_STREAM_H #include /**/ "ace/pre.h" #include "ace/Stream.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #if defined (ACE_HAS_THREADS) #include "ace/SPIPE.h" #include "ace/Message_Queue.h" #include "ace/UPIPE_Addr.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_UPIPE_Stream * * @brief Defines the method that transfer data on a UPIPE. */ class ACE_Export ACE_UPIPE_Stream : public ACE_SPIPE { public: friend class ACE_UPIPE_Acceptor; friend class ACE_UPIPE_Connector; typedef ACE_Stream MT_Stream; ACE_UPIPE_Stream (); virtual ~ACE_UPIPE_Stream (); /// Shut down the UPIPE and release resources. int close (); /// Return the underlying I/O handle. ACE_HANDLE get_handle () const; // = Send/recv ACE Message_Blocks. /// Send a message through the message queue. Returns -1 on error, /// else 0. int send (ACE_Message_Block *mb_p, ACE_Time_Value *timeout = 0); /// Recv a message from the message queue. Returns -1 on error, else /// 0. int recv (ACE_Message_Block *&mb_p, ACE_Time_Value *timeout = 0); // = Send/recv char buffers. /// Send a buffer of @a n bytes through the message queue. Returns -1 /// on error, else number of bytes sent. ssize_t send (const char *buffer, size_t n, ACE_Time_Value *timeout = 0); /// Recv a buffer of upto @a n bytes from the message queue. Returns /// -1 on error, else number of bytes read. ssize_t recv (char *buffer, size_t n, ACE_Time_Value *timeout = 0); /// Send a buffer of exactly @a n bytes to the message queue. Returns /// -1 on error, else number of bytes written (which should == n). ssize_t send_n (const char *buffer, size_t n, ACE_Time_Value *timeout = 0); /// Recv a buffer of exactly @a n bytes from the message queue. /// Returns -1 on error, else the number of bytes read. ssize_t recv_n (char *buffer, size_t n, ACE_Time_Value *timeout = 0); /// Perform control operations on the UPIPE_Stream. int control (int cmd, void *val) const; /// Return the remote address we are connected to. int get_remote_addr (ACE_UPIPE_Addr &remote_sap) const; /// Dump the state of an object. void dump () const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; // = Meta-type info typedef ACE_UPIPE_Addr PEER_ADDR; private: /// To hold the last ACE_Message_Block read out of the stream. Thus /// allowing subsequent reads from one ACE_Message_Block ACE_Message_Block *mb_last_; /// Address of who we are connected to. ACE_UPIPE_Addr remote_addr_; /// Stream component used by the @c UPIPE_Acceptor and /// @c UPIPE_Connector to link together two UPIPE_Streams. MT_Stream stream_; /// Keep track of whether the sender and receiver have both shutdown. int reference_count_; #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) /// Ensure that we are thread-safe. ACE_Thread_Mutex lock_; #endif /* ACE_MT_SAFE */ }; ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/UPIPE_Stream.inl" #endif /* __ACE_INLINE__ */ #endif /* ACE_HAS_THREADS */ #include /**/ "ace/post.h" #endif /*ACE_UPIPE_STREAM_H */ ace-8.0.4+dfsg.orig/ace/SOCK_IO.h0000644000175000017500000001001615027201773015214 0ustar sudipsudip// -*- C++ -*- //========================================================================== /** * @file SOCK_IO.h * * @author Douglas C. Schmidt */ //========================================================================== #ifndef ACE_SOCK_IO_H #define ACE_SOCK_IO_H #include /**/ "ace/pre.h" #include "ace/SOCK.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/ACE.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_SOCK_IO * * @brief Defines the methods for the ACE socket wrapper I/O routines * described below. * * If @a timeout == 0, then the call behaves as a normal * send/recv call, i.e., for blocking sockets, the call will * block until action is possible; for non-blocking sockets, * -1 will be returned with errno == EWOULDBLOCK if no action is * immediately possible. * If @a timeout != 0, the call will wait until the relative time * specified in *@a timeout elapses. * Errors are reported by -1 and 0 return values. If the * operation times out, -1 is returned with @c errno == ETIME. * If it succeeds the number of bytes transferred is returned. * Methods with the extra @a flags argument will always result in * @c send getting called. Methods without the extra @a flags * argument will result in @c send getting called on Win32 * platforms, and @c write getting called on non-Win32 platforms. */ class ACE_Export ACE_SOCK_IO : public ACE_SOCK { public: /// Constructor. ACE_SOCK_IO (); /// Destructor. ~ACE_SOCK_IO (); /// Recv an @a n byte buffer from the connected socket. ssize_t recv (void *buf, size_t n, int flags, const ACE_Time_Value *timeout = 0) const; /// Recv an @a n byte buffer from the connected socket. ssize_t recv (void *buf, size_t n, const ACE_Time_Value *timeout = 0) const; /// Recv an of size @a n from the connected socket. ssize_t recvv (iovec iov[], int n, const ACE_Time_Value *timeout = 0) const; /** * Allows a client to read from a socket without having to provide a * buffer to read. This method determines how much data is in the * socket, allocates a buffer of this size, reads in the data, and * returns the number of bytes read. The caller is responsible for * deleting the member in the field of @a io_vec using * delete [] io_vec->iov_base. */ ssize_t recvv (iovec *io_vec, const ACE_Time_Value *timeout = 0) const; #ifndef ACE_LACKS_VA_FUNCTIONS /// Recv @a n varargs messages to the connected socket. ssize_t recv (size_t n, ...) const; #endif /// Recv @a n bytes via Win32 @c ReadFile using overlapped I/O. ssize_t recv (void *buf, size_t n, ACE_OVERLAPPED *overlapped) const; /// Send an @a n byte buffer to the connected socket. ssize_t send (const void *buf, size_t n, int flags, const ACE_Time_Value *timeout = 0) const; /// Send an @a n byte buffer to the connected socket. ssize_t send (const void *buf, size_t n, const ACE_Time_Value *timeout = 0) const; /// Send an @c iovec of size @a n to the connected socket. ssize_t sendv (const iovec iov[], int n, const ACE_Time_Value *timeout = 0) const; #ifndef ACE_LACKS_VA_FUNCTIONS /// Send @a n varargs messages to the connected socket. ssize_t send (size_t n, ...) const; #endif /// Send @a n bytes via Win32 using overlapped I/O. ssize_t send (const void *buf, size_t n, ACE_OVERLAPPED *overlapped) const; /// Dump the state of an object. void dump () const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; }; ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/SOCK_IO.inl" #endif /* __ACE_INLINE__ */ #include /**/ "ace/post.h" #endif /* ACE_SOCK_IO_H */ ace-8.0.4+dfsg.orig/ace/Log_Msg_IPC.h0000644000175000017500000000423615027201773016117 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Log_Msg_IPC.h * * @author Carlos O'Ryan */ //============================================================================= #ifndef ACE_LOG_MSG_LOGGER_H #define ACE_LOG_MSG_LOGGER_H #include /**/ "ace/pre.h" #include "ace/Log_Msg_Backend.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Default_Constants.h" // IPC conduit between sender and client daemon. This should be // included in the ACE_Log_Msg class, but due to "order of include" // problems it can't be... #if (ACE_HAS_STREAM_LOG_MSG_IPC == 1) # include "ace/SPIPE_Connector.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef ACE_SPIPE_Stream ACE_LOG_MSG_IPC_STREAM; typedef ACE_SPIPE_Connector ACE_LOG_MSG_IPC_CONNECTOR; typedef ACE_SPIPE_Addr ACE_LOG_MSG_IPC_ADDR; ACE_END_VERSIONED_NAMESPACE_DECL #else # include "ace/SOCK_Connector.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef ACE_SOCK_Stream ACE_LOG_MSG_IPC_STREAM; typedef ACE_SOCK_Connector ACE_LOG_MSG_IPC_CONNECTOR; typedef ACE_INET_Addr ACE_LOG_MSG_IPC_ADDR; ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_STREAM_PIPES */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL /// Defines the interfaces for ACE_Log_Msg backend. /** * Implement an ACE_Log_Msg_Backend that logs to a remote logging * process. */ class ACE_Export ACE_Log_Msg_IPC : public ACE_Log_Msg_Backend { public: /// Constructor ACE_Log_Msg_IPC () = default; /// Destructor ~ACE_Log_Msg_IPC () override; /// Open a new connection int open (const ACE_TCHAR *logger_key) override; /** * Reset the backend. When changing the logging destination the * backend may need to properly disconnect from the remote logging * daemon and reclaim some local resources. But we try to reduce * the number of local allocations/deallocations. */ int reset () override; int close () override; ssize_t log (ACE_Log_Record &log_record) override; ACE_ALLOC_HOOK_DECLARE; private: ACE_LOG_MSG_IPC_STREAM message_queue_; }; ACE_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" #endif /* ACE_LOG_MSG_H */ ace-8.0.4+dfsg.orig/ace/Event_Handler_Handle_Timeout_Upcall.h0000644000175000017500000000667715027201773023107 0ustar sudipsudip#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 * * Based on classes and files developed by Doug Schmidt, Darrell * Brunsch, Irfan Pyarali and a cast of thousands. */ #include "ace/Timer_Queuefwd.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 on ACE_Event_Handlers. */ class ACE_Export ACE_Event_Handler_Handle_Timeout_Upcall { public: ACE_Event_Handler_Handle_Timeout_Upcall () = default; /// Destructor. ~ACE_Event_Handler_Handle_Timeout_Upcall () = default; /// 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); /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; private: ACE_Event_Handler_Handle_Timeout_Upcall (const ACE_Event_Handler_Handle_Timeout_Upcall &) = delete; ACE_Event_Handler_Handle_Timeout_Upcall (ACE_Event_Handler_Handle_Timeout_Upcall &&) = delete; ACE_Event_Handler_Handle_Timeout_Upcall &operator= (const ACE_Event_Handler_Handle_Timeout_Upcall &) = delete; ACE_Event_Handler_Handle_Timeout_Upcall &operator= (ACE_Event_Handler_Handle_Timeout_Upcall &&) = delete; /// Flag indicating that reference counting is required for this /// event handler upcall. int requires_reference_counting_ {0}; }; 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 */ ace-8.0.4+dfsg.orig/ace/Monotonic_Time_Policy.h0000644000175000017500000000235115027201773020333 0ustar sudipsudip#ifndef ACE_MONOTONIC_TIME_POLICY_H #define ACE_MONOTONIC_TIME_POLICY_H // -*- C++ -*- /** * @file Monotonic_Time_Policy.h * * @author Martin Corino */ #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 ACE_HAS_MONOTONIC_TIME_POLICY * isn't defined and 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 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 */ ace-8.0.4+dfsg.orig/ace/Time_Policy_T.h0000644000175000017500000000332115027201773016567 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Time_Policy_T.h * * @author Martin Corino */ //============================================================================= #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 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 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 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__ */ #include "ace/Time_Policy_T.cpp" #endif /* ACE_TIME_POLICY_T_H */ ace-8.0.4+dfsg.orig/ace/MEM_IO.h0000644000175000017500000002167215027201773015105 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file MEM_IO.h * * @author Nanbor Wang */ //============================================================================= #ifndef ACE_MEM_IO_H #define ACE_MEM_IO_H #include /**/ "ace/pre.h" #include /**/ "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1) #include "ace/SOCK.h" #include "ace/MEM_SAP.h" #include "ace/Message_Block.h" #include "ace/Process_Semaphore.h" #include "ace/Process_Mutex.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Export ACE_Reactive_MEM_IO : public ACE_MEM_SAP { public: ACE_Reactive_MEM_IO (); virtual ~ACE_Reactive_MEM_IO (); /** * Initialize the MEM_SAP object. * * @a options is used to pass in the Malloc_Options to initialize * underlying ACE_MMAP. */ virtual int init (ACE_HANDLE handle, const ACE_TCHAR *name, MALLOC_OPTIONS *options); /** * Fetch location of next available data into . * As this operation read the address of the data off the socket * using ACE::recv, @a timeout only applies to ACE::recv. */ virtual ssize_t recv_buf (ACE_MEM_SAP_Node *&buf, int flags, const ACE_Time_Value *timeout); /** * Wait to to @a timeout amount of time to send @a buf. If * times out a -1 is returned with @c errno == ETIME. If it succeeds * the number of bytes sent is returned. */ virtual ssize_t send_buf (ACE_MEM_SAP_Node *buf, int flags, const ACE_Time_Value *timeout); /** * Convert the buffer offset @a off to absolute address to @a buf. * Return the size of valid information containing in the @a buf, * -1 if is not initialized. */ ssize_t get_buf_len (const ACE_OFF_T off, ACE_MEM_SAP_Node *&buf); }; #if defined (ACE_WIN32) || !defined (_ACE_USE_SV_SEM) class ACE_Export ACE_MT_MEM_IO : public ACE_MEM_SAP { public: /// Structure for a simple queue typedef struct { ACE_MEM_SAP_Node::ACE_MEM_SAP_NODE_PTR head_; ACE_MEM_SAP_Node::ACE_MEM_SAP_NODE_PTR tail_; } MQ_Struct; class Simple_Queue { public: Simple_Queue (); Simple_Queue (MQ_Struct *mq); int init (MQ_Struct *mq, ACE_MEM_SAP::MALLOC_TYPE *malloc); int write (ACE_MEM_SAP_Node *new_msg); ACE_MEM_SAP_Node *read (); private: MQ_Struct *mq_; ACE_MEM_SAP::MALLOC_TYPE *malloc_; }; typedef struct { ACE_SYNCH_PROCESS_SEMAPHORE *sema_; ACE_SYNCH_PROCESS_MUTEX *lock_; Simple_Queue queue_; } Channel; ACE_MT_MEM_IO (); virtual ~ACE_MT_MEM_IO (); /** * Initialize the MEM_SAP object. */ virtual int init (ACE_HANDLE handle, const ACE_TCHAR *name, MALLOC_OPTIONS *options); int fini (); /** * Fetch location of next available data into . * As this operation read the address of the data off the socket * using ACE::recv, @a timeout only applies to ACE::recv. */ virtual ssize_t recv_buf (ACE_MEM_SAP_Node *&buf, int flags, const ACE_Time_Value *timeout); /** * Wait to to @a timeout amount of time to send @a buf. If * times out a -1 is returned with @c errno == ETIME. If it succeeds * the number of bytes sent is returned. */ virtual ssize_t send_buf (ACE_MEM_SAP_Node *buf, int flags, const ACE_Time_Value *timeout); private: Channel recv_channel_; Channel send_channel_; }; #endif /* ACE_WIN32 || !_ACE_USE_SV_SEM */ /** * @class ACE_MEM_IO * * @brief Defines the methods for the ACE shared memory wrapper I/O * routines (e.g., send/recv). * The shared memory transport uses ACE_SOCK_* class to * implement the signaling mechanism so we can easily use the * new mechanism with the Reactor pattern (which uses select * under the hood.) * ACE_MEM_Acceptor and ACE_MEM_Connector are used to establish * connections. When a connection is established, * ACE_MEM_Acceptor creates the MMAP file for data exchange and * sends the location of the file (complete path name) to * ACE_MEM_Connector thru the socket. ACE_MEM_Connector then * reads the location of the file off the socket and opens up * the same MMAP file. ACE_MEM_Stream at each side then * contains a reference to the ACE_Mallo object using the same * MMAP file. * When sending information using methods provided in this * class, ACE_MEM_IO requests a chunk of memory from the * MALLOC_TYPE object, copy the data into the shared memory and * send the memory offset (from the start of the ACE_Malloc) * across the socket. This action also servers as a signal to * the other end. The receiving side then reverses the * procedures and copies the information into user buffer. */ class ACE_Export ACE_MEM_IO : public ACE_SOCK { public: /// Constructor. ACE_MEM_IO (); /// Destructor. ~ACE_MEM_IO (); typedef enum { Reactive, MT } Signal_Strategy; /** * Initialize the MEM_SAP object. */ int init (const ACE_TCHAR *name, ACE_MEM_IO::Signal_Strategy type = ACE_MEM_IO::Reactive, ACE_MEM_SAP::MALLOC_OPTIONS *options = 0); /** * Finalizing the MEM_IO object. This method doesn't invoke * the method. */ int fini (); /// Send an @a n byte buffer to the other process using shm_malloc_ /// connected thru the socket. ssize_t send (const void *buf, size_t n, int flags) ; /// Recv an @a n byte buffer from the shm_malloc_ thru connected socket. ssize_t recv (void *buf, size_t n, int flags) ; /// Send an @a n byte buffer to the other process using shm_malloc_ /// connected thru the socket. ssize_t send (const void *buf, size_t n) ; /// Recv an @a n byte buffer from the shm_malloc_ thru connected socket. ssize_t recv (void *buf, size_t n) ; /** * Wait to to @a timeout amount of time to send up to @a n bytes into * @a buf from (uses the call). If times out * a -1 is returned with @c errno == ETIME. If it succeeds the * number of bytes sent is returned. */ ssize_t send (const void *buf, size_t n, const ACE_Time_Value *timeout); /** * Wait to to @a timeout amount of time to send up to @a n bytes into * @a buf from (uses the call). If times out * a -1 is returned with @c errno == ETIME. If it succeeds the * number of bytes sent is returned. */ ssize_t send (const void *buf, size_t n, int flags, const ACE_Time_Value *timeout); /** * Wait to to @a timeout amount of time to send the @a message_block. * If times out a -1 is returned with @c errno == ETIME. If * it succeeds the number of bytes sent is returned. */ ssize_t send (const ACE_Message_Block *message_block, const ACE_Time_Value *timeout); /** * Wait up to @a timeout amount of time to receive up to @a n bytes * into @a buf from (uses the call). If times * out a -1 is returned with @c errno == ETIME. If it succeeds the * number of bytes received is returned. */ ssize_t recv (void *buf, size_t n, const ACE_Time_Value *timeout); /** * Wait up to @a timeout amount of time to receive up to @a n bytes * into @a buf from (uses the call). If times * out a -1 is returned with @c errno == ETIME. If it succeeds the * number of bytes received is returned. */ ssize_t recv (void *buf, size_t n, int flags, const ACE_Time_Value *timeout); /// Dump the state of an object. void dump () const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; /// Return the local endpoint port number. Returns 0 if successful, /// else -1. /* int get_local_port (u_short &) const; /// Return the port number of the remotely connected peer (if there /// is one). Returns 0 if successful, else -1. int get_remote_port (u_short &) const; */ private: ssize_t fetch_recv_buf (int flag, const ACE_Time_Value *timeout); /// Actual deliverying mechanism. ACE_MEM_SAP *deliver_strategy_; /// Internal pointer for support recv/send. ACE_MEM_SAP_Node *recv_buffer_; /// Record the current total buffer size of . ssize_t buf_size_; /// Record the current read pointer location in . ssize_t cur_offset_; }; ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/MEM_IO.inl" #endif /* __ACE_INLINE__ */ #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */ #include /**/ "ace/post.h" #endif /* ACE_SOCK_IO_H */ ace-8.0.4+dfsg.orig/ace/FIFO_Recv_Msg.cpp0000644000175000017500000000360415027201773016736 0ustar sudipsudip#include "ace/FIFO_Recv_Msg.h" #include "ace/Log_Category.h" #if defined (ACE_HAS_ALLOC_HOOKS) # include "ace/Malloc_Base.h" #endif /* ACE_HAS_ALLOC_HOOKS */ #if !defined (__ACE_INLINE__) #include "ace/FIFO_Recv_Msg.inl" #endif /* __ACE_INLINE__ */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Recv_Msg) void ACE_FIFO_Recv_Msg::dump () const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_FIFO_Recv_Msg::dump"); ACE_FIFO_Recv::dump (); #endif /* ACE_HAS_DUMP */ } // Note that persistent means "open FIFO for writing, as well as // reading." This ensures that the FIFO never gets EOF, even if there // aren't any writers at the moment! int ACE_FIFO_Recv_Msg::open (const ACE_TCHAR *fifo_name, int flags, mode_t perms, int persistent, LPSECURITY_ATTRIBUTES sa) { ACE_TRACE ("ACE_FIFO_Recv_Msg::open"); return ACE_FIFO_Recv::open (fifo_name, flags, perms, persistent, sa); } ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg () { ACE_TRACE ("ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg"); } ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg (const ACE_TCHAR *fifo_name, int flags, mode_t perms, int persistent, LPSECURITY_ATTRIBUTES sa) { ACE_TRACE ("ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg"); if (this->ACE_FIFO_Recv_Msg::open (fifo_name, flags, perms, persistent, sa) == -1) ACELIB_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_FIFO_Recv_Msg"))); } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Timeprobe.inl0000644000175000017500000000042515027201773016352 0ustar sudipsudip// -*- C++ -*- ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE bool ACE_Event_Descriptions::operator== (const ACE_Event_Descriptions &rhs) const { return this->minimum_id_ == rhs.minimum_id_ && this->descriptions_ == rhs.descriptions_; } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Dump.cpp0000644000175000017500000000613415027201773015334 0ustar sudipsudip#include "ace/Dump.h" #include "ace/Guard_T.h" #include "ace/Thread_Mutex.h" #include "ace/Object_Manager.h" #include "ace/Log_Category.h" #if defined (ACE_HAS_ALLOC_HOOKS) # include "ace/Malloc_Base.h" #endif /* ACE_HAS_ALLOC_HOOKS */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Implementations (very simple for now...) ACE_Dumpable::~ACE_Dumpable () { ACE_TRACE ("ACE_Dumpable::~ACE_Dumpable"); } ACE_Dumpable::ACE_Dumpable (const void *this_ptr) : this_ (this_ptr) { ACE_TRACE ("ACE_Dumpable::ACE_Dumpable"); } ACE_Dumpable_Ptr::ACE_Dumpable_Ptr (const ACE_Dumpable *dumper) : dumper_ (dumper) { ACE_TRACE ("ACE_Dumpable_Ptr::ACE_Dumpable_Ptr"); } const ACE_Dumpable * ACE_Dumpable_Ptr::operator->() const { ACE_TRACE ("ACE_Dumpable_Ptr::operator->"); return this->dumper_; } void ACE_Dumpable_Ptr::operator= (const ACE_Dumpable *dumper) const { ACE_TRACE ("ACE_Dumpable_Ptr::operator="); if (this->dumper_ != dumper) { delete const_cast (this->dumper_); (const_cast (this))->dumper_ = dumper; } } ACE_ODB::ACE_ODB () // Let the Tuple default constructor initialize object_table_ : current_size_ (0) { ACE_TRACE ("ACE_ODB::ACE_ODB"); } ACE_ALLOC_HOOK_DEFINE(ACE_ODB) ACE_ODB * ACE_ODB::instance () { ACE_TRACE ("ACE_ODB::instance"); if (ACE_ODB::instance_ == 0) { ACE_MT (ACE_Thread_Mutex *lock = ACE_Managed_Object::get_preallocated_object (ACE_Object_Manager::ACE_DUMP_LOCK); ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, 0)); if (ACE_ODB::instance_ == 0) ACE_NEW_RETURN (ACE_ODB::instance_, ACE_ODB, 0); } return ACE_ODB::instance_; } void ACE_ODB::dump_objects () { ACE_TRACE ("ACE_ODB::dump_objects"); for (int i = 0; i < this->current_size_; i++) { if (this->object_table_[i].this_ != 0) // Dump the state of the object. this->object_table_[i].dumper_->dump (); } } // This method registers a new . It detects // duplicates and simply overwrites them. void ACE_ODB::register_object (const ACE_Dumpable *dumper) { ACE_TRACE ("ACE_ODB::register_object"); int i; int slot = 0; for (i = 0; i < this->current_size_; i++) { if (this->object_table_[i].this_ == 0) slot = i; else if (this->object_table_[i].this_ == dumper->this_) { slot = i; break; } } if (i == this->current_size_) { slot = this->current_size_++; ACE_ASSERT (this->current_size_ < ACE_ODB::MAX_TABLE_SIZE); } this->object_table_[slot].this_ = dumper->this_; this->object_table_[slot].dumper_ = dumper; } void ACE_ODB::remove_object (const void *this_ptr) { ACE_TRACE ("ACE_ODB::remove_object"); int i; for (i = 0; i < this->current_size_; i++) { if (this->object_table_[i].this_ == this_ptr) break; } if (i < this->current_size_) { this->object_table_[i].this_ = 0; this->object_table_[i].dumper_ = 0; } } ACE_ODB *ACE_ODB::instance_ = 0; ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Remote_Tokens.h0000644000175000017500000002311315027201773016646 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Remote_Tokens.h * * @author Douglas C. Schmidt (d.schmidt@vanderbilt.edu) * @author Tim Harrison (harrison@cs.wustl.edu) */ //============================================================================= #ifndef ACE_REMOTE_MUTEX_H #define ACE_REMOTE_MUTEX_H #include /**/ "ace/pre.h" #include "ace/INET_Addr.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/SOCK_Connector.h" #include "ace/SOCK_Stream.h" #include "ace/Synch_Options.h" #include "ace/Local_Tokens.h" #include "ace/Token_Request_Reply.h" #if defined (ACE_HAS_TOKENS_LIBRARY) ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_Remote_Token_Proxy * * @brief Proxy for acquiring, renewing, and releasing a distributed * synchronization token. * * The Remote_Token_Proxy class implements the mechanisms for * distributed token operations. It is similar to the * ACE_Token_Proxy. * @todo * Distributed sleep_hooks have not been implemented. * is not implemented. */ class ACE_Export ACE_Remote_Token_Proxy : public ACE_Token_Proxy { public: /// Null construction. ACE_Remote_Token_Proxy (); /// Death. virtual ~ACE_Remote_Token_Proxy (); /** * Same as Token_Proxy. @a name is the string uniquely identifying * the token. @a ignore_deadlock can be 1 to disable deadlock * notifications. @a debug prints debug messages. */ int open (const ACE_TCHAR *name, int ignore_deadlock = 0, int debug = 0); /** * Open a connection with the token server. This only need be used * when the user wishes to explicitly open a connection to check if * the server exists. Connections are stored in the * ACE_Token_Connections singleton as thread-specific data. That * is, every thread has only one connection that is used for all * remote tokens. */ int initiate_connection (); /** * Acquire the distributed token. If notify is specified and the * token is already held, the owner is notified. options contains * the timeout value for the acquire call. The timer is kept at the * token server. Asynchronous operations are not supported. * Returns 0 on success, -1 on failure with @c errno == problem. */ virtual int acquire (int notify = 0, void (*sleep_hook)(void *) = 0, ACE_Synch_Options &options = ACE_Synch_Options::synch); /** * Try to acquire the distributed token. If the token is already * held, the call returns without queuing the caller as a waiter. * Returns 0 on success (the token was acquired), and -1 with * EWOULDBLOCK if the token was already held. */ virtual int tryacquire (void (*sleep_hook)(void *) = 0); /** * Renew the token by offering to release it if there are any other * waiters, otherwise get the token back immediately. This renew * has the same semantics as ACE_Local_Mutex release. It is * semantically equivalent to release() followed by acquire(), but * it is faster. options contains the timeout value used if renew * blocks. As with acquire, the timer is maintained at the token * server. If there are waiters and requeue_position == -1, the * caller is queued at the rear of the waiter list. Otherwise, * requeue_position specifies the number of waiters to "let by" * before reacquiring the token (effectively, the position in the * waiter list.) */ virtual int renew (int requeue_position = 0, ACE_Synch_Options &options = ACE_Synch_Options::synch); /** * Release the distributed token. Similar to ACE_Local_Mutex, if the * caller is not the owner, it is removed from the waiter list (if * applicable.) Returns 0 on success, -1 on failure with @c errno == * problem. */ virtual int release (ACE_Synch_Options &options = ACE_Synch_Options::synch); /// Become interface compliant for our guards. This has no /// functionality. virtual int remove (ACE_Synch_Options &options = ACE_Synch_Options::synch); /// Override the default to do nothing. virtual void token_acquired (ACE_TPQ_Entry *); /// The client id of the current token holder virtual const ACE_TCHAR* owner_id (); /** * Sets the server address for all instances of ACE_Remote_Token_Proxy * If this isn't called, the environment variable TOKEN_SERVER is * checked for the server address. If that is not specified, all * ACE_Remote_** operations will fail. */ static void set_server_address (const ACE_INET_Addr &server_address); /// Dump the state of the class. void dump () const; protected: /// If shadows report deadlock, go remote anyway int ignore_shadow_deadlock_; /// Perform the request and wait for the reply. int request_reply (ACE_Token_Request &request, ACE_Synch_Options &options); }; /** * @class ACE_Remote_Mutex * * @brief Proxy for acquiring, renewing, and releasing a distributed * mutex. * * This is the remote equivalent to ACE_Local_Mutex. The * Remote_Mutex class offers methods for acquiring, renewing, and * releasing a distributed synchronization mutex. Similar to * ACE_Local_Mutex, ACE_Remote_Token_Proxy offers recursive * acquisition, FIFO waiter ordering, and deadlock detection. It * depends on the Token Server for its distributed synchronization * semantics. */ class ACE_Export ACE_Remote_Mutex : public ACE_Remote_Token_Proxy { public: /// Null creation. Remote_Token_Proxy::open must be called. ACE_Remote_Mutex (); /// Calls Remote_Token_Proxy::open for you. ACE_Remote_Mutex (const ACE_TCHAR *token_name, int ignore_deadlock = 0, int debug = 0); /// Dump the state of the class. void dump () const; /// Return deep copy. virtual ACE_Token_Proxy *clone () const; protected: /// Make the correct type of ACE_Tokens. /// This is called by the ACE_Token_Manager. virtual ACE_Tokens *create_token (const ACE_TCHAR *name); }; /** * @class ACE_Remote_RLock * * @brief Proxy for acquiring, renewing, and releasing a distributed * readers lock. * * This is the remote equivalent to ACE_Local_RLock. Multiple * readers can hold the lock simultaneously when no writers have * the lock. Alternatively, when a writer holds the lock, no other * participants (readers or writers) may hold the lock. * ACE_Remote_RLock depends on the ACE Token Server for its * distributed synchronization semantics. */ class ACE_Export ACE_Remote_RLock : public ACE_Remote_Token_Proxy { public: ACE_Remote_RLock (); ACE_Remote_RLock (const ACE_TCHAR *token_name, int ignore_deadlock = 0, int debug = 0); ACE_Remote_RLock (const ACE_Remote_RLock &mutex); /// Dump the state of the class. void dump () const; /// Returns ACE_RW_Token::RLOCK; virtual int type () const; /// Return deep copy. virtual ACE_Token_Proxy *clone () const; protected: /// Make the correct type of ACE_Tokens. This is called by the Token /// Manager. virtual ACE_Tokens *create_token (const ACE_TCHAR *name); }; /** * @class ACE_Remote_WLock * * @brief Proxy for acquiring, renewing, and releasing a distributed * writers lock. * * Shields applications from details of interacting with the * ACE_Token_Server. The token_name_ is just the string that the * Token Server uses to identify the token. The client_id_ (also * used by the Token Server,) identifies the owner of the token and * is used for deadlock detection. */ class ACE_Export ACE_Remote_WLock : public ACE_Remote_Token_Proxy { public: ACE_Remote_WLock (); ACE_Remote_WLock (const ACE_TCHAR *token_name, int ignore_deadlock = 0, int debug = 0); ACE_Remote_WLock (const ACE_Remote_WLock &mutex); /// Dump the state of the class. void dump () const; /// Returns ACE_RW_Token::WLOCK; virtual int type () const; /// Return deep copy. virtual ACE_Token_Proxy *clone () const; protected: /// Make the correct type of ACE_Tokens. This is called by the Token /// Manager. virtual ACE_Tokens *create_token (const ACE_TCHAR *name); }; /** * @class ACE_TSS_Connection * * @brief Class for providing a connection per thread. * * ACE_TSS_Connection provides a single access point for all * threads to access thread-specific connections. This prevents * resource-sharing problems such as thread serialization. */ class ACE_Export ACE_TSS_Connection : public ACE_TSS { public: // Necessary to make some compilers work... ACE_TSS_Connection (); ~ACE_TSS_Connection (); /// Retrieve the thread's connection ACE_SOCK_Stream *get_connection (); /// Factory Method that creates a new SOCK Stream. virtual ACE_SOCK_Stream *make_TSS_TYPE () const; /// Inheritance and operator overloading don't mix. Redefine this /// from ACE_TSS so that we can use it. operator ACE_SOCK_Stream *(); /// Set the server address. static void set_server_address (const ACE_INET_Addr &server_address); /// Dump the state of the class. void dump () const; protected: /// The address of the Token Server used by all instances of /// Token_Proxy. static ACE_INET_Addr server_address_; private: ACE_TSS_Connection (const ACE_TSS_Connection &) = delete; void operator= (const ACE_TSS_Connection &) = delete; }; ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_TOKENS_LIBRARY */ #if defined (__ACE_INLINE__) #include "ace/Remote_Tokens.inl" #endif /* __ACE_INLINE__ */ #include /**/ "ace/post.h" #endif /* ACE_REMOTE_TOKEN_H */ ace-8.0.4+dfsg.orig/ace/Dynamic.cpp0000644000175000017500000000120315027201773016003 0ustar sudipsudip#include "ace/Dynamic.h" #include "ace/Singleton.h" #include "ace/TSS_T.h" #include "ace/Synch_Traits.h" #include "ace/Null_Mutex.h" #if !defined (__ACE_INLINE__) #include "ace/Dynamic.inl" #endif /* __ACE_INLINE__ */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Dynamic::ACE_Dynamic () : is_dynamic_ (false) { ACE_TRACE ("ACE_Dynamic::ACE_Dynamic"); } ACE_ALLOC_HOOK_DEFINE(ACE_Dynamic) /* static */ ACE_Dynamic * ACE_Dynamic::instance () { return ACE_TSS_Singleton::instance (); } ACE_SINGLETON_TEMPLATE_INSTANTIATE(ACE_TSS_Singleton, ACE_Dynamic, ACE_Null_Mutex); ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/OS_NS_Thread.cpp0000644000175000017500000045706115027201773016650 0ustar sudipsudip#include "ace/OS_NS_Thread.h" #if !defined (ACE_HAS_INLINED_OSCALLS) # include "ace/OS_NS_Thread.inl" #endif /* ACE_HAS_INLINED_OSCALLS */ #include "ace/OS_NS_stdio.h" #include "ace/Sched_Params.h" #include "ace/OS_Memory.h" #include "ace/OS_Thread_Adapter.h" #include "ace/Object_Manager_Base.h" #include "ace/OS_NS_errno.h" #include "ace/OS_NS_ctype.h" #include "ace/Log_Category.h" // for ACE_ASSERT #include "ace/Thread_Mutex.h" #include "ace/Condition_Thread_Mutex.h" #include "ace/Guard_T.h" #ifdef ACE_HAS_GETTID # include "ace/OS_NS_sys_resource.h" // syscall for gettid impl #endif #include #include #if defined (ACE_INTEGRITY) && !defined (ACE_HAS_PTHREADS) # include #endif extern "C" void ACE_MUTEX_LOCK_CLEANUP_ADAPTER_NAME (void *args) { ACE_VERSIONED_NAMESPACE_NAME::ACE_OS::mutex_lock_cleanup (args); } #if !defined(ACE_WIN32) && defined (__IBMCPP__) && (__IBMCPP__ >= 400) # define ACE_BEGINTHREADEX(STACK, STACKSIZE, ENTRY_POINT, ARGS, FLAGS, THR_ID) \ (*THR_ID = ::_beginthreadex ((void(_Optlink*)(void*))ENTRY_POINT, STACK, STACKSIZE, ARGS), *THR_ID) #elif defined(ACE_HAS_WTHREADS) // Green Hills compiler gets confused when __stdcall is embedded in // parameter list, so we define the type ACE_WIN32THRFUNC_T and use it // instead. typedef unsigned (__stdcall *ACE_WIN32THRFUNC_T)(void*); # define ACE_BEGINTHREADEX(STACK, STACKSIZE, ENTRY_POINT, ARGS, FLAGS, THR_ID) \ ::_beginthreadex (STACK, STACKSIZE, (ACE_WIN32THRFUNC_T) ENTRY_POINT, ARGS, FLAGS, (unsigned int *) THR_ID) #endif /* defined (__IBMCPP__) && (__IBMCPP__ >= 400) */ /*****************************************************************************/ ACE_BEGIN_VERSIONED_NAMESPACE_DECL void ACE_Thread_ID::to_string (char *thr_string, size_t thr_string_len) const { #if defined (ACE_WIN32) ACE_OS::snprintf (thr_string, thr_string_len, "%u", static_cast (this->thread_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 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::snprintf (thr_string, thr_string_len, "%lu", # ifdef ACE_THREAD_T_IS_A_STRUCT *reinterpret_cast (& # else (unsigned long) ( # endif // ACE_THREAD_T_IS_A_STRUCT thread_handle_)); #endif /* ACE_WIN32 */ } /*****************************************************************************/ #if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION) #if defined (ACE_HAS_TSS_EMULATION) u_int ACE_TSS_Emulation::total_keys_ = 0; ACE_TSS_Keys* ACE_TSS_Emulation::tss_keys_used_ = 0; ACE_TSS_Emulation::ACE_TSS_DESTRUCTOR ACE_TSS_Emulation::tss_destructor_[ACE_TSS_Emulation::ACE_TSS_THREAD_KEYS_MAX] = { 0 }; # if !defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) && defined (ACE_HAS_VXTHREADS) # if (defined (_WRS_CONFIG_SMP) || defined (INCLUDE_AMP_CPU)) __thread void* ACE_TSS_Emulation::ace_tss_keys = 0; # else /* ! VxWorks SMP */ void* ACE_TSS_Emulation::ace_tss_keys = 0; # endif /* ! VxWorks SMP */ # elif defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) bool ACE_TSS_Emulation::key_created_ = false; ACE_OS_thread_key_t ACE_TSS_Emulation::native_tss_key_; /* static */ # if defined (ACE_HAS_THR_C_FUNC) extern "C" void ACE_TSS_Emulation_cleanup (void *) { // Really this must be used for ACE_TSS_Emulation code to make the TSS // cleanup } # else void ACE_TSS_Emulation_cleanup (void *) { // Really this must be used for ACE_TSS_Emulation code to make the TSS // cleanup } # endif /* ACE_HAS_THR_C_FUNC */ void ** ACE_TSS_Emulation::tss_base (void* ts_storage[], u_int *ts_created) { // TSS Singleton implementation. // Create the one native TSS key, if necessary. if (!key_created_) { // Double-checked lock . . . ACE_TSS_BASE_GUARD if (!key_created_) { if (ACE_OS::thr_keycreate_native (&native_tss_key_, &ACE_TSS_Emulation_cleanup) != 0) { ACE_ASSERT (0); return 0; // Major problems, this should *never* happen! } key_created_ = true; } } void **old_ts_storage = 0; // Get the tss_storage from thread-OS specific storage. if (ACE_OS::thr_getspecific_native (native_tss_key_, (void **) &old_ts_storage) == -1) { ACE_ASSERT (false); return 0; // This should not happen! } // Check to see if this is the first time in for this thread. // This block can also be entered after a fork () in the child process. if (old_ts_storage == 0) { if (ts_created) *ts_created = 1u; // Use the ts_storage passed as argument, if non-zero. It is // possible that this has been implemented in the stack. At the // moment, this is unknown. The cleanup must not do nothing. // If ts_storage is zero, allocate (and eventually leak) the // storage array. if (ts_storage == 0) { #ifdef ACE_HAS_ALLOC_HOOKS const size_t n = ACE_TSS_THREAD_KEYS_MAX * sizeof (void *); ACE_Allocator *const alloc = ACE_Allocator::instance (); ACE_ALLOCATOR_RETURN (ts_storage, static_cast (alloc->malloc (n)), 0); #else ACE_NEW_RETURN (ts_storage, void*[ACE_TSS_THREAD_KEYS_MAX], 0); #endif // Zero the entire TSS array. Do it manually instead of // using memset, for optimum speed. Though, memset may be // faster :-) void **tss_base_p = ts_storage; for (u_int i = 0; i < ACE_TSS_THREAD_KEYS_MAX; ++i) *tss_base_p++ = 0; } // Store the pointer in thread-specific storage. It gets // deleted via the ACE_TSS_Emulation_cleanup function when the // thread terminates. if (ACE_OS::thr_setspecific_native (native_tss_key_, (void *) ts_storage) != 0) { ACE_ASSERT (false); return 0; // This should not happen! } } else if (ts_created) ts_created = 0; return ts_storage ? ts_storage : old_ts_storage; } # endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE */ u_int ACE_TSS_Emulation::total_keys () { ACE_OS_Recursive_Thread_Mutex_Guard guard ( *static_cast (ACE_OS_Object_Manager::preallocated_object[ ACE_OS_Object_Manager::ACE_TSS_KEY_LOCK])); return total_keys_; } int ACE_TSS_Emulation::next_key (ACE_thread_key_t &key) { ACE_OS_Recursive_Thread_Mutex_Guard guard ( *static_cast (ACE_OS_Object_Manager::preallocated_object[ ACE_OS_Object_Manager::ACE_TSS_KEY_LOCK])); // Initialize the tss_keys_used_ pointer on first use. if (tss_keys_used_ == 0) { ACE_NEW_RETURN (tss_keys_used_, ACE_TSS_Keys, -1); } if (total_keys_ < ACE_TSS_THREAD_KEYS_MAX) { u_int counter = 0; // 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 = 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) { tss_keys_used_->test_and_set(localkey); key = localkey; break; } } ++total_keys_; return 0; } else { key = ACE_OS::NULL_key; return -1; } } int ACE_TSS_Emulation::release_key (ACE_thread_key_t key) { ACE_OS_Recursive_Thread_Mutex_Guard guard ( *static_cast (ACE_OS_Object_Manager::preallocated_object[ ACE_OS_Object_Manager::ACE_TSS_KEY_LOCK])); if (tss_keys_used_ != 0 && tss_keys_used_->test_and_clear (key) == 0) { --total_keys_; return 0; } return 1; } int ACE_TSS_Emulation::is_key (ACE_thread_key_t key) { ACE_OS_Recursive_Thread_Mutex_Guard guard ( *static_cast (ACE_OS_Object_Manager::preallocated_object[ ACE_OS_Object_Manager::ACE_TSS_KEY_LOCK])); if (tss_keys_used_ != 0 && tss_keys_used_->is_set (key) == 1) { return 1; } return 0; } void * ACE_TSS_Emulation::tss_open (void *ts_storage[ACE_TSS_THREAD_KEYS_MAX]) { # if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) // On VxWorks, in particular, don't check to see if the field // is 0. It isn't always, specifically, when a program is run // directly by the shell (without spawning a new task) after // another program has been run. u_int ts_created = 0; tss_base (ts_storage, &ts_created); if (ts_created) { # else /* ! ACE_HAS_THREAD_SPECIFIC_STORAGE */ tss_base () = ts_storage; # endif // Zero the entire TSS array. Do it manually instead of using // memset, for optimum speed. Though, memset may be faster :-) void **tss_base_p = tss_base (); for (u_int i = 0; i < ACE_TSS_THREAD_KEYS_MAX; ++i, ++tss_base_p) { *tss_base_p = 0; } return tss_base (); # if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) } else { return 0; } # endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE */ } void ACE_TSS_Emulation::tss_close () { #if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) ACE_OS::thr_keyfree_native (native_tss_key_); #endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE */ } #endif /* ACE_HAS_TSS_EMULATION */ #endif /* WIN32 || ACE_HAS_TSS_EMULATION */ /*****************************************************************************/ #if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION) // Moved class ACE_TSS_Ref declaration to OS.h so it can be visible to // the single file of template instantiations. ACE_TSS_Ref::ACE_TSS_Ref (ACE_thread_t id) : tid_(id) { ACE_OS_TRACE ("ACE_TSS_Ref::ACE_TSS_Ref"); } ACE_TSS_Ref::ACE_TSS_Ref () { ACE_OS_TRACE ("ACE_TSS_Ref::ACE_TSS_Ref"); } // Check for equality. bool ACE_TSS_Ref::operator== (const ACE_TSS_Ref &info) const { ACE_OS_TRACE ("ACE_TSS_Ref::operator=="); #ifdef ACE_THREAD_T_IS_A_STRUCT return 0 == ACE_OS::memcmp (&this->tid_, &info.tid_, sizeof tid_); #else return this->tid_ == info.tid_; #endif } // Check for inequality. bool ACE_TSS_Ref::operator != (const ACE_TSS_Ref &tss_ref) const { ACE_OS_TRACE ("ACE_TSS_Ref::operator !="); return !(*this == tss_ref); } // moved class ACE_TSS_Info declaration // to OS.h so it can be visible to the // single file of template instantiations ACE_TSS_Info::ACE_TSS_Info (ACE_thread_key_t key, ACE_TSS_Info::Destructor dest) : key_ (key), destructor_ (dest), thread_count_ (-1) { ACE_OS_TRACE ("ACE_TSS_Info::ACE_TSS_Info"); } ACE_TSS_Info::ACE_TSS_Info () : key_ (ACE_OS::NULL_key), destructor_ (0), thread_count_ (-1) { ACE_OS_TRACE ("ACE_TSS_Info::ACE_TSS_Info"); } // Check for equality. bool ACE_TSS_Info::operator== (const ACE_TSS_Info &info) const { ACE_OS_TRACE ("ACE_TSS_Info::operator=="); return this->key_ == info.key_; } // Check for inequality. bool ACE_TSS_Info::operator != (const ACE_TSS_Info &info) const { ACE_OS_TRACE ("ACE_TSS_Info::operator !="); return !(*this == info); } void ACE_TSS_Info::dump () { # if defined (ACE_HAS_DUMP) // ACE_OS_TRACE ("ACE_TSS_Info::dump"); # if 0 ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("key_ = %u\n"), this->key_)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("destructor_ = %u\n"), this->destructor_)); ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP)); # endif /* 0 */ # endif /* ACE_HAS_DUMP */ } // Moved class ACE_TSS_Keys declaration to OS.h so it can be visible // to the single file of template instantiations. ACE_TSS_Keys::ACE_TSS_Keys () { for (u_int i = 0; i < ACE_WORDS; ++i) { key_bit_words_[i] = 0; } } void ACE_TSS_Keys::find (const u_int key, u_int &word, u_int &bit) { word = key / ACE_BITS_PER_WORD; bit = key % ACE_BITS_PER_WORD; } int ACE_TSS_Keys::test_and_set (const ACE_thread_key_t key) { u_int word, bit; find (key, word, bit); if (ACE_BIT_ENABLED (key_bit_words_[word], 1 << bit)) { return 1; } else { ACE_SET_BITS (key_bit_words_[word], 1 << bit); return 0; } } int ACE_TSS_Keys::test_and_clear (const ACE_thread_key_t key) { u_int word, bit; find (key, word, bit); if (word < ACE_WORDS && ACE_BIT_ENABLED (key_bit_words_[word], 1 << bit)) { ACE_CLR_BITS (key_bit_words_[word], 1 << bit); return 0; } else { return 1; } } int ACE_TSS_Keys::is_set (const ACE_thread_key_t key) const { u_int word, bit; find (key, word, bit); return word < ACE_WORDS ? ACE_BIT_ENABLED (key_bit_words_[word], 1 << bit) : 0; } /** * @class ACE_TSS_Cleanup * @brief Singleton that helps to manage the lifetime of TSS objects and keys. */ class ACE_TSS_Cleanup { public: ACE_ALLOC_HOOK_DECLARE; /// Register a newly-allocated key /// @param key the key to be monitored /// @param destructor the function to call to delete objects stored via this key int insert (ACE_thread_key_t key, void (*destructor)(void *)); /// Mark a key as being used by this thread. void thread_use_key (ACE_thread_key_t key); /// This thread is no longer using this key /// call destructor if appropriate int thread_detach_key (ACE_thread_key_t key); /// This key is no longer used /// Release key if use count == 0 /// fail if use_count != 0; /// @param key the key to be released int free_key (ACE_thread_key_t key); /// Cleanup the thread-specific objects. Does _NOT_ exit the thread. /// For each used key perform the same actions as free_key. void thread_exit (); private: void dump (); /// Release a key used by this thread /// @param info reference to the info for this key /// @param destructor out arg to receive destructor function ptr /// @param tss_obj out arg to receive pointer to deletable object void thread_release ( ACE_TSS_Info &info, ACE_TSS_Info::Destructor & destructor, void *& tss_obj); /// remove key if it's unused (thread_count == 0) /// @param info reference to the info for this key int remove_key (ACE_TSS_Info &info); /// Find the TSS keys (if any) for this thread. /// @param thread_keys reference to pointer to be filled in by this function. /// @return false if keys don't exist. bool find_tss_keys (ACE_TSS_Keys *& thread_keys) const; /// Accessor for this threads ACE_TSS_Keys instance. /// Creates the keys if necessary. ACE_TSS_Keys *tss_keys (); /// Ensure singleton. ACE_TSS_Cleanup (); ~ACE_TSS_Cleanup (); /// ACE_TSS_Cleanup access only via TSS_Cleanup_Instance friend class TSS_Cleanup_Instance; private: // Array of objects. typedef ACE_TSS_Info ACE_TSS_TABLE[ACE_DEFAULT_THREAD_KEYS]; typedef ACE_TSS_Info *ACE_TSS_TABLE_ITERATOR; /// Table of 's. ACE_TSS_TABLE table_; /// Key for the thread-specific ACE_TSS_Keys /// Used by find_tss_keys() or tss_keys() to find the /// bit array that records whether each TSS key is in /// use by this thread. ACE_thread_key_t in_use_; }; ACE_ALLOC_HOOK_DEFINE (ACE_TSS_Cleanup); ACE_ALLOC_HOOK_DEFINE (ACE_TSS_Keys); /*****************************************************************************/ /** * @class TSS_Cleanup_Instance * @A class to manage an instance pointer to ACE_TSS_Cleanup. * Note: that the double checked locking pattern doesn't allow * safe deletion. * Callers who wish to access the singleton ACE_TSS_Cleanup must * do so by instantiating a TSS_Cleanup_Instance, calling the valid * method to be sure the ACE_TSS_Cleanup is available, then using * the TSS_Cleanup_Instance as a pointer to the instance. * Construction argument to the TSS_Cleanup_Instance determines how * it is to be used: * CREATE means allow this call to create an ACE_TSS_Cleanup if necessary. * USE means use the existing ACE_TSS_Cleanup, but do not create a new one. * DESTROY means provide exclusive access to the ACE_TSS_Cleanup, then * delete it when the TSS_Cleanup_Instance goes out of scope. */ class TSS_Cleanup_Instance { public: enum Purpose { CREATE, USE, DESTROY }; explicit TSS_Cleanup_Instance (Purpose purpose = USE); ~TSS_Cleanup_Instance(); bool valid(); ACE_TSS_Cleanup * operator ->(); private: ACE_TSS_Cleanup * operator *(); private: static unsigned int reference_count_; static ACE_TSS_Cleanup * instance_; static ACE_Thread_Mutex* mutex_; static ACE_Condition_Thread_Mutex* condition_; private: ACE_TSS_Cleanup * ptr_; unsigned short flags_; enum { FLAG_DELETING = 1, FLAG_VALID_CHECKED = 2 }; }; TSS_Cleanup_Instance::TSS_Cleanup_Instance (Purpose purpose) : ptr_(0) , flags_(0) { // During static construction or construction of the ACE_Object_Manager, // there can be only one thread in this constructor at any one time, so // it's safe to check for a zero mutex_. If it's zero, we create a new // mutex and condition variable. if (mutex_ == 0) { ACE_NEW (mutex_, ACE_Thread_Mutex ()); ACE_NEW (condition_, ACE_Condition_Thread_Mutex (*mutex_)); } ACE_GUARD (ACE_Thread_Mutex, m, *mutex_); if (purpose == CREATE) { if (instance_ == 0) { instance_ = new ACE_TSS_Cleanup(); } ptr_ = instance_; ++reference_count_; } else if(purpose == DESTROY) { if (instance_ != 0) { ptr_ = instance_; instance_ = 0; ACE_SET_BITS(flags_, FLAG_DELETING); while (reference_count_ > 0) { condition_->wait(); } } } else // must be normal use { ACE_ASSERT(purpose == USE); if (instance_ != 0) { ptr_ = instance_; ++reference_count_; } } } TSS_Cleanup_Instance::~TSS_Cleanup_Instance () { // Variable to hold the mutex_ to delete outside the scope of the // guard. ACE_Thread_Mutex *del_mutex = 0; // scope the guard { ACE_GUARD (ACE_Thread_Mutex, guard, *mutex_); if (ptr_ != 0) { if (ACE_BIT_ENABLED (flags_, FLAG_DELETING)) { ACE_ASSERT(instance_ == 0); ACE_ASSERT(reference_count_ == 0); delete ptr_; del_mutex = mutex_ ; mutex_ = 0; } else { ACE_ASSERT (reference_count_ > 0); --reference_count_; if (reference_count_ == 0 && instance_ == 0) condition_->signal (); } } }// end of guard scope if (del_mutex != 0) { delete condition_; condition_ = 0; delete del_mutex; } } bool TSS_Cleanup_Instance::valid() { ACE_SET_BITS(flags_, FLAG_VALID_CHECKED); return (this->instance_ != 0); } ACE_TSS_Cleanup * TSS_Cleanup_Instance::operator *() { ACE_ASSERT(ACE_BIT_ENABLED(flags_, FLAG_VALID_CHECKED)); return instance_; } ACE_TSS_Cleanup * TSS_Cleanup_Instance::operator ->() { ACE_ASSERT(ACE_BIT_ENABLED(flags_, FLAG_VALID_CHECKED)); return instance_; } // = Static object initialization. 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_Condition_Thread_Mutex* TSS_Cleanup_Instance::condition_ = 0; ACE_TSS_Cleanup::~ACE_TSS_Cleanup () { } void ACE_TSS_Cleanup::thread_exit () { ACE_OS_TRACE ("ACE_TSS_Cleanup::thread_exit"); // variables to hold the destructors, keys // and pointers to the object to be destructed // the actual destruction is deferred until the guard is released ACE_TSS_Info::Destructor destructor[ACE_DEFAULT_THREAD_KEYS]; void * tss_obj[ACE_DEFAULT_THREAD_KEYS]; ACE_thread_key_t keys[ACE_DEFAULT_THREAD_KEYS]; // count of items to be destroyed unsigned int d_count = 0; // scope the guard { ACE_TSS_CLEANUP_GUARD // if not initialized or already cleaned up ACE_TSS_Keys *this_thread_keys = 0; if (! find_tss_keys (this_thread_keys) ) { return; } // Minor hack: Iterating in reverse order means the LOG buffer which is // accidentally allocated first will be accidentally deallocated (almost) // last -- in case someone logs something from the other destructors. // applications should not count on this behavior because platforms which // do not use ACE_TSS_Cleanup may delete objects in other orders. unsigned int key_index = ACE_DEFAULT_THREAD_KEYS; while( key_index > 0) { --key_index; ACE_TSS_Info & info = this->table_[key_index]; // if this key is in use by this thread if (info.key_in_use () && this_thread_keys->is_set(info.key_)) { // defer deleting the in-use key until all others have been deleted if(info.key_ != this->in_use_) { destructor[d_count] = 0; tss_obj[d_count] = 0; keys[d_count] = 0; this->thread_release (info, destructor[d_count], tss_obj[d_count]); if (destructor[d_count] != 0 && tss_obj[d_count] != 0) { keys[d_count] = info.key_; ++d_count; } } } } // remove the in_use bit vector last u_int use_index = this->in_use_; ACE_TSS_Info & info = this->table_[use_index]; destructor[d_count] = 0; tss_obj[d_count] = 0; keys[d_count] = 0; this->thread_release (info, destructor[d_count], tss_obj[d_count]); if (destructor[d_count] != 0 && tss_obj[d_count] != 0) { keys[d_count] = info.key_; ++d_count; } } // end of guard scope for (unsigned int d_index = 0; d_index < d_count; ++d_index) { (*destructor[d_index])(tss_obj[d_index]); #if defined (ACE_HAS_TSS_EMULATION) ACE_TSS_Emulation::ts_object (keys[d_index]) = 0; #else // defined (ACE_HAS_TSS_EMULATION) ACE_OS::thr_setspecific_native (keys[d_index], 0); #endif // defined (ACE_HAS_TSS_EMULATION) } } extern "C" void ACE_TSS_Cleanup_keys_destroyer (void *tss_keys) { delete static_cast (tss_keys); } ACE_TSS_Cleanup::ACE_TSS_Cleanup () : in_use_ (ACE_OS::NULL_key) { ACE_OS_TRACE ("ACE_TSS_Cleanup::ACE_TSS_Cleanup"); } int ACE_TSS_Cleanup::insert (ACE_thread_key_t key, void (*destructor)(void *)) { ACE_OS_TRACE ("ACE_TSS_Cleanup::insert"); ACE_TSS_CLEANUP_GUARD u_int key_index = key; ACE_ASSERT (key_index < ACE_DEFAULT_THREAD_KEYS); if (key_index < ACE_DEFAULT_THREAD_KEYS) { ACE_ASSERT (table_[key_index].thread_count_ == -1); table_[key_index] = ACE_TSS_Info (key, destructor); table_[key_index].thread_count_ = 0; // inserting it does not use it // but it does "allocate" it return 0; } else { return -1; } } int ACE_TSS_Cleanup::free_key (ACE_thread_key_t key) { ACE_OS_TRACE ("ACE_TSS_Cleanup::free_key"); ACE_TSS_CLEANUP_GUARD u_int key_index = key; if (key_index < ACE_DEFAULT_THREAD_KEYS) { return remove_key (this->table_ [key_index]); } return -1; } int ACE_TSS_Cleanup::remove_key (ACE_TSS_Info &info) { // assume CLEANUP_GUARD is held by caller ACE_OS_TRACE ("ACE_TSS_Cleanup::remove_key"); #if 0 // This was a good idea, but POSIX says it's legal to delete used keys. // When this is done, any existing TSS objects controlled by this key are leaked // There is no "right thing" to do in this case // only remove it if all threads are done with it if (info.thread_count_ != 0) { return -1; } #endif // 0 #if !defined (ACE_HAS_TSS_EMULATION) ACE_OS_thread_key_t temp_key = info.key_; ACE_OS::thr_keyfree_native (temp_key); #endif /* !ACE_HAS_TSS_EMULATION */ if (info.key_ == this->in_use_) { this->in_use_ = ACE_OS::NULL_key; } info.key_in_use (0); info.destructor_ = 0; return 0; } int ACE_TSS_Cleanup::thread_detach_key (ACE_thread_key_t key) { // variables to hold the destructor and the object to be destructed // the actual call is deferred until the guard is released ACE_TSS_Info::Destructor destructor = 0; void * tss_obj = 0; // scope the guard { ACE_TSS_CLEANUP_GUARD u_int key_index = key; ACE_ASSERT (key_index < sizeof(this->table_)/sizeof(this->table_[0])); // If this entry was never set, just bug out. If it is set, but is the // wrong key, assert. if (this->table_[key_index].key_ == 0) return 0; ACE_ASSERT (this->table_[key_index].key_ == key); ACE_TSS_Info &info = this->table_ [key_index]; // sanity check if (!info.key_in_use ()) { return -1; } this->thread_release (info, destructor, tss_obj); } // end of scope for the Guard // if there's a destructor and an object to be destroyed if (destructor != 0 && tss_obj != 0) { (*destructor) (tss_obj); } return 0; } void ACE_TSS_Cleanup::thread_release ( ACE_TSS_Info &info, ACE_TSS_Info::Destructor & destructor, void *& tss_obj) { // assume guard is held by caller // Find the TSS keys (if any) for this thread // do not create them if they don't exist ACE_TSS_Keys * thread_keys = 0; if (find_tss_keys (thread_keys)) { // if this key is in use by this thread if (thread_keys->test_and_clear(info.key_) == 0) { // save destructor & pointer to tss object // until after the guard is released destructor = info.destructor_; ACE_OS::thr_getspecific (info.key_, &tss_obj); ACE_ASSERT (info.thread_count_ > 0); --info.thread_count_; } } } void ACE_TSS_Cleanup::thread_use_key (ACE_thread_key_t key) { // If the key's ACE_TSS_Info in-use bit for this thread is not set, // set it and increment the key's thread_count_. if (! tss_keys ()->test_and_set (key)) { ACE_TSS_CLEANUP_GUARD // Retrieve the key's ACE_TSS_Info and increment its thread_count_. u_int key_index = key; ACE_TSS_Info &key_info = this->table_ [key_index]; ACE_ASSERT (key_info.key_in_use ()); ++key_info.thread_count_; } } void ACE_TSS_Cleanup::dump () { # if defined (ACE_HAS_DUMP) // Iterate through all the thread-specific items and dump them all. ACE_TSS_TABLE_ITERATOR key_info = table_; for (unsigned int i = 0; i < ACE_DEFAULT_THREAD_KEYS; ++key_info, ++i) key_info->dump (); # endif /* ACE_HAS_DUMP */ } bool ACE_TSS_Cleanup::find_tss_keys (ACE_TSS_Keys *& tss_keys) const { if (this->in_use_ == ACE_OS::NULL_key) return false; if (ACE_OS::thr_getspecific (in_use_, reinterpret_cast (&tss_keys)) == -1) { ACE_ASSERT (false); return false; // This should not happen! } return tss_keys != 0; } ACE_TSS_Keys * ACE_TSS_Cleanup::tss_keys () { if (this->in_use_ == ACE_OS::NULL_key) { ACE_TSS_CLEANUP_GUARD // Double-check; if (in_use_ == ACE_OS::NULL_key) { // Initialize in_use_ with a new key. if (ACE_OS::thr_keycreate (&in_use_, &ACE_TSS_Cleanup_keys_destroyer)) { ACE_ASSERT (false); return 0; // Major problems, this should *never* happen! } } } void *ts_keys = 0; if (ACE_OS::thr_getspecific (in_use_, &ts_keys) == -1) { ACE_ASSERT (false); return 0; // This should not happen! } if (ts_keys == 0) { ACE_NEW_RETURN (ts_keys, ACE_TSS_Keys, 0); // Store the dynamically allocated pointer in thread-specific // storage. if (ACE_OS::thr_setspecific (in_use_, ts_keys) == -1) { ACE_ASSERT (false); delete reinterpret_cast (ts_keys); return 0; // Major problems, this should *never* happen! } } return reinterpret_cast (ts_keys); } #endif /* ACE_WIN32 || ACE_HAS_TSS_EMULATION */ /*****************************************************************************/ // = Static initialization. // This is necessary to deal with POSIX pthreads insanity. This // guarantees that we've got a "zero'd" thread id even when // ACE_thread_t, ACE_hthread_t, and ACE_thread_key_t are implemented // as structures... Under no circumstances should these be given // initial values. // Note: these three objects require static construction. ACE_thread_t ACE_OS::NULL_thread; ACE_hthread_t ACE_OS::NULL_hthread; #if defined (ACE_HAS_TSS_EMULATION) ACE_thread_key_t ACE_OS::NULL_key = static_cast (-1); #else /* ! ACE_HAS_TSS_EMULATION */ ACE_thread_key_t ACE_OS::NULL_key; #endif /* ! ACE_HAS_TSS_EMULATION */ /*****************************************************************************/ void ACE_OS::cleanup_tss (const u_int main_thread) { #if defined (ACE_HAS_TSS_EMULATION) || defined (ACE_WIN32) { // scope the cleanup instance // Call TSS destructors for current thread. TSS_Cleanup_Instance cleanup; if (cleanup.valid ()) { cleanup->thread_exit (); } } #endif /* ACE_HAS_TSS_EMULATION || ACE_WIN32 */ if (main_thread) { #if !defined (ACE_HAS_TSS_EMULATION) && !defined (ACE_HAS_MINIMAL_ACE_OS) // Just close the ACE_Log_Msg for the current (which should be // main) thread. We don't have TSS emulation; if there's native // TSS, it should call its destructors when the main thread // exits. ACE_Base_Thread_Adapter::close_log_msg (); #endif /* ! ACE_HAS_TSS_EMULATION && ! ACE_HAS_MINIMAL_ACE_OS */ #if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION) // Finally, free up the ACE_TSS_Cleanup instance. This method gets // called by the ACE_Object_Manager. TSS_Cleanup_Instance cleanup(TSS_Cleanup_Instance::DESTROY); if (cleanup.valid ()) { ; // the pointer deletes the Cleanup when it goes out of scope } #endif /* WIN32 || ACE_HAS_TSS_EMULATION */ #if defined (ACE_HAS_TSS_EMULATION) ACE_TSS_Emulation::tss_close (); #endif /* ACE_HAS_TSS_EMULATION */ } } /*****************************************************************************/ // CONDITIONS BEGIN /*****************************************************************************/ #if defined (ACE_LACKS_COND_T) int ACE_OS::cond_broadcast (ACE_cond_t *cv) { ACE_OS_TRACE ("ACE_OS::cond_broadcast"); # if defined (ACE_HAS_THREADS) // The must be locked before this call is made. // This is needed to ensure that and are // consistent relative to each other. if (ACE_OS::thread_mutex_lock (&cv->waiters_lock_) != 0) { return -1; } bool have_waiters = false; if (cv->waiters_ > 0) { // We are broadcasting, even if there is just one waiter... // Record the fact that we are broadcasting. This helps the // cond_wait() method know how to optimize itself. Be sure to // set this with the held. cv->was_broadcast_ = 1; have_waiters = true; } if (ACE_OS::thread_mutex_unlock (&cv->waiters_lock_) != 0) { // This is really bad, we have the lock but can't release it anymore return -1; } int result = 0; if (have_waiters) { // Wake up all the waiters. if (ACE_OS::sema_post (&cv->sema_, cv->waiters_) == -1) result = -1; // Wait for all the awakened threads to acquire their part of // the counting semaphore. # if defined (ACE_VXWORKS) || defined (ACE_MQX) || defined (ACE_INTEGRITY) else if (ACE_OS::sema_wait (&cv->waiters_done_) == -1) # else else if (ACE_OS::event_wait (&cv->waiters_done_) == -1) # endif /* ACE_VXWORKS || ACE_MQX || ACE_INTEGRITY */ result = -1; // This is okay, even without the held because // no other waiter threads can wake up to access it. cv->was_broadcast_ = 0; } return result; # else ACE_UNUSED_ARG (cv); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_THREADS */ } int ACE_OS::cond_destroy (ACE_cond_t *cv) { ACE_OS_TRACE ("ACE_OS::cond_destroy"); # if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_WTHREADS) ACE_OS::event_destroy (&cv->waiters_done_); # elif defined (ACE_VXWORKS) || defined (ACE_MQX) || defined (ACE_INTEGRITY) ACE_OS::sema_destroy (&cv->waiters_done_); # endif /* ACE_VXWORKS */ int result = 0; if (ACE_OS::thread_mutex_destroy (&cv->waiters_lock_) != 0) result = -1; if (ACE_OS::sema_destroy (&cv->sema_) != 0) result = -1; return result; # else ACE_UNUSED_ARG (cv); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_THREADS */ } int ACE_OS::cond_init (ACE_cond_t *cv, ACE_condattr_t &attributes, const char *name, void *arg) { return ACE_OS::cond_init (cv, static_cast (attributes.type), name, arg); } # if defined (ACE_HAS_WCHAR) int ACE_OS::cond_init (ACE_cond_t *cv, ACE_condattr_t &attributes, const wchar_t *name, void *arg) { return ACE_OS::cond_init (cv, static_cast (attributes.type), name, arg); } # endif /* ACE_HAS_WCHAR */ int ACE_OS::cond_init (ACE_cond_t *cv, short type, const char *name, void *arg) { ACE_OS_TRACE ("ACE_OS::cond_init"); # if defined (ACE_HAS_THREADS) cv->waiters_ = 0; cv->was_broadcast_ = 0; int result = 0; if (ACE_OS::sema_init (&cv->sema_, 0, type, name, arg) == -1) result = -1; else if (ACE_OS::thread_mutex_init (&cv->waiters_lock_) == -1) result = -1; # if defined (ACE_VXWORKS) || defined (ACE_MQX) || defined (ACE_INTEGRITY) else if (ACE_OS::sema_init (&cv->waiters_done_, 0, type) == -1) # else else if (ACE_OS::event_init (&cv->waiters_done_) == -1) # endif /* ACE_VXWORKS */ result = -1; return result; # else ACE_UNUSED_ARG (cv); ACE_UNUSED_ARG (type); ACE_UNUSED_ARG (name); ACE_UNUSED_ARG (arg); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_THREADS */ } # if defined (ACE_HAS_WCHAR) int ACE_OS::cond_init (ACE_cond_t *cv, short type, const wchar_t *name, void *arg) { ACE_OS_TRACE ("ACE_OS::cond_init"); # if defined (ACE_HAS_THREADS) cv->waiters_ = 0; cv->was_broadcast_ = 0; int result = 0; if (ACE_OS::sema_init (&cv->sema_, 0, type, name, arg) == -1) result = -1; else if (ACE_OS::thread_mutex_init (&cv->waiters_lock_) == -1) result = -1; # if defined (ACE_VXWORKS) || defined (ACE_MQX) || defined (ACE_INTEGRITY) else if (ACE_OS::sema_init (&cv->waiters_done_, 0, type) == -1) # else else if (ACE_OS::event_init (&cv->waiters_done_) == -1) # endif /* ACE_VXWORKS */ result = -1; return result; # else ACE_UNUSED_ARG (cv); ACE_UNUSED_ARG (type); ACE_UNUSED_ARG (name); ACE_UNUSED_ARG (arg); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_THREADS */ } # endif /* ACE_HAS_WCHAR */ int ACE_OS::cond_signal (ACE_cond_t *cv) { ACE_OS_TRACE ("ACE_OS::cond_signal"); # if defined (ACE_HAS_THREADS) // If there aren't any waiters, then this is a no-op. Note that // this function *must* be called with the held // since other wise there is a race condition that can lead to the // lost wakeup bug... This is needed to ensure that the // value is not in an inconsistent internal state while being // updated by another thread. if (ACE_OS::thread_mutex_lock (&cv->waiters_lock_) != 0) return -1; bool const have_waiters = cv->waiters_ > 0; if (ACE_OS::thread_mutex_unlock (&cv->waiters_lock_) != 0) return -1; if (have_waiters) return ACE_OS::sema_post (&cv->sema_); else return 0; // No-op # else ACE_UNUSED_ARG (cv); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_THREADS */ } int ACE_OS::cond_wait (ACE_cond_t *cv, ACE_mutex_t *external_mutex) { ACE_OS_TRACE ("ACE_OS::cond_wait"); # if defined (ACE_HAS_THREADS) // Prevent race conditions on the count. if (ACE_OS::thread_mutex_lock (&cv->waiters_lock_) != 0) return -1; ++cv->waiters_; if (ACE_OS::thread_mutex_unlock (&cv->waiters_lock_) != 0) return -1; int result = 0; # if defined (ACE_HAS_SIGNAL_OBJECT_AND_WAIT) if (external_mutex->type_ == USYNC_PROCESS) { // This call will automatically release the mutex and wait on the semaphore. ACE_WIN32CALL (ACE_ADAPT_RETVAL (::SignalObjectAndWait (external_mutex->proc_mutex_, cv->sema_, INFINITE, FALSE), result), int, -1, result); if (result == -1) return result; } else # endif /* ACE_HAS_SIGNAL_OBJECT_AND_WAIT */ { // We keep the lock held just long enough to increment the count of // waiters by one. Note that we can't keep it held across the call // to ACE_OS::sema_wait() since that will deadlock other calls to // ACE_OS::cond_signal(). if (ACE_OS::mutex_unlock (external_mutex) != 0) return -1; // Wait to be awakened by a ACE_OS::cond_signal() or // ACE_OS::cond_broadcast(). result = ACE_OS::sema_wait (&cv->sema_); } // Reacquire lock to avoid race conditions on the count. if (ACE_OS::thread_mutex_lock (&cv->waiters_lock_) != 0) return -1; // We're ready to return, so there's one less waiter. --cv->waiters_; bool const last_waiter = cv->was_broadcast_ && cv->waiters_ == 0; // Release the lock so that other collaborating threads can make // progress. if (ACE_OS::thread_mutex_unlock (&cv->waiters_lock_) != 0) return -1; if (result == -1) // Bad things happened, so let's just return below. /* NOOP */; # if defined (ACE_HAS_SIGNAL_OBJECT_AND_WAIT) else if (external_mutex->type_ == USYNC_PROCESS) { if (last_waiter) // This call atomically signals the event and // waits until it can acquire the mutex. This is important to // prevent unfairness. ACE_WIN32CALL (ACE_ADAPT_RETVAL (::SignalObjectAndWait (cv->waiters_done_, external_mutex->proc_mutex_, INFINITE, FALSE), result), int, -1, result); else // We must always regain the , even when // errors occur because that's the guarantee that we give to // our callers. if (ACE_OS::mutex_lock (external_mutex) != 0) return -1; return result; /* NOTREACHED */ } # endif /* ACE_HAS_SIGNAL_OBJECT_AND_WAIT */ // If we're the last waiter thread during this particular broadcast // then let all the other threads proceed. else if (last_waiter) # if defined (ACE_VXWORKS) || defined (ACE_MQX) || defined (ACE_INTEGRITY) ACE_OS::sema_post (&cv->waiters_done_); # else ACE_OS::event_signal (&cv->waiters_done_); # endif /* ACE_VXWORKS */ // We must always regain the , even when errors // occur because that's the guarantee that we give to our callers. ACE_OS::mutex_lock (external_mutex); return result; # else ACE_UNUSED_ARG (cv); ACE_UNUSED_ARG (external_mutex); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_THREADS */ } int ACE_OS::cond_timedwait (ACE_cond_t *cv, ACE_mutex_t *external_mutex, ACE_Time_Value *timeout) { ACE_OS_TRACE ("ACE_OS::cond_timedwait"); # if defined (ACE_HAS_THREADS) // Handle the easy case first. if (timeout == 0) return ACE_OS::cond_wait (cv, external_mutex); # if defined (ACE_HAS_WTHREADS) || defined (ACE_VXWORKS) || defined (ACE_MQX) // Prevent race conditions on the count. if (ACE_OS::thread_mutex_lock (&cv->waiters_lock_) != 0) return -1; ++cv->waiters_; if (ACE_OS::thread_mutex_unlock (&cv->waiters_lock_) != 0) return -1; int result = 0; ACE_Errno_Guard error (errno, 0); int msec_timeout = 0; if (timeout != 0 && *timeout != ACE_Time_Value::zero) { // 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->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) msec_timeout = relative_time.msec (); } # if defined (ACE_HAS_SIGNAL_OBJECT_AND_WAIT) if (external_mutex->type_ == USYNC_PROCESS) // This call will automatically release the mutex and wait on the // semaphore. result = ::SignalObjectAndWait (external_mutex->proc_mutex_, cv->sema_, msec_timeout, FALSE); else # endif /* ACE_HAS_SIGNAL_OBJECT_AND_WAIT */ { // We keep the lock held just long enough to increment the count // of waiters by one. Note that we can't keep it held across // the call to WaitForSingleObject since that will deadlock // other calls to ACE_OS::cond_signal(). if (ACE_OS::mutex_unlock (external_mutex) != 0) return -1; // Wait to be awakened by a ACE_OS::signal() or // ACE_OS::broadcast(). # if defined (ACE_WIN32) result = ::WaitForSingleObject (cv->sema_, msec_timeout); # elif defined (ACE_VXWORKS) // Inline the call to ACE_OS::sema_wait () because it takes an // ACE_Time_Value argument. Avoid the cost of that conversion . . . _Vx_freq_t const ticks_per_sec = ::sysClkRateGet (); int const ticks = msec_timeout * ticks_per_sec / ACE_ONE_SECOND_IN_MSECS; result = ::semTake (cv->sema_.sema_, ticks); # else result = ACE_OS::sema_wait (&cv->sema_, timeout); # endif /* ACE_WIN32 || VXWORKS */ } // Reacquire lock to avoid race conditions. if (ACE_OS::thread_mutex_lock (&cv->waiters_lock_) != 0) return -1; --cv->waiters_; bool const last_waiter = cv->was_broadcast_ && cv->waiters_ == 0; if (ACE_OS::thread_mutex_unlock (&cv->waiters_lock_) != 0) return -1; # if defined (ACE_WIN32) if (result != (int)WAIT_OBJECT_0) { switch (result) { case WAIT_TIMEOUT: error = ETIME; break; default: error = ::GetLastError (); break; } result = -1; } # elif defined (ACE_VXWORKS) if (result == ERROR) { switch (errno) { case S_objLib_OBJ_TIMEOUT: error = ETIME; break; case S_objLib_OBJ_UNAVAILABLE: if (msec_timeout == 0) error = ETIME; break; default: error = errno; break; } result = -1; } # endif /* ACE_WIN32 || VXWORKS */ # if defined (ACE_HAS_SIGNAL_OBJECT_AND_WAIT) if (external_mutex->type_ == USYNC_PROCESS) { if (last_waiter) // This call atomically signals the event and // waits until it can acquire the mutex. This is important to // prevent unfairness. ACE_WIN32CALL (ACE_ADAPT_RETVAL (::SignalObjectAndWait (cv->waiters_done_, external_mutex->proc_mutex_, INFINITE, FALSE), result), int, -1, result); else { // We must always regain the , even when // errors occur because that's the guarantee that we give to // our callers. if (ACE_OS::mutex_lock (external_mutex) != 0) return -1; } return result; /* NOTREACHED */ } # endif /* ACE_HAS_SIGNAL_OBJECT_AND_WAIT */ // Note that this *must* be an "if" statement rather than an "else // if" statement since the caller may have timed out and hence the // result would have been -1 above. if (last_waiter) { // Release the signaler/broadcaster if we're the last waiter. # if defined (ACE_WIN32) if (ACE_OS::event_signal (&cv->waiters_done_) != 0) # else if (ACE_OS::sema_post (&cv->waiters_done_) != 0) # endif /* ACE_WIN32 */ return -1; } // We must always regain the , even when errors // occur because that's the guarantee that we give to our callers. if (ACE_OS::mutex_lock (external_mutex) != 0) return -1; return result; # elif defined (ACE_INTEGRITY) // INTEGRITY Semaphore has calls with timeout so this function could be emulated using it. // INTEGRITY-178, on the other hand, does not have a similar kernel call. // Not supporting it to mimic INTEGRITY-178 port. ACE_UNUSED_ARG (timeout); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_WTHREADS || ACE_VXWORKS || ACE_MQX */ # else ACE_UNUSED_ARG (cv); ACE_UNUSED_ARG (external_mutex); ACE_UNUSED_ARG (timeout); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_THREADS */ } #else int ACE_OS::cond_init (ACE_cond_t *cv, short type, const char *name, void *arg) { ACE_condattr_t attributes; if (ACE_OS::condattr_init (attributes, type) == 0 && ACE_OS::cond_init (cv, attributes, name, arg) == 0) { (void) ACE_OS::condattr_destroy (attributes); return 0; } return -1; } #endif /* ACE_LACKS_COND_T */ #if defined (ACE_WIN32) && defined (ACE_HAS_WTHREADS) int ACE_OS::cond_timedwait (ACE_cond_t *cv, ACE_thread_mutex_t *external_mutex, ACE_Time_Value *timeout) { ACE_OS_TRACE ("ACE_OS::cond_timedwait"); # if defined (ACE_HAS_THREADS) // Handle the easy case first. if (timeout == 0) return ACE_OS::cond_wait (cv, external_mutex); # if defined (ACE_HAS_WTHREADS_CONDITION_VARIABLE) int msec_timeout = 0; int result = 0; 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) msec_timeout = relative_time.msec (); ACE_OSCALL (ACE_ADAPT_RETVAL (::SleepConditionVariableCS (cv, external_mutex, msec_timeout), result), int, result); return result; #else // Prevent race conditions on the count. if (ACE_OS::thread_mutex_lock (&cv->waiters_lock_) != 0) return -1; ++cv->waiters_; if (ACE_OS::thread_mutex_unlock (&cv->waiters_lock_) != 0) return -1; int result = 0; int error = 0; int msec_timeout = 0; if (timeout != 0 && *timeout != ACE_Time_Value::zero) { // 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->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) msec_timeout = relative_time.msec (); } // We keep the lock held just long enough to increment the count of // waiters by one. Note that we can't keep it held across the call // to WaitForSingleObject since that will deadlock other calls to // ACE_OS::cond_signal(). if (ACE_OS::thread_mutex_unlock (external_mutex) != 0) return -1; // Wait to be awakened by a ACE_OS::signal() or ACE_OS::broadcast(). result = ::WaitForSingleObject (cv->sema_, msec_timeout); // Reacquire lock to avoid race conditions. if (ACE_OS::thread_mutex_lock (&cv->waiters_lock_) != 0) return -1; --cv->waiters_; bool const last_waiter = cv->was_broadcast_ && cv->waiters_ == 0; if (ACE_OS::thread_mutex_unlock (&cv->waiters_lock_) != 0) return -1; if (result != (int)WAIT_OBJECT_0) { switch (result) { case WAIT_TIMEOUT: error = ETIME; break; default: error = ::GetLastError (); break; } result = -1; } if (last_waiter) { // Release the signaler/broadcaster if we're the last waiter. if (ACE_OS::event_signal (&cv->waiters_done_) != 0) return -1; } // We must always regain the , even when errors // occur because that's the guarantee that we give to our callers. if (ACE_OS::thread_mutex_lock (external_mutex) != 0) result = -1; if (error != 0) { /* This assignment must only be done if error != 0, * since writing 0 to errno violates the POSIX specification. */ errno = error; } return result; # endif # else ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_THREADS */ } int ACE_OS::cond_wait (ACE_cond_t *cv, ACE_thread_mutex_t *external_mutex) { ACE_OS_TRACE ("ACE_OS::cond_wait"); # if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_WTHREADS_CONDITION_VARIABLE) int result; ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::SleepConditionVariableCS (cv, external_mutex, INFINITE), result), int); #else if (ACE_OS::thread_mutex_lock (&cv->waiters_lock_) != 0) return -1; ++cv->waiters_; if (ACE_OS::thread_mutex_unlock (&cv->waiters_lock_) != 0) return -1; int result = 0; int error = 0; // We keep the lock held just long enough to increment the count of // waiters by one. Note that we can't keep it held across the call // to ACE_OS::sema_wait() since that will deadlock other calls to // ACE_OS::cond_signal(). if (ACE_OS::thread_mutex_unlock (external_mutex) != 0) return -1; // Wait to be awakened by a ACE_OS::cond_signal() or // ACE_OS::cond_broadcast(). result = ::WaitForSingleObject (cv->sema_, INFINITE); // Reacquire lock to avoid race conditions. if (ACE_OS::thread_mutex_lock (&cv->waiters_lock_) != 0) return -1; cv->waiters_--; bool const last_waiter = cv->was_broadcast_ && cv->waiters_ == 0; if (ACE_OS::thread_mutex_unlock (&cv->waiters_lock_) != 0) return -1; if (result != (int)WAIT_OBJECT_0) { switch (result) { case WAIT_TIMEOUT: error = ETIME; break; default: error = ::GetLastError (); break; } } else if (last_waiter) { // Release the signaler/broadcaster if we're the last waiter. if (ACE_OS::event_signal (&cv->waiters_done_) != 0) return -1; } // We must always regain the , even when errors // occur because that's the guarantee that we give to our callers. if (ACE_OS::thread_mutex_lock (external_mutex) != 0) result = -1; // Reset errno in case mutex_lock() also fails... if (error != 0) { /* This assignment must only be done if error != 0, * since writing 0 to errno violates the POSIX specification. */ errno = error; } return result; #endif # else ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_THREADS */ } # endif /* ACE_HAS_WTHREADS */ /*****************************************************************************/ // CONDITIONS END /*****************************************************************************/ /*****************************************************************************/ // MUTEXES BEGIN /*****************************************************************************/ int ACE_OS::mutex_init (ACE_mutex_t *m, int lock_scope, const char *name, ACE_mutexattr_t *attributes, LPSECURITY_ATTRIBUTES sa, int lock_type) { // ACE_OS_TRACE ("ACE_OS::mutex_init"); #if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_PTHREADS) ACE_UNUSED_ARG (name); ACE_UNUSED_ARG (sa); # if defined (ACE_PTHREAD_MUTEXATTR_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. */ pthread_mutexattr_t l_attributes = {0}; # else pthread_mutexattr_t l_attributes; # endif if (attributes == 0) attributes = &l_attributes; int result = 0; int attr_init = 0; // have we initialized the local attributes. // Only do these initializations if the parameter // wasn't originally set. if (attributes == &l_attributes) { if (ACE_ADAPT_RETVAL (::pthread_mutexattr_init (attributes), result) == 0) { result = 0; attr_init = 1; // we have initialized these attributes } else { result = -1; // ACE_ADAPT_RETVAL used it for intermediate status } } if (result == 0 && lock_scope != 0) { # if defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_MUTEXATTR_PSHARED) (void) ACE_ADAPT_RETVAL (::pthread_mutexattr_setpshared (attributes, lock_scope), result); # endif /* _POSIX_THREAD_PROCESS_SHARED && !ACE_LACKS_MUTEXATTR_PSHARED */ } if (result == 0 && lock_type != 0) { # if defined (ACE_HAS_RECURSIVE_MUTEXES) && !defined (ACE_LACKS_PTHREAD_MUTEXATTR_SETTYPE) (void) ACE_ADAPT_RETVAL (::pthread_mutexattr_settype (attributes, lock_type), result); # endif /* ACE_HAS_RECURSIVE_MUTEXES */ } if (result == 0) { # if defined (ACE_PTHREAD_MUTEX_T_INITIALIZE) /* VxWorks 6.x API reference states: * If the memory for the mutex variable object has been allocated * dynamically, it is a good policy to always zero out the * block of memory so as to avoid spurious EBUSY return code * when calling this routine. * Tests shows this to be necessary. */ ACE_OS::memset (m, 0, sizeof (*m)); # endif if (ACE_ADAPT_RETVAL (::pthread_mutex_init (m, attributes), result) == 0) result = 0; else result = -1; // ACE_ADAPT_RETVAL used it for intermediate status } // Only do the deletions if the parameter wasn't // originally set. if (attributes == &l_attributes && attr_init) ::pthread_mutexattr_destroy (&l_attributes); return result; # elif defined (ACE_HAS_WTHREADS) m->type_ = lock_scope; SECURITY_ATTRIBUTES sa_buffer; SECURITY_DESCRIPTOR sd_buffer; switch (lock_scope) { case USYNC_PROCESS: m->proc_mutex_ = ::CreateMutexA (ACE_OS::default_win32_security_attributes_r (sa, &sa_buffer, &sd_buffer), FALSE, name); if (m->proc_mutex_ == 0) ACE_FAIL_RETURN (-1); else { // Make sure to set errno to ERROR_ALREADY_EXISTS if necessary. ACE_OS::set_errno_to_last_error (); return 0; } case USYNC_THREAD: return ACE_OS::thread_mutex_init (&m->thr_mutex_, lock_type, name, attributes); default: errno = EINVAL; return -1; } /* NOTREACHED */ # elif defined (ACE_VXWORKS) ACE_UNUSED_ARG (name); ACE_UNUSED_ARG (attributes); ACE_UNUSED_ARG (sa); ACE_UNUSED_ARG (lock_type); return (*m = ::semMCreate (lock_scope)) == 0 ? -1 : 0; # elif defined (ACE_INTEGRITY) ACE_UNUSED_ARG (lock_scope); ACE_UNUSED_ARG (name); ACE_UNUSED_ARG (attributes); ACE_UNUSED_ARG (sa); ACE_UNUSED_ARG (lock_type); // Implement mutex using a counting semaphore with initial value of 1. return ::CreateSemaphore (1, m) == Success ? 0 : -1; # endif /* ACE_HAS_PTHREADS */ #else ACE_UNUSED_ARG (m); ACE_UNUSED_ARG (lock_scope); ACE_UNUSED_ARG (name); ACE_UNUSED_ARG (attributes); ACE_UNUSED_ARG (sa); ACE_UNUSED_ARG (lock_type); ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_THREADS */ } int ACE_OS::mutex_destroy (ACE_mutex_t *m) { ACE_OS_TRACE ("ACE_OS::mutex_destroy"); #if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_PTHREADS) # if defined (ACE_LACKS_PTHREAD_MUTEX_DESTROY) ACE_UNUSED_ARG (m); ACE_NOTSUP_RETURN (-1); # else int result; ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_mutex_destroy (m), result), int); # endif /* ACE_LACKS_PTHREAD_MUTEX_DESTROY */ # elif defined (ACE_HAS_WTHREADS) switch (m->type_) { case USYNC_PROCESS: ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::CloseHandle (m->proc_mutex_), ace_result_), int, -1); case USYNC_THREAD: return ACE_OS::thread_mutex_destroy (&m->thr_mutex_); default: errno = EINVAL; return -1; } /* NOTREACHED */ # elif defined (ACE_VXWORKS) return ::semDelete (*m) == OK ? 0 : -1; # elif defined (ACE_INTEGRITY) return ACE_OS::sema_destroy (m); # endif /* Threads variety case */ #else ACE_UNUSED_ARG (m); ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_THREADS */ } #if defined (ACE_HAS_WCHAR) int ACE_OS::mutex_init (ACE_mutex_t *m, int lock_scope, const wchar_t *name, ACE_mutexattr_t *attributes, LPSECURITY_ATTRIBUTES sa, int lock_type) { #if defined (ACE_HAS_THREADS) && defined (ACE_HAS_WTHREADS) m->type_ = lock_scope; SECURITY_ATTRIBUTES sa_buffer; SECURITY_DESCRIPTOR sd_buffer; switch (lock_scope) { case USYNC_PROCESS: m->proc_mutex_ = ::CreateMutexW (ACE_OS::default_win32_security_attributes_r (sa, &sa_buffer, &sd_buffer), FALSE, name); if (m->proc_mutex_ == 0) ACE_FAIL_RETURN (-1); else { // Make sure to set errno to ERROR_ALREADY_EXISTS if necessary. ACE_OS::set_errno_to_last_error (); return 0; } case USYNC_THREAD: return ACE_OS::thread_mutex_init (&m->thr_mutex_, lock_type, name, attributes); } errno = EINVAL; return -1; #else /* ACE_HAS_THREADS && ACE_HAS_WTHREADS */ return ACE_OS::mutex_init (m, lock_scope, ACE_Wide_To_Ascii (name).char_rep (), attributes, sa, lock_type); #endif /* ACE_HAS_THREADS && ACE_HAS_WTHREADS */ } #endif /* ACE_HAS_WCHAR */ int ACE_OS::mutex_lock (ACE_mutex_t *m) { // ACE_OS_TRACE ("ACE_OS::mutex_lock"); #if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_PTHREADS) // Note, don't use "::" here since the following call is often a macro. int result; ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_mutex_lock (m), result), int); # elif defined (ACE_HAS_WTHREADS) switch (m->type_) { case USYNC_PROCESS: switch (::WaitForSingleObject (m->proc_mutex_, INFINITE)) { // // Timeout can't occur, so don't bother checking... // case WAIT_OBJECT_0: case WAIT_ABANDONED: // We will ignore abandonments in this method // Note that we still hold the lock return 0; default: // This is a hack, we need to find an appropriate mapping... ACE_OS::set_errno_to_last_error (); return -1; } case USYNC_THREAD: return ACE_OS::thread_mutex_lock (&m->thr_mutex_); default: errno = EINVAL; return -1; } /* NOTREACHED */ # elif defined (ACE_VXWORKS) return ::semTake (*m, WAIT_FOREVER) == OK ? 0 : -1; # elif defined (ACE_INTEGRITY) return ::WaitForSemaphore (*m) == Success ? 0 : -1; # endif /* Threads variety case */ #else ACE_UNUSED_ARG (m); ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_THREADS */ } int ACE_OS::mutex_lock (ACE_mutex_t *m, int &abandoned) { ACE_OS_TRACE ("ACE_OS::mutex_lock"); #if defined (ACE_HAS_THREADS) && defined (ACE_HAS_WTHREADS) abandoned = 0; switch (m->type_) { case USYNC_PROCESS: switch (::WaitForSingleObject (m->proc_mutex_, INFINITE)) { // // Timeout can't occur, so don't bother checking... // case WAIT_OBJECT_0: return 0; case WAIT_ABANDONED: abandoned = 1; return 0; // something goofed, but we hold the lock ... default: // This is a hack, we need to find an appropriate mapping... ACE_OS::set_errno_to_last_error (); return -1; } case USYNC_THREAD: return ACE_OS::thread_mutex_lock (&m->thr_mutex_); default: errno = EINVAL; return -1; } /* NOTREACHED */ #else ACE_UNUSED_ARG (m); ACE_UNUSED_ARG (abandoned); ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_THREADS and ACE_HAS_WTHREADS */ } int ACE_OS::mutex_lock (ACE_mutex_t *m, const ACE_Time_Value &timeout) { #if defined (ACE_HAS_THREADS) && defined (ACE_HAS_MUTEX_TIMEOUTS) # if defined (ACE_HAS_PTHREADS) int result; // "timeout" should be an absolute time. timespec_t ts = timeout; // Calls ACE_Time_Value::operator timespec_t(). // Note that the mutex should not be a recursive one, i.e., it // should only be a standard mutex or an error checking mutex. ACE_OSCALL (ACE_ADAPT_RETVAL (::pthread_mutex_timedlock (m, &ts), result), int, result); // We need to adjust this to make the errno values consistent. if (result == -1 && errno == ETIMEDOUT) errno = ETIME; return result; # elif defined (ACE_HAS_WTHREADS) // 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.to_relative_time (); switch (m->type_) { case USYNC_PROCESS: switch (::WaitForSingleObject (m->proc_mutex_, relative_time.msec ())) { case WAIT_OBJECT_0: case WAIT_ABANDONED: // We will ignore abandonments in this method // Note that we still hold the lock return 0; case WAIT_TIMEOUT: errno = ETIME; return -1; default: // This is a hack, we need to find an appropriate mapping... ACE_OS::set_errno_to_last_error (); return -1; } case USYNC_THREAD: ACE_NOTSUP_RETURN (-1); default: errno = EINVAL; return -1; } /* NOTREACHED */ # elif defined (ACE_VXWORKS) // 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.to_relative_time (); _Vx_freq_t const ticks_per_sec = ::sysClkRateGet (); int ticks = relative_time.sec() * ticks_per_sec + relative_time.usec () * ticks_per_sec / ACE_ONE_SECOND_IN_USECS; if (::semTake (*m, ticks) == ERROR) { if (errno == S_objLib_OBJ_TIMEOUT) // Convert the VxWorks errno to one that's common for to ACE // platforms. errno = ETIME; else if (errno == S_objLib_OBJ_UNAVAILABLE) errno = EBUSY; return -1; } else return 0; # endif /* ACE_HAS_PTHREADS */ #else ACE_UNUSED_ARG (m); ACE_UNUSED_ARG (timeout); ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_THREADS && ACE_HAS_MUTEX_TIMEOUTS */ } int ACE_OS::mutex_trylock (ACE_mutex_t *m) { ACE_OS_TRACE ("ACE_OS::mutex_trylock"); #if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_PTHREADS) // Note, don't use "::" here since the following call is often a macro. int result; ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_mutex_trylock (m), result), int); # elif defined (ACE_HAS_WTHREADS) switch (m->type_) { case USYNC_PROCESS: { // Try for 0 milliseconds - i.e. nonblocking. switch (::WaitForSingleObject (m->proc_mutex_, 0)) { case WAIT_OBJECT_0: return 0; case WAIT_ABANDONED: // We will ignore abandonments in this method. Note that // we still hold the lock. return 0; case WAIT_TIMEOUT: errno = EBUSY; return -1; default: ACE_OS::set_errno_to_last_error (); return -1; } } case USYNC_THREAD: return ACE_OS::thread_mutex_trylock (&m->thr_mutex_); default: errno = EINVAL; return -1; } /* NOTREACHED */ # elif defined (ACE_VXWORKS) if (::semTake (*m, NO_WAIT) == ERROR) if (errno == S_objLib_OBJ_UNAVAILABLE) { // couldn't get the semaphore errno = EBUSY; return -1; } else // error return -1; else // got the semaphore return 0; # elif defined (ACE_INTEGRITY) return ::TryToObtainSemaphore (*m) == Success ? 0 : -1; # endif /* Threads variety case */ #else ACE_UNUSED_ARG (m); ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_THREADS */ } int ACE_OS::mutex_trylock (ACE_mutex_t *m, int &abandoned) { #if defined (ACE_HAS_THREADS) && defined (ACE_HAS_WTHREADS) abandoned = 0; switch (m->type_) { case USYNC_PROCESS: { // Try for 0 milliseconds - i.e. nonblocking. switch (::WaitForSingleObject (m->proc_mutex_, 0)) { case WAIT_OBJECT_0: return 0; case WAIT_ABANDONED: abandoned = 1; return 0; // something goofed, but we hold the lock ... case WAIT_TIMEOUT: errno = EBUSY; return -1; default: ACE_OS::set_errno_to_last_error (); return -1; } } case USYNC_THREAD: return ACE_OS::thread_mutex_trylock (&m->thr_mutex_); default: errno = EINVAL; return -1; } /* NOTREACHED */ #else ACE_UNUSED_ARG (m); ACE_UNUSED_ARG (abandoned); ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_THREADS and ACE_HAS_WTHREADS */ } int ACE_OS::mutex_unlock (ACE_mutex_t *m) { ACE_OS_TRACE ("ACE_OS::mutex_unlock"); #if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_PTHREADS) // Note, don't use "::" here since the following call is often a macro. int result; ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_mutex_unlock (m), result), int); # elif defined (ACE_HAS_WTHREADS) switch (m->type_) { case USYNC_PROCESS: ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::ReleaseMutex (m->proc_mutex_), ace_result_), int, -1); case USYNC_THREAD: return ACE_OS::thread_mutex_unlock (&m->thr_mutex_); default: errno = EINVAL; return -1; } /* NOTREACHED */ # elif defined (ACE_VXWORKS) return ::semGive (*m) == OK ? 0 : -1; # elif defined (ACE_INTEGRITY) // Make sure the semaphore's value does not exceed its initial value, which is 1. // This guards against incorrect unlocks from threads without holding the lock. // This, however, does not prevent a race when two or more threads call this function // simultaneously and the calls to GetSemaphoreValue and ReleaseSemaphore interleave. // In that case, the semaphore's value could raise to above 1. // So, only call unlock when know for sure the thread is holding the lock! SignedValue curr_val; if (::GetSemaphoreValue (*m, &curr_val) != Success) return -1; if (curr_val == 1) { errno = EPERM; return -1; } return ::ReleaseSemaphore (*m) == Success ? 0 : -1; # endif /* Threads variety case */ #else ACE_UNUSED_ARG (m); ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_THREADS */ } void ACE_OS::mutex_lock_cleanup (void *mutex) { ACE_OS_TRACE ("ACE_OS::mutex_lock_cleanup"); #if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_PTHREADS) ACE_mutex_t *p_lock = (ACE_mutex_t *) mutex; ACE_OS::mutex_unlock (p_lock); # else ACE_UNUSED_ARG (mutex); # endif /* ACE_HAS_PTHREADS */ #else ACE_UNUSED_ARG (mutex); #endif /* ACE_HAS_THREADS */ } /*****************************************************************************/ // MUTEXES END /*****************************************************************************/ /*****************************************************************************/ // EVENTS BEGIN /*****************************************************************************/ #ifndef ACE_WIN32 int ACE_event_t::lock () { # if !ACE_EVENT_USE_MUTEX_PSHARED if (this->eventdata_->type_ == USYNC_PROCESS) return ACE_OS::sema_wait (&this->lock_); # endif return ACE_OS::mutex_lock (&this->eventdata_->lock_); } int ACE_event_t::unlock () { # if !ACE_EVENT_USE_MUTEX_PSHARED if (this->eventdata_->type_ == USYNC_PROCESS) return ACE_OS::sema_post (&this->lock_); # endif return ACE_OS::mutex_unlock (&this->eventdata_->lock_); } int ACE_event_t::wake_one () { # if !ACE_EVENT_USE_COND_PSHARED if (this->eventdata_->type_ == USYNC_PROCESS) { if (ACE_OS::sema_post (&this->semaphore_) != 0) return -1; } else # endif if (ACE_OS::cond_signal (&this->eventdata_->condition_) != 0) return -1; return 0; } #endif /* ACE_WIN32 */ int ACE_OS::event_destroy (ACE_event_t *event) { #if defined (ACE_WIN32) ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::CloseHandle (*event), ace_result_), int, -1); #elif defined (ACE_HAS_THREADS) if (!event->eventdata_) { errno = EINVAL; return -1; } // mutex_destroy()/cond_destroy() are called in a loop if the object // is BUSY. This avoids conditions where we fail to destroy these // objects because at time of destroy they were just being used in // another thread possibly causing deadlocks later on if they keep // being used after we're gone. if (event->eventdata_->type_ == USYNC_PROCESS) { if (event->name_) { int r1, r2; # if ACE_EVENT_USE_MUTEX_PSHARED // First destroy the mutex so locking after this will return // errors. while ((r1 = ACE_OS::mutex_destroy (&event->eventdata_->lock_)) == -1 && errno == EBUSY) ACE_OS::thr_yield (); # else r1 = ACE_OS::sema_destroy (&event->lock_); # endif # if ACE_EVENT_USE_COND_PSHARED // Now fix event to manual reset, raise signal and broadcast // until is's possible to destroy the condition. event->eventdata_->manual_reset_ = 1; while ((r2 = ACE_OS::cond_destroy (&event->eventdata_->condition_)) == -1 && errno == EBUSY) { event->eventdata_->is_signaled_ = 1; if (ACE_OS::cond_broadcast (&event->eventdata_->condition_) != 0) return -1; ACE_OS::thr_yield (); } # else r2 = ACE_OS::sema_destroy (&event->semaphore_); # endif ACE_OS::munmap (event->eventdata_, sizeof (ACE_eventdata_t)); ACE_OS::shm_unlink (ACE_TEXT_CHAR_TO_TCHAR (event->name_)); # if defined (ACE_HAS_ALLOC_HOOKS) ACE_Allocator::instance ()->free (event->name_); # else ACE_OS::free (event->name_); # endif /* ACE_HAS_ALLOC_HOOKS */ return r1 != 0 || r2 != 0 ? -1 : 0; } else // !name_ (not owned by this process) { ACE_OS::munmap (event->eventdata_, sizeof (ACE_eventdata_t)); # if !ACE_EVENT_USE_MUTEX_PSHARED ACE_OS::sema_destroy (&event->lock_); # endif # if !ACE_EVENT_USE_COND_PSHARED return ACE_OS::sema_destroy (&event->semaphore_); # endif } } else // USYNC_THREAD: { int r1, r2; // First destroy the mutex so locking after this will return errors. while ((r1 = ACE_OS::mutex_destroy (&event->eventdata_->lock_)) == -1 && errno == EBUSY) ACE_OS::thr_yield (); // Now fix event to manual reset, raise signal and broadcast until // it's possible to destroy the condition. event->eventdata_->manual_reset_ = 1; while ((r2 = ACE_OS::cond_destroy (&event->eventdata_->condition_)) == -1 && errno == EBUSY) { event->eventdata_->is_signaled_ = 1; if (ACE_OS::cond_broadcast (&event->eventdata_->condition_) != 0) return -1; ACE_OS::thr_yield (); } delete event->eventdata_; return r1 != 0 || r2 != 0 ? -1 : 0; } return 0; #else ACE_UNUSED_ARG (event); ACE_NOTSUP_RETURN (-1); #endif /* ACE_WIN32 */ } ACE_ALLOC_HOOK_DEFINE (ACE_eventdata_t) #ifndef ACE_WIN32 namespace { int eventdata_init (ACE_eventdata_t *evtdata, int type, int manual_reset, int initial_state, ACE_condattr_t *attributes, const char *name, void *arg, int init_condition = 1, int init_mutex = 1) { evtdata->type_ = type; evtdata->manual_reset_ = manual_reset; evtdata->is_signaled_ = initial_state; evtdata->auto_event_signaled_ = false; evtdata->waiting_threads_ = 0; evtdata->signal_count_ = 0; if (init_condition) { const int result = attributes ? ACE_OS::cond_init (&evtdata->condition_, *attributes, name, arg) : ACE_OS::cond_init (&evtdata->condition_, (short) type, name, arg); if (result != 0) return result; } return init_mutex ? ACE_OS::mutex_init (&evtdata->lock_, type, name, (ACE_mutexattr_t *) arg) : 0; } template void format_name (char (&str)[N], const char *name, const char (&suffix)[M]) { ACE_OS::strncpy (str, name, N - M); ACE_OS::strcat (str, suffix); } } #endif /* ACE_WIN32 */ int ACE_OS::event_init (ACE_event_t *event, int type, ACE_condattr_t *attributes, int manual_reset, int initial_state, const char *name, void *arg, LPSECURITY_ATTRIBUTES sa) { #if defined (ACE_WIN32) ACE_UNUSED_ARG (type); ACE_UNUSED_ARG (attributes); ACE_UNUSED_ARG (arg); SECURITY_ATTRIBUTES sa_buffer; SECURITY_DESCRIPTOR sd_buffer; *event = ::CreateEventA (ACE_OS::default_win32_security_attributes_r (sa, &sa_buffer, &sd_buffer), manual_reset, initial_state, name); if (*event == 0) ACE_FAIL_RETURN (-1); else { // Make sure to set errno to ERROR_ALREADY_EXISTS if necessary. ACE_OS::set_errno_to_last_error (); return 0; } #elif defined (ACE_HAS_THREADS) ACE_UNUSED_ARG (sa); event->name_ = 0; event->eventdata_ = 0; if (type == USYNC_PROCESS) { const char *name_p = name; bool owner = false; // Let's see if the shared memory entity already exists. ACE_HANDLE fd = ACE_OS::shm_open (ACE_TEXT_CHAR_TO_TCHAR (name_p), O_RDWR | O_CREAT | O_EXCL, ACE_DEFAULT_FILE_PERMS); if (fd == ACE_INVALID_HANDLE) { if (errno == EEXIST) fd = ACE_OS::shm_open (ACE_TEXT_CHAR_TO_TCHAR (name_p), O_RDWR | O_CREAT, ACE_DEFAULT_FILE_PERMS); if (fd == ACE_INVALID_HANDLE) // Still can't get it. return -1; } else { // We own this shared memory object! Let's set its size. if (ACE_OS::ftruncate (fd, sizeof (ACE_eventdata_t)) == -1) { ACE_OS::close (fd); return -1; } owner = true; } void *const mapped = ACE_OS::mmap (0, sizeof (ACE_eventdata_t), PROT_RDWR, MAP_SHARED, fd); ACE_eventdata_t *evtdata = reinterpret_cast (mapped); ACE_OS::close (fd); if (evtdata == MAP_FAILED) { if (owner) ACE_OS::shm_unlink (ACE_TEXT_CHAR_TO_TCHAR (name_p)); return -1; } event->eventdata_ = evtdata; if (owner) { event->name_ = ACE_OS::strdup (name_p); if (event->name_ == 0 || eventdata_init (event->eventdata_, USYNC_PROCESS, manual_reset, initial_state, attributes, name, arg, ACE_EVENT_USE_COND_PSHARED, ACE_EVENT_USE_MUTEX_PSHARED) != 0) { ACE_OS::munmap (evtdata, sizeof (ACE_eventdata_t)); ACE_OS::shm_unlink (ACE_TEXT_CHAR_TO_TCHAR (name_p)); return -1; } } int result = 0; # if !ACE_EVENT_USE_COND_PSHARED char sem_name[128] = {}; format_name (sem_name, name, "._ACE_EVTSEM_"); result = ACE_OS::sema_init (&event->semaphore_, 0, type, attributes, sem_name, arg); # endif # if !ACE_EVENT_USE_MUTEX_PSHARED if (result == 0) { char lck_name[128] = {}; format_name (lck_name, name, "._ACE_EVTLCK_"); result = ACE_OS::sema_init (&event->lock_, owner, type, attributes, lck_name, arg); } # endif # if !ACE_EVENT_USE_COND_PSHARED || !ACE_EVENT_USE_MUTEX_PSHARED if (result != 0 && owner) ACE_OS::shm_unlink (ACE_TEXT_CHAR_TO_TCHAR (name_p)); # endif return result; } else { ACE_NEW_RETURN (event->eventdata_, ACE_eventdata_t, -1); return eventdata_init (event->eventdata_, USYNC_THREAD, manual_reset, initial_state, attributes, name, arg); } #else ACE_UNUSED_ARG (event); ACE_UNUSED_ARG (manual_reset); ACE_UNUSED_ARG (initial_state); ACE_UNUSED_ARG (type); ACE_UNUSED_ARG (attributes); ACE_UNUSED_ARG (name); ACE_UNUSED_ARG (arg); ACE_UNUSED_ARG (sa); ACE_NOTSUP_RETURN (-1); #endif /* ACE_WIN32 */ } int ACE_OS::event_pulse (ACE_event_t *event) { #if defined (ACE_WIN32) ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::PulseEvent (*event), ace_result_), int, -1); #elif defined (ACE_HAS_THREADS) int error = 0; int result = event->lock (); if (result != 0) return result; if (event->eventdata_->waiting_threads_ > 0) { if (event->eventdata_->manual_reset_ == 1) { // Wakeup all waiters. # if !ACE_EVENT_USE_COND_PSHARED if (event->eventdata_->type_ == USYNC_PROCESS) { event->eventdata_->signal_count_ = event->eventdata_->waiting_threads_; for (unsigned long i = 0; i < event->eventdata_->signal_count_; ++i) if (ACE_OS::sema_post (&event->semaphore_) != 0) { event->eventdata_->signal_count_ = 0; result = -1; error = errno; } if (result == 0) while (event->eventdata_->signal_count_ != 0 && event->eventdata_->waiting_threads_ != 0) ACE_OS::thr_yield (); } else #endif if (ACE_OS::cond_broadcast (&event->eventdata_->condition_) != 0) { result = -1; error = errno; } else event->eventdata_->signal_count_ = event->eventdata_->waiting_threads_; } else // Auto-reset event: wakeup one waiter. { if (event->wake_one () != 0) { result = -1; error = errno; } event->eventdata_->auto_event_signaled_ = true; } } event->eventdata_->is_signaled_ = 0; if (event->unlock () != 0) return -1; if (result == -1) errno = error; return result; #else ACE_UNUSED_ARG (event); ACE_NOTSUP_RETURN (-1); #endif /* ACE_WIN32 */ } int ACE_OS::event_reset (ACE_event_t *event) { #if defined (ACE_WIN32) ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::ResetEvent (*event), ace_result_), int, -1); #elif defined (ACE_HAS_THREADS) if (event->lock () != 0) return -1; event->eventdata_->is_signaled_ = 0; event->eventdata_->auto_event_signaled_ = false; return event->unlock (); #else ACE_UNUSED_ARG (event); ACE_NOTSUP_RETURN (-1); #endif /* ACE_WIN32 */ } int ACE_OS::event_signal (ACE_event_t *event) { #if defined (ACE_WIN32) ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::SetEvent (*event), ace_result_), int, -1); #elif defined (ACE_HAS_THREADS) int error = 0; int result = event->lock (); if (result != 0) return result; if (event->eventdata_->manual_reset_ == 1) { // wakeup all # if !ACE_EVENT_USE_COND_PSHARED if (event->eventdata_->type_ == USYNC_PROCESS) { if (ACE_OS::sema_post (&event->semaphore_) != 0) { result = -1; error = errno; } } else #endif if (ACE_OS::cond_broadcast (&event->eventdata_->condition_) != 0) { result = -1; error = errno; } if (result == 0) event->eventdata_->is_signaled_ = 1; } else // Auto-reset event { if (event->eventdata_->waiting_threads_ == 0) event->eventdata_->is_signaled_ = 1; else if (event->wake_one () != 0) { result = -1; error = errno; } event->eventdata_->auto_event_signaled_ = true; } if (event->unlock () != 0) return -1; if (result == -1) errno = error; return result; #else ACE_UNUSED_ARG (event); ACE_NOTSUP_RETURN (-1); #endif /* ACE_WIN32 */ } int ACE_OS::event_timedwait (ACE_event_t *event, ACE_Time_Value *timeout, int use_absolute_time) { #if defined (ACE_WIN32) DWORD result; if (timeout && *timeout == ACE_Time_Value::zero) // Do a "poll". result = ::WaitForSingleObject (*event, 0); else { // Wait for upto number of milliseconds. Note // that we must convert between absolute time (which is passed // as a parameter) and relative time (which is what // WaitForSingleObjects() expects). // parameter is given in absolute or relative value // depending on parameter . int msec_timeout = 0; if (!timeout) { msec_timeout = INFINITE; } else if (use_absolute_time) { // Time is given in absolute time, we should use // gettimeofday() to calculate relative time 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 // Rapp for pointing this. if (relative_time > ACE_Time_Value::zero) msec_timeout = relative_time.msec (); } else // time is given in relative time, just convert it into // milliseconds and use it msec_timeout = timeout->msec (); result = ::WaitForSingleObject (*event, msec_timeout); } switch (result) { case WAIT_OBJECT_0: return 0; case WAIT_TIMEOUT: errno = ETIME; return -1; default: // This is a hack, we need to find an appropriate mapping... ACE_OS::set_errno_to_last_error (); return -1; } #elif defined (ACE_HAS_THREADS) int error = 0; int result = event->lock (); if (result != 0) return result; if (event->eventdata_->is_signaled_ == 1) { if (event->eventdata_->manual_reset_ == 0) { // AUTO: reset state event->eventdata_->is_signaled_ = 0; event->eventdata_->auto_event_signaled_ = false; } } else // event is currently not signaled { ++event->eventdata_->waiting_threads_; ACE_Time_Value *absolute_timeout = timeout, converted_time; // cond_timedwait() expects absolute time, check flag if (timeout && use_absolute_time == 0) { converted_time = timeout->to_absolute_time (); absolute_timeout = &converted_time; } while (event->eventdata_->is_signaled_ == 0 && !event->eventdata_->auto_event_signaled_) # if !ACE_EVENT_USE_COND_PSHARED if (event->eventdata_->type_ == USYNC_PROCESS) { if (event->unlock () != 0) { --event->eventdata_->waiting_threads_; return -1; } if (ACE_OS::sema_wait (&event->semaphore_, absolute_timeout) != 0) { result = -1; error = (errno == ETIMEDOUT) // Semaphores use ETIMEDOUT (POSIX) ? ETIME : errno; } bool signalled = false; if (result == 0 && event->eventdata_->signal_count_ > 0) { --event->eventdata_->signal_count_; signalled = true; } if (event->lock () != 0) { --event->eventdata_->waiting_threads_; return -1; } if (result != 0) break; if (event->eventdata_->manual_reset_ == 1 && event->eventdata_->is_signaled_ == 1 && ACE_OS::sema_post (&event->semaphore_) != 0) { result = -1; error = errno; break; } if (signalled) break; } else #endif { if (ACE_OS::cond_timedwait (&event->eventdata_->condition_, &event->eventdata_->lock_, absolute_timeout) != 0) { result = -1; error = errno; break; } if (event->eventdata_->signal_count_ > 0) { --event->eventdata_->signal_count_; break; } } // Reset the auto_event_signaled_ to false now that we have woken up. if (event->eventdata_->auto_event_signaled_) event->eventdata_->auto_event_signaled_ = false; --event->eventdata_->waiting_threads_; } if (event->unlock () != 0) return -1; if (result == -1) errno = error; return result; #else ACE_UNUSED_ARG (event); ACE_UNUSED_ARG (timeout); ACE_UNUSED_ARG (use_absolute_time); ACE_NOTSUP_RETURN (-1); #endif /* ACE_WIN32 */ } /*****************************************************************************/ // EVENTS END /*****************************************************************************/ int ACE_OS::lwp_getparams (ACE_Sched_Params &sched_params) { ACE_UNUSED_ARG (sched_params); ACE_NOTSUP_RETURN (-1); } int ACE_OS::lwp_setparams (const ACE_Sched_Params &sched_params) { ACE_UNUSED_ARG (sched_params); ACE_NOTSUP_RETURN (-1); } #if defined ACE_HAS_THREADS && defined ACE_LACKS_RWLOCK_T namespace { struct UniqueName { UniqueName (int type, const void *addr) { #ifdef ACE_WIN32 if (type == USYNC_THREAD) { this->named_ = false; return; } this->named_ = true; #else ACE_UNUSED_ARG (type); #endif ACE_OS::unique_name (addr, &this->buffer_[0], ACE_UNIQUE_NAME_LEN); } operator const ACE_TCHAR * () const { #ifdef ACE_WIN32 if (!this->named_) { return 0; } #endif return &this->buffer_[0]; } ACE_TCHAR buffer_[ACE_UNIQUE_NAME_LEN]; #ifdef ACE_WIN32 bool named_; #endif }; enum RWLockCleanup {RWLC_CondAttr, RWLC_Lock, RWLC_CondReaders, RWLC_CondWriters}; struct RWLockCleaner { RWLockCleaner (ACE_condattr_t &attr, ACE_rwlock_t *rw) : state_ (RWLC_CondAttr) , attr_ (attr) , rw_ (rw) {} ~RWLockCleaner () { ACE_Errno_Guard error (errno); switch (this->state_) { case RWLC_CondWriters: ACE_OS::cond_destroy (&this->rw_->waiting_writers_); ACE_FALLTHROUGH; case RWLC_CondReaders: ACE_OS::cond_destroy (&this->rw_->waiting_readers_); ACE_FALLTHROUGH; case RWLC_Lock: ACE_OS::mutex_destroy (&this->rw_->lock_); ACE_FALLTHROUGH; case RWLC_CondAttr: ACE_OS::condattr_destroy (this->attr_); } } RWLockCleanup state_; ACE_condattr_t &attr_; ACE_rwlock_t *rw_; }; } #endif #if !defined (ACE_HAS_THREADS) || defined (ACE_LACKS_RWLOCK_T) int ACE_OS::rwlock_init (ACE_rwlock_t *rw, int type, const ACE_TCHAR *, void *arg) { // ACE_OS_TRACE ("ACE_OS::rwlock_init"); # if defined (ACE_HAS_THREADS) && defined (ACE_LACKS_RWLOCK_T) // NT, POSIX, and VxWorks don't support this natively. ACE_condattr_t attributes; if (ACE_OS::condattr_init (attributes, type) != 0) return -1; RWLockCleaner cleanup (attributes, rw); if (ACE_OS::mutex_init (&rw->lock_, type, UniqueName (type, &rw->lock_), (ACE_mutexattr_t *) arg) != 0) return -1; cleanup.state_ = RWLC_Lock; if (ACE_OS::cond_init (&rw->waiting_readers_, attributes, UniqueName (type, &rw->waiting_readers_), arg) != 0) return -1; cleanup.state_ = RWLC_CondReaders; if (ACE_OS::cond_init (&rw->waiting_writers_, attributes, UniqueName (type, &rw->waiting_writers_), arg) != 0) return -1; cleanup.state_ = RWLC_CondWriters; if (ACE_OS::cond_init (&rw->waiting_important_writer_, attributes, UniqueName (type, &rw->waiting_important_writer_), arg) != 0) return -1; cleanup.state_ = RWLC_CondAttr; rw->ref_count_ = 0; rw->num_waiting_writers_ = 0; rw->num_waiting_readers_ = 0; rw->important_writer_ = false; return 0; # else ACE_UNUSED_ARG (rw); ACE_UNUSED_ARG (type); ACE_UNUSED_ARG (arg); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_THREADS */ } #endif /* ! ACE_HAS_THREADS || ACE_LACKS_RWLOCK_T */ int ACE_OS::sched_params (const ACE_Sched_Params &sched_params, ACE_id_t id) { ACE_OS_TRACE ("ACE_OS::sched_params"); #if defined (ACE_HAS_PTHREADS) && \ (!defined (ACE_LACKS_SETSCHED) || \ defined (ACE_HAS_PTHREAD_SCHEDPARAM)) if (sched_params.quantum () != ACE_Time_Value::zero) { // quantums not supported errno = EINVAL; return -1; } // Thanks to Thilo Kielmann for // providing this code for 1003.1c PThreads. Please note that this // has only been tested for POSIX 1003.1c threads, and may cause // problems with other PThreads flavors! struct sched_param param; param.sched_priority = sched_params.priority (); if (sched_params.scope () == ACE_SCOPE_PROCESS) { # if defined (ACE_HAS_PTHREAD_SCHEDPARAM) ACE_UNUSED_ARG (id); ACE_NOTSUP_RETURN (-1); # 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_HAS_PTHREAD_SCHEDPARAM */ } else if (sched_params.scope () == ACE_SCOPE_THREAD) { ACE_thread_t thr_id = ACE_OS::thr_self (); int result; ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_setschedparam (thr_id, sched_params.policy (), ¶m), result), int); } else // sched_params.scope () == ACE_SCOPE_LWP, which isn't POSIX { errno = EINVAL; return -1; } #elif defined (ACE_WIN32) if (sched_params.scope () == ACE_SCOPE_THREAD) { // Setting the REALTIME_PRIORITY_CLASS on Windows is almost always // a VERY BAD THING. This include guard will allow people // to easily disable this feature in ACE. #if !defined (ACE_DISABLE_WIN32_INCREASE_PRIORITY) // Set the priority class of this process to the REALTIME process class // _if_ the policy is ACE_SCHED_FIFO. Otherwise, set to NORMAL. if (!::SetPriorityClass (::GetCurrentProcess (), (sched_params.policy () == ACE_SCHED_FIFO || sched_params.policy () == ACE_SCHED_RR) ? REALTIME_PRIORITY_CLASS : NORMAL_PRIORITY_CLASS)) { ACE_OS::set_errno_to_last_error (); return -1; } #endif /* ACE_DISABLE_WIN32_INCREASE_PRIORITY */ // Now that we have set the priority class of the process, set the // priority of the current thread to the desired value. return ACE_OS::thr_setprio (sched_params.priority ()); } else if (sched_params.scope () == ACE_SCOPE_PROCESS) { HANDLE hProcess = ::OpenProcess (PROCESS_SET_INFORMATION, FALSE, id == ACE_SELF ? ::GetCurrentProcessId() : id); if (!hProcess) { ACE_OS::set_errno_to_last_error(); return -1; } // There is no way for us to set the priority of the thread when we // are setting the priority of a different process. So just ignore // the priority argument when ACE_SCOPE_PROCESS is specified. // Setting the priority class will automatically increase the base // priority of all the threads within a process while maintaining the // relative priorities of the threads within it. if (!::SetPriorityClass (hProcess, (sched_params.policy () == ACE_SCHED_FIFO || sched_params.policy () == ACE_SCHED_RR) ? REALTIME_PRIORITY_CLASS : NORMAL_PRIORITY_CLASS)) { ACE_OS::set_errno_to_last_error (); ::CloseHandle (hProcess); return -1; } ::CloseHandle (hProcess); return 0; } else { errno = EINVAL; return -1; } #elif defined (ACE_VXWORKS) ACE_UNUSED_ARG (id); // There is only one class of priorities on VxWorks, and no time // quanta. So, just set the current thread's priority. if (sched_params.policy () != ACE_SCHED_FIFO || sched_params.scope () != ACE_SCOPE_PROCESS || sched_params.quantum () != ACE_Time_Value::zero) { errno = EINVAL; return -1; } // Set the thread priority on the current thread. return ACE_OS::thr_setprio (sched_params.priority ()); #else ACE_UNUSED_ARG (sched_params); ACE_UNUSED_ARG (id); ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_PTHREADS */ } int ACE_OS::scheduling_class (const char */*class_name*/, ACE_id_t &/*id*/) { ACE_NOTSUP_RETURN (-1); } int ACE_OS::set_scheduling_params (const ACE_Sched_Params &/*sched_params*/, ACE_id_t /*id*/) { ACE_NOTSUP_RETURN (-1); } #if defined (ACE_INTEGRITY) && !defined (ACE_HAS_PTHREADS) namespace ACE_OS { // Workaround for INTEGRITY-178's SetupTask's lack of argument for Task's thread function. // INTEGRITY-178's SetupTask function that creates a Task, i.e. thread, does not have an argument // that can be passed to the newly created thread's entry point. // This works around that by storing the argument for each Task's entry point in a global map, keyed // by ACE_hthread_t of the corresponding Task. The value is a pointer to an ACE_Base_Thread_Adapter // instance that wraps the user-defined thread function and its argument. // This also works for INTEGRITY calls to create Tasks, such as CommonCreateTask, that don't receive // an argument for the Task's entry point. ACE_OS::thr_create currently uses CommonCreateTask // so this workaround is being used on INTEGRITY as well as INTEGRITY-178. static std::map integrity_task_args; // Semaphores used to coordinate joining thread with the joined thread. // There should be at most one joining thread. static std::map integrity_join_semas; // Lock for the two data structures above. static ACE_thread_mutex_t integrity_task_args_lock; # if defined (ACE_INTEGRITY178B) // INTEGRITY-178 Task API requires a stack to be provided explicitly in the SetupTask call. // INTEGRITY doesn't need this. # if !defined (ACE_INTEGRITY178B_DEFAULT_STACK_SIZE) # define ACE_INTEGRITY178B_DEFAULT_STACK_SIZE 0x10000 // 64 KB # endif // We can have a maximum of ACE_MAX_NUM_THREADS Tasks including the Initial Task (i.e. main thread). // The Initial Task already has a stack provided by the OS. // Here, we reserve the stacks for the Tasks dynamically created by SetupTask(). # define NUM_DYNAMIC_THREADS (ACE_MAX_NUM_THREADS - 1) class ACE_Int178_Stack_Manager { private: typedef Address Int178_Stack[ACE_INTEGRITY178B_DEFAULT_STACK_SIZE / sizeof (Address)]; typedef Int178_Stack Int178_Stack_Pool[NUM_DYNAMIC_THREADS]; struct StackInfo { ACE_hthread_t id {}; bool occupied {}; }; typedef StackInfo StackPoolInfo[NUM_DYNAMIC_THREADS]; public: // Get an unoccupied stack and return its address. // This is only called before a Task is created with SetupTask(). // Return the start address of a stack if one available. Otherwise, return nullptr. // In case of success, also update @a slot to the index of the stack in the pool. void *acquire (unsigned &slot) { LockGuard guard (lock_); for (unsigned i = 0; i < NUM_DYNAMIC_THREADS; ++i) { StackInfo &si = stack_pool_info_[i]; if (!si.occupied) { si.occupied = true; slot = i; return stack_pool_[i]; } } // We have created the maximum number of concurrent threads! return nullptr; } // Update the owner thread of a stack returned by a previous successfull call to acquire(). // This is separate from acquire() because we have to pass a stack to a SetupTask() but // only know the thread id after the call has returned. void owner (ACE_hthread_t id, unsigned slot) { LockGuard guard (lock_); stack_pool_info_[slot].id = id; } // Release the stack assigned to a thread so it can be reused. // Return true if success, false if there is no thread with the given id. bool release (ACE_hthread_t id) { LockGuard guard (lock_); for (unsigned i = 0; i < NUM_DYNAMIC_THREADS; ++i) { StackInfo &si = stack_pool_info_[i]; if (si.id == id) { si.occupied = false; return true; } } return false; } private: Int178_Stack_Pool stack_pool_; StackPoolInfo stack_pool_info_; ACE_thread_mutex_t lock_; }; static ACE_Int178_Stack_Manager int178_stack_manager; # endif /* ACE_INTEGRITY178B */ extern "C" void integrity_task_adapter () { const ACE_hthread_t curr_task = CurrentTask (); ACE_Base_Thread_Adapter *thr_arg = nullptr; { // The thread argument should be ready when this function starts LockGuard guard (integrity_task_args_lock); thr_arg = integrity_task_args[curr_task]; } // Call the wrapper of the actual user-provided function (*thr_arg->entry_point ()) (thr_arg); # if defined (ACE_HAS_TSS_EMULATION) && !defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) // Now we can delete the TSS metadata entry for the Task ACE_INTEGRITY_TSS_Impl *const obj = static_cast (ACE_Object_Manager::preallocated_object[ACE_Object_Manager::ACE_INTEGRITY_TSS_IMPL]); obj->erase (curr_task); # endif { // , and its argument entry. LockGuard guard (integrity_task_args_lock); integrity_task_args.erase (curr_task); // Signal any thread joining with this thread ::ReleaseSemaphore (integrity_join_semas[curr_task]); } # if defined (ACE_INTEGRITY178B) // Release the stack so other thread can use it. // This is at the end of the function so that the stack is really not used anymore. int178_stack_manager.release (curr_task); # endif } } #endif /* ACE_INTEGRITY && !ACE_HAS_PTHREADS */ int ACE_OS::thr_create (ACE_THR_FUNC func, void *args, long flags, ACE_thread_t *thr_id, ACE_hthread_t *thr_handle, long priority, void *stack, size_t stacksize, ACE_Base_Thread_Adapter *thread_adapter, const char **thr_name) { ACE_OS_TRACE ("ACE_OS::thr_create"); if (ACE_BIT_DISABLED (flags, THR_DETACHED) && ACE_BIT_DISABLED (flags, THR_JOINABLE)) ACE_SET_BITS (flags, THR_JOINABLE); #if defined (ACE_NO_THREAD_ADAPTER) # define ACE_THREAD_FUNCTION func # define ACE_THREAD_ARGUMENT args #else /* ! defined (ACE_NO_THREAD_ADAPTER) */ # define ACE_THREAD_FUNCTION thread_args->entry_point () # define ACE_THREAD_ARGUMENT thread_args #endif /* ! defined (ACE_NO_THREAD_ADAPTER) */ ACE_Base_Thread_Adapter *thread_args = 0; if (thread_adapter == 0) #if defined (ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS) ACE_NEW_RETURN (thread_args, 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(), flags), -1); #else ACE_NEW_RETURN (thread_args, ACE_OS_Thread_Adapter (func, args, (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME, flags), -1); #endif /* ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS */ else thread_args = thread_adapter; std::unique_ptr auto_thread_args; if (thread_adapter == 0) auto_thread_args.reset (thread_args); #if defined (ACE_HAS_THREADS) // *** Set Stack Size # if defined (ACE_NEEDS_HUGE_THREAD_STACKSIZE) if (stacksize < ACE_NEEDS_HUGE_THREAD_STACKSIZE) stacksize = ACE_NEEDS_HUGE_THREAD_STACKSIZE; # endif /* ACE_NEEDS_HUGE_THREAD_STACKSIZE */ ACE_thread_t tmp_thr; if (thr_id == 0) thr_id = &tmp_thr; ACE_hthread_t tmp_handle; if (thr_handle == 0) thr_handle = &tmp_handle; # if defined (ACE_HAS_PTHREADS) int result; # if defined (ACE_PTHREAD_ATTR_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. */ pthread_attr_t attr = {0}; # else pthread_attr_t attr; # endif if (ACE_ADAPT_RETVAL(::pthread_attr_init(&attr), result) != 0) return -1; if (stacksize != 0) { size_t size = stacksize; # if defined (PTHREAD_STACK_MIN) if (size < static_cast (PTHREAD_STACK_MIN)) size = PTHREAD_STACK_MIN; # endif /* PTHREAD_STACK_MIN */ # if !defined (ACE_LACKS_PTHREAD_ATTR_SETSTACKSIZE) # if !defined (ACE_LACKS_PTHREAD_ATTR_SETSTACK) int result; if (stack != 0) result = ACE_ADAPT_RETVAL (pthread_attr_setstack (&attr, stack, size), result); else result = ACE_ADAPT_RETVAL (pthread_attr_setstacksize (&attr, size), result); if (result == -1) # else if (ACE_ADAPT_RETVAL (pthread_attr_setstacksize (&attr, size), result) == -1) # endif /* !ACE_LACKS_PTHREAD_ATTR_SETSTACK */ { ::pthread_attr_destroy (&attr); return -1; } # else ACE_UNUSED_ARG (size); # endif /* !ACE_LACKS_PTHREAD_ATTR_SETSTACKSIZE */ } // *** Set Stack Address # if defined (ACE_LACKS_PTHREAD_ATTR_SETSTACK) # if !defined (ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR) if (stack != 0) { if (ACE_ADAPT_RETVAL(::pthread_attr_setstackaddr (&attr, stack), result) != 0) { ::pthread_attr_destroy (&attr); return -1; } } # else ACE_UNUSED_ARG (stack); # endif /* !ACE_LACKS_PTHREAD_ATTR_SETSTACKADDR */ # endif /* ACE_LACKS_PTHREAD_ATTR_SETSTACK */ // *** Deal with various attributes if (flags != 0) { // *** Set Detach state # if !defined (ACE_LACKS_SETDETACH) if (ACE_BIT_ENABLED (flags, THR_DETACHED) || ACE_BIT_ENABLED (flags, THR_JOINABLE)) { int dstate = PTHREAD_CREATE_JOINABLE; if (ACE_BIT_ENABLED (flags, THR_DETACHED)) dstate = PTHREAD_CREATE_DETACHED; if (ACE_ADAPT_RETVAL(::pthread_attr_setdetachstate (&attr, dstate), result) != 0) { ::pthread_attr_destroy (&attr); return -1; } } // Note: if ACE_LACKS_SETDETACH and THR_DETACHED is enabled, we // call ::pthread_detach () below. If THR_DETACHED is not // enabled, we call ::pthread_detach () in the Thread_Manager, // after joining with the thread. # endif /* ACE_LACKS_SETDETACH */ // *** Set Policy # if !defined (ACE_LACKS_SETSCHED) || defined (ACE_HAS_PTHREAD_SCHEDPARAM) // If we wish to set the priority explicitly, we have to enable // explicit scheduling, and a policy, too. if (priority != ACE_DEFAULT_THREAD_PRIORITY) { ACE_SET_BITS (flags, THR_EXPLICIT_SCHED); if (ACE_BIT_DISABLED (flags, THR_SCHED_FIFO) && ACE_BIT_DISABLED (flags, THR_SCHED_RR) && ACE_BIT_DISABLED (flags, THR_SCHED_DEFAULT)) ACE_SET_BITS (flags, THR_SCHED_DEFAULT); } if (ACE_BIT_ENABLED (flags, THR_SCHED_FIFO) || ACE_BIT_ENABLED (flags, THR_SCHED_RR) || ACE_BIT_ENABLED (flags, THR_SCHED_DEFAULT)) { int spolicy; # if defined (ACE_HAS_ONLY_SCHED_OTHER) // SunOS, thru version 5.6, only supports SCHED_OTHER. spolicy = SCHED_OTHER; # else // Make sure to enable explicit scheduling, in case we didn't // enable it above (for non-default priority). ACE_SET_BITS (flags, THR_EXPLICIT_SCHED); if (ACE_BIT_ENABLED (flags, THR_SCHED_DEFAULT)) spolicy = SCHED_OTHER; else if (ACE_BIT_ENABLED (flags, THR_SCHED_FIFO)) spolicy = SCHED_FIFO; # if defined (SCHED_IO) else if (ACE_BIT_ENABLED (flags, THR_SCHED_IO)) spolicy = SCHED_IO; # else else if (ACE_BIT_ENABLED (flags, THR_SCHED_IO)) { errno = ENOSYS; return -1; } # endif /* SCHED_IO */ else spolicy = SCHED_RR; # endif /* ACE_HAS_ONLY_SCHED_OTHER */ (void) ACE_ADAPT_RETVAL(::pthread_attr_setschedpolicy (&attr, spolicy), result); if (result != 0) { ::pthread_attr_destroy (&attr); return -1; } } // *** Set Priority (use reasonable default priorities) # if defined(ACE_HAS_PTHREADS) // If we wish to explicitly set a scheduling policy, we also // have to specify a priority. We choose a "middle" priority as // default. Maybe this is also necessary on other POSIX'ish // implementations? if ((ACE_BIT_ENABLED (flags, THR_SCHED_FIFO) || ACE_BIT_ENABLED (flags, THR_SCHED_RR) || ACE_BIT_ENABLED (flags, THR_SCHED_DEFAULT)) && priority == ACE_DEFAULT_THREAD_PRIORITY) { if (ACE_BIT_ENABLED (flags, THR_SCHED_FIFO)) priority = ACE_THR_PRI_FIFO_DEF; else if (ACE_BIT_ENABLED (flags, THR_SCHED_RR)) priority = ACE_THR_PRI_RR_DEF; else // THR_SCHED_DEFAULT priority = ACE_THR_PRI_OTHER_DEF; } # endif /* ACE_HAS_PTHREADS */ if (priority != ACE_DEFAULT_THREAD_PRIORITY) { struct sched_param sparam; ACE_OS::memset ((void *) &sparam, 0, sizeof sparam); # if defined (PTHREAD_MAX_PRIORITY) && !defined(ACE_HAS_PTHREADS) /* For MIT pthreads... */ sparam.prio = (std::min) (priority, PTHREAD_MAX_PRIORITY); # elif defined(ACE_HAS_PTHREADS) // The following code forces priority into range. if (ACE_BIT_ENABLED (flags, THR_SCHED_FIFO)) sparam.sched_priority = (std::min) (ACE_THR_PRI_FIFO_MAX, (std::max) (ACE_THR_PRI_FIFO_MIN, priority)); else if (ACE_BIT_ENABLED(flags, THR_SCHED_RR)) sparam.sched_priority = (std::min) (ACE_THR_PRI_RR_MAX, (std::max) (ACE_THR_PRI_RR_MIN, priority)); else // Default policy, whether set or not sparam.sched_priority = (std::min) (ACE_THR_PRI_OTHER_MAX, (std::max) (ACE_THR_PRI_OTHER_MIN, priority)); # elif defined (PRIORITY_MAX) sparam.sched_priority = (std::min) (priority, (long) PRIORITY_MAX); # else sparam.sched_priority = priority; # endif /* PTHREAD_MAX_PRIORITY */ { (void) ACE_ADAPT_RETVAL(::pthread_attr_setschedparam (&attr, &sparam), result); if (result != 0) { ::pthread_attr_destroy (&attr); return -1; } } } # 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)) { int sched = PTHREAD_EXPLICIT_SCHED; if (ACE_BIT_ENABLED (flags, THR_INHERIT_SCHED)) sched = PTHREAD_INHERIT_SCHED; if (ACE_ADAPT_RETVAL(::pthread_attr_setinheritsched (&attr, sched), result) != 0) { ::pthread_attr_destroy (&attr); return -1; } } # endif /* ACE_LACKS_SETINHERITSCHED */ # else /* ACE_LACKS_SETSCHED */ ACE_UNUSED_ARG (priority); # endif /* ACE_LACKS_SETSCHED */ // *** Set pthread name # if defined (ACE_HAS_PTHREAD_ATTR_SETNAME) if (thr_name && *thr_name) { if (ACE_ADAPT_RETVAL(::pthread_attr_setname (&attr, const_cast(*thr_name)), result) != 0) { ::pthread_attr_destroy (&attr); return -1; } } # endif /* ACE_HAS_PTHREAD_ATTR_SETNAME */ // *** Set Scope # if !defined (ACE_LACKS_THREAD_PROCESS_SCOPING) if (ACE_BIT_ENABLED (flags, THR_SCOPE_SYSTEM) || ACE_BIT_ENABLED (flags, THR_SCOPE_PROCESS)) { # if defined (ACE_LACKS_PTHREAD_SCOPE_PROCESS) int scope = PTHREAD_SCOPE_SYSTEM; # else /* ACE_LACKS_PTHREAD_SCOPE_PROCESS */ int scope = PTHREAD_SCOPE_PROCESS; # endif /* ACE_LACKS_PTHREAD_SCOPE_PROCESS */ if (ACE_BIT_ENABLED (flags, THR_SCOPE_SYSTEM)) scope = PTHREAD_SCOPE_SYSTEM; if (ACE_ADAPT_RETVAL(::pthread_attr_setscope (&attr, scope), result) != 0) { ::pthread_attr_destroy (&attr); return -1; } } # endif /* !ACE_LACKS_THREAD_PROCESS_SCOPING */ # ifdef ACE_HAS_PTHREAD_ATTR_SETCREATESUSPEND_NP if (ACE_BIT_ENABLED (flags, THR_SUSPENDED)) { if (ACE_ADAPT_RETVAL(::pthread_attr_setcreatesuspend_np(&attr), result) != 0) { ::pthread_attr_destroy (&attr); return -1; } } # endif /* !ACE_HAS_PTHREAD_ATTR_SETCREATESUSPEND_NP */ if (ACE_BIT_ENABLED (flags, THR_NEW_LWP)) { // Increment the number of LWPs by one to emulate the // SunOS semantics. int lwps = ACE_OS::thr_getconcurrency (); if (lwps == -1) { if (errno == ENOTSUP) // Suppress the ENOTSUP because it's harmless. errno = 0; else // This should never happen on SunOS: // ::thr_getconcurrency () should always succeed. return -1; } else if (ACE_OS::thr_setconcurrency (lwps + 1) == -1) { if (errno == ENOTSUP) { // Unlikely: ::thr_getconcurrency () is supported // but ::thr_setconcurrency () is not? } else return -1; } } } ACE_OSCALL (ACE_ADAPT_RETVAL (::pthread_create (thr_id, &attr, thread_args->entry_point (), thread_args), result), int, result); ::pthread_attr_destroy (&attr); // This is a SunOS or POSIX implementation of pthreads, where we // assume that ACE_thread_t and ACE_hthread_t are the same. If this // *isn't* correct on some platform, please let us know. if (result != -1) *thr_handle = *thr_id; auto_thread_args.release (); // *** Set pthread name (second try) # if !defined (ACE_HAS_PTHREAD_ATTR_SETNAME) # if defined (ACE_HAS_PTHREAD_SETNAME_NP) if (thr_name && *thr_name) { ACE_OSCALL (ACE_ADAPT_RETVAL(::pthread_setname_np (*thr_id, *thr_name), result), int, result); } # else ACE_UNUSED_ARG (thr_name); # endif /* ACE_HAS_PTHREAD_SETNAME_NP */ # endif /* !ACE_HAS_PTHREAD_ATTR_SETNAME */ return result; # elif defined (ACE_HAS_WTHREADS) ACE_UNUSED_ARG (thr_name); ACE_UNUSED_ARG (stack); # if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) if (ACE_BIT_ENABLED (flags, THR_USE_AFX)) { CWinThread *cwin_thread = ::AfxBeginThread ((AFX_THREADPROC) thread_args->entry_point (), thread_args, priority, 0, flags | THR_SUSPENDED); // Have to duplicate the handle because // CWinThread::~CWinThread() closes the original handle. (void) ::DuplicateHandle (::GetCurrentProcess (), cwin_thread->m_hThread, ::GetCurrentProcess (), thr_handle, 0, TRUE, DUPLICATE_SAME_ACCESS); *thr_id = cwin_thread->m_nThreadID; if (ACE_BIT_ENABLED (flags, THR_SUSPENDED) == 0) cwin_thread->ResumeThread (); // cwin_thread will be deleted in AfxThreadExit() // Warning: If AfxThreadExit() is called from within the // thread, ACE_TSS_Cleanup->thread_exit() never gets called ! } else # endif /* ACE_HAS_MFC */ { int const start_suspended = ACE_BIT_ENABLED (flags, THR_SUSPENDED); if (priority != ACE_DEFAULT_THREAD_PRIORITY) // If we need to set the priority, then we need to start the // thread in a suspended mode. ACE_SET_BITS (flags, THR_SUSPENDED); *thr_handle = (void *) ACE_BEGINTHREADEX (0, static_cast (stacksize), thread_args->entry_point (), thread_args, flags, thr_id); if (thr_name && *thr_name && *thr_handle) { SetThreadDescription (*thr_handle, ACE_Ascii_To_Wide (*thr_name).wchar_rep ()); } if (priority != ACE_DEFAULT_THREAD_PRIORITY && *thr_handle != 0) { // Set the priority of the new thread and then let it // continue, but only if the user didn't start it suspended // in the first place! if (ACE_OS::thr_setprio (*thr_handle, priority) != 0) { return -1; } if (start_suspended == 0) { ACE_OS::thr_continue (*thr_handle); } } } // Close down the handle if no one wants to use it. if (thr_handle == &tmp_handle && tmp_handle != 0) ::CloseHandle (tmp_handle); if (*thr_handle != 0) { auto_thread_args.release (); return 0; } else ACE_FAIL_RETURN (-1); /* NOTREACHED */ # elif defined (ACE_VXWORKS) // The hard-coded values below are what ::sp () would use. (::sp () // hardcodes priority to 100, flags to VX_FP_TASK, and stacksize to // 20,000.) stacksize should be an even integer. If a stack is not // specified, ::taskSpawn () is used so that we can set the // priority, flags, and stacksize. If a stack is specified, // ::taskInit ()/::taskActivate() are used. // If called with thr_create() defaults, use same default values as ::sp (): if (priority == ACE_DEFAULT_THREAD_PRIORITY) priority = 100; // Assumes that there is a floating point coprocessor. As noted // above, ::sp () hardcodes this, so we should be safe with it. if (flags == 0) flags = VX_FP_TASK; if (stacksize == 0) stacksize = 20000; ACE_thread_t tid; # if 0 /* Don't support setting of stack, because it doesn't seem to work. */ if (stack == 0) { # else ACE_UNUSED_ARG (stack); # endif /* 0 */ // The call below to ::taskSpawn () causes VxWorks to assign a // unique task name of the form: "t" + an integer, because the // first argument is 0. tid = ::taskSpawn (thr_name && *thr_name ? const_cast (*thr_name) : 0, priority, (int) flags, stacksize, thread_args->entry_point (), (ACE_VX_USR_ARG_T) thread_args, 0, 0, 0, 0, 0, 0, 0, 0, 0); # if 0 /* Don't support setting of stack, because it doesn't seem to work. */ } else { // If a task name (thr_id) was not supplied, then the task will // not have a unique name. That's VxWorks' behavior. // Carve out a TCB at the beginning of the stack space. The TCB // occupies 400 bytes with VxWorks 5.3.1/I386. WIND_TCB *tcb = (WIND_TCB *) stack; // The TID is defined to be the address of the TCB. int status = ::taskInit (tcb, thr_name && *thr_name ? const_cast (*thr_name) : 0, priority, (int) flags, (char *) stack + sizeof (WIND_TCB), (int) (stacksize - sizeof (WIND_TCB)), thread_args->entry_point (), (int) thread_args, 0, 0, 0, 0, 0, 0, 0, 0, 0); if (status == OK) { // The task was successfully initialized, now activate it. status = ::taskActivate ((ACE_hthread_t) tcb); } tid = status == OK ? (ACE_thread_t) tcb : ERROR; } # endif /* 0 */ if (tid == ACE_VX_TASK_ID_ERROR) return -1; else { if (thr_id) *thr_id = tid; if (thr_handle) *thr_handle = tid; if (thr_name && !(*thr_name)) *thr_name = ::taskName (tid); auto_thread_args.release (); return 0; } # elif defined (ACE_INTEGRITY) ACE_UNUSED_ARG (flags); // From INTEGRITY-178 Kernel Reference Guide, Sec. 4 - Task Kernel Calls for SetupTask: // "Priority must be less than or equal to the Priority of the source Task. Moreover, when the head // is being used (e.g., when using malloc or the C++ new operator), Priority must be set to the // Maximum Priority of the Initial Task so that the Maximum Priority of the new Task will be the // same as that of the Initial Task." // We start from the Initial Task and all new Tasks will use the same Maximum Priority. Value max_parent_prio, unused_weight; Error err_code = ::GetMaximumPriorityAndWeight (CurrentTask (), &max_parent_prio, &unused_weight); if (err_code != Success) return -1; // Disregard the input priority value priority = max_parent_prio; # if defined (ACE_INTEGRITY178B) // Use the pre-allocated stack if no stack provided unsigned slot = NUM_DYNAMIC_THREADS; if (!stack) { stack = int178_stack_manager.acquire (slot); if (!stack) return -1; stacksize = ACE_INTEGRITY178B_DEFAULT_STACK_SIZE; } // Don't let this Task run immediately; we have to set its entrypoint's argument below. err_code = ::SetupTask (AddressSpaceObjectNumber (1), priority /* priority */, 0 /* weight */, 0 /* timeslice */, (Address) stack /* stack */, (Address) stacksize /* stackLength */, true /* enableClibrary */, true /* allocTLS */, (Address) &integrity_task_adapter, false /* startIt */, thr_name ? const_cast (*thr_name) : nullptr /* name */, 0 /* symbolFile */, thr_handle /* newTask */, 0 /* newActivity */); # else ACE_UNUSED_ARG (stack); // INTEGRITY has kernel calls in which we can pass argument for the new Task's entry point, // e.g. CommonCreateTaskWithArgument. // However, we are imitating INTEGRITY-178 and the call without entrypoint's argument is used. err_code = ::CommonCreateTask (priority, (Address) &integrity_task_adapter /* entrypoint */, (Address) stacksize, thr_name ? const_cast (*thr_name) : nullptr /* name */, thr_handle /* newtask */); # endif if (err_code != Success) { # if defined (ACE_INTEGRITY178B) // Cleanup the pre-allocated stack if one is assigned. if (slot != NUM_DYNAMIC_THREADS) { int178_stack_manager.release (*thr_handle); } # endif return -1; } # if defined (ACE_INTEGRITY178B) // Set the owner of the acquired stack if one from the stack pool is being used. if (slot != NUM_DYNAMIC_THREADS) { int178_stack_manager.owner (*thr_handle, slot); } # endif *thr_id = *thr_handle; { // Set the argument for the new Task's entrypoint, then run it. LockGuard guard (integrity_task_args_lock); integrity_task_args[*thr_handle] = thread_args; Semaphore sema; if (::CreateSemaphore (0, &sema) != Success) return -1; integrity_join_semas[*thr_handle] = sema; } return RunTask (*thr_handle) == Success ? 0 : -1; # endif /* ACE_HAS_PTHREADS */ #else ACE_UNUSED_ARG (func); ACE_UNUSED_ARG (args); ACE_UNUSED_ARG (flags); ACE_UNUSED_ARG (thr_id); ACE_UNUSED_ARG (thr_handle); ACE_UNUSED_ARG (priority); ACE_UNUSED_ARG (stack); ACE_UNUSED_ARG (stacksize); ACE_UNUSED_ARG (thr_name); ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_THREADS */ } void ACE_OS::thr_exit (ACE_THR_FUNC_RETURN status) { ACE_OS_TRACE ("ACE_OS::thr_exit"); #if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_PTHREADS) && !defined (ACE_LACKS_PTHREAD_EXIT) ::pthread_exit (status); # elif defined (ACE_HAS_WTHREADS) // Can't call it here because on NT, the thread is exited // directly by ACE_Thread_Adapter::invoke (). // ACE_TSS_Cleanup::instance ()->thread_exit (status); # if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) int using_afx = -1; // An ACE_Thread_Descriptor really is an ACE_OS_Thread_Descriptor. // But without #including ace/Thread_Manager.h, we don't know that. ACE_OS_Thread_Descriptor *td = ACE_Base_Thread_Adapter::thr_desc_log_msg (); if (td) using_afx = ACE_BIT_ENABLED (td->flags (), THR_USE_AFX); # endif /* ACE_HAS_MFC && (ACE_HAS_MFC != 0) */ // Call TSS destructors. ACE_OS::cleanup_tss (0 /* not main thread */); // Exit the thread. // Allow CWinThread-destructor to be invoked from AfxEndThread. // _endthreadex will be called from AfxEndThread so don't exit the // thread now if we are running an MFC thread. # if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) if (using_afx != -1) { if (using_afx) ::AfxEndThread (status); else ACE_ENDTHREADEX (status); } else { // Not spawned by ACE_Thread_Manager, use the old buggy // version. You should seriously consider using // ACE_Thread_Manager to spawn threads. The following code is // know to cause some problem. CWinThread *pThread = ::AfxGetThread (); if (!pThread || pThread->m_nThreadID != ACE_OS::thr_self ()) ACE_ENDTHREADEX (status); else ::AfxEndThread (status); } # else ACE_ENDTHREADEX (status); # endif /* ACE_HAS_MFC && ACE_HAS_MFS != 0*/ # elif defined (ACE_HAS_VXTHREADS) ACE_UNUSED_ARG (status); ::taskDelete (ACE_OS::thr_self ()); # elif defined (ACE_INTEGRITY) ACE_UNUSED_ARG (status); const ACE_hthread_t curr_task = CurrentTask (); ACE_INTEGRITY_TSS_Impl* const obj = static_cast (ACE_Object_Manager::preallocated_object[ACE_Object_Manager::ACE_INTEGRITY_TSS_IMPL]); obj->erase (curr_task); { // Signal any thread joining with this thread LockGuard guard (integrity_task_args_lock); ::ReleaseSemaphore (integrity_join_semas[curr_task]); } # if defined (ACE_INTEGRITY178B) // Release the assigned stack int178_stack_manager.release (curr_task); # endif // Any stack usage from this call? Exit (0); # else ACE_UNUSED_ARG (status); # endif /* ACE_HAS_PTHREADS */ #else ACE_UNUSED_ARG (status); #endif /* ACE_HAS_THREADS */ } #if defined (ACE_HAS_VXTHREADS) // Leave this in the global scope to allow // users to adjust the delay value. int ACE_THR_JOIN_DELAY = 5; int ACE_OS::thr_join (ACE_hthread_t thr_handle, ACE_THR_FUNC_RETURN *status) { // We can't get the status of the thread if (status != 0) { *status = 0; } // This method can not support joining all threads if (ACE_OS::thr_cmp (thr_handle, ACE_OS::NULL_hthread)) { ACE_NOTSUP_RETURN (-1); } int retval = ESRCH; ACE_thread_t current = ACE_OS::thr_self (); // Make sure we are not joining ourself if (ACE_OS::thr_cmp (thr_handle, current)) { retval = EDEADLK; } else { // Whether the task exists or not // we will return a successful value retval = 0; // Verify that the task id still exists while (taskIdVerify (thr_handle) == OK) { // Wait a bit to see if the task is still active. ACE_OS::sleep (ACE_THR_JOIN_DELAY); } } // Adapt the return value into errno and return value. // The ACE_ADAPT_RETVAL macro doesn't exactly do what // we need to do here, so we do it manually. if (retval != 0) { errno = retval; retval = -1; } return retval; } int ACE_OS::thr_join (ACE_thread_t waiter_id, ACE_thread_t *thr_id, ACE_THR_FUNC_RETURN *status) { thr_id = 0; return ACE_OS::thr_join (waiter_id, status); } #endif /* ACE_HAS_VXTHREADS */ #if defined (ACE_INTEGRITY) && !defined (ACE_HAS_PTHREADS) int ACE_OS::thr_join (ACE_hthread_t thr_handle, ACE_THR_FUNC_RETURN *) { if (ACE_OS::thr_cmp (thr_handle, ACE_OS::NULL_hthread)) { ACE_NOTSUP_RETURN (-1); } int retval = 0; ACE_hthread_t current; ACE_OS::thr_self (current); if (ACE_OS::thr_cmp (thr_handle, current)) { retval = EDEADLK; } else { Semaphore join_sema = 0; std::map::iterator it = integrity_join_semas.end(); { LockGuard guard (integrity_task_args_lock); it = integrity_join_semas.find (thr_handle); if (it == integrity_join_semas.end ()) { errno = EINVAL; return -1; } join_sema = it->second; } if (::WaitForSemaphore (join_sema) != Success) retval = EINVAL; else { LockGuard guard (integrity_task_args_lock); // The joined thread has finished, we can delete the associated semaphore. # if !defined (ACE_INTEGRITY178B) // INTEGRITY provides API to close semaphore but INTEGRITY-178 does not ::CloseSemaphore (join_sema); # endif integrity_join_semas.erase (it); } } if (retval) { errno = retval; retval = -1; } return retval; } int ACE_OS::thr_join (ACE_thread_t waiter_id, ACE_thread_t *, ACE_THR_FUNC_RETURN* status) { return ACE_OS::thr_join (waiter_id, status); } #endif /* ACE_INTEGRITY && !ACE_HAS_PTHREADS */ int ACE_OS::thr_key_detach (ACE_thread_key_t key) { #if defined (ACE_HAS_WTHREADS) || defined (ACE_HAS_TSS_EMULATION) TSS_Cleanup_Instance cleanup; if (cleanup.valid ()) { return cleanup->thread_detach_key (key); } else { return -1; } #else ACE_UNUSED_ARG (key); ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_WTHREADS || ACE_HAS_TSS_EMULATION */ } int ACE_OS::thr_get_affinity (ACE_hthread_t thr_id, size_t cpu_set_size, cpu_set_t * cpu_mask) { #if defined (ACE_HAS_PTHREAD_GETAFFINITY_NP) // Handle of the thread, which is NPTL thread-id, normally a big number if (::pthread_getaffinity_np (thr_id, cpu_set_size, cpu_mask) != 0) { return -1; } return 0; #elif defined (ACE_HAS_2_PARAM_SCHED_GETAFFINITY) // The process-id is expected as , which can be a thread-id of // linux-thread, thus making binding to cpu of that particular thread only. // If you are using this flag for NPTL-threads, however, please pass as a // thr_id process id obtained by ACE_OS::getpid () ACE_UNUSED_ARG (cpu_set_size); if (::sched_getaffinity(thr_id, cpu_mask) == -1) { return -1; } return 0; #elif defined (ACE_HAS_SCHED_GETAFFINITY) // The process-id is expected as , which can be a thread-id of // linux-thread, thus making binding to cpu of that particular thread only. // If you are using this flag for NPTL-threads, however, please pass as a // thr_id process id obtained by ACE_OS::getpid () if (::sched_getaffinity(thr_id, cpu_set_size, cpu_mask) == -1) { return -1; } return 0; #elif defined (ACE_HAS_TASKCPUAFFINITYSET) ACE_UNUSED_ARG (cpu_set_size); int result = 0; if (ACE_ADAPT_RETVAL (::taskCpuAffinitySet (thr_id, *cpu_mask), result) == -1) { return -1; } return 0; #else ACE_UNUSED_ARG (thr_id); ACE_UNUSED_ARG (cpu_set_size); ACE_UNUSED_ARG (cpu_mask); ACE_NOTSUP_RETURN (-1); #endif } int ACE_OS::thr_set_affinity (ACE_hthread_t thr_id, size_t cpu_set_size, const cpu_set_t * cpu_mask) { #if defined (ACE_HAS_PTHREAD_SETAFFINITY_NP) if (::pthread_setaffinity_np (thr_id, cpu_set_size, cpu_mask) != 0) { return -1; } return 0; #elif defined (ACE_HAS_2_PARAM_SCHED_SETAFFINITY) // The process-id is expected as , which can be a thread-id of // linux-thread, thus making binding to cpu of that particular thread only. // If you are using this flag for NPTL-threads, however, please pass as a // thr_id process id obtained by ACE_OS::getpid (), but whole process will bind your CPUs // ACE_UNUSED_ARG (cpu_set_size); if (::sched_setaffinity (thr_id, cpu_mask) == -1) { return -1; } return 0; #elif defined (ACE_HAS_SCHED_SETAFFINITY) // The process-id is expected as , which can be a thread-id of // linux-thread, thus making binding to cpu of that particular thread only. // If you are using this flag for NPTL-threads, however, please pass as a // thr_id process id obtained by ACE_OS::getpid (), but whole process will bind your CPUs // if (::sched_setaffinity (thr_id, cpu_set_size, cpu_mask) == -1) { return -1; } return 0; #elif defined (ACE_HAS_TASKCPUAFFINITYSET) ACE_UNUSED_ARG (cpu_set_size); int result = 0; if (ACE_ADAPT_RETVAL (::taskCpuAffinitySet (thr_id, *cpu_mask), result) == -1) { return -1; } return 0; #else ACE_UNUSED_ARG (thr_id); ACE_UNUSED_ARG (cpu_set_size); ACE_UNUSED_ARG (cpu_mask); ACE_NOTSUP_RETURN (-1); #endif } int ACE_OS::thr_key_used (ACE_thread_key_t key) { #if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION) TSS_Cleanup_Instance cleanup; if (cleanup.valid ()) { cleanup->thread_use_key (key); return 0; } return -1; #else ACE_UNUSED_ARG (key); ACE_NOTSUP_RETURN (-1); #endif /* ACE_WIN32 || ACE_HAS_TSS_EMULATION */ } #if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) int ACE_OS::thr_keycreate_native (ACE_OS_thread_key_t *key, # if defined (ACE_HAS_THR_C_DEST) ACE_THR_C_DEST dest # else ACE_THR_DEST dest # endif /* ACE_HAS_THR_C_DEST */ ) { // can't trace here. Trace uses TSS // ACE_OS_TRACE ("ACE_OS::thr_keycreate_native"); # if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_PTHREADS) int result; ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_key_create (key, dest), result), int); # elif defined (ACE_HAS_WTHREADS) ACE_UNUSED_ARG (dest); *key = ::TlsAlloc (); if (*key == ACE_SYSCALL_FAILED) ACE_FAIL_RETURN (-1); return 0; # endif /* ACE_HAS_PTHREADS */ # else ACE_UNUSED_ARG (key); ACE_UNUSED_ARG (dest); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_THREADS */ } #endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE */ int ACE_OS::thr_keycreate (ACE_thread_key_t *key, # if defined (ACE_HAS_THR_C_DEST) ACE_THR_C_DEST dest) # else ACE_THR_DEST dest) # endif /* ACE_HAS_THR_C_DEST */ { // ACE_OS_TRACE ("ACE_OS::thr_keycreate"); #if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_TSS_EMULATION) if (ACE_TSS_Emulation::next_key (*key) == 0) { ACE_TSS_Emulation::tss_destructor (*key, dest); // Extract out the thread-specific table instance and stash away // the key and destructor so that we can free it up later on... TSS_Cleanup_Instance cleanup (TSS_Cleanup_Instance::CREATE); if (cleanup.valid ()) { return cleanup->insert (*key, dest); } else { return -1; } } else return -1; # elif defined (ACE_HAS_WTHREADS) if (ACE_OS::thr_keycreate_native (key, dest) == 0) { // Extract out the thread-specific table instance and stash away // the key and destructor so that we can free it up later on... TSS_Cleanup_Instance cleanup (TSS_Cleanup_Instance::CREATE); if (cleanup.valid ()) { return cleanup->insert (*key, dest); } else { return -1; } } else return -1; /* NOTREACHED */ # elif defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) return ACE_OS::thr_keycreate_native (key, dest); # else ACE_UNUSED_ARG (key); ACE_UNUSED_ARG (dest); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_TSS_EMULATION */ # else /* ACE_HAS_THREADS */ ACE_UNUSED_ARG (key); ACE_UNUSED_ARG (dest); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_THREADS */ } #if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) int ACE_OS::thr_keyfree_native (ACE_OS_thread_key_t key) { ACE_OS_TRACE ("ACE_OS::thr_keyfree_native"); # if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_BROKEN_THREAD_KEYFREE) || defined (ACE_HAS_THR_KEYDELETE) // For some systems, e.g. LynxOS, we need to ensure that // any registered thread destructor action for this slot // is now disabled. Otherwise in the event of a dynamic library // unload of libACE, by a program not linked with libACE, // ACE_TSS_cleanup will be invoked again at the thread exit // after libACE has been actually been unmapped from memory. (void) ACE_OS::thr_setspecific_native (key, 0); # endif /* ACE_HAS_BROKEN_THREAD_KEYFREE */ # if defined (ACE_HAS_PTHREADS) # if defined (ACE_LACKS_PTHREAD_KEY_DELETE) ACE_UNUSED_ARG (key); ACE_NOTSUP_RETURN (-1); # else return ::pthread_key_delete (key); # endif /* ACE_LACKS_PTHREAD_KEY_DELETE */ # elif defined (ACE_HAS_THR_KEYDELETE) return ::thr_keydelete (key); # elif defined (ACE_HAS_WTHREADS) ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::TlsFree (key), ace_result_), int, -1); # else ACE_UNUSED_ARG (key); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_PTHREADS */ # else ACE_UNUSED_ARG (key); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_THREADS */ } #endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE */ int ACE_OS::thr_keyfree (ACE_thread_key_t key) { ACE_OS_TRACE ("ACE_OS::thr_keyfree"); # if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_TSS_EMULATION) // Release the key in the TSS_Emulation administration ACE_TSS_Emulation::release_key (key); TSS_Cleanup_Instance cleanup; if (cleanup.valid ()) { return cleanup->free_key (key); } return -1; # elif defined (ACE_HAS_WTHREADS) // Extract out the thread-specific table instance and free up // the key and destructor. TSS_Cleanup_Instance cleanup; if (cleanup.valid ()) { return cleanup->free_key (key); } return -1; # elif defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) return ACE_OS::thr_keyfree_native (key); # else ACE_UNUSED_ARG (key); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_TSS_EMULATION */ # else /* ACE_HAS_THREADS */ ACE_UNUSED_ARG (key); ACE_NOTSUP_RETURN (-1); return 0; # endif /* ACE_HAS_THREADS */ } int ACE_OS::thr_setprio (const ACE_Sched_Priority prio) { // Set the thread priority on the current thread. ACE_hthread_t my_thread_id; ACE_OS::thr_self (my_thread_id); return ACE_OS::thr_setprio (my_thread_id, prio); } # if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) int ACE_OS::thr_setspecific_native (ACE_OS_thread_key_t key, void *data) { // ACE_OS_TRACE ("ACE_OS::thr_setspecific_native"); # if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_PTHREADS) int result; ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_setspecific (key, data), result), int); # elif defined (ACE_HAS_WTHREADS) ::TlsSetValue (key, data); return 0; # else /* ACE_HAS_PTHREADS */ ACE_UNUSED_ARG (key); ACE_UNUSED_ARG (data); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_PTHREADS */ # else ACE_UNUSED_ARG (key); ACE_UNUSED_ARG (data); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_THREADS */ } # endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE */ int ACE_OS::thr_setspecific (ACE_thread_key_t key, void *data) { // ACE_OS_TRACE ("ACE_OS::thr_setspecific"); #if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_TSS_EMULATION) if (ACE_TSS_Emulation::is_key (key) == 0) { errno = EINVAL; data = 0; return -1; } else { ACE_TSS_Emulation::ts_object (key) = data; TSS_Cleanup_Instance cleanup; if (cleanup.valid ()) { cleanup->thread_use_key (key); // for TSS_Cleanup purposes treat stetting data to zero // like detaching. This is a consequence of POSIX allowing // deletion of a "used" key. if (data == 0) { cleanup->thread_detach_key (key); } return 0; } else { return -1; } } # elif defined (ACE_HAS_WTHREADS) if (ACE_OS::thr_setspecific_native (key, data) == 0) { TSS_Cleanup_Instance cleanup; if (cleanup.valid ()) { cleanup->thread_use_key (key); // for TSS_Cleanup purposes treat stetting data to zero // like detaching. This is a consequence of POSIX allowing // deletion of a "used" key. if (data == 0) { cleanup->thread_detach_key (key); } return 0; } return -1; } return -1; # elif defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) return ACE_OS::thr_setspecific_native (key, data); # else /* ACE_HAS_TSS_EMULATION */ ACE_UNUSED_ARG (key); ACE_UNUSED_ARG (data); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_TSS_EMULATION */ # else /* ACE_HAS_THREADS */ ACE_UNUSED_ARG (key); ACE_UNUSED_ARG (data); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_THREADS */ } void ACE_OS::unique_name (const void *object, char *name, size_t length) { // The process ID will provide uniqueness between processes on the // same machine. The "this" pointer of the will provide // uniqueness between other "live" objects in the same process. The // uniqueness of this name is therefore only valid for the life of // . ACE_OS::snprintf (name, length, "%p%d", object, static_cast (ACE_OS::getpid ())); } #if defined (ACE_USES_WCHAR) void ACE_OS::unique_name (const void *object, wchar_t *name, size_t length) { // The process ID will provide uniqueness between processes on the // same machine. The "this" pointer of the will provide // uniqueness between other "live" objects in the same process. The // uniqueness of this name is therefore only valid for the life of // . ACE_OS::snprintf (name, length, ACE_TEXT ("%p%d"), object, static_cast (ACE_OS::getpid ())); } #endif ACE_END_VERSIONED_NAMESPACE_DECL #if defined (ACE_VXWORKS) && !defined (__RTP__) # include /**/ /* for ::sp() */ # include /**/ /* for ::sysClkRateGet() */ # include "ace/Service_Config.h" #if !defined (ACE_LACKS_VA_FUNCTIONS) // This global function can be used from the VxWorks shell to pass // arguments to a C main () function. // // usage: -> spa main, "arg1", "arg2" // // All arguments must be quoted, even numbers. int spa (FUNCPTR entry, ...) { // The called entrypoint can get the function name plus the normal 10 // optional arguments. static ACE_VX_USR_ARG_T const ACE_MAX_ARGS = 1 + 10; static char *argv[ACE_MAX_ARGS] = { 0 }; va_list pvar; ACE_VX_USR_ARG_T argc; // Hardcode a program name because the real one isn't available // through the VxWorks shell. argv[0] = const_cast ("ace_main"); // Peel off arguments to spa () and put into argv. va_arg () isn't // necessarily supposed to return 0 when done, though since the // VxWorks shell uses a fixed number (10) of arguments, it might 0 // the unused ones. This function could be used to increase that // limit, but then it couldn't depend on the trailing 0. So, the // number of arguments would have to be passed. va_start (pvar, entry); for (argc = 1; argc < ACE_MAX_ARGS; ++argc) { argv[argc] = va_arg (pvar, char *); if (argv[argc] == 0) break; } if (argc >= ACE_MAX_ARGS && argv[ACE_MAX_ARGS - 1] != 0) { // Try to read another arg, and warn user if the limit was exceeded. // // Note that the VxWorks shell arguments change from int to long when // using a 64bit compiler. Cast the argument up so that the format // specifier remains correct for either build type. if (va_arg (pvar, char *) != 0) ACE_OS::fprintf (stderr, "spa(): number of arguments limited to %ld\n", (long)ACE_MAX_ARGS); } else { // fill unused argv slots with 0 to get rid of leftovers // from previous invocations for (ACE_VX_USR_ARG_T i = argc; i < ACE_MAX_ARGS; ++i) argv[i] = 0; } // The hard-coded options are what ::sp () uses, except for the // larger stack size (instead of ::sp ()'s 20000). ACE_VX_TASK_ID const ret = ::taskSpawn (argv[0], // task name 100, // task priority VX_FP_TASK, // task options ACE_NEEDS_HUGE_THREAD_STACKSIZE, // stack size entry, // entry point argc, // first argument to main () (ACE_VX_USR_ARG_T) argv, // second argument to main () 0, 0, 0, 0, 0, 0, 0, 0); va_end (pvar); // ::taskSpawn () returns TASK_ID_ERROR on // error return ret == ACE_VX_TASK_ID_ERROR ? -1 : 0; } #endif /* !ACE_LACKS_VA_FUNCTIONS */ // A helper function for the extended spa functions static void add_to_argv (ACE_VX_USR_ARG_T& argc, char** argv, int max_args, char* string) { char indouble = 0; size_t previous = 0; size_t length = ACE_OS::strlen (string); if (length > 0) { // We use <= to make sure that we get the last argument for (size_t i = 0; i <= length; i++) { // Is it a double quote that hasn't been escaped? if (string[i] == '\"' && (i == 0 || string[i - 1] != '\\')) { indouble ^= 1; if (indouble) { // We have just entered a double quoted string, so // save the starting position of the contents. previous = i + 1; } else { // We have just left a double quoted string, so // zero out the ending double quote. string[i] = '\0'; } } else if (string[i] == '\\') // Escape the next character { // The next character is automatically skipped because // of the memmove(). ACE_OS::memmove (string + i, string + i + 1, length); --length; } else if (!indouble && (ACE_OS::ace_isspace (string[i]) || string[i] == '\0')) { string[i] = '\0'; if (argc < max_args) { argv[argc] = string + previous; ++argc; } else { ACE_OS::fprintf (stderr, "spae(): number of arguments " "limited to %d\n", max_args); } // Skip over whitespace in between arguments for(++i; i < length && ACE_OS::ace_isspace (string[i]); ++i) { } // Save the starting point for the next time around previous = i; // Make sure we don't skip over a character due // to the above loop to skip over whitespace --i; } } } } // This global function can be used from the VxWorks shell to pass // arguments to a C main () function. // // usage: -> spae main, "arg1 arg2 \"arg3 with spaces\"" // // All arguments must be within double quotes, even numbers. int spae (FUNCPTR entry, ...) { static int const WINDSH_ARGS = 10; static ACE_VX_USR_ARG_T const ACE_MAX_ARGS = 128; static char* argv[ACE_MAX_ARGS] = { const_cast ("ace_main"), 0 }; va_list pvar; ACE_VX_USR_ARG_T argc = 1; // Peel off arguments to spa () and put into argv. va_arg () isn't // necessarily supposed to return 0 when done, though since the // VxWorks shell uses a fixed number (10) of arguments, it might 0 // the unused ones. va_start (pvar, entry); int i = 0; for (char* str = va_arg (pvar, char*); str != 0 && i < WINDSH_ARGS; str = va_arg (pvar, char*), ++i) { add_to_argv(argc, argv, ACE_MAX_ARGS, str); } // fill unused argv slots with 0 to get rid of leftovers // from previous invocations for (i = argc; i < ACE_MAX_ARGS; ++i) argv[i] = 0; // The hard-coded options are what ::sp () uses, except for the // larger stack size (instead of ::sp ()'s 20000). ACE_VX_TASK_ID const ret = ::taskSpawn (argv[0], // task name 100, // task priority VX_FP_TASK, // task options ACE_NEEDS_HUGE_THREAD_STACKSIZE, // stack size entry, // entry point argc, // first argument to main () (ACE_VX_USR_ARG_T) argv, // second argument to main () 0, 0, 0, 0, 0, 0, 0, 0); va_end (pvar); // ::taskSpawn () returns the taskID on success: return 0 instead if // successful return ret == ACE_VX_TASK_ID_ERROR ? -1 : 0; } // This global function can be used from the VxWorks shell to pass // arguments to a C main () function. The function will be run // within the shells task. // // usage: -> spaef main, "arg1 arg2 \"arg3 with spaces\"" // // All arguments must be within double quotes, even numbers. // Unlike the spae function, this fuction executes the supplied // routine in the foreground, rather than spawning it in a separate // task. int spaef (FUNCPTR entry, ...) { static int const WINDSH_ARGS = 10; static ACE_VX_USR_ARG_T const ACE_MAX_ARGS = 128; static char* argv[ACE_MAX_ARGS] = { const_cast ("ace_main"), 0 }; va_list pvar; ACE_VX_USR_ARG_T argc = 1; // Peel off arguments to spa () and put into argv. va_arg () isn't // necessarily supposed to return 0 when done, though since the // VxWorks shell uses a fixed number (10) of arguments, it might 0 // the unused ones. va_start (pvar, entry); int i = 0; for (char* str = va_arg (pvar, char*); str != 0 && i < WINDSH_ARGS; str = va_arg (pvar, char*), ++i) { add_to_argv(argc, argv, ACE_MAX_ARGS, str); } // fill unused argv slots with 0 to get rid of leftovers // from previous invocations for (i = argc; i < ACE_MAX_ARGS; ++i) argv[i] = 0; int const ret = entry (argc, argv); va_end (pvar); // Return the return value of the invoked ace_main routine. return ret; } // This global function can be used from the VxWorks shell to pass // arguments to and run a main () function (i.e. ace_main). // // usage: -> vx_execae ace_main, "arg1 arg2 \"arg3 with spaces\"", [prio, [opt, [stacksz]]] // // All arguments must be within double quotes, even numbers. // This routine spawns the main () function in a separate task and waits till the // task has finished. static int _vx_call_rc = 0; static int _vx_call_entry(FUNCPTR entry, int argc, char* argv[]) { ACE_Service_Config::current (ACE_Service_Config::global()); _vx_call_rc = entry (argc, argv); return _vx_call_rc; } int vx_execae (FUNCPTR entry, char* arg, int prio, int opt, size_t stacksz, ...) { static ACE_VX_USR_ARG_T const ACE_MAX_ARGS = 128; static char* argv[ACE_MAX_ARGS] = { const_cast ("ace_main"), 0 }; ACE_VX_USR_ARG_T argc = 1; // Peel off arguments to run_main () and put into argv. if (arg) { add_to_argv(argc, argv, ACE_MAX_ARGS, arg); } // fill unused argv slots with 0 to get rid of leftovers // from previous invocations for (ACE_VX_USR_ARG_T i = argc; i < ACE_MAX_ARGS; ++i) argv[i] = 0; // The hard-coded options are what ::sp () uses, except for the // larger stack size (instead of ::sp ()'s 20000). ACE_VX_TASK_ID const ret = ::taskSpawn (argv[0], // task name prio==0 ? 100 : prio, // task priority opt==0 ? VX_FP_TASK : opt, // task options stacksz==0 ? ACE_NEEDS_HUGE_THREAD_STACKSIZE : stacksz, // stack size (FUNCPTR)_vx_call_entry, // entrypoint caller (ACE_VX_USR_ARG_T)entry, // entry point argc, // first argument to main () (ACE_VX_USR_ARG_T) argv, // second argument to main () 0, 0, 0, 0, 0, 0, 0); if (ret == ACE_VX_TASK_ID_ERROR) return 255; while( ::taskIdVerify (ret) != ERROR ) ::taskDelay (3 * ::sysClkRateGet ()); // ::taskSpawn () returns TASK_ID_ERROR on failure: return _vx_call_rc instead if // successful return ret == ACE_VX_TASK_ID_ERROR ? 255 : _vx_call_rc; } #if defined(ACE_AS_STATIC_LIBS) && defined (ACE_VXWORKS_DEBUGGING_HELPER) /** Wind River workbench allows the user to spawn a kernel task as a "Debug Configuration". Use this function as the entrypoint so that the arguments are translated into the form that ace_main() requires. */ int ace_wb_exec (int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9) { return spaef ((FUNCPTR) ace_main, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); } #endif /* ACE_AS_STATIC_LIBS && ... */ #endif /* ACE_VXWORKS && !__RTP__ */ ace-8.0.4+dfsg.orig/ace/String_Base_Const.cpp0000644000175000017500000000041715027201773017773 0ustar sudipsudip#include "ace/String_Base_Const.h" #include "ace/Numeric_Limits.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_String_Base_Const::size_type const ACE_String_Base_Const::npos = ACE_Numeric_Limits::max (); ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Base_Thread_Adapter.h0000644000175000017500000001422415027201773017674 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Base_Thread_Adapter.h * * @author Nanbor Wang */ //============================================================================= #ifndef ACE_BASE_THREAD_ADAPTER_H #define ACE_BASE_THREAD_ADAPTER_H #include /**/ "ace/pre.h" #include "ace/OS_Log_Msg_Attributes.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include /**/ "ace/ACE_export.h" #include "ace/OS_Log_Msg_Attributes.h" #ifdef ACE_USES_GPROF #include "os_include/sys/os_time.h" #endif // ACE_USES_GPROF #if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) # define ACE_THREAD_ADAPTER_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ace_thread_adapter) #else # 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... extern "C" ACE_Export ACE_THR_FUNC_RETURN ACE_THREAD_ADAPTER_NAME (void *args); 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. */ class ACE_Export ACE_OS_Thread_Descriptor { public: /// Get the thread creation flags. long flags () const; virtual ~ACE_OS_Thread_Descriptor () = default; protected: /// For use by ACE_Thread_Descriptor. ACE_OS_Thread_Descriptor (long flags = 0); /** * 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 * close down the handle). */ long flags_; }; class ACE_Service_Gestalt; /** * @class ACE_Base_Thread_Adapter * * @brief Base class for all the Thread_Adapters. * * Converts a C++ function into a function that can be * called from a thread creation routine * (e.g., pthread_create() or _beginthreadex()) that expects an * extern "C" entry point. This class also makes it possible to * transparently provide hooks to register a thread with an * ACE_Thread_Manager. * This class is used in ACE_OS::thr_create(). In general, the * thread that creates an object of this class is different from * the thread that calls @c invoke() on this object. Therefore, * the @c invoke() method is responsible for deleting itself. */ class ACE_Export ACE_Base_Thread_Adapter { public: virtual ~ACE_Base_Thread_Adapter () = default; /// Virtual method invoked by the thread entry point. virtual ACE_THR_FUNC_RETURN invoke () = 0; /// Accessor for the C entry point function to the OS thread creation /// routine. ACE_THR_C_FUNC entry_point (); #ifdef ACE_USES_GPROF /// Accessor to the itimer_ /// followed http://sam.zoy.org/writings/programming/gprof.html struct itimerval* timerval (); #endif // ACE_USES_PROF /// Invoke the close_log_msg_hook, if it is present static void close_log_msg (); /// Invoke the sync_log_msg_hook, if it is present static void sync_log_msg (const ACE_TCHAR *prog_name); /// Invoke the thr_desc_log_msg_hook, if it is present static ACE_OS_Thread_Descriptor *thr_desc_log_msg (); protected: /// Constructor. ACE_Base_Thread_Adapter (ACE_THR_FUNC user_func, void *arg, ACE_THR_C_FUNC entry_point = (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME, ACE_OS_Thread_Descriptor *td = 0 # if defined (ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS) , ACE_SEH_EXCEPT_HANDLER selector = 0 , ACE_SEH_EXCEPT_HANDLER handler = 0 # endif /* ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS */ , long cancel_flags = 0 ); /// Inherit the logging features if the parent thread has an /// ACE_Log_Msg. void inherit_log_msg (); private: /// The hooks to inherit and cleanup the Log_Msg attributes static ACE_INIT_LOG_MSG_HOOK init_log_msg_hook_; static ACE_INHERIT_LOG_MSG_HOOK inherit_log_msg_hook_; static ACE_CLOSE_LOG_MSG_HOOK close_log_msg_hook_; static ACE_SYNC_LOG_MSG_HOOK sync_log_msg_hook_; static ACE_THR_DESC_LOG_MSG_HOOK thr_desc_log_msg_hook_; /// Set the Log_Msg hooks static void set_log_msg_hooks (ACE_INIT_LOG_MSG_HOOK init_hook, ACE_INHERIT_LOG_MSG_HOOK inherit_hook, ACE_CLOSE_LOG_MSG_HOOK close_hook, ACE_SYNC_LOG_MSG_HOOK sync_hook, ACE_THR_DESC_LOG_MSG_HOOK thr_desc); /// Allow the ACE_Log_Msg class to set its hooks. friend class ACE_Log_Msg; protected: /// Thread startup function passed in by the user (C++ linkage). ACE_THR_FUNC user_func_; /// Argument to thread startup function. void *arg_; /// Entry point to the underlying OS thread creation call (C /// linkage). ACE_THR_C_FUNC entry_point_; /** * 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 * descriptor. */ ACE_OS_Thread_Descriptor *thr_desc_; /// The ACE_Log_Msg attributes. ACE_OS_Log_Msg_Attributes log_msg_attributes_; /// That is useful for gprof, define itimerval #ifdef ACE_USES_GPROF struct itimerval itimer_; #endif // ACE_USES_GPROF /// 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 # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE # endif /* ACE_INLINE */ # define ACE_INLINE inline # include "ace/Base_Thread_Adapter.inl" # endif /* ACE_HAS_INLINED_OSCALLS */ #include /**/ "ace/post.h" #endif /* ACE_BASE_THREAD_ADAPTER_H */ ace-8.0.4+dfsg.orig/ace/post.h0000644000175000017500000000074215027201773015060 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file post.h * * @author Christopher Kohlhoff * * This file restores the original alignment rules. */ //============================================================================= // No header guard #if defined (_MSC_VER) # pragma pack (pop) #elif defined (__BORLANDC__) # pragma option pop # pragma nopushoptwarn # pragma nopackwarning #endif ace-8.0.4+dfsg.orig/ace/MEM_Stream.cpp0000644000175000017500000000201315027201773016350 0ustar sudipsudip#include "ace/MEM_Stream.h" #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1) #if !defined (__ACE_INLINE__) #include "ace/MEM_Stream.inl" #endif /* __ACE_INLINE__ */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_MEM_Stream) void ACE_MEM_Stream::dump () const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_MEM_Stream::dump"); #endif /* ACE_HAS_DUMP */ } int ACE_MEM_Stream::close () { this->send ((char *)0, 0); this->fini (); #if defined (ACE_WIN32) // We need the following call to make things work correctly on // Win32, which requires use to do a before doing the // close in order to avoid losing data. Note that we don't need to // do this on UNIX since it doesn't have this "feature". Moreover, // this will cause subtle problems on UNIX due to the way that // fork() works. this->close_writer (); #endif /* ACE_WIN32 */ // Close down the socket. return ACE_SOCK::close (); } ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */ ace-8.0.4+dfsg.orig/ace/config-win32-msvc-141.h0000644000175000017500000001023415027201773017546 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file config-win32-msvc-141.h * * @brief Microsoft Visual C++ 14.1 configuration file. * * This file is the ACE configuration file for Microsoft Visual C++ 14.1 (as released with Visual Studio 2017). * * @note Do not include this file directly, include config-win32.h instead. */ //============================================================================= #ifndef ACE_CONFIG_WIN32_MSVC_141_H #define ACE_CONFIG_WIN32_MSVC_141_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 ACE_WIN32_VC14 # define ACE_WIN32_VC14 #endif #ifndef ACE_WIN32_VC141 # define ACE_WIN32_VC141 #endif // Windows' timeval is non-conformant (defined in terms of long instead of // 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 #define ACE_HAS_ITOA #define ACE_ITOA_EQUIVALENT ::_itoa #define ACE_STRCASECMP_EQUIVALENT ::_stricmp #define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp #define ACE_WCSDUP_EQUIVALENT ::_wcsdup #define ACE_FILENO_EQUIVALENT(X) (_get_osfhandle (::_fileno (X))) #define ACE_HAS_SIG_ATOMIC_T #define ACE_LACKS_STRPTIME #define ACE_HAS_INTRIN_H #define ACE_HAS_INTRINSIC_INTERLOCKED #define ACE_HAS_INTRINSIC_BYTESWAP #define ACE_LACKS_STRRECVFD // Platform provides ACE_TLI function prototypes. // For Win32, this is not really true, but saves a lot of hassle! #define ACE_HAS_TLI_PROTOTYPES // Platform support linebuffered streaming is broken #define ACE_LACKS_LINEBUFFERED_STREAMBUF // ace/iostream.h does not work with the standard cpp library (yet). #if !defined (ACE_USES_OLD_IOSTREAMS) # define ACE_LACKS_ACE_IOSTREAM #endif /* ! ACE_USES_OLD_IOSTREAMS */ // There are too many instances of this warning to fix it right now. // Maybe in the future. // Disable warning of using Microsoft Extension. #pragma warning(disable:4231) // 'class1' : inherits 'class2::member' via dominance #pragma warning(disable:4250) #if !defined (ACE_HAS_TR24731_2005_CRT) # define ACE_HAS_TR24731_2005_CRT #endif // A template can not be exported. Only an instantiation may be exported. #define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT // Windows Vista and Windows Server 2008 and newer do have native condition // variables, but this is commented out because the support in ACE hasn't // been completed // #if defined (_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) // # define ACE_HAS_WTHREADS_CONDITION_VARIABLE // # undef ACE_LACKS_COND_T // #endif #define ACE_HAS_POSIX_TIME 1 #define ACE_LACKS_TIMESPEC_T 1 // According to MS the Visual Studio 2015 C-runtime has a // C99 compliant vsnprintf/vsnwprintf, this is a change compared to // previous versions #define ACE_HAS_C99_VSNPRINTF #define ACE_HAS_C99_VSNWPRINTF // Visual Studio 2015 has 3 parameter wcstok #define ACE_HAS_3_PARAM_WCSTOK // Visual Studio 2015 has adequate C++11 support #define ACE_HAS_CPP11 #define ACE_PUTENV_EQUIVALENT ::_putenv #define ACE_TEMPNAM_EQUIVALENT ::_tempnam #define ACE_STRDUP_EQUIVALENT ::_strdup #define ACE_MKDIR_EQUIVALENT ::_mkdir #define ACE_ACCESS_EQUIVALENT ::_access #define ACE_CHDIR_EQUIVALENT ::_chdir #define ACE_RMDIR_EQUIVALENT ::_rmdir #define ACE_GETCWD_EQUIVALENT ::_getcwd #define ACE_SWAB_EQUIVALENT ::_swab #define ACE_UNLINK_EQUIVALENT ::_unlink #define ACE_HAS_STRNLEN #define ACE_HAS_WCSNLEN #define ACE_LACKS_STRUCT_DIR #define ACE_LACKS_OPENDIR #define ACE_LACKS_CLOSEDIR #define ACE_LACKS_READDIR #define ACE_LACKS_MODE_T #define ACE_LACKS_PID_T #define ACE_LACKS_NLINK_T #define ACE_LACKS_UID_T #define ACE_LACKS_GID_T #if _MSVC_LANG >= 201402L # define ACE_HAS_CPP14 #endif /* _MSVC_LANG >= 201402L */ #if _MSVC_LANG >= 201703L # define ACE_HAS_CPP17 #endif /* _MSVC_LANG >= 201703L */ #if _MSVC_LANG >= 202002L # define ACE_HAS_CPP20 #endif /* _MSVC_LANG >= 202002L */ #include /**/ "ace/post.h" #endif /* ACE_CONFIG_WIN32_MSVC_141_H */ ace-8.0.4+dfsg.orig/ace/Codeset_Symbols.h0000644000175000017500000002226315027201773017173 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Codeset_Symbols.h * * Symbolic names for codeset ids. * * @author Dale Wilson (wilson_d@ociweb.com) */ //============================================================================= #ifndef CODESET_SYMBOLS_H #define CODESET_SYMBOLS_H // These numbers are assigned by the OpenGroup, a database is // available at // // ftp://ftp.opengroup.org/pub/code_set_registry/ // // Alas, the database is in a semi-regular text file -- difficult to use. // The following C/C++-friendly version of the codeset ids was captured // from Version 1.2g of the registry. // #define ACE_CODESET_ID_ISO_8859_1 0x00010001U #define ACE_CODESET_ID_ISO_8859_2 0x00010002U #define ACE_CODESET_ID_ISO_8859_3 0x00010003U #define ACE_CODESET_ID_ISO_8859_4 0x00010004U #define ACE_CODESET_ID_ISO_8859_5 0x00010005U #define ACE_CODESET_ID_ISO_8859_6 0x00010006U #define ACE_CODESET_ID_ISO_8859_7 0x00010007U #define ACE_CODESET_ID_ISO_8859_8 0x00010008U #define ACE_CODESET_ID_ISO_8859_9 0x00010009U #define ACE_CODESET_ID_ISO_8859_10 0x0001000AU #define ACE_CODESET_ID_ISO_8859_15 0x0001000FU #define ACE_CODESET_ID_ISO_646 0x00010020U #define ACE_CODESET_ID_ISO_UCS_2_LEVEL_1 0x00010100U #define ACE_CODESET_ID_ISO_UCS_2_LEVEL_2 0x00010101U #define ACE_CODESET_ID_ISO_UCS_2_LEVEL_3 0x00010102U #define ACE_CODESET_ID_ISO_UCS_4_LEVEL_1 0x00010104U #define ACE_CODESET_ID_ISO_UCS_4_LEVEL_2 0x00010105U #define ACE_CODESET_ID_ISO_UCS_4_LEVEL_3 0x00010106U #define ACE_CODESET_ID_ISO_UTF_8 0x00010108U #define ACE_CODESET_ID_ISO_UTF_16 0x00010109U #define ACE_CODESET_ID_JIS_X0201 0x00030001U #define ACE_CODESET_ID_JIS_X0208_1978 0x00030004U #define ACE_CODESET_ID_JIS_X0208_1983 0x00030005U #define ACE_CODESET_ID_JIS_X0208_1990 0x00030006U #define ACE_CODESET_ID_JIS_X0212 0x0003000AU #define ACE_CODESET_ID_JIS_EUCJP 0x00030010U #define ACE_CODESET_ID_KS_C5601 0x00040001U #define ACE_CODESET_ID_KS_C5657 0x00040002U #define ACE_CODESET_ID_KS_EUCKR 0x0004000AU #define ACE_CODESET_ID_CNS_11643_1986 0x00050001U #define ACE_CODESET_ID_CNS_11643_1992 0x00050002U #define ACE_CODESET_ID_CNS_EUCTW_1991 0x0005000AU #define ACE_CODESET_ID_CNS_EUCTW_1993 0x00050010U #define ACE_CODESET_ID_TIS_620_25290X000B0001U #define ACE_CODESET_ID_TTB_CCDC 0x000D0001U #define ACE_CODESET_ID_OSF_JAPANESE_UJIS 0x05000010U #define ACE_CODESET_ID_OSF_JAPANESE_SJIS_1 0x05000011U #define ACE_CODESET_ID_OSF_JAPANESE_SJIS_2 0x05000012U #define ACE_CODESET_ID_XOPEN_UTF_8 0x05010001U #define ACE_CODESET_ID_JVC_EUCJP 0x05020001U #define ACE_CODESET_ID_JVC_SJIS 0x05020002U #define ACE_CODESET_ID_DEC_KANJI 0x10000001U #define ACE_CODESET_ID_SUPER_DEC_KANJI 0x10000002U #define ACE_CODESET_ID_DEC_SHIFT_JIS 0x10000003U #define ACE_CODESET_ID_HP_ROMAN8 0x10010001U #define ACE_CODESET_ID_HP_KANA8 0x10010002U #define ACE_CODESET_ID_HP_ARABIC8 0x10010003U #define ACE_CODESET_ID_HP_GREEK8 0x10010004U #define ACE_CODESET_ID_HP_HEBREW8 0x10010005U #define ACE_CODESET_ID_HP_TURKISH8 0x10010006U #define ACE_CODESET_ID_HP15CN 0x10010007U #define ACE_CODESET_ID_HP_BIG5 0x10010008U #define ACE_CODESET_ID_HP_JAPANESE15__SJIS_ 0x10010009U #define ACE_CODESET_ID_HP_SJISHI 0x1001000AU #define ACE_CODESET_ID_HP_SJISPC 0x1001000BU #define ACE_CODESET_ID_HP_UJIS 0x1001000CU #define ACE_CODESET_ID_IBM_037 0x10020025U #define ACE_CODESET_ID_IBM_273 0x10020111U #define ACE_CODESET_ID_IBM_277 0x10020115U #define ACE_CODESET_ID_IBM_278 0x10020116U #define ACE_CODESET_ID_IBM_280 0x10020118U #define ACE_CODESET_ID_IBM_282 0x1002011AU #define ACE_CODESET_ID_IBM_284 0x1002011CU #define ACE_CODESET_ID_IBM_285 0x1002011DU #define ACE_CODESET_ID_IBM_290 0x10020122U #define ACE_CODESET_ID_IBM_297 0x10020129U #define ACE_CODESET_ID_IBM_300 0x1002012CU #define ACE_CODESET_ID_IBM_301 0x1002012DU #define ACE_CODESET_ID_IBM_420 0x100201A4U #define ACE_CODESET_ID_IBM_424 0x100201A8U #define ACE_CODESET_ID_IBM_437 0x100201B5U #define ACE_CODESET_ID_IBM_500 0x100201F4U #define ACE_CODESET_ID_IBM_833 0x10020341U #define ACE_CODESET_ID_IBM_834 0x10020342U #define ACE_CODESET_ID_IBM_835 0x10020343U #define ACE_CODESET_ID_IBM_836 0x10020344U #define ACE_CODESET_ID_IBM_837 0x10020345U #define ACE_CODESET_ID_IBM_838 0x10020346U #define ACE_CODESET_ID_IBM_839 0x10020347U #define ACE_CODESET_ID_IBM_850 0x10020352U #define ACE_CODESET_ID_IBM_852 0x10020354U #define ACE_CODESET_ID_IBM_855 0x10020357U #define ACE_CODESET_ID_IBM_856 0x10020358U #define ACE_CODESET_ID_IBM_857 0x10020359U #define ACE_CODESET_ID_IBM_861 0x1002035DU #define ACE_CODESET_ID_IBM_862 0x1002035EU #define ACE_CODESET_ID_IBM_863 0x1002035FU #define ACE_CODESET_ID_IBM_864 0x10020360U #define ACE_CODESET_ID_IBM_866 0x10020362U #define ACE_CODESET_ID_IBM_868 0x10020364U #define ACE_CODESET_ID_IBM_869 0x10020365U #define ACE_CODESET_ID_IBM_870 0x10020366U #define ACE_CODESET_ID_IBM_871 0x10020367U #define ACE_CODESET_ID_IBM_874 0x1002036AU #define ACE_CODESET_ID_IBM_875 0x1002036BU #define ACE_CODESET_ID_IBM_880 0x10020370U #define ACE_CODESET_ID_IBM_891 0x1002037BU #define ACE_CODESET_ID_IBM_896 0x10020380U #define ACE_CODESET_ID_IBM_897 0x10020381U #define ACE_CODESET_ID_IBM_903 0x10020387U #define ACE_CODESET_ID_IBM_904 0x10020388U #define ACE_CODESET_ID_IBM_918 0x10020396U #define ACE_CODESET_ID_IBM_921 0x10020399U #define ACE_CODESET_ID_IBM_922 0x1002039AU #define ACE_CODESET_ID_IBM_926 0x1002039EU #define ACE_CODESET_ID_IBM_927 0x1002039FU #define ACE_CODESET_ID_IBM_928 0x100203A0U #define ACE_CODESET_ID_IBM_929 0x100203A1U #define ACE_CODESET_ID_IBM_930 0x100203A2U #define ACE_CODESET_ID_IBM_932 0x100203A4U #define ACE_CODESET_ID_IBM_933 0x100203A5U #define ACE_CODESET_ID_IBM_934 0x100203A6U #define ACE_CODESET_ID_IBM_935 0x100203A7U #define ACE_CODESET_ID_IBM_936 0x100203A8U #define ACE_CODESET_ID_IBM_937 0x100203A9U #define ACE_CODESET_ID_IBM_938 0x100203AAU #define ACE_CODESET_ID_IBM_939 0x100203ABU #define ACE_CODESET_ID_IBM_941 0x100203ADU #define ACE_CODESET_ID_IBM_942 0x100203AEU #define ACE_CODESET_ID_IBM_943 0x100203AFU #define ACE_CODESET_ID_IBM_946 0x100203B2U #define ACE_CODESET_ID_IBM_947 0x100203B3U #define ACE_CODESET_ID_IBM_948 0x100203B4U #define ACE_CODESET_ID_IBM_949 0x100203B5U #define ACE_CODESET_ID_IBM_950 0x100203B6U #define ACE_CODESET_ID_IBM_951 0x100203B7U #define ACE_CODESET_ID_IBM_955 0x100203BBU #define ACE_CODESET_ID_IBM_964 0x100203C4U #define ACE_CODESET_ID_IBM_970 0x100203CAU #define ACE_CODESET_ID_IBM_1006 0x100203EEU #define ACE_CODESET_ID_IBM_1025 0x10020401U #define ACE_CODESET_ID_IBM_1026 0x10020402U #define ACE_CODESET_ID_IBM_1027 0x10020403U #define ACE_CODESET_ID_IBM_1040 0x10020410U #define ACE_CODESET_ID_IBM_1041 0x10020411U #define ACE_CODESET_ID_IBM_1043 0x10020413U #define ACE_CODESET_ID_IBM_1046 0x10020416U #define ACE_CODESET_ID_IBM_1047 0x10020417U #define ACE_CODESET_ID_IBM_1088 0x10020440U #define ACE_CODESET_ID_IBM_1097 0x10020449U #define ACE_CODESET_ID_IBM_1098 0x1002044AU #define ACE_CODESET_ID_IBM_1112 0x10020458U #define ACE_CODESET_ID_IBM_1114 0x1002045AU #define ACE_CODESET_ID_IBM_1115 0x1002045BU #define ACE_CODESET_ID_IBM_1122 0x10020462U #define ACE_CODESET_ID_IBM_1250 0x100204E2U #define ACE_CODESET_ID_IBM_1251 0x100204E3U #define ACE_CODESET_ID_IBM_1252 0x100204E4U #define ACE_CODESET_ID_IBM_1253 0x100204E5U #define ACE_CODESET_ID_IBM_1254 0x100204E6U #define ACE_CODESET_ID_IBM_1255 0x100204E7U #define ACE_CODESET_ID_IBM_1256 0x100204E8U #define ACE_CODESET_ID_IBM_1257 0x100204E9U #define ACE_CODESET_ID_IBM_1380 0x10020564U #define ACE_CODESET_ID_IBM_1381 0x10020565U #define ACE_CODESET_ID_IBM_1383 0x10020567U #define ACE_CODESET_ID_IBM_4396 0x1002112CU #define ACE_CODESET_ID_IBM_4946 0x10021352U #define ACE_CODESET_ID_IBM_4948 0x10021354U #define ACE_CODESET_ID_IBM_4951 0x10021357U #define ACE_CODESET_ID_IBM_4952 0x10021358U #define ACE_CODESET_ID_IBM_4953 0x10021359U #define ACE_CODESET_ID_IBM_4960 0x10021360U #define ACE_CODESET_ID_IBM_4964 0x10021364U #define ACE_CODESET_ID_IBM_4965 0x10021365U #define ACE_CODESET_ID_IBM_5026 0x100213A2U #define ACE_CODESET_ID_IBM_5031 0x100213A7U #define ACE_CODESET_ID_IBM_5035 0x100213ABU #define ACE_CODESET_ID_IBM_5048 0x100213B8U #define ACE_CODESET_ID_IBM_5049 0x100213B9U #define ACE_CODESET_ID_IBM_5067 0x100213CBU #define ACE_CODESET_ID_IBM_8612 0x100221A4U #define ACE_CODESET_ID_IBM_9025 0x10022341U #define ACE_CODESET_ID_IBM_9026 0x10022342U #define ACE_CODESET_ID_IBM_9030 0x10022346U #define ACE_CODESET_ID_IBM_9056 0x10022360U #define ACE_CODESET_ID_IBM_9066 0x1002236AU #define ACE_CODESET_ID_IBM_9125 0x100223A5U #define ACE_CODESET_ID_IBM_25426 0x10026352U #define ACE_CODESET_ID_IBM_25432 0x10026358U #define ACE_CODESET_ID_IBM_1042 0x10026412U #define ACE_CODESET_ID_IBM_28709 0x10027025U #define ACE_CODESET_ID_IBM_33624 0x10028358U #define ACE_CODESET_ID_IBM_33722 0x100283BAU #define ACE_CODESET_ID_HTCSJIS 0x10030001U #define ACE_CODESET_ID_HTCUJIS 0x10030002U #define ACE_CODESET_ID_FUJITSU_U90 0x10040001U #define ACE_CODESET_ID_FUJITSU_S90 0x10040002U #define ACE_CODESET_ID_FUJITSU_R90 0x10040003U #define ACE_CODESET_ID_EBCDIC_ASCII_AND_JEF 0x10040004U #define ACE_CODESET_ID_EBCDIC_KATAKANA_AND_JEF 0x10040005U #define ACE_CODESET_ID_EBCDIC_JAPANESE_ENGLISH_AND_JEF 0x10040006U #define ACE_CODESET_ID_TAO_BACKWARD_COMPATIBLE 0xf54414F0U #endif // CODESET_SYMBOLS_H ace-8.0.4+dfsg.orig/ace/Process.inl0000644000175000017500000001447215027201773016051 0ustar sudipsudip// -*- C++ -*- #include "ace/ACE.h" #include "ace/OS_NS_sys_wait.h" #include "ace/OS_NS_signal.h" #include "ace/OS_NS_pwd.h" #include "ace/OS_NS_string.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE void ACE_Process_Options::enable_unicode_environment () { this->use_unicode_environment_ = true; } ACE_INLINE void ACE_Process_Options::disable_unicode_environment () { this->use_unicode_environment_ = false; } ACE_INLINE bool ACE_Process_Options::use_unicode_environment () const { return this->use_unicode_environment_; } #if defined (ACE_WIN32) ACE_INLINE PROCESS_INFORMATION ACE_Process::process_info () { return process_info_; } #endif /* ACE_WIN32 */ ACE_INLINE ACE_HANDLE ACE_Process::gethandle () const { #if defined (ACE_WIN32) return process_info_.hProcess; #else return ACE_HANDLE (child_id_); #endif /* ACE_WIN32 */ } ACE_INLINE pid_t ACE_Process::getpid () const { #if defined (ACE_WIN32) return process_info_.dwProcessId; #else /* ACE_WIN32 */ return child_id_; #endif /* ACE_WIN32 */ } ACE_INLINE pid_t ACE_Process::wait (ACE_exitcode *status, int wait_options) { pid_t retv = ACE_OS::wait (this->getpid (), &this->exit_code_, wait_options #if defined (ACE_WIN32) , process_info_.hProcess #endif /* ACE_WIN32 */ ); if (status != 0) *status = this->exit_code_; return retv; } ACE_INLINE int ACE_Process::kill (int signum) { if (this->getpid () != -1) return ACE_OS::kill (this->getpid (), signum); else return -1; } ACE_INLINE int ACE_Process::terminate () { if (this->getpid () != -1) return ACE::terminate_process (this->getpid ()); else return -1; } ACE_INLINE int ACE_Process::return_value () const { #if defined (ACE_WIN32) return this->exit_code_; #else return WEXITSTATUS (this->exit_code_); #endif /* ACE_WIN32 */ } ACE_INLINE ACE_exitcode ACE_Process::exit_code () const { return this->exit_code_; } ACE_INLINE void ACE_Process::exit_code (ACE_exitcode code) { this->exit_code_ = code; } ACE_INLINE u_long ACE_Process_Options::creation_flags () const { #if defined (ACE_USES_WCHAR) && defined (ACE_WIN32) return creation_flags_ | CREATE_UNICODE_ENVIRONMENT; #else return creation_flags_; #endif /* ACE_USES_WCHAR */ } ACE_INLINE void ACE_Process_Options::creation_flags (u_long cf) { creation_flags_ = cf; } ACE_INLINE pid_t ACE_Process_Options::getgroup () const { return process_group_; } ACE_INLINE pid_t ACE_Process_Options::setgroup (pid_t pgrp) { pid_t old = process_group_; process_group_ = pgrp; return old; } ACE_INLINE int ACE_Process_Options::handle_inheritance () { return handle_inheritance_; } ACE_INLINE void ACE_Process_Options::handle_inheritance (int hi) { handle_inheritance_ = hi; } ACE_INLINE int ACE_Process_Options::avoid_zombies () { return avoid_zombies_; } ACE_INLINE void ACE_Process_Options::avoid_zombies (int avoid_zombies) { avoid_zombies_ = avoid_zombies; } #if defined (ACE_WIN32) ACE_INLINE ACE_TEXT_STARTUPINFO * ACE_Process_Options::startup_info () { return &startup_info_; } ACE_INLINE LPSECURITY_ATTRIBUTES ACE_Process_Options::get_process_attributes () const { return process_attributes_; } ACE_INLINE LPSECURITY_ATTRIBUTES ACE_Process_Options::set_process_attributes () { process_attributes_ = &security_buf1_; return process_attributes_; } ACE_INLINE LPSECURITY_ATTRIBUTES ACE_Process_Options::get_thread_attributes () const { return thread_attributes_; } ACE_INLINE LPSECURITY_ATTRIBUTES ACE_Process_Options::set_thread_attributes () { thread_attributes_ = &security_buf2_; return thread_attributes_; } ACE_INLINE HANDLE ACE_Process_Options::get_user_token () const { return user_token_; } #else /* !defined (ACE_WIN32) */ ACE_INLINE ACE_HANDLE ACE_Process_Options::get_stdin () const { return stdin_; } ACE_INLINE ACE_HANDLE ACE_Process_Options::get_stdout () const { return stdout_; } ACE_INLINE ACE_HANDLE ACE_Process_Options::get_stderr () const { return stderr_; } ACE_INLINE bool ACE_Process_Options::inherit_environment () const { return inherit_environment_; } ACE_INLINE void ACE_Process_Options::inherit_environment (bool nv) { inherit_environment_ = nv; } ACE_INLINE int ACE_Process_Options::setreugid (const ACE_TCHAR* user) { #if !defined (ACE_LACKS_PWD_FUNCTIONS) struct passwd *ent = ACE_OS::getpwnam (ACE_TEXT_ALWAYS_CHAR (user)); if (ent != 0) { this->euid_ = ent->pw_uid; this->ruid_ = ent->pw_uid; this->egid_ = ent->pw_gid; this->rgid_ = ent->pw_gid; return 0; } else return -1; #else ACE_UNUSED_ARG (user); ACE_NOTSUP_RETURN (-1); #endif /* ACE_LACKS_PWD_FUNCTIONS */ } ACE_INLINE void ACE_Process_Options::setruid (uid_t id) { this->ruid_ = id; } ACE_INLINE void ACE_Process_Options::seteuid (uid_t id) { this->euid_ = id; } ACE_INLINE void ACE_Process_Options::setrgid (gid_t id) { this->rgid_ = id; } ACE_INLINE void ACE_Process_Options::setegid (gid_t id) { this->egid_ = id; } ACE_INLINE uid_t ACE_Process_Options::getruid () const { return this->ruid_; } ACE_INLINE uid_t ACE_Process_Options::geteuid () const { return this->euid_; } ACE_INLINE gid_t ACE_Process_Options::getrgid () const { return this->rgid_; } ACE_INLINE gid_t ACE_Process_Options::getegid () const { return this->egid_; } #endif /* ACE_WIN32 */ ACE_INLINE ACE_TCHAR * ACE_Process_Options::command_line_buf (size_t *max_lenp) { if (max_lenp != 0) *max_lenp = this->command_line_buf_len_; return this->command_line_buf_; } ACE_INLINE ACE_TCHAR * ACE_Process_Options::working_directory () { if (working_directory_[0] == '\0') return 0; else return working_directory_; } ACE_INLINE void ACE_Process_Options::working_directory (const char *wd) { ACE_OS::strcpy (working_directory_, ACE_TEXT_CHAR_TO_TCHAR (wd)); } #if defined (ACE_HAS_WCHAR) ACE_INLINE void ACE_Process_Options::working_directory (const wchar_t *wd) { ACE_OS::strcpy (working_directory_, ACE_TEXT_WCHAR_TO_TCHAR (wd)); } #endif /* ACE_HAS_WCHAR */ ACE_INLINE void ACE_Process_Options::process_name (const ACE_TCHAR *p) { ACE_OS::strcpy (this->process_name_, p); } ACE_INLINE const ACE_TCHAR * ACE_Process_Options::process_name () { if (process_name_[0] == '\0') this->process_name (this->command_line_argv ()[0]); return this->process_name_; } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Time_Policy_T.inl0000644000175000017500000000132315027201773017122 0ustar sudipsudip// -*- C++ -*- ACE_BEGIN_VERSIONED_NAMESPACE_DECL template ACE_INLINE ACE_Time_Policy_T::ACE_Time_Policy_T (TIME_POLICY const & time_policy) : time_policy_ (time_policy) { } template ACE_INLINE ACE_Time_Value_T ACE_Time_Policy_T::operator() () const { return this->gettimeofday (); } template ACE_INLINE void ACE_Time_Policy_T::set_gettimeofday (ACE_Time_Value (*)(void)) { } template ACE_INLINE void ACE_Time_Policy_T::set_time_policy(TIME_POLICY const & time_policy) { this->time_policy_ = time_policy; } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/OS_NS_time.cpp0000644000175000017500000002272415027201773016371 0ustar sudipsudip#include "ace/OS_NS_time.h" #if !defined (ACE_HAS_INLINED_OSCALLS) # include "ace/OS_NS_time.inl" #endif /* ACE_HAS_INLINED_OSCALLS */ #if defined (ACE_LACKS_STRPTIME) # include "ace/os_include/os_ctype.h" #endif /* ACE_LACKS_STRPTIME */ #include "ace/OS_NS_Thread.h" #include "ace/Object_Manager_Base.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL struct tm * ACE_OS::localtime_r (const time_t *t, struct tm *res) { ACE_OS_TRACE ("ACE_OS::localtime_r"); #if defined (ACE_HAS_TR24731_2005_CRT) ACE_SECURECRTCALL (localtime_s (res, t), struct tm *, 0, res); return res; #elif defined (ACE_LACKS_LOCALTIME_R) ACE_OS_GUARD ACE_UNUSED_ARG (res); struct tm * res_ptr = 0; ACE_OSCALL (::localtime (t), struct tm *, res_ptr); if (res_ptr == 0) return 0; else { *res = *res_ptr; return res; } #else return ace_localtime_r_helper (t, res); #endif /* ACE_HAS_TR24731_2005_CRT */ } time_t ACE_OS::mktime (struct tm *t) { ACE_OS_TRACE ("ACE_OS::mktime"); #if defined (ACE_HAS_THREADS) && !defined (ACE_HAS_MT_SAFE_MKTIME) ACE_OS_GUARD #endif /* ACE_HAS_THREADS && ! ACE_HAS_MT_SAFE_MKTIME */ return std::mktime (t); } #if defined (ACE_LACKS_STRPTIME) char * ACE_OS::strptime_emulation (const char *buf, const char *format, struct tm *tm) { int bi = 0; int fi = 0; bool percent = false; if (!buf || !format) return 0; while (format[fi] != '\0') { if (percent) { percent = false; switch (format[fi]) { case '%': // an escaped % if (buf[bi] == '%') { ++fi; ++bi; } else return const_cast (buf + bi); break; /* not supported yet: weekday via locale long/short names case 'a': / * weekday via locale * / / * FALL THROUGH * / case 'A': / * long/short names * / break; */ /* not supported yet: case 'b': / * month via locale * / / * FALL THROUGH * / case 'B': / * long/short names * / / * FALL THROUGH * / case 'h': break; */ /* not supported yet: case 'c': / * %x %X * / break; */ /* not supported yet: case 'C': / * date & time - * / / * locale long format * / break; */ case 'd': /* day of month (1-31) */ /* FALL THROUGH */ case 'e': if (!ACE_OS::strptime_getnum (buf + bi, &tm->tm_mday, &bi, &fi, 1, 31)) return const_cast (buf + bi); break; case 'D': /* %m/%d/%y */ if (!ACE_OS::strptime_getnum (buf + bi, &tm->tm_mon, &bi, &fi, 1, 12)) return const_cast (buf + bi); --fi; tm->tm_mon--; if (buf[bi] != '/') return const_cast (buf + bi); ++bi; if (!ACE_OS::strptime_getnum (buf + bi, &tm->tm_mday, &bi, &fi, 1, 31)) return const_cast (buf + bi); --fi; if (buf[bi] != '/') return const_cast (buf + bi); ++bi; if (!ACE_OS::strptime_getnum (buf + bi, &tm->tm_year, &bi, &fi, 0, 99)) return const_cast (buf + bi); if (tm->tm_year < 69) tm->tm_year += 100; break; case 'H': /* hour (0-23) */ /* FALL THROUGH */ case 'k': if (!ACE_OS::strptime_getnum (buf + bi, &tm->tm_hour, &bi, &fi, 0, 23)) return const_cast (buf + bi); break; /* not supported yet: case 'I': / * hour (0-12) * / / * FALL THROUGH * / case 'l': break; */ case 'j': /* day of year (0-366) */ if (!ACE_OS::strptime_getnum (buf + bi, &tm->tm_yday, &bi, &fi, 1, 366)) return const_cast (buf + bi); tm->tm_yday--; break; case 'm': /* an escaped % */ if (!ACE_OS::strptime_getnum (buf + bi, &tm->tm_mon, &bi, &fi, 1, 12)) return const_cast (buf + bi); tm->tm_mon--; break; case 'M': /* minute (0-59) */ if (!ACE_OS::strptime_getnum (buf + bi, &tm->tm_min, &bi, &fi, 0, 59)) return const_cast (buf + bi); break; /* not supported yet: case 'p': / * am or pm for locale * / break; */ /* not supported yet: case 'r': / * %I:%M:%S %p * / break; */ case 'R': /* %H:%M */ if (!ACE_OS::strptime_getnum (buf + bi, &tm->tm_hour, &bi, &fi, 0, 23)) return const_cast (buf + bi); --fi; if (buf[bi] != ':') return const_cast (buf + bi); ++bi; if (!ACE_OS::strptime_getnum (buf + bi, &tm->tm_min, &bi, &fi, 0, 59)) return const_cast (buf + bi); break; case 'S': /* seconds (0-61) */ if (!ACE_OS::strptime_getnum (buf + bi, &tm->tm_sec, &bi, &fi, 0, 61)) return const_cast (buf + bi); break; case 'T': /* %H:%M:%S */ if (!ACE_OS::strptime_getnum (buf + bi, &tm->tm_hour, &bi, &fi, 0, 23)) return const_cast (buf + bi); --fi; if (buf[bi] != ':') return const_cast (buf + bi); ++bi; if (!ACE_OS::strptime_getnum (buf + bi, &tm->tm_min, &bi, &fi, 0, 59)) return const_cast (buf + bi); --fi; if (buf[bi] != ':') return const_cast (buf + bi); ++bi; if (!ACE_OS::strptime_getnum (buf + bi, &tm->tm_sec, &bi, &fi, 0, 61)) return const_cast (buf + bi); break; case 'w': /* day of week (0=Sun-6) */ if (!ACE_OS::strptime_getnum (buf + bi, &tm->tm_wday, &bi, &fi, 0, 6)) return const_cast (buf + bi); break; /* not supported yet: date, based on locale case 'x': / * date, based on locale * / break; */ /* not supported yet: case 'X': / * time, based on locale * / break; */ case 'y': /* the year - 1900 (0-99) */ if (!ACE_OS::strptime_getnum (buf + bi, &tm->tm_year, &bi, &fi, 0, 99)) return const_cast (buf + bi); if (tm->tm_year < 69) tm->tm_year += 100; break; case 'Y': /* the full year (1999) */ if (!ACE_OS::strptime_getnum (buf + bi, &tm->tm_year, &bi, &fi, 0, 0)) return const_cast (buf + bi); tm->tm_year -= 1900; break; default: /* unrecognised */ return const_cast (buf + bi); } /* switch (format[fi]) */ } else { /* if (percent) */ if (format[fi] == '%') { percent = true; ++fi; } else { if (format[fi] == buf[bi]) { ++fi; ++bi; } else return const_cast (buf + bi); } } /* if (percent) */ } /* while (format[fi] */ return const_cast (buf + bi); } int ACE_OS::strptime_getnum (const char *buf, int *num, int *bi, int *fi, int min, int max) { int i = 0, tmp = 0; while (isdigit (buf[i])) { tmp = (tmp * 10) + (buf[i] - '0'); if (max && (tmp > max)) return 0; ++i; } if (tmp < min) return 0; else if (i) { *num = tmp; (*fi)++; *bi += i; return 1; } else return 0; } #endif /* ACE_LACKS_STRPTIME */ ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/INET_Addr.h0000644000175000017500000003675215027201773015576 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file INET_Addr.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef ACE_INET_ADDR_H #define ACE_INET_ADDR_H #include /**/ "ace/pre.h" #include "ace/Sock_Connect.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Addr.h" #include ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_INET_Addr * * @brief Defines a C++ wrapper facade for the Internet domain address * family format. * * ACE_INET_Addr can hold all of the IP addresses assigned to a single name. * By default it refers only to the first, if there is more than one. The * next() method can make the others available in turn. */ class ACE_Export ACE_INET_Addr : public ACE_Addr { public: /// Default constructor. ACE_INET_Addr (); /// Copy constructor. ACE_INET_Addr (const ACE_INET_Addr &); /// Creates an ACE_INET_Addr from a sockaddr_in structure. ACE_INET_Addr (const sockaddr_in *addr, int len); /// Creates an ACE_INET_Addr from a @a port_number and the remote /// @a host_name. The port number is assumed to be in host byte order. /// To set a port already in network byte order, please @see set(). /// Use address_family to select IPv6 (PF_INET6) vs. IPv4 (PF_INET). ACE_INET_Addr (u_short port_number, const char host_name[], int address_family = AF_UNSPEC); /** * Initializes an ACE_INET_Addr from the @a address, which can be * "ip-addr:port-number" (e.g., "tango.cs.wustl.edu:1234"), * "ip-addr:port-name" (e.g., "tango.cs.wustl.edu:telnet"), * "ip-number:port-number" (e.g., "128.252.166.57:1234"), * "ip-number:port-name" (e.g., "128.252.166.57:telnet"), * "[ipv6-number]:port-number (e.g, "[2001:db8::57]:1234") or * "[ipv6-number]:port-name (e.g, "[2001:db8::57]:telnet"). * If there is no ':' in the @a address it is assumed to be a port number, * with the IP address being INADDR_ANY. */ explicit ACE_INET_Addr (const char address[], int address_family = AF_UNSPEC); /** * Creates an ACE_INET_Addr from a @a port_number and an Internet * @a ip_addr. This method assumes that @a port_number and @a ip_addr * are in host byte order. If you have addressing information in * network byte order, @see set(). */ explicit ACE_INET_Addr (u_short port_number, ACE_UINT32 ip_addr = INADDR_ANY); /// Uses getservbyname() to create an ACE_INET_Addr from a /// @a port_name, the remote @a host_name, and the @a protocol. ACE_INET_Addr (const char port_name[], const char host_name[], const char protocol[] = "tcp"); /** * Uses getservbyname() to create an ACE_INET_Addr from a * @a port_name, an Internet @a ip_addr, and the @a protocol. This * method assumes that @a ip_addr is in host byte order. */ ACE_INET_Addr (const char port_name[], ACE_UINT32 ip_addr, const char protocol[] = "tcp"); #if defined (ACE_HAS_WCHAR) ACE_INET_Addr (u_short port_number, const wchar_t host_name[], int address_family = AF_UNSPEC); explicit ACE_INET_Addr (const wchar_t address[], int address_family = AF_UNSPEC); ACE_INET_Addr (const wchar_t port_name[], const wchar_t host_name[], const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp")); ACE_INET_Addr (const wchar_t port_name[], ACE_UINT32 ip_addr, const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp")); #endif /* ACE_HAS_WCHAR */ /// Default dtor. ~ACE_INET_Addr (); // = Direct initialization methods. // These methods are useful after the object has been constructed. /// Assignment. In a more well-ordered world, member-wise assignment would /// work fine. However, because of the class design feature that all of the /// acceptor/connector-type classes that can be used in the /// Acceptor-Connector framework take ACE_Addr objects instead of the /// addressing class matching the family in use. The mechanism used to /// enable this substitution to the more-appropriate class is /// ACE_sap_any_cast, which casts the ACE_Addr to the more-specific class. /// In this case, casting an ACE_Addr to ACE_INET_Addr then copying it. /// Since adding multiple address support to ACE_INET_Addr, that cast-copy /// operation ends up, in the member-wise case, copying a bogus vector /// and doing lots of random damage. Thus, this operator is used to make /// life ordered in this common scenario. ACE_INET_Addr & operator= (const ACE_INET_Addr &rhs); /// Initializes from another ACE_INET_Addr. int set (const ACE_INET_Addr &); /** * Initializes an ACE_INET_Addr from a @a port_number and the * remote @a host_name. If @a encode is non-zero then @a port_number is * converted into network byte order, otherwise it is assumed to be * in network byte order already and are passed straight through. * address_family can be used to select IPv4/IPv6 if the OS has * IPv6 capability (ACE_HAS_IPV6 is defined). To specify IPv6, use * the value AF_INET6. To specify IPv4, use AF_INET. */ int set (u_short port_number, const char host_name[], int encode = 1, int address_family = AF_UNSPEC); /** * Initializes an ACE_INET_Addr from a @a port_number and an Internet * @a ip_addr. If @a encode is non-zero then the port number and IP address * are converted into network byte order, otherwise they are assumed to be * in network byte order already and are passed straight through. * * If @a map is non-zero and IPv6 support has been compiled in, * then this address will be set to the IPv4-mapped IPv6 address of it. */ int set (u_short port_number, ACE_UINT32 ip_addr = INADDR_ANY, int encode = 1, int map = 0); /// Uses getservbyname() to initialize an ACE_INET_Addr from a /// @a port_name, the remote @a host_name, and the @a protocol. int set (const char port_name[], const char host_name[], const char protocol[] = "tcp"); /** * Uses getservbyname() to initialize an ACE_INET_Addr from a * @a port_name, an @a ip_addr, and the @a protocol. This assumes that * @a ip_addr is already in network byte order. */ int set (const char port_name[], ACE_UINT32 ip_addr, const char protocol[] = "tcp"); /** * Initializes an ACE_INET_Addr from the @a address, which can be * "ip-addr:port-number" (e.g., "tango.cs.wustl.edu:1234"), * "ip-addr:port-name" (e.g., "tango.cs.wustl.edu:telnet"), * "ip-number:port-number" (e.g., "128.252.166.57:1234"), * "ip-number:port-name" (e.g., "128.252.166.57:telnet"), * "[ipv6-number]:port-number (e.g, "[2001:db8::57]:1234") or * "[ipv6-number]:port-name (e.g, "[2001:db8::57]:telnet"). * If there is no ':' in the @a address it is assumed to be a port number, * with the IP address being INADDR_ANY. */ int set (const char addr[], int address_family = AF_UNSPEC); /// Creates an ACE_INET_Addr from a sockaddr_in structure. int set (const sockaddr_in *, int len); #if defined (ACE_HAS_WCHAR) int set (u_short port_number, const wchar_t host_name[], int encode = 1, int address_family = AF_UNSPEC); int set (const wchar_t port_name[], const wchar_t host_name[], const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp")); int set (const wchar_t port_name[], ACE_UINT32 ip_addr, const wchar_t protocol[] = ACE_TEXT_WIDE ("tcp")); int set (const wchar_t addr[], int address_family = AF_UNSPEC); #endif /* ACE_HAS_WCHAR */ /// Return a pointer to the underlying network address. virtual void *get_addr () const; int get_addr_size() const; /// Set a pointer to the address. virtual void set_addr (const void *, int len); /// Set a pointer to the address. virtual void set_addr (const void *, int len, int map); /** * Transform the current ACE_INET_Addr address into string format. * If @a ipaddr_format is true this produces "ip-number:port-number" * (e.g., "128.252.166.57:1234" or "[2001:db8::57]:1234"), whereas * if @a ipaddr_format is false this produces "ip-name:port-number" (e.g., * "tango.cs.wustl.edu:1234"). Returns -1 if the @a size of the * @a buffer is too small, else 0. */ virtual int addr_to_string (ACE_TCHAR buffer[], size_t size, int ipaddr_format = 1) const; /** * Initializes an ACE_INET_Addr from the @a address, which can be * "ip-addr:port-number" (e.g., "tango.cs.wustl.edu:1234"), * "ip-addr:port-name" (e.g., "tango.cs.wustl.edu:telnet"), * "ip-number:port-number" (e.g., "128.252.166.57:1234"), * "ip-number:port-name" (e.g., "128.252.166.57:telnet"), * "[ipv6-number]:port-number (e.g, "[2001:db8::57]:1234") or * "[ipv6-number]:port-name (e.g, "[2001:db8::57]:telnet"). * If there is no ':' in the @a address it is assumed to be a port number, * with the IP address being INADDR_ANY. */ virtual int string_to_addr (const char address[], int address_family = AF_UNSPEC); #if defined (ACE_HAS_WCHAR) /* virtual int string_to_addr (const char address[]); */ #endif /* ACE_HAS_WCHAR */ /** * Sets the port number without affecting the host name. If * @a encode is enabled then @a port_number is converted into network * byte order, otherwise it is assumed to be in network byte order * already and are passed straight through. */ void set_port_number (u_short, int encode = 1); /** * Sets the address without affecting the port number. If * @a encode is enabled then @a ip_addr is converted into network * byte order, otherwise it is assumed to be in network byte order * already and are passed straight through. The size of the address * is specified in the @a len parameter. * If @a map is non-zero, IPv6 support has been compiled in, and * @a ip_addr is an IPv4 address, then this address is set to the IPv4-mapped * IPv6 address of it. */ int set_address (const char *ip_addr, int len, int encode = 1, int map = 0); #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 /* (ACE_LINUX || ACE_WIN32) && ACE_HAS_IPV6 */ /// Return the port number, converting it into host byte-order. u_short get_port_number () const; /** * Return the character representation of the name of the host, * storing it in the @a hostname (which is assumed to be * @a hostnamelen bytes long). This version is reentrant. If * @a hostnamelen is greater than 0 then @a hostname will be * NUL-terminated even if -1 is returned. */ int get_host_name (char hostname[], size_t hostnamelen) const; #if defined (ACE_HAS_WCHAR) int get_host_name (wchar_t hostname[], size_t hostnamelen) const; #endif /* ACE_HAS_WCHAR */ /** * Return the character representation of the hostname. This * version is non-reentrant since it returns a pointer to a static * data area. You should therefore either (1) do a "deep copy" of * the address returned by get_host_name(), e.g., using strdup() or * (2) use the "reentrant" version of get_host_name() described * above. */ const char *get_host_name () const; /** * Return the "dotted decimal" Internet address representation of * the hostname storing it in the @a addr (which is assumed to be * @a addr_size bytes long). This version is reentrant. */ const char *get_host_addr (char *addr, int addr_size) const; /** * Return the "dotted decimal" Internet address representation of * the hostname. This version is non-reentrant since it returns a * pointer to a static data area. You should therefore either * (1) do a "deep copy" of the address returned by get_host_addr(), e.g., * using strdup() or (2) use the "reentrant" version of * get_host_addr() described above. */ const char *get_host_addr () const; /// Return the 4-byte IP address, converting it into host byte /// order. ACE_UINT32 get_ip_address () const; /// Return @c true if the IP address is INADDR_ANY or IN6ADDR_ANY. bool is_any () const; /// Return @c true if the IP address is IPv4/IPv6 loopback address. bool is_loopback () const; /// Return @c true if the IP address is IPv4/IPv6 multicast address. bool is_multicast () const; #if defined (ACE_HAS_IPV6) /// Return @c true if the IP address is IPv6 linklocal address. bool is_linklocal () const; /// Return @c true if the IP address is IPv6 sitelocal address. bool is_sitelocal () const; /// Return @c true if the IP address is IPv4-mapped IPv6 address. bool is_ipv4_mapped_ipv6 () const; /// Return @c true if the IP address is IPv4-compatible IPv6 address. bool is_ipv4_compat_ipv6 () const; #endif /* ACE_HAS_IPV6 */ /** * Returns @c true if @c this is less than @a rhs. In this context, * "less than" is defined in terms of IP address and TCP port * number. This operator makes it possible to use @c ACE_INET_Addrs * in STL maps. */ bool operator < (const ACE_INET_Addr &rhs) const; /// Compare two addresses for equality. The addresses are considered /// equal if they contain the same IP address and port number. bool operator == (const ACE_INET_Addr &SAP) const; /// Compare two addresses for inequality. bool operator != (const ACE_INET_Addr &SAP) const; /// A variation of the equality operator, this method only compares the /// IP address and ignores the port number. bool is_ip_equal (const ACE_INET_Addr &SAP) const; /// Computes and returns hash value. virtual u_long hash () const; /// If there is another address to examine, move to it and return true; /// else return false. bool next (); /// Reset the set of address so they can be scanned again using next(). void reset (); /// Dump the state of an object. void dump () const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; private: /// Insure that @a hostname is properly null-terminated. int get_host_name_i (char hostname[], size_t hostnamelen) const; // Methods to gain access to the actual address of // the underlying internet address structure. void *ip_addr_pointer () const; int ip_addr_size () const; int determine_type () const; /// Initialize underlying inet_addr_ to default values void reset_i (); /// Underlying representation. /// This union uses the knowledge that the two structures share the /// first member, sa_family (as all sockaddr structures do). union ip46 { sockaddr_in in4_; #if defined (ACE_HAS_IPV6) sockaddr_in6 in6_; #endif /* ACE_HAS_IPV6 */ } inet_addr_; // If there is more than one address assigned to a given name, this // holds all of them; one is always copied to inet_addr_. std::vector inet_addrs_; std::vector::iterator inet_addrs_iter_; }; ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/INET_Addr.inl" #endif /* __ACE_INLINE__ */ #include /**/ "ace/post.h" #endif /* ACE_INET_ADDR_H */ ace-8.0.4+dfsg.orig/ace/Timer_List_T.cpp0000644000175000017500000003164715027201773016774 0ustar sudipsudip#ifndef ACE_TIMER_LIST_T_C #define ACE_TIMER_LIST_T_C #include "ace/Timer_List_T.h" #include "ace/Guard_T.h" #include "ace/Log_Category.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ // Default Constructor template ACE_Timer_List_Iterator_T::ACE_Timer_List_Iterator_T (List& lst) : list_ (lst) { this->first(); } template ACE_Timer_List_Iterator_T::~ACE_Timer_List_Iterator_T () { } // Positions the iterator at the node right after the dummy node template void ACE_Timer_List_Iterator_T::first () { this->current_node_ = this->list_.get_first(); } // Positions the iterator at the next node in the Timer Queue template void ACE_Timer_List_Iterator_T::next () { // Make sure that if we are at the end, we don't wrap around if (! this->isdone()) this->current_node_ = this->current_node_->get_next (); if (this->current_node_ == this->list_.head_) this->current_node_ = 0; } // Returns true when we are at template bool ACE_Timer_List_Iterator_T::isdone () const { return this->current_node_ == 0; } // Returns the node at or 0 if we are at the end template ACE_Timer_Node_T * ACE_Timer_List_Iterator_T::item () { if (! this->isdone()) return this->current_node_; return 0; } /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // Return our instance of the iterator template ACE_Timer_Queue_Iterator_T & ACE_Timer_List_T::iter () { this->iterator_->first (); return *this->iterator_; } // Create an empty list. template ACE_Timer_List_T::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) , id_counter_ (0) { ACE_TRACE ("ACE_Timer_List_T::ACE_Timer_List_T"); this->head_->set_next (this->head_); this->head_->set_prev (this->head_); ACE_NEW (iterator_, Iterator(*this)); } // Checks if list is empty. template bool ACE_Timer_List_T::is_empty () const { ACE_TRACE ("ACE_Timer_List_T::is_empty"); return this->get_first_i() == 0; } // Returns earliest time in a non-empty list. template const ACE_Time_Value & ACE_Timer_List_T::earliest_time () const { ACE_TRACE ("ACE_Timer_List_T::earliest_time"); ACE_Timer_Node_T* first = this->get_first_i(); if (first != 0) return first->get_timer_value (); return ACE_Time_Value::zero; } // Remove all remaining items in the list. template ACE_Timer_List_T::~ACE_Timer_List_T () { 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 int ACE_Timer_List_T::close () { 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* n = this->get_first(); n != this->head_; ) { this->upcall_functor ().deletion (*this, n->get_type(), n->get_act()); ACE_Timer_Node_T *next = n->get_next (); this->free_node (n); n = next; } } // Leave rest to destructor return 0; } template void ACE_Timer_List_T::dump () const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_Timer_List_T::dump"); ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); int count = 0; ACE_Timer_Node_T* n = this->get_first_i(); if (n != 0) { for (; n != this->head_; n = n->get_next()) { ++count; } } ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nsize_ = %d"), count)); ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } // Reschedule a periodic timer. This function must be called with the // lock held. template void ACE_Timer_List_T::reschedule (ACE_Timer_Node_T* n) { ACE_TRACE ("ACE_Timer_List_T::reschedule"); this->schedule_i(n, n->get_timer_value()); } // Insert a new handler that expires at time future_time; if interval // is > 0, the handler will be reinvoked periodically. template long ACE_Timer_List_T::schedule_i (const TYPE &type, const void *act, const ACE_Time_Value &future_time, const ACE_Time_Value &interval) { ACE_TRACE ("ACE_Timer_List_T::schedule_i"); ACE_Timer_Node_T* n = this->alloc_node(); if (n != 0) { long id = this->id_counter_++; if (id != -1) { n->set (type, act, future_time, interval, 0, 0, id); this->schedule_i (n, future_time); } return id; } // Failure return errno = ENOMEM; return -1; } /// The shared scheduling functionality between schedule() and reschedule() template void ACE_Timer_List_T::schedule_i (ACE_Timer_Node_T* n, const ACE_Time_Value& expire) { if (this->is_empty()) { n->set_prev(this->head_); n->set_next(this->head_); this->head_->set_prev(n); this->head_->set_next(n); return; } // We always want to search backwards from the tail of the list, because // this minimizes the search in the extreme case when lots of timers are // scheduled for exactly the same time, and it also assumes that most of // the timers will be scheduled later than existing timers. ACE_Timer_Node_T* p = this->head_->get_prev(); while (p != this->head_ && p->get_timer_value() > expire) p = p->get_prev(); // insert after n->set_prev(p); n->set_next(p->get_next()); p->get_next()->set_prev(n); p->set_next(n); } template ACE_Timer_Node_T* ACE_Timer_List_T::find_node (long timer_id) const { ACE_Timer_Node_T* n = this->get_first_i(); if (n == 0) return 0; for (; n != this->head_; n = n->get_next()) { if (n->get_timer_id() == timer_id) { return n; } } return 0; } // Locate and update the inteval on the timer_id template int ACE_Timer_List_T::reset_interval (long timer_id, const ACE_Time_Value &interval) { ACE_TRACE ("ACE_Timer_List_T::reset_interval"); ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); ACE_Timer_Node_T* n = this->find_node(timer_id); if (n != 0) { n->set_interval(interval); // The interval will take effect the next time this node is expired. return 0; } return -1; } // Locate and remove the single with a value of // @a timer_id from the timer queue. template int ACE_Timer_List_T::cancel (long timer_id, const void **act, int skip_close) { ACE_TRACE ("ACE_Timer_List_T::cancel"); ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); ACE_Timer_Node_T* n = this->find_node(timer_id); if (n != 0) { if (act != 0) *act = n->get_act (); // Call the close hooks. int cookie = 0; // cancel_type() called once per . this->upcall_functor ().cancel_type (*this, n->get_type (), skip_close, cookie); // cancel_timer() called once per . this->upcall_functor ().cancel_timer (*this, n->get_type (), skip_close, cookie); this->cancel_i (n); return 1; } return 0; } // Locate and remove all values of from the timer queue. template int ACE_Timer_List_T::cancel (const TYPE &type, int skip_close) { ACE_TRACE ("ACE_Timer_List_T::cancel"); int num_canceled = 0; // Note : Technically this can overflow. int cookie = 0; ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); if (!this->is_empty ()) { for (ACE_Timer_Node_T* n = this->get_first(); n != this->head_; ) { if (n->get_type() == type) // Note: Typically Type is an ACE_Event_Handler* { ++num_canceled; ACE_Timer_Node_T* tmp = n; n = n->get_next(); this->cancel_i (tmp); } else { n = n->get_next(); } } } // Call the close hooks. // cancel_type() called once per . this->upcall_functor ().cancel_type (*this, type, skip_close, cookie); for (int i = 0; i < num_canceled; ++i) { // cancel_timer() called once per . this->upcall_functor ().cancel_timer (*this, type, skip_close, cookie); } return num_canceled; } template void ACE_Timer_List_T::unlink (ACE_Timer_Node_T* n) { n->get_prev()->set_next(n->get_next()); n->get_next()->set_prev(n->get_prev()); n->set_prev(0); n->set_next(0); } /// Shared subset of the two cancel() methods. template void ACE_Timer_List_T::cancel_i (ACE_Timer_Node_T* n) { this->unlink (n); this->free_node (n); } // Reads the first node on the list and returns it. template ACE_Timer_Node_T * ACE_Timer_List_T::get_first () { ACE_TRACE ("ACE_Timer_List_T::get_first"); return this->get_first_i(); } template ACE_Timer_Node_T * ACE_Timer_List_T::get_first_i () const { ACE_TRACE ("ACE_Timer_List_T::get_first_i"); ACE_Timer_Node_T* first = this->head_->get_next(); if (first != this->head_) // Note : is_empty() uses get_first() return first; return 0; } // Removes the first node on the list and returns it. template ACE_Timer_Node_T * ACE_Timer_List_T::remove_first () { ACE_TRACE ("ACE_Timer_List_T::remove_first"); ACE_Timer_Node_T* first = this->get_first(); if (first != 0) { this->unlink(first); return first; } return 0; } #endif /* ACE_TIMER_LIST_T_C */ ace-8.0.4+dfsg.orig/ace/Log_Msg_Callback.h0000644000175000017500000000417315027201773017200 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Log_Msg_Callback.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef ACE_LOG_MSG_CALLBACK_H #define ACE_LOG_MSG_CALLBACK_H #include /**/ "ace/pre.h" #include /**/ "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Log_Record; /** * @class ACE_Log_Msg_Callback * * @brief An interface class used to get logging callbacks. * * Users who are interested in getting the logging messages * directly, can subclass this interface and override the log() * method. They must then register their subclass with the * Log_Msg class and make sure that they turn on the * ACE_Log_Msg::MSG_CALLBACK flag. * * Your log() routine is called with an instance of * ACE_Log_Record. From this class, you can get the log * message, the verbose log message, message type, message * priority, and so on. * * Remember that there is one Log_Msg object per thread. * Therefore, you may need to register your callback object with * many ACE_Log_Msg objects (and have the correct * synchronization in the log() method) or have a separate * callback object per Log_Msg object. Moreover, * ACE_Log_Msg_Callbacks are not inherited when a new thread * is spawned because it might have been allocated off of the * stack of the original thread, in which case all hell would * break loose... Therefore, you'll need to reset these in each * new thread. */ class ACE_Export ACE_Log_Msg_Callback { public: /// Default constructor ACE_Log_Msg_Callback () = default; /// No-op virtual destructor. virtual ~ACE_Log_Msg_Callback () = default; /// Callback routine. This is called when we want to log a message. /// Since this routine is pure virtual, it must be overwritten by the /// subclass. virtual void log (ACE_Log_Record &log_record) = 0; }; ACE_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" #endif /* ACE_LOG_MSG_CALLBACK_H */ ace-8.0.4+dfsg.orig/ace/DEV_Connector.inl0000644000175000017500000000206415027201773017055 0ustar sudipsudip// -*- C++ -*- ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Creates a Local ACE_DEV. ACE_INLINE ACE_DEV_Connector::ACE_DEV_Connector (ACE_DEV_IO &new_io, const ACE_DEV_Addr &remote_sap, ACE_Time_Value *timeout, const ACE_Addr &local_sap, int reuse_addr, int flags, int perms) { ACE_TRACE ("ACE_DEV_Connector::ACE_DEV_Connector"); if (this->connect (new_io, remote_sap, timeout, local_sap, reuse_addr, flags, perms) == ACE_IO_SAP::INVALID_HANDLE && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) ACELIB_ERROR ((LM_ERROR, ACE_TEXT ("address %s, %p\n"), remote_sap.get_path_name (), ACE_TEXT ("ACE_DEV_IO"))); } ACE_INLINE bool ACE_DEV_Connector::reset_new_handle (ACE_HANDLE) { // Nothing to do here since the handle is not a socket return false; } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/SOCK_CODgram.inl0000644000175000017500000000045215027201773016517 0ustar sudipsudip// -*- C++ -*- ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_SOCK_CODgram::ACE_SOCK_CODgram () { ACE_TRACE ("ACE_SOCK_CODgram::ACE_SOCK_CODgram"); } ACE_INLINE ACE_SOCK_CODgram::~ACE_SOCK_CODgram () { ACE_TRACE ("ACE_SOCK_CODgram::~ACE_SOCK_CODgram"); } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/FIFO_Recv.cpp0000644000175000017500000000462715027201773016136 0ustar sudipsudip#include "ace/FIFO_Recv.h" #include "ace/Log_Category.h" #include "ace/OS_NS_fcntl.h" #if defined (ACE_HAS_ALLOC_HOOKS) # include "ace/Malloc_Base.h" #endif /* ACE_HAS_ALLOC_HOOKS */ #if !defined (__ACE_INLINE__) #include "ace/FIFO_Recv.inl" #endif /* __ACE_INLINE__ */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Recv) void ACE_FIFO_Recv::dump () const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_FIFO_Recv::dump"); ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_FIFO::dump (); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("aux_handle_ = %d"), this->aux_handle_)); ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } int ACE_FIFO_Recv::close () { ACE_TRACE ("ACE_FIFO_Recv::close"); int result = ACE_FIFO::close (); if (this->aux_handle_ != ACE_INVALID_HANDLE) return ACE_OS::close (this->aux_handle_); else return result; } // Note that persistent means "open fifo for writing, as well as // reading." This ensures that the fifo never gets EOF, even if there // aren't any writers at the moment! int ACE_FIFO_Recv::open (const ACE_TCHAR *fifo_name, int flags, mode_t perms, int persistent, LPSECURITY_ATTRIBUTES sa) { ACE_TRACE ("ACE_FIFO_Recv::open"); if (ACE_FIFO::open (fifo_name, ACE_NONBLOCK | flags, perms, sa) == -1) return -1; else if (this->disable (ACE_NONBLOCK) == -1) return -1; else if (persistent && (this->aux_handle_ = ACE_OS::open (fifo_name, O_WRONLY, 0, sa)) == ACE_INVALID_HANDLE) return -1; else return this->get_handle () == ACE_INVALID_HANDLE ? -1 : 0; } ACE_FIFO_Recv::ACE_FIFO_Recv () : aux_handle_ (ACE_INVALID_HANDLE) { ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv"); } ACE_FIFO_Recv::ACE_FIFO_Recv (const ACE_TCHAR *fifo_name, int flags, mode_t perms, int persistent, LPSECURITY_ATTRIBUTES sa) : aux_handle_ (ACE_INVALID_HANDLE) { ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv"); if (this->ACE_FIFO_Recv::open (fifo_name, flags, perms, persistent, sa) == -1) ACELIB_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_FIFO_Recv"))); } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Arg_Shifter.cpp0000644000175000017500000001237715027201773016632 0ustar sudipsudip#ifndef ACE_ARG_SHIFTER_T_CPP #define ACE_ARG_SHIFTER_T_CPP #include "ace/Arg_Shifter.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_strings.h" #include "ace/OS_Errno.h" #include "ace/OS_Memory.h" #if defined (ACE_HAS_ALLOC_HOOKS) # include "ace/Malloc_Base.h" #endif /* ACE_HAS_ALLOC_HOOKS */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL template ACE_Arg_Shifter_T::ACE_Arg_Shifter_T (int &argc, CHAR_TYPE const **argv, CHAR_TYPE const **temp) : argc_ (argc), total_size_ (argc), temp_ (const_cast (temp)), argv_ (const_cast (argv)), current_index_ (0), back_ (argc - 1), front_ (0) { this->init (); } template ACE_Arg_Shifter_T::ACE_Arg_Shifter_T (int &argc, CHAR_TYPE **argv, CHAR_TYPE **temp) : argc_ (argc), total_size_ (argc), temp_ (temp), argv_ (argv), current_index_ (0), back_ (argc - 1), front_ (0) { this->init (); } template void ACE_Arg_Shifter_T::init () { // If not provided with one, allocate a temporary array. if (this->temp_ == 0) #if defined (ACE_HAS_ALLOC_HOOKS) this->temp_ = reinterpret_cast (ACE_Allocator::instance ()->malloc (sizeof (CHAR_TYPE*) * this->total_size_)); #else ACE_NEW (this->temp_, CHAR_TYPE *[this->total_size_]); #endif /* ACE_HAS_ALLOC_HOOKS */ if (this->temp_ != 0) { // Fill the temporary array. this->argc_ = 0; for (int i = 0; i < this->total_size_; i++) { this->temp_[i] = this->argv_[i]; this->argv_[i] = 0; } } else { // Allocation failed, prohibit iteration. this->current_index_ = this->argc_; this->front_ = this->argc_; } } template ACE_Arg_Shifter_T::~ACE_Arg_Shifter_T () { // Delete the temporary vector. #if defined (ACE_HAS_ALLOC_HOOKS) if (this->temp_) ACE_Allocator::instance ()->free (this->temp_); #else delete [] temp_; #endif /* ACE_HAS_ALLOC_HOOKS */ } template CHAR_TYPE const * ACE_Arg_Shifter_T::get_current () const { CHAR_TYPE const *retval = 0; if (this->is_anything_left ()) retval = this->temp_[current_index_]; return retval; } template CHAR_TYPE const * ACE_Arg_Shifter_T::get_the_parameter (CHAR_TYPE const *flag) { // the return 0's abound because this method // would otherwise be a deep if { } else { } // check to see if any arguments still exist if (!this->is_anything_left()) return 0; // check to see if the flag is the argument int const offset = this->cur_arg_strncasecmp (flag); if (offset == -1) return 0; if (offset == 0) { this->consume_arg (); if (!this->is_parameter_next()) { return 0; } } // the parameter is in the middle somewhere... return this->temp_[current_index_] + offset; } template int ACE_Arg_Shifter_T::cur_arg_strncasecmp (CHAR_TYPE const *flag) { if (!this->is_anything_left ()) return -1; const size_t flag_length = ACE_OS::strlen (flag); CHAR_TYPE const *arg = this->temp_[this->current_index_]; if (ACE_OS::strncasecmp (arg, flag, flag_length) != 0) return -1; const size_t arg_length = ACE_OS::strlen (arg); size_t remaining = flag_length; while (remaining < arg_length && arg[remaining] == CHAR_TYPE (' ')) ++remaining; return (arg_length == flag_length) ? 0 : static_cast (remaining); } template int ACE_Arg_Shifter_T::consume_arg (int number) { int retval = 0; // Stick knowns at the end of the vector (consumed). if (this->is_anything_left() >= number) { for (int i = 0, j = this->back_ - (number - 1); i < number; ++i, ++j, ++this->current_index_) this->argv_[j] = this->temp_[this->current_index_]; this->back_ -= number; retval = 1; } return retval; } template int ACE_Arg_Shifter_T::ignore_arg (int number) { int retval = 0; // Keep unknowns at the head of the vector. if (this->is_anything_left () >= number) { for (int i = 0; i < number; i++, this->current_index_++, this->front_++) this->argv_[this->front_] = this->temp_[this->current_index_]; retval = 1; this->argc_ += number; } return retval; } template int ACE_Arg_Shifter_T::is_anything_left () const { return this->total_size_ - this->current_index_; } template int ACE_Arg_Shifter_T::is_option_next () const { return this->is_anything_left () && this->temp_[this->current_index_][0] == '-'; } template int ACE_Arg_Shifter_T::is_parameter_next () const { return this->is_anything_left () && this->temp_[this->current_index_][0] != '-'; } template int ACE_Arg_Shifter_T::num_ignored_args () const { return this->front_; } ACE_END_VERSIONED_NAMESPACE_DECL #endif ace-8.0.4+dfsg.orig/ace/config-win32-borland.h0000644000175000017500000001207515027201773017721 0ustar sudipsudip//-*- C++ -*- // 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 1 #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; #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 ; // 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 !defined (WIN32) # if defined (__WIN32__) || defined (_WIN32) # define WIN32 1 # endif #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 /**/ # endif #define ACE_HAS_BCC64 #define ACE_CC_PREPROCESSOR_ARGS "--precompile -q -o%s" #define ACE_CC_PREPROCESSOR "BCC64X.EXE" # include "ace/config-win32-common.h" #define ACE_WSTRING_HAS_USHORT_SUPPORT 1 #define ACE_HAS_DIRENT #define ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS #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 #define ACE_LACKS_WCSRTOMBS #define ACE_LACKS_SET_ABORT_BEHAVIOR #define ACE_HAS_CRTSETREPORTMODE #define ACE_HAS_SETUNHANDLEDEXCEPTIONFILTER #undef ACE_LACKS_REWINDDIR #define ACE_HAS_WOPENDIR_EQUIVALENT ::_wopendir #define ACE_HAS_WCLOSEDIR_EQUIVALENT ::_wclosedir #define ACE_HAS_WREADDIR_EQUIVALENT ::_wreaddir #define ACE_HAS_WREWINDDIR_EQUIVALENT ::_wrewinddir #define ACE_LACKS_STRRECVFD #define ACE_HAS_TIME_T_LONG_MISMATCH #define ACE_HAS_NONCONST_SELECT_TIMEVAL #define ACE_HAS_SIG_ATOMIC_T #define ACE_HAS_USER_MODE_MASKS 1 #define ACE_LACKS_ACE_IOSTREAM 1 #define ACE_LACKS_LINEBUFFERED_STREAMBUF 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__ */ #endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */ #define ACE_LACKS_ISWCTYPE #define ACE_LACKS_ISCTYPE #define ACE_LACKS_STRTOK_R #define ACE_LACKS_ASCTIME_R #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 #define ACE_HAS_BUILTIN_BSWAP16 #define ACE_HAS_BUILTIN_BSWAP32 #define ACE_HAS_BUILTIN_BSWAP64 #define ACE_LACKS_INLINE_ASSEMBLY #define ACE_LACKS_GID_T #undef ACE_LACKS_USECONDS_T #define ACE_HAS_POSIX_TIME #define ACE_LACKS_TIMESPEC_T #define ACE_LACKS_UID_T #define ACE_LACKS_GMTIME_R #define ACE_LACKS_LOCALTIME_R #define ACE_LACKS_NLINK_T #define ACE_HAS_3_PARAM_WCSTOK #define ACE_LACKS_STRPTIME #if __cplusplus >= 201103L # define ACE_HAS_CPP11 #endif #if __cplusplus >= 201402L # define ACE_HAS_CPP14 #endif #if __cplusplus >= 201703L # define ACE_HAS_CPP17 #endif #if __cplusplus >= 202002L # define ACE_HAS_CPP20 #endif #if __cplusplus >= 202302L # define ACE_HAS_CPP23 #endif #include /**/ "ace/post.h" #endif /* ACE_CONFIG_WIN32_BORLAND_H */ ace-8.0.4+dfsg.orig/ace/POSIX_CB_Proactor.cpp0000644000175000017500000001125215027201773017543 0ustar sudipsudip#include "ace/POSIX_CB_Proactor.h" #if defined (ACE_HAS_AIO_CALLS) && !defined (ACE_HAS_BROKEN_SIGEVENT_STRUCT) #include "ace/Task_T.h" #include "ace/Log_Category.h" #include "ace/Object_Manager.h" #include "ace/OS_NS_sys_time.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_POSIX_CB_Proactor::ACE_POSIX_CB_Proactor (size_t max_aio_operations) : ACE_POSIX_AIOCB_Proactor (max_aio_operations, ACE_POSIX_Proactor::PROACTOR_CB), sema_ ((unsigned int) 0) { // we should start pseudo-asynchronous accept task // one per all future acceptors this->get_asynch_pseudo_task ().start (); } // Destructor. ACE_POSIX_CB_Proactor::~ACE_POSIX_CB_Proactor () { this->close (); } ACE_POSIX_Proactor::Proactor_Type ACE_POSIX_CB_Proactor::get_impl_type () { return PROACTOR_CB; } void ACE_POSIX_CB_Proactor::aio_completion_func (sigval cb_data) { ACE_POSIX_CB_Proactor * impl = static_cast (cb_data.sival_ptr); if ( impl != 0 ) impl->notify_completion (0); } #if defined (ACE_HAS_SIG_C_FUNC) extern "C" void ACE_POSIX_CB_Proactor_aio_completion (sigval cb_data) { ACE_POSIX_CB_Proactor::aio_completion_func (cb_data); } #endif /* ACE_HAS_SIG_C_FUNC */ int ACE_POSIX_CB_Proactor::handle_events (ACE_Time_Value &wait_time) { // Decrement with the amount of time spent in the method ACE_Countdown_Time countdown (&wait_time); return this->handle_events_i (wait_time.msec ()); } int ACE_POSIX_CB_Proactor::handle_events () { return this->handle_events_i (ACE_INFINITE); } int ACE_POSIX_CB_Proactor::notify_completion (int sig_num) { ACE_UNUSED_ARG (sig_num); return this->sema_.release(); } ssize_t ACE_POSIX_CB_Proactor::allocate_aio_slot (ACE_POSIX_Asynch_Result *result) { ssize_t const slot = ACE_POSIX_AIOCB_Proactor::allocate_aio_slot (result); if (slot == -1) return -1; // setup OS notification methods for this aio // @@ TODO: This gets the completion method back to this proactor to // find the completed aiocb. It would be so much better to not only get // the proactor, but the aiocb as well. result->aio_sigevent.sigev_notify = SIGEV_THREAD; # if defined (ACE_HAS_SIG_C_FUNC) result->aio_sigevent.sigev_notify_function = ACE_POSIX_CB_Proactor_aio_completion; # else result->aio_sigevent.sigev_notify_function = aio_completion_func; # endif /* ACE_HAS_SIG_C_FUNC */ result->aio_sigevent.sigev_notify_attributes = 0; result->aio_sigevent.sigev_value.sival_ptr = this ; return slot; } int ACE_POSIX_CB_Proactor::handle_events_i (u_long milli_seconds) { int result_wait=0; // Wait for the signals. if (milli_seconds == ACE_INFINITE) { result_wait = this->sema_.acquire(); } else { // Wait for amount of time. ACE_Time_Value abs_time = ACE_OS::gettimeofday () + ACE_Time_Value (0, milli_seconds * 1000); result_wait = this->sema_.acquire(abs_time); } // Check for errors // but let continue work in case of errors // we should check "post_completed" queue if (result_wait == -1) { int const lerror = errno; if (lerror != ETIME && // timeout lerror != EINTR ) // interrupted system call ACELIB_ERROR ((LM_ERROR, ACE_TEXT("%N:%l:(%P | %t)::%p\n"), ACE_TEXT("ACE_POSIX_CB_Proactor::handle_events:") ACE_TEXT("semaphore acquire failed") )); } size_t index = 0; // start index to scan aiocb list size_t count = this->aiocb_list_max_size_; // max number to iterate int error_status = 0; size_t return_status = 0; int ret_aio = 0; int ret_que = 0; for (;; ret_aio++) { ACE_POSIX_Asynch_Result * asynch_result = this->find_completed_aio (error_status, return_status, index, count); if (asynch_result == 0) break; // Call the application code. this->application_specific_code (asynch_result, return_status, // Bytes transferred. 0, // No completion key. error_status); // Error } // process post_completed results ret_que = this->process_result_queue (); // Uncomment this if you want to test // and research the behavior of you system // ACELIB_DEBUG ((LM_DEBUG, // "(%t) NumAIO=%d NumQueue=%d\n", // ret_aio, ret_que)); return ret_aio + ret_que > 0 ? 1 : 0; } ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_AIO_CALLS && !ACE_HAS_BROKEN_SIGEVENT_STRUCT */ ace-8.0.4+dfsg.orig/ace/SOCK_Dgram_Mcast.cpp0000644000175000017500000007306015027201773017431 0ustar sudipsudip#include "ace/SOCK_Dgram_Mcast.h" #include "ace/OS_Memory.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_errno.h" #include "ace/os_include/net/os_if.h" #include "ace/os_include/arpa/os_inet.h" #if defined (ACE_HAS_ALLOC_HOOKS) # include "ace/Malloc_Base.h" #endif /* ACE_HAS_ALLOC_HOOKS */ #if defined (ACE_LINUX) && defined (ACE_HAS_IPV6) #include "ace/OS_NS_sys_socket.h" #endif #if defined (ACE_WIN32) #include /**/ #endif #if defined (ACE_HAS_GETIFADDRS) # if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x700) # include /**/ # else # include /**/ # endif /*ACE_VXWORKS */ #endif /* ACE_HAS_GETIFADDRS */ #if !defined (__ACE_INLINE__) #include "ace/SOCK_Dgram_Mcast.inl" #endif /* __ACE_INLINE__ */ #include "ace/Log_Category.h" // This is a workaround for platforms with non-standard // definitions of the ip_mreq structure #if ! defined (IMR_MULTIADDR) #define IMR_MULTIADDR imr_multiaddr #endif /* ! defined (IMR_MULTIADDR) */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Helper (inline) functions. class ACE_SDM_helpers { public: // Convert ACE_INET_Addr to string, using local formatting rules. static void addr_to_string (const ACE_INET_Addr &ip_addr, ACE_TCHAR *ret_string, // results here. size_t len, int clip_portnum) // clip port# info? { if (ip_addr.addr_to_string (ret_string, len, 1) == -1) ACE_OS::strcpy (ret_string, ACE_TEXT ("")); else { ACE_TCHAR *pc = ACE_OS::strrchr (ret_string, ACE_TEXT (':')); if (clip_portnum && pc) *pc = ACE_TEXT ('\0'); // clip port# info. } } // op== for ip_mreq structs. static int is_equal (const ip_mreq &m1, const ip_mreq &m2) { return m1.IMR_MULTIADDR.s_addr == m2.IMR_MULTIADDR.s_addr && m1.imr_interface.s_addr == m2.imr_interface.s_addr; } }; ACE_ALLOC_HOOK_DEFINE (ACE_SOCK_Dgram_Mcast) void ACE_SOCK_Dgram_Mcast::dump () const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_SOCK_Dgram_Mcast::dump"); ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); # if defined (ACE_SOCK_DGRAM_MCAST_DUMPABLE) ACE_TCHAR addr_string[MAXNAMELEN + 1]; ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nOptions: bindaddr=%s, nulliface=%s\n"), ACE_BIT_ENABLED (this->opts_, OPT_BINDADDR_YES) ? ACE_TEXT ("") : ACE_TEXT (""), ACE_BIT_ENABLED (this->opts_, OPT_NULLIFACE_ALL) ? ACE_TEXT ("") : ACE_TEXT (""))); // Show default send addr, port#, and interface. ACE_SDM_helpers::addr_to_string (this->send_addr_, addr_string, sizeof addr_string, 0); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("Send addr=%s iface=%s\n"), addr_string, this->send_net_if_ ? this->send_net_if_ : ACE_TEXT (""))); // Show list of subscribed addresses. ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("Subscription list:\n"))); ACE_MT (ACE_GUARD (ACE_SDM_LOCK, guard, this->subscription_list_lock_)); subscription_list_iter_t iter (this->subscription_list_); for ( ; !iter.done (); iter.advance ()) { ACE_TCHAR iface_string[MAXNAMELEN + 1]; ip_mreq *pm = iter.next (); // Get subscribed address (w/out port# info - not relevant). ACE_INET_Addr ip_addr (static_cast (0), ACE_NTOHL (pm->IMR_MULTIADDR.s_addr)); ACE_SDM_helpers::addr_to_string (ip_addr, addr_string, sizeof addr_string, 1); // Get interface address/specification. ACE_INET_Addr if_addr (static_cast (0), ACE_NTOHL (pm->imr_interface.s_addr)); ACE_SDM_helpers::addr_to_string (if_addr, iface_string, sizeof iface_string, 1); if (ACE_OS::strcmp (iface_string, ACE_TEXT ("0.0.0.0")) == 0) // Receives on system default iface. (Note that null_iface_opt_ // option processing has already occurred.) ACE_OS::strcpy (iface_string, ACE_TEXT ("")); // Dump info. ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\taddr=%s iface=%s\n"), addr_string, iface_string)); } # endif /* ACE_SOCK_DGRAM_MCAST_DUMPABLE */ ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } // Constructor. ACE_SOCK_Dgram_Mcast::ACE_SOCK_Dgram_Mcast (ACE_SOCK_Dgram_Mcast::options opts) : send_addr_ () , opts_ (opts) { ACE_TRACE ("ACE_SOCK_Dgram_Mcast::ACE_SOCK_Dgram_Mcast"); } // Destructor. ACE_SOCK_Dgram_Mcast::~ACE_SOCK_Dgram_Mcast () { ACE_TRACE ("ACE_SOCK_Dgram_Mcast::~ACE_SOCK_Dgram_Mcast"); // Free memory and optionally unsubscribe from currently subscribed group(s). #if defined (ACE_HAS_ALLOC_HOOKS) ACE_Allocator::instance()->free(this->send_net_if_); #else delete [] this->send_net_if_; #endif /* ACE_HAS_ALLOC_HOOKS */ this->clear_subs_list (); } int ACE_SOCK_Dgram_Mcast::open (const ACE_INET_Addr &mcast_addr, const ACE_TCHAR *net_if, int reuse_addr) { ACE_TRACE ("ACE_SOCK_Dgram_Mcast::open"); // Only perform the initialization if we haven't been opened // earlier. // No sanity check? We should probably flag an error if the user // makes multiple calls to open(). if (this->get_handle () != ACE_INVALID_HANDLE) return 0; // Invoke lower-layer ::open. if (ACE_SOCK::open (SOCK_DGRAM, mcast_addr.get_type (), 0, // always use 0 reuse_addr) == -1) return -1; return this->open_i (mcast_addr, net_if, reuse_addr); } int ACE_SOCK_Dgram_Mcast::open_i (const ACE_INET_Addr &mcast_addr, const ACE_TCHAR *net_if, int reuse_addr) { ACE_TRACE ("ACE_SOCK_Dgram_Mcast::open_i"); // ACE_SOCK::open calls this if reuse_addr is set, so we only need to // process port reuse option. if (reuse_addr) { #if defined (SO_REUSEPORT) int one = 1; if (this->ACE_SOCK::set_option (SOL_SOCKET, SO_REUSEPORT, &one, sizeof one) == -1) return -1; #endif /* SO_REUSEPORT */ } // Create an address/port# to bind the socket to. Use mcast_addr to // initialize bind_addy to pick up the correct protocol family. If // OPT_BINDADDR_YES is set, then we're done. Else use mcast_addr's // port number and use the "any" address. ACE_INET_Addr bind_addy (mcast_addr); if (ACE_BIT_DISABLED (this->opts_, OPT_BINDADDR_YES)) { #if defined (ACE_HAS_IPV6) if (mcast_addr.get_type () == PF_INET6) { if (bind_addy.set (mcast_addr.get_port_number (), "::", 1, AF_INET6) == -1) return -1; } else // Bind to "any" address and explicit port#. if (bind_addy.set (mcast_addr.get_port_number ()) == -1) return -1; #else // Bind to "any" address and explicit port#. if (bind_addy.set (mcast_addr.get_port_number ()) == -1) return -1; #endif /* ACE_HAS_IPV6 */ } // Bind to the address (which may be INADDR_ANY) and port# (which may be 0) if (ACE_SOCK_Dgram::shared_open (bind_addy, bind_addy.get_type ()) == -1) return -1; // Cache the actual bound address (which may be INADDR_ANY) // and the actual bound port# (which will be a valid, non-zero port#). ACE_INET_Addr bound_addy; if (this->get_local_addr (bound_addy) == -1) { // (Unexpected failure - should be bound to something) if (bound_addy.set (bind_addy) == -1) { // (Shouldn't happen - bind_addy is a valid addy; punt.) return -1; } } this->send_addr_ = mcast_addr; this->send_addr_.set_port_number (bound_addy.get_port_number ()); if (net_if) { if (this->set_nic (net_if, mcast_addr.get_type ())) return -1; #if defined (ACE_HAS_ALLOC_HOOKS) this->send_net_if_ = static_cast(ACE_Allocator::instance()->malloc(sizeof(ACE_TCHAR) * (ACE_OS::strlen (net_if) + 1))); #else this->send_net_if_ = new ACE_TCHAR[ACE_OS::strlen (net_if) + 1]; #endif /* ACE_HAS_ALLOC_HOOKS */ ACE_OS::strcpy (this->send_net_if_, net_if); } return 0; } int ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr, const ACE_TCHAR *net_if, int reuse_addr) { ACE_TRACE ("ACE_SOCK_Dgram_Mcast::subscribe_ifs"); if (ACE_BIT_ENABLED (this->opts_, OPT_NULLIFACE_ALL) && net_if == 0) { int family = mcast_addr.get_type (); size_t nr_subscribed = 0; #if defined (ACE_HAS_GETIFADDRS) // Take advantage of the BSD getifaddrs function that simplifies // access to connected interfaces. struct ifaddrs *ifap = 0; struct ifaddrs *p_if = 0; if (::getifaddrs (&ifap) != 0) return -1; // 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) { struct sockaddr_in *addr = reinterpret_cast (p_if->ifa_addr); if (addr->sin_addr.s_addr == INADDR_ANY) continue; } # if defined (ACE_HAS_IPV6) else if (p_if->ifa_addr->sa_family == AF_INET6) { struct sockaddr_in6 *addr = reinterpret_cast (p_if->ifa_addr); // Skip the ANY address if (IN6_IS_ADDR_UNSPECIFIED(&addr->sin6_addr)) continue; } # endif /* ACE_HAS_IPV6 */ // 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; } ::freeifaddrs (ifap); # elif defined (ACE_WIN32) 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) { errno = dwRetVal; return -1; // With output bufferlength 0 this can't be right. } // 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 (buf); if ((dwRetVal = ::GetAdaptersAddresses (family, flags, 0, pAddrs, &bufLen)) != NO_ERROR) { delete[] buf; // clean up errno = dwRetVal; return -1; } for (; pAddrs; pAddrs = pAddrs->Next) { if (pAddrs->OperStatus != IfOperStatusUp) continue; // 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) { 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 { if (this->join (mcast_addr, reuse_addr, ACE_TEXT_CHAR_TO_TCHAR(pAddrs->AdapterName)) == 0) ++nr_subscribed; } } delete[] buf; // clean up # else // 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; if (ACE::get_ip_interfaces (if_cnt, if_addrs) != 0) return -1; if (if_cnt < 2) { if (this->join (mcast_addr, reuse_addr, ACE_TEXT ("0.0.0.0")) == 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 () != family || 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; } } delete [] if_addrs; # endif /* ACE_WIN32 */ if (nr_subscribed == 0) { errno = ENODEV; return -1; } return 1; } // Subscribe on a specific interface, or on the default interface. #if defined (ACE_HAS_IPV6) if (mcast_addr.get_type () == AF_INET6) { if (this->make_multicast_ifaddr6 (0, mcast_addr, net_if) == -1) 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, mcast_addr, net_if) == -1) return -1; } return 0; } int ACE_SOCK_Dgram_Mcast::join (const ACE_INET_Addr &mcast_addr, int reuse_addr, const ACE_TCHAR *net_if) { ACE_TRACE ("ACE_SOCK_Dgram_Mcast::join"); ACE_INET_Addr subscribe_addr = mcast_addr; // If port# is 0, insert bound port# if it is set. (To satisfy lower-level // port# validation.) u_short def_port_number = this->send_addr_.get_port_number (); if (subscribe_addr.get_port_number () == 0 && def_port_number != 0) { subscribe_addr.set_port_number (def_port_number); } // Check for port# different than bound port#. u_short sub_port_number = mcast_addr.get_port_number (); if (sub_port_number != 0 && def_port_number != 0 && sub_port_number != def_port_number) { ACELIB_ERROR ((LM_ERROR, ACE_TEXT ("Subscribed port# (%u) different than bound ") ACE_TEXT ("port# (%u).\n"), (u_int) sub_port_number, (u_int) def_port_number)); errno = ENXIO; return -1; } // If bind_addr_opt_ is enabled, check for address different than // bound address. ACE_INET_Addr tmp_addr (this->send_addr_); tmp_addr.set_port_number (mcast_addr.get_port_number ()); // force equal port numbers if (ACE_BIT_ENABLED (this->opts_, OPT_BINDADDR_YES) && !this->send_addr_.is_any () && this->send_addr_ != mcast_addr) { ACE_TCHAR sub_addr_string[MAXNAMELEN + 1]; ACE_TCHAR bound_addr_string[MAXNAMELEN + 1]; ACE_SDM_helpers::addr_to_string (mcast_addr, sub_addr_string, sizeof sub_addr_string, 1); ACE_SDM_helpers::addr_to_string (this->send_addr_, bound_addr_string, sizeof bound_addr_string, 1); ACELIB_ERROR ((LM_ERROR, ACE_TEXT ("Subscribed address (%s) different than ") ACE_TEXT ("bound address (%s).\n"), sub_addr_string, bound_addr_string)); errno = ENXIO; return -1; } // Attempt subscription. int result = this->subscribe_i (subscribe_addr, reuse_addr, net_if); #if defined (ACE_SOCK_DGRAM_MCAST_DUMPABLE) if (result == 0) { // Add this addr/iface info to the list of subscriptions. // (Assumes this is unique addr/iface combo - most systems don't allow // re-sub to same addr/iface.) ip_mreq *pmreq = new ip_mreq; // (should not fail) if (this->make_multicast_ifaddr (pmreq, subscribe_addr, net_if) != -1) { ACE_MT (ACE_GUARD_RETURN (ACE_SDM_LOCK, guard, this->subscription_list_lock_, -1)); this->subscription_list_.insert_tail (pmreq); return 0; } // this still isn't really right. If ACE_GUARD_RETURN fails, we leak. // Need to add one of Chris' fancy ace auto pointers (bound?). delete pmreq; } #endif /* ACE_SOCK_DGRAM_MCAST_DUMPABLE */ return result >= 0 ? 0 : result; } // Attempt subscribe and return status. int ACE_SOCK_Dgram_Mcast::subscribe_i (const ACE_INET_Addr &mcast_addr, int reuse_addr, const ACE_TCHAR *net_if) { ACE_TRACE ("ACE_SOCK_Dgram_Mcast::subscribe_i"); ip_mreq mreq; #if defined (ACE_HAS_IPV6) ipv6_mreq mreq6; #endif /* ACE_LINUX && ACE_HAS_IPV6 */ // Open the socket IFF this is the first ::subscribe and ::open // was not explicitly invoked. if (this->open (mcast_addr, net_if, reuse_addr) == -1) return -1; // Only do this if net_if == 0, i.e., INADDR_ANY if (net_if == 0) { int const result = this->subscribe_ifs (mcast_addr, net_if, reuse_addr); // Check for error or "short-circuit" return. if (result != 0) return result; } #if defined (ACE_HAS_IPV6) if (mcast_addr.get_type () == AF_INET6) { if (this->make_multicast_ifaddr6 (&mreq6, mcast_addr, net_if) == -1) return -1; // Tell IP stack to pass messages sent to this group. else if (this->ACE_SOCK::set_option (IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq6, sizeof mreq6) == -1) return -1; return 0; } // Fall through for IPv4 case #endif /* ACE_HAS_IPV6 */ // Create multicast addr/if struct. if (this->make_multicast_ifaddr (&mreq, mcast_addr, net_if) == -1) return -1; // Tell IP stack to pass messages sent to this group. else if (this->ACE_SOCK::set_option (IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof mreq) == -1) return -1; return 0; } int ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr, const ACE_TCHAR *net_if) { ACE_TRACE ("ACE_SOCK_Dgram_Mcast::unsubscribe_ifs"); 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_unsubscribed = 0; # if defined(ACE_LINUX) struct if_nameindex *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->leave (mcast_addr, ACE_TEXT_CHAR_TO_TCHAR(intf[index].if_name)) == 0) ++nr_unsubscribed; ++index; } ACE_OS::if_freenameindex (intf); # elif defined (ACE_WIN32) 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. // 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 (buf); if ((dwRetVal = ::GetAdaptersAddresses (AF_INET6, 0, 0, pAddrs, &bufLen)) != NO_ERROR) { delete[] buf; // clean up return -1; } while (pAddrs) { if (this->leave (mcast_addr, ACE_TEXT_CHAR_TO_TCHAR(pAddrs->AdapterName)) == 0) ++nr_unsubscribed; pAddrs = pAddrs->Next; } delete[] buf; // clean up # endif /* ACE_WIN32 */ if (nr_unsubscribed == 0) { errno = ENODEV; return -1; } return 1; } else { // Unsubscribe on all local multicast-capable network interfaces, by // doing recursive calls with specific interfaces. ACE_INET_Addr *if_addrs = 0; size_t if_cnt; // NOTE - doesn't always get all of the // interfaces. In particular, it may not get a PPP interface. This // is a limitation of the way works with // old versions of MSVC. The reliable way of getting the interface // list is available only with MSVC 5 and newer. if (ACE::get_ip_interfaces (if_cnt, if_addrs) != 0) return -1; size_t nr_unsubscribed = 0; if (if_cnt < 2) { if (this->leave (mcast_addr, ACE_TEXT ("0.0.0.0")) == 0) ++nr_unsubscribed; } else { 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->leave (mcast_addr, ACE_TEXT_CHAR_TO_TCHAR (if_addrs[if_cnt].get_host_addr (addr_buf, INET6_ADDRSTRLEN))) == 0) ++nr_unsubscribed; } } delete [] if_addrs; if (nr_unsubscribed == 0) { errno = ENODEV; return -1; } return 1; } #else /* ACE_HAS_IPV6 */ // Unsubscribe on all local multicast-capable network interfaces, by // doing recursive calls with specific interfaces. ACE_INET_Addr *if_addrs = 0; size_t if_cnt; // NOTE - doesn't always get all of the // interfaces. In particular, it may not get a PPP interface. This // is a limitation of the way works with // old versions of MSVC. The reliable way of getting the interface list // is available only with MSVC 5 and newer. if (ACE::get_ip_interfaces (if_cnt, if_addrs) != 0) return -1; size_t nr_unsubscribed = 0; if (if_cnt < 2) { if (this->leave (mcast_addr, ACE_TEXT ("0.0.0.0")) == 0) ++nr_unsubscribed; } else { while (if_cnt > 0) { --if_cnt; // Convert to 0-based for indexing, next loop check if (if_addrs[if_cnt].is_loopback ()) continue; char addr_buf[INET6_ADDRSTRLEN]; if (this->leave (mcast_addr, ACE_TEXT_CHAR_TO_TCHAR (if_addrs[if_cnt].get_host_addr (addr_buf, INET6_ADDRSTRLEN))) == 0) ++nr_unsubscribed; } } delete [] if_addrs; if (nr_unsubscribed == 0) { errno = ENODEV; return -1; } return 1; #endif /* !ACE_HAS_IPV6 */ } return 0; } int ACE_SOCK_Dgram_Mcast::leave (const ACE_INET_Addr &mcast_addr, const ACE_TCHAR *net_if) { ACE_TRACE ("ACE_SOCK_Dgram_Mcast::leave"); // Unsubscribe. int result = this->unsubscribe_i (mcast_addr, net_if); #if defined (ACE_SOCK_DGRAM_MCAST_DUMPABLE) // (Unconditionally) Remove this addr/if from subscription list. // (Addr/if is removed even if unsubscribe failed) ip_mreq tgt_mreq; if (this->make_multicast_ifaddr (&tgt_mreq, mcast_addr, net_if) != -1) { ACE_MT (ACE_GUARD_RETURN (ACE_SDM_LOCK, guard, this->subscription_list_lock_, -1)); subscription_list_iter_t iter (this->subscription_list_); for (; !iter.done (); iter.advance ()) { ip_mreq *pm = iter.next (); if (ACE_SDM_helpers::is_equal (*pm, tgt_mreq)) { iter.remove (); delete pm; break; } } } #endif /* ACE_SOCK_DGRAM_MCAST_DUMPABLE */ return result >= 0 ? 0 : result; } // Attempt unsubscribe and return status. int ACE_SOCK_Dgram_Mcast::unsubscribe_i (const ACE_INET_Addr &mcast_addr, const ACE_TCHAR *net_if) { ACE_TRACE ("ACE_SOCK_Dgram_Mcast::unsubscribe_i"); int result = this->unsubscribe_ifs (mcast_addr, net_if); // Check for error or "short-circuit" return. if (result != 0) return result; #if defined (ACE_HAS_IPV6) if (mcast_addr.get_type () == AF_INET6) { // Validate addr/if specifications and create addr/if struct. ipv6_mreq mreq; if (this->make_multicast_ifaddr6 (&mreq, mcast_addr, net_if) == -1) { return -1; } // Tell network device driver to stop reading datagrams with the // . else if (ACE_SOCK::set_option (IPPROTO_IPV6, IPV6_LEAVE_GROUP, &mreq, sizeof mreq) == -1) { return -1; } } else // IPv4 { // Validate addr/if specifications and create addr/if struct. ip_mreq mreq; if (this->make_multicast_ifaddr (&mreq, mcast_addr, net_if) == -1) { return -1; } // Tell network device driver to stop reading datagrams with the // . else if (ACE_SOCK::set_option (IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof mreq) == -1) { return -1; } } #else // Validate addr/if specifications and create addr/if struct. ip_mreq mreq; if (this->make_multicast_ifaddr (&mreq, mcast_addr, net_if) == -1) { return -1; } // Tell network device driver to stop reading datagrams with the // . // Note, this is not IPv6 friendly... else if (ACE_SOCK::set_option (IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof mreq) == -1) { return -1; } #endif /* ACE_HAS_IPV6 */ return 0; } int ACE_SOCK_Dgram_Mcast::clear_subs_list () { ACE_TRACE ("ACE_SOCK_Dgram_Mcast::clear_subs_list"); int result = 0; #if defined (ACE_SOCK_DGRAM_MCAST_DUMPABLE) ACE_MT (ACE_GUARD_RETURN (ACE_SDM_LOCK, guard, this->subscription_list_lock_, -1)); subscription_list_iter_t iter (this->subscription_list_); for (; !iter.done (); /*Hack: Do _not_ ::advance after remove*/) { ip_mreq *pm = iter.next (); iter.remove (); delete pm; } #endif /* ACE_SOCK_DGRAM_MCAST_DUMPABLE */ return result; } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Naming_Context.inl0000644000175000017500000000144615027201773017345 0ustar sudipsudipACE_INLINE bool ACE_Name_Options::use_registry () const { ACE_TRACE ("ACE_Name_Options::use_registry"); return this->use_registry_; } ACE_INLINE void ACE_Name_Options::use_registry (bool x) { ACE_TRACE ("ACE_Name_Options::use_registry"); this->use_registry_ = x; } ACE_INLINE bool ACE_Name_Options::verbose () { ACE_TRACE ("ACE_Name_Options::verbose"); return this->verbosity_; } ACE_INLINE const ACE_TCHAR * ACE_Name_Options::process_name () { ACE_TRACE ("ACE_Name_Options::process_name"); return this->process_name_; } ACE_INLINE const ACE_TCHAR * ACE_Name_Options::namespace_dir () { ACE_TRACE ("ACE_Name_Options::namespace_dir"); return this->namespace_dir_; } ACE_INLINE bool ACE_Name_Options::debug () { ACE_TRACE ("ACE_Name_Options::debug"); return this->debugging_; } ace-8.0.4+dfsg.orig/ace/Auto_Functor.inl0000644000175000017500000000517115027201773017037 0ustar sudipsudip// -*- C++ -*- ACE_BEGIN_VERSIONED_NAMESPACE_DECL template ACE_INLINE ACE_Utils::Auto_Functor_Ref:: Auto_Functor_Ref(X * p, Functor f) : p_(p) , f_(f) { } template ACE_INLINE ACE_Utils::Auto_Functor::Auto_Functor(X * p, Functor f) : p_(p) , f_(f) { } template ACE_INLINE ACE_Utils::Auto_Functor::Auto_Functor(Auto_Functor & rhs) : p_(rhs.release()) , f_(rhs.f_) { } template ACE_INLINE ACE_Utils::Auto_Functor& ACE_Utils::Auto_Functor:: operator=(Auto_Functor & rhs) { reset(rhs.release()); f_ = rhs.f_; return *this; } template template ACE_INLINE ACE_Utils::Auto_Functor::Auto_Functor(Auto_Functor& rhs) : p_(rhs.release()) , f_(rhs.f_) { } template template ACE_INLINE ACE_Utils::Auto_Functor& ACE_Utils::Auto_Functor::operator=(Auto_Functor& rhs) { reset(rhs.release()); return *this; } template ACE_INLINE X & ACE_Utils::Auto_Functor::operator*() const { return *p_; } template ACE_INLINE X * ACE_Utils::Auto_Functor::operator->() const { return p_; } template ACE_INLINE X * ACE_Utils::Auto_Functor::get() { return p_; } template ACE_INLINE X * ACE_Utils::Auto_Functor::release() { X * tmp = p_; p_ = 0; return tmp; } template ACE_INLINE Functor const & ACE_Utils::Auto_Functor::functor() const { return f_; } template ACE_INLINE ACE_Utils::Auto_Functor::Auto_Functor(Auto_Functor_Ref rhs) : p_(rhs.p_) , f_(rhs.f_) { } template ACE_INLINE ACE_Utils::Auto_Functor & ACE_Utils::Auto_Functor::operator=(Auto_Functor_Ref rhs) { if(rhs.p_ != p_) { reset(rhs.p_); f_ = rhs.f_; } return *this; } template template ACE_INLINE ACE_Utils::Auto_Functor::operator ACE_Utils::Auto_Functor_Ref() { return ACE_Utils::Auto_Functor_Ref(release(), f_); } template template ACE_INLINE ACE_Utils::Auto_Functor::operator ACE_Utils::Auto_Functor() { return ACE_Utils::Auto_Functor(release(), f_); } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Map_T.h0000644000175000017500000014407615027201773015104 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Map_T.h * * @author Irfan Pyarali */ //============================================================================= #ifndef ACE_MAP_T_H #define ACE_MAP_T_H #include /**/ "ace/pre.h" #include "ace/Map_Manager.h" #include "ace/Hash_Map_Manager_T.h" #include "ace/Active_Map_Manager.h" #include "ace/Pair_T.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_Noop_Key_Generator * * @brief Defines a noop key generator. */ template class ACE_Noop_Key_Generator { public: /// Functor method: generates a new key. int operator () (T &); }; /** * @class ACE_Incremental_Key_Generator * * @brief Defines a simple incremental key generator. * * Generates a new key of type T by incrementing current * value. Requirements on T are: * - Constructor that accepts 0 in the constructor. * - Prefix increment. * - Assignment. * Note that a primitive types such as u_long, int, etc., are * suitable for this class. */ template class ACE_Incremental_Key_Generator { public: /// Constructor. ACE_Incremental_Key_Generator () = default; /// Functor method: generates a new key. int operator () (T &t); /// Returns the current value. const T& current_value () const; protected: /// Current value. T t_ {}; }; /** * @class ACE_Iterator_Impl * * @brief Defines a abstract iterator. * * Implementation to be provided by subclasses. */ template class ACE_Iterator_Impl { public: /// Destructor. virtual ~ACE_Iterator_Impl () = default; /// Clone. virtual ACE_Iterator_Impl *clone () const = 0; /// Comparison. virtual int compare (const ACE_Iterator_Impl &rhs) const = 0; /// Dereference. virtual T dereference () const = 0; /// Advance. virtual void plus_plus () = 0; /// Reverse. virtual void minus_minus () = 0; }; /** * @class ACE_Reverse_Iterator_Impl * * @brief Defines a abstract reverse iterator. * * Implementation to be provided by subclasses. */ template class ACE_Reverse_Iterator_Impl { public: /// Destructor. virtual ~ACE_Reverse_Iterator_Impl () = default; /// Clone. virtual ACE_Reverse_Iterator_Impl *clone () const = 0; /// Comparison. virtual int compare (const ACE_Reverse_Iterator_Impl &rhs) const = 0; /// Dereference. virtual T dereference () const = 0; /// Advance. virtual void plus_plus () = 0; /// Reverse. virtual void minus_minus () = 0; }; /** * @class ACE_Iterator * * @brief Defines the iterator interface. * * Implementation to be provided by forwarding. */ template class ACE_Iterator { public: // = Traits. typedef T value_type; typedef ACE_Iterator_Impl implementation; /// Constructor. ACE_Iterator (ACE_Iterator_Impl *impl); /// Copy constructor. ACE_Iterator (const ACE_Iterator &rhs); /// Destructor. ~ACE_Iterator (); /// Assignment operator. ACE_Iterator &operator= (const ACE_Iterator &rhs); /// Comparison operators. bool operator== (const ACE_Iterator &rhs) const; bool operator!= (const ACE_Iterator &rhs) const; /// Dereference operator. T operator *() const; /// Prefix advance. ACE_Iterator &operator++ (); /// Postfix advance. ACE_Iterator operator++ (int); /// Prefix reverse. ACE_Iterator &operator-- (); /// Postfix reverse. ACE_Iterator operator-- (int); /// Accessor to implementation object. ACE_Iterator_Impl &impl (); protected: /// Implementation pointer. ACE_Iterator_Impl *implementation_; }; /** * @class ACE_Reverse_Iterator * * @brief Defines the reverse iterator interface. * * Implementation to be provided by forwarding. */ template class ACE_Reverse_Iterator { public: // = Traits. typedef T value_type; typedef ACE_Reverse_Iterator_Impl implementation; /// Constructor. ACE_Reverse_Iterator (ACE_Reverse_Iterator_Impl *impl); /// Copy constructor. ACE_Reverse_Iterator (const ACE_Reverse_Iterator &rhs); /// Destructor. ~ACE_Reverse_Iterator (); /// Assignment operator. ACE_Reverse_Iterator &operator= (const ACE_Reverse_Iterator &rhs); /** * @name Comparison Operators * * The usual equality operators. */ //@{ bool operator== (const ACE_Reverse_Iterator &rhs) const; bool operator!= (const ACE_Reverse_Iterator &rhs) const; //@} /// Dereference operator. T operator *() const; /// Prefix advance. ACE_Reverse_Iterator &operator++ (); /// Postfix advance. ACE_Reverse_Iterator operator++ (int); /// Prefix reverse. ACE_Reverse_Iterator &operator-- (); /// Postfix reverse. ACE_Reverse_Iterator operator-- (int); /// Accessor to implementation object. ACE_Reverse_Iterator_Impl &impl (); protected: /// Implementation pointer. ACE_Reverse_Iterator_Impl *implementation_; }; /** * @class ACE_Map * * @brief Defines a map interface. * * Implementation to be provided by subclasses. */ template class ACE_Map { public: // = Traits. typedef KEY key_type; typedef VALUE mapped_type; typedef ACE_Reference_Pair value_type; typedef ACE_Iterator iterator; typedef ACE_Reverse_Iterator reverse_iterator; typedef ACE_Iterator_Impl iterator_implementation; typedef ACE_Reverse_Iterator_Impl reverse_iterator_implementation; /// Close down and release dynamically allocated resources. virtual ~ACE_Map () = default; /// Initialize a map with size @a length. virtual int open (size_t length = ACE_DEFAULT_MAP_SIZE, ACE_Allocator *alloc = nullptr) = 0; /// Close down a and release dynamically allocated resources. virtual int close () = 0; /** * Add @a key / @a value pair to the map. If @a key is already in the * map then no changes are made and 1 is returned. Returns 0 on a * successful addition. This function fails for maps that do not * allow user specified keys. @a key is an "in" parameter. */ virtual int bind (const KEY &key, const VALUE &value) = 0; /** * 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 * method. */ virtual int bind_modify_key (const VALUE &value, KEY &key) = 0; /** * Produce a key and return it through @a key which is an "out" * parameter. For maps that do not naturally produce keys, the map * adapters will use the @c KEY_GENERATOR class to produce a key. * However, the users are responsible for not jeopardizing this key * production scheme by using user specified keys with keys produced * by the key generator. */ virtual int create_key (KEY &key) = 0; /** * Add @a value to the map, and the corresponding key produced by the * Map is returned through @a key which is an "out" parameter. For * maps that do not naturally produce keys, the map adapters will * use the @c KEY_GENERATOR class to produce a key. However, the * users are responsible for not jeopardizing this key production * scheme by using user specified keys with keys produced by the key * generator. */ virtual int bind_create_key (const VALUE &value, KEY &key) = 0; /** * Add @a value to the map. The user does not care about the * corresponding key produced by the Map. For maps that do not * naturally produce keys, the map adapters will use the * @c KEY_GENERATOR class to produce a key. However, the users are * responsible for not jeopardizing this key production scheme by * using user specified keys with keys produced by the key * generator. */ virtual int bind_create_key (const VALUE &value) = 0; /// Recovers the original key potentially modified by the map during /// . virtual int recover_key (const KEY &modified_key, KEY &original_key) = 0; /** * Reassociate @a key with @a value. The function fails if @a key is * not in the map for maps that do not allow user specified keys. * However, for maps that allow user specified keys, if the key is * not in the map, a new @a key / @a value association is created. */ virtual int rebind (const KEY &key, const VALUE &value) = 0; /** * Reassociate @a key with @a value, storing the old value into the * "out" parameter @a old_value. The function fails if @a key is not * in the map for maps that do not allow user specified keys. * However, for maps that allow user specified keys, if the key is * not in the map, a new @a key / @a value association is created. */ virtual int rebind (const KEY &key, const VALUE &value, VALUE &old_value) = 0; /** * Reassociate @a key with @a value, storing the old key and value * into the "out" parameters @a old_key and @a old_value. The * function fails if @a key is not in the map for maps that do not * allow user specified keys. However, for maps that allow user * specified keys, if the key is not in the map, a new @a key / @a value * association is created. */ virtual int rebind (const KEY &key, const VALUE &value, KEY &old_key, VALUE &old_value) = 0; /** * Associate @a key with @a value if and only if @a key is not in the * map. If @a key is already in the map, then the @a value parameter * is overwritten with the existing value in the map. Returns 0 if a * new @a key / @a value association is created. Returns 1 if an * attempt is made to bind an existing entry. This function fails * for maps that do not allow user specified keys. */ virtual int trybind (const KEY &key, VALUE &value) = 0; /// Locate @a value associated with @a key. virtual int find (const KEY &key, VALUE &value) = 0; /// Is @a key in the map? virtual int find (const KEY &key) = 0; /// Remove @a key from the map. virtual int unbind (const KEY &key) = 0; /// Remove @a key from the map, and return the @a value associated with /// @a key. virtual int unbind (const KEY &key, VALUE &value) = 0; /// Return the current size of the map. virtual size_t current_size () const = 0; /// Return the total size of the map. virtual size_t total_size () const = 0; /// Dump the state of an object. virtual void dump () const = 0; // = STL styled iterator factory functions. /// Return forward iterator. iterator begin (); iterator end (); /// Return reverse iterator. reverse_iterator rbegin (); reverse_iterator rend (); protected: // = Protected no-op constructor. ACE_Map () = default; /// Return forward iterator. virtual ACE_Iterator_Impl > *begin_impl () = 0; virtual ACE_Iterator_Impl > *end_impl () = 0; /// Return reverse iterator. virtual ACE_Reverse_Iterator_Impl > *rbegin_impl () = 0; virtual ACE_Reverse_Iterator_Impl > *rend_impl () = 0; private: // = Disallow these operations. void operator= (const ACE_Map &) = delete; ACE_Map (const ACE_Map &) = delete; }; /** * @class ACE_Map_Impl_Iterator_Adapter * * @brief Defines a iterator implementation for the Map_Impl class. * * Implementation to be provided by . */ template class ACE_Map_Impl_Iterator_Adapter : public ACE_Iterator_Impl { public: // = Traits. typedef IMPLEMENTATION implementation; /// Constructor. ACE_Map_Impl_Iterator_Adapter (const IMPLEMENTATION &impl); /// Destructor. virtual ~ACE_Map_Impl_Iterator_Adapter () = default; /// Clone. virtual ACE_Iterator_Impl *clone () const; /// Comparison. virtual int compare (const ACE_Iterator_Impl &rhs) const; /// Dereference. virtual T dereference () const; /// Advance. virtual void plus_plus (); /// Reverse. virtual void minus_minus (); /// Accessor to implementation object. IMPLEMENTATION &impl (); protected: /// All implementation details are forwarded to this class. IMPLEMENTATION implementation_; }; /** * @class ACE_Map_Impl_Reverse_Iterator_Adapter * * @brief Defines a reverse iterator implementation for the Map_Impl class. * * Implementation to be provided by IMPLEMENTATION. */ template class ACE_Map_Impl_Reverse_Iterator_Adapter : public ACE_Reverse_Iterator_Impl { public: // = Traits. typedef IMPLEMENTATION implementation; /// Constructor. ACE_Map_Impl_Reverse_Iterator_Adapter (const IMPLEMENTATION &impl); /// Destructor. virtual ~ACE_Map_Impl_Reverse_Iterator_Adapter (); /// Clone. virtual ACE_Reverse_Iterator_Impl *clone () const; /// Comparison. virtual int compare (const ACE_Reverse_Iterator_Impl &rhs) const; /// Dereference. virtual T dereference () const; /// Advance. virtual void plus_plus (); /// Reverse. virtual void minus_minus (); /// Accessor to implementation object. IMPLEMENTATION &impl (); protected: /// All implementation details are forwarded to this class. IMPLEMENTATION implementation_; }; /** * @class ACE_Map_Impl * * @brief Defines a map implementation. * * Implementation to be provided by . */ template class ACE_Map_Impl : public ACE_Map { public: // = Traits. typedef ACE_Map_Impl_Iterator_Adapter::value_type, ITERATOR, ENTRY> iterator_impl; typedef ACE_Map_Impl_Reverse_Iterator_Adapter::value_type, REVERSE_ITERATOR, ENTRY> reverse_iterator_impl; typedef IMPLEMENTATION implementation; /// Initialize with the ACE_DEFAULT_MAP_SIZE. ACE_Map_Impl (ACE_Allocator *alloc = nullptr); /// Initialize with @a size entries. The @a size parameter is ignored /// by maps for which an initialize size does not make sense. ACE_Map_Impl (size_t size, ACE_Allocator *alloc = nullptr); /// Close down and release dynamically allocated resources. virtual ~ACE_Map_Impl (); /// Initialize a with size @a length. virtual int open (size_t length = ACE_DEFAULT_MAP_SIZE, ACE_Allocator *alloc = nullptr); /// Close down a and release dynamically allocated resources. virtual int close (); /** * Add @a key / @a value pair to the map. If @a key is already in the * map then no changes are made and 1 is returned. Returns 0 on a * successful addition. This function fails for maps that do not * allow user specified keys. @a key is an "in" parameter. */ virtual int bind (const KEY &key, const VALUE &value); /** * 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 * method. */ virtual int bind_modify_key (const VALUE &value, KEY &key); /** * Produce a key and return it through @a key which is an "out" * parameter. For maps that do not naturally produce keys, the map * adapters will use the @c KEY_GENERATOR class to produce a key. * However, the users are responsible for not jeopardizing this key * production scheme by using user specified keys with keys produced * by the key generator. */ virtual int create_key (KEY &key); /** * Add @a value to the map, and the corresponding key produced by the * Map is returned through @a key which is an "out" parameter. For * maps that do not naturally produce keys, the map adapters will * use the @c KEY_GENERATOR class to produce a key. However, the * users are responsible for not jeopardizing this key production * scheme by using user specified keys with keys produced by the key * generator. */ virtual int bind_create_key (const VALUE &value, KEY &key); /** * Add @a value to the map. The user does not care about the * corresponding key produced by the Map. For maps that do not * naturally produce keys, the map adapters will use the * @c KEY_GENERATOR class to produce a key. However, the users are * responsible for not jeopardizing this key production scheme by * using user specified keys with keys produced by the key * generator. */ virtual int bind_create_key (const VALUE &value); /// Recovers the original key potentially modified by the map during /// . virtual int recover_key (const KEY &modified_key, KEY &original_key); /** * Reassociate @a key with @a value. The function fails if @a key is * not in the map for maps that do not allow user specified keys. * However, for maps that allow user specified keys, if the key is * not in the map, a new @a key / @a value association is created. */ virtual int rebind (const KEY &key, const VALUE &value); /** * Reassociate @a key with @a value, storing the old value into the * "out" parameter @a old_value. The function fails if @a key is not * in the map for maps that do not allow user specified keys. * However, for maps that allow user specified keys, if the key is * not in the map, a new @a key / @a value association is created. */ virtual int rebind (const KEY &key, const VALUE &value, VALUE &old_value); /** * Reassociate @a key with @a value, storing the old key and value * into the "out" parameters @a old_key and @a old_value. The * function fails if @a key is not in the map for maps that do not * allow user specified keys. However, for maps that allow user * specified keys, if the key is not in the map, a new @a key / @a value * association is created. */ virtual int rebind (const KEY &key, const VALUE &value, KEY &old_key, VALUE &old_value); /** * Associate @a key with @a value if and only if @a key is not in the * map. If @a key is already in the map, then the @a value parameter * is overwritten with the existing value in the map. Returns 0 if a * new @a key / @a value association is created. Returns 1 if an * attempt is made to bind an existing entry. This function fails * for maps that do not allow user specified keys. */ virtual int trybind (const KEY &key, VALUE &value); /// Locate @a value associated with @a key. virtual int find (const KEY &key, VALUE &value); /// Is @a key in the map? virtual int find (const KEY &key); /// Remove @a key from the map. virtual int unbind (const KEY &key); /// Remove @a key from the map, and return the @a value associated with /// @a key. virtual int unbind (const KEY &key, VALUE &value); /// Return the current size of the map. virtual size_t current_size () const; /// Return the total size of the map. virtual size_t total_size () const; /// Dump the state of an object. virtual void dump () const; /// Accessor to implementation object. IMPLEMENTATION &impl (); protected: /// All implementation details are forwarded to this class. IMPLEMENTATION implementation_; // = STL styled iterator factory functions. /// Return forward iterator. virtual ACE_Iterator_Impl > *begin_impl (); virtual ACE_Iterator_Impl > *end_impl (); /// Return reverse iterator. virtual ACE_Reverse_Iterator_Impl > *rbegin_impl (); virtual ACE_Reverse_Iterator_Impl > *rend_impl (); private: // = Disallow these operations. void operator= (const ACE_Map_Impl &) = delete; ACE_Map_Impl (const ACE_Map_Impl &) = delete; }; /** * @class ACE_Active_Map_Manager_Iterator_Adapter * * @brief Defines a iterator implementation for the Active_Map_Manager_Adapter. * * Implementation to be provided by ACE_Active_Map_Manager::iterator. */ template class ACE_Active_Map_Manager_Iterator_Adapter : public ACE_Iterator_Impl { public: // = Traits. typedef typename ACE_Active_Map_Manager::iterator implementation; /// Constructor. ACE_Active_Map_Manager_Iterator_Adapter (const ACE_Map_Iterator &impl); /// Destructor. virtual ~ACE_Active_Map_Manager_Iterator_Adapter () = default; /// Clone. virtual ACE_Iterator_Impl *clone () const; /// Comparison. virtual int compare (const ACE_Iterator_Impl &rhs) const; /// Dereference. virtual T dereference () const; /// Advance. virtual void plus_plus (); /// Reverse. virtual void minus_minus (); /// Accessor to implementation object. ACE_Map_Iterator &impl (); protected: /// All implementation details are forwarded to this class. ACE_Map_Iterator implementation_; }; /** * @class ACE_Active_Map_Manager_Reverse_Iterator_Adapter * * @brief Defines a reverse iterator implementation for the Active_Map_Manager_Adapter. * * Implementation to be provided by ACE_Active_Map_Manager::reverse_iterator. */ template class ACE_Active_Map_Manager_Reverse_Iterator_Adapter : public ACE_Reverse_Iterator_Impl { public: // = Traits. typedef typename ACE_Active_Map_Manager::reverse_iterator implementation; /// Constructor. ACE_Active_Map_Manager_Reverse_Iterator_Adapter (const ACE_Map_Reverse_Iterator &impl); /// Destructor. virtual ~ACE_Active_Map_Manager_Reverse_Iterator_Adapter (); /// Clone. virtual ACE_Reverse_Iterator_Impl *clone () const; /// Comparison. virtual int compare (const ACE_Reverse_Iterator_Impl &rhs) const; /// Dereference. virtual T dereference () const; /// Advance. virtual void plus_plus (); /// Reverse. virtual void minus_minus (); /// Accessor to implementation object. ACE_Map_Reverse_Iterator &impl (); protected: /// All implementation details are forwarded to this class. ACE_Map_Reverse_Iterator implementation_; }; /** * @class ACE_Active_Map_Manager_Adapter * * @brief Defines a map implementation. * * Implementation to be provided by . */ template class ACE_Active_Map_Manager_Adapter : public ACE_Map { public: // = Traits. typedef std::pair expanded_value; typedef ACE_Active_Map_Manager_Iterator_Adapter, expanded_value> iterator_impl; typedef ACE_Active_Map_Manager_Reverse_Iterator_Adapter, expanded_value> reverse_iterator_impl; typedef ACE_Active_Map_Manager implementation; /// Initialize with the ACE_DEFAULT_MAP_SIZE. ACE_Active_Map_Manager_Adapter (ACE_Allocator *alloc = nullptr); /// Initialize with @a size entries. The @a size parameter is ignored /// by maps for which an initialize size does not make sense. ACE_Active_Map_Manager_Adapter (size_t size, ACE_Allocator *alloc = nullptr); /// Close down and release dynamically allocated resources. virtual ~ACE_Active_Map_Manager_Adapter (); /// Initialize a Map with size @a length. virtual int open (size_t length = ACE_DEFAULT_MAP_SIZE, ACE_Allocator *alloc = nullptr); /// Close down a Map and release dynamically allocated resources. virtual int close (); /** * Add @a key / @a value pair to the map. If @a key is already in the * map then no changes are made and 1 is returned. Returns 0 on a * successful addition. This function fails for maps that do not * allow user specified keys. @a key is an "in" parameter. */ virtual int bind (const KEY &key, const VALUE &value); /** * 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() * method. */ virtual int bind_modify_key (const VALUE &value, KEY &key); /** * Produce a key and return it through @a key which is an "out" * parameter. For maps that do not naturally produce keys, the map * adapters will use the @c KEY_GENERATOR class to produce a key. * However, the users are responsible for not jeopardizing this key * production scheme by using user specified keys with keys produced * by the key generator. */ virtual int create_key (KEY &key); /** * Add @a value to the map, and the corresponding key produced by the * Map is returned through @a key which is an "out" parameter. For * maps that do not naturally produce keys, the map adapters will * use the @c KEY_GENERATOR class to produce a key. However, the * users are responsible for not jeopardizing this key production * scheme by using user specified keys with keys produced by the key * generator. */ virtual int bind_create_key (const VALUE &value, KEY &key); /** * Add @a value to the map. The user does not care about the * corresponding key produced by the Map. For maps that do not * naturally produce keys, the map adapters will use the * @c KEY_GENERATOR class to produce a key. However, the users are * responsible for not jeopardizing this key production scheme by * using user specified keys with keys produced by the key * generator. */ virtual int bind_create_key (const VALUE &value); /// Recovers the original key potentially modified by the map during /// bind_modify_key(). virtual int recover_key (const KEY &modified_key, KEY &original_key); /** * Reassociate @a key with @a value. The function fails if @a key is * not in the map for maps that do not allow user specified keys. * However, for maps that allow user specified keys, if the key is * not in the map, a new @a key / @a value association is created. */ virtual int rebind (const KEY &key, const VALUE &value); /** * Reassociate @a key with @a value, storing the old value into the * "out" parameter @a old_value. The function fails if @a key is not * in the map for maps that do not allow user specified keys. * However, for maps that allow user specified keys, if the key is * not in the map, a new @a key / @a value association is created. */ virtual int rebind (const KEY &key, const VALUE &value, VALUE &old_value); /** * Reassociate @a key with @a value, storing the old key and value * into the "out" parameters @a old_key and @a old_value. The * function fails if @a key is not in the map for maps that do not * allow user specified keys. However, for maps that allow user * specified keys, if the key is not in the map, a new @a key / @a value * association is created. */ virtual int rebind (const KEY &key, const VALUE &value, KEY &old_key, VALUE &old_value); /** * Associate @a key with @a value if and only if @a key is not in the * map. If @a key is already in the map, then the @a value parameter * is overwritten with the existing value in the map. Returns 0 if a * new @a key / @a value association is created. Returns 1 if an * attempt is made to bind an existing entry. This function fails * for maps that do not allow user specified keys. */ virtual int trybind (const KEY &key, VALUE &value); /// Locate @a value associated with @a key. virtual int find (const KEY &key, VALUE &value); /// Is @a key in the map? virtual int find (const KEY &key); /// Remove @a key from the map. virtual int unbind (const KEY &key); /// Remove @a key from the map, and return the @a value associated with /// @a key. virtual int unbind (const KEY &key, VALUE &value); /// Return the current size of the map. virtual size_t current_size () const; /// Return the total size of the map. virtual size_t total_size () const; /// Dump the state of an object. virtual void dump () const; /// Accessor to implementation object. ACE_Active_Map_Manager > &impl (); /// Accessor to key adapter. KEY_ADAPTER &key_adapter (); protected: /// Find helper. virtual int find (const KEY &key, expanded_value *&internal_value); /// Unbind helper. virtual int unbind (const KEY &key, expanded_value *&internal_value); /// All implementation details are forwarded to this class. ACE_Active_Map_Manager > implementation_; /// Adapts between the user key and the Active_Map_Manager_Key. KEY_ADAPTER key_adapter_; // = STL styled iterator factory functions. /// Return forward iterator. virtual ACE_Iterator_Impl > *begin_impl (); virtual ACE_Iterator_Impl > *end_impl (); /// Return reverse iterator. virtual ACE_Reverse_Iterator_Impl > *rbegin_impl (); virtual ACE_Reverse_Iterator_Impl > *rend_impl (); private: // = Disallow these operations. void operator= (const ACE_Active_Map_Manager_Adapter &) = delete; ACE_Active_Map_Manager_Adapter (const ACE_Active_Map_Manager_Adapter &) = delete; }; /** * @class ACE_Hash_Map_Manager_Ex_Iterator_Adapter * * @brief Defines a iterator implementation for the Hash_Map_Manager_Adapter. * * Implementation to be provided by ACE_Hash_Map_Manager_Ex::iterator. */ template class ACE_Hash_Map_Manager_Ex_Iterator_Adapter : public ACE_Iterator_Impl { public: // = Traits. typedef typename ACE_Hash_Map_Manager_Ex::iterator implementation; /// Constructor. ACE_Hash_Map_Manager_Ex_Iterator_Adapter (const ACE_Hash_Map_Iterator_Ex &impl); /// Destructor. virtual ~ACE_Hash_Map_Manager_Ex_Iterator_Adapter (); /// Clone. virtual ACE_Iterator_Impl *clone () const; /// Comparison. virtual int compare (const ACE_Iterator_Impl &rhs) const; /// Dereference. virtual T dereference () const; /// Advance. virtual void plus_plus (); /// Reverse. virtual void minus_minus (); /// Accessor to implementation object. ACE_Hash_Map_Iterator_Ex &impl (); protected: /// All implementation details are forwarded to this class. ACE_Hash_Map_Iterator_Ex implementation_; }; /** * @class ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter * * @brief Defines a reverse iterator implementation for the Hash_Map_Manager_Adapter. * * Implementation to be provided by ACE_Hash_Map_Manager_Ex::reverse_iterator. */ template class ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter : public ACE_Reverse_Iterator_Impl { public: // = Traits. typedef typename ACE_Hash_Map_Manager_Ex::reverse_iterator implementation; /// Constructor. ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter (const ACE_Hash_Map_Reverse_Iterator_Ex &impl); /// Destructor. virtual ~ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter (); /// Clone. virtual ACE_Reverse_Iterator_Impl *clone () const; /// Comparison. virtual int compare (const ACE_Reverse_Iterator_Impl &rhs) const; /// Dereference. virtual T dereference () const; /// Advance. virtual void plus_plus (); /// Reverse. virtual void minus_minus (); /// Accessor to implementation object. ACE_Hash_Map_Reverse_Iterator_Ex &impl (); protected: /// All implementation details are forwarded to this class. ACE_Hash_Map_Reverse_Iterator_Ex implementation_; }; /** * @class ACE_Hash_Map_Manager_Ex_Adapter * * @brief Defines a map implementation. * * Implementation to be provided by ACE_Hash_Map_Manager_Ex. */ template class ACE_Hash_Map_Manager_Ex_Adapter : public ACE_Map { public: // = Traits. typedef ACE_Hash_Map_Manager_Ex_Iterator_Adapter, KEY, VALUE, HASH_KEY, COMPARE_KEYS> iterator_impl; typedef ACE_Hash_Map_Manager_Ex_Reverse_Iterator_Adapter, KEY, VALUE, HASH_KEY, COMPARE_KEYS> reverse_iterator_impl; typedef ACE_Hash_Map_Manager_Ex implementation; /// Initialize with the ACE_DEFAULT_MAP_SIZE. ACE_Hash_Map_Manager_Ex_Adapter (ACE_Allocator *alloc = nullptr); /// Initialize with @a size entries. The @a size parameter is ignored /// by maps for which an initialize size does not make sense. ACE_Hash_Map_Manager_Ex_Adapter (size_t size, ACE_Allocator *alloc = nullptr); /// Close down and release dynamically allocated resources. virtual ~ACE_Hash_Map_Manager_Ex_Adapter (); /// Initialize a Map with size @a length. virtual int open (size_t length = ACE_DEFAULT_MAP_SIZE, ACE_Allocator *alloc = nullptr); /// Close down a Map and release dynamically allocated resources. virtual int close (); /** * Add @a key / @a value pair to the map. If @a key is already in the * map then no changes are made and 1 is returned. Returns 0 on a * successful addition. This function fails for maps that do not * allow user specified keys. @a key is an "in" parameter. */ virtual int bind (const KEY &key, const VALUE &value); /** * 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 * method. */ virtual int bind_modify_key (const VALUE &value, KEY &key); /** * Produce a key and return it through @a key which is an "out" * parameter. For maps that do not naturally produce keys, the map * adapters will use the @c KEY_GENERATOR class to produce a key. * However, the users are responsible for not jeopardizing this key * production scheme by using user specified keys with keys produced * by the key generator. */ virtual int create_key (KEY &key); /** * Add @a value to the map, and the corresponding key produced by the * Map is returned through @a key which is an "out" parameter. For * maps that do not naturally produce keys, the map adapters will * use the @c KEY_GENERATOR class to produce a key. However, the * users are responsible for not jeopardizing this key production * scheme by using user specified keys with keys produced by the key * generator. */ virtual int bind_create_key (const VALUE &value, KEY &key); /** * Add @a value to the map. The user does not care about the * corresponding key produced by the Map. For maps that do not * naturally produce keys, the map adapters will use the * @c KEY_GENERATOR class to produce a key. However, the users are * responsible for not jeopardizing this key production scheme by * using user specified keys with keys produced by the key * generator. */ virtual int bind_create_key (const VALUE &value); /// Recovers the original key potentially modified by the map during /// bind_modify_key(). virtual int recover_key (const KEY &modified_key, KEY &original_key); /** * Reassociate @a key with @a value. The function fails if @a key is * not in the map for maps that do not allow user specified keys. * However, for maps that allow user specified keys, if the key is * not in the map, a new @a key / @a value association is created. */ virtual int rebind (const KEY &key, const VALUE &value); /** * Reassociate @a key with @a value, storing the old value into the * "out" parameter @a old_value. The function fails if @a key is not * in the map for maps that do not allow user specified keys. * However, for maps that allow user specified keys, if the key is * not in the map, a new @a key / @a value association is created. */ virtual int rebind (const KEY &key, const VALUE &value, VALUE &old_value); /** * Reassociate @a key with @a value, storing the old key and value * into the "out" parameters @a old_key and @a old_value. The * function fails if @a key is not in the map for maps that do not * allow user specified keys. However, for maps that allow user * specified keys, if the key is not in the map, a new @a key / @a value * association is created. */ virtual int rebind (const KEY &key, const VALUE &value, KEY &old_key, VALUE &old_value); /** * Associate @a key with @a value if and only if @a key is not in the * map. If @a key is already in the map, then the @a value parameter * is overwritten with the existing value in the map. Returns 0 if a * new @a key / @a value association is created. Returns 1 if an * attempt is made to bind an existing entry. This function fails * for maps that do not allow user specified keys. */ virtual int trybind (const KEY &key, VALUE &value); /// Locate @a value associated with @a key. virtual int find (const KEY &key, VALUE &value); /// Is @a key in the map? virtual int find (const KEY &key); /// Remove @a key from the map. virtual int unbind (const KEY &key); /// Remove @a key from the map, and return the @a value associated with /// @a key. virtual int unbind (const KEY &key, VALUE &value); /// Return the current size of the map. virtual size_t current_size () const; /// Return the total size of the map. virtual size_t total_size () const; /// Dump the state of an object. virtual void dump () const; /// Accessor to implementation object. ACE_Hash_Map_Manager_Ex &impl (); /// Accessor to key generator. KEY_GENERATOR &key_generator (); protected: /// All implementation details are forwarded to this class. ACE_Hash_Map_Manager_Ex implementation_; /// Functor class used for generating key. KEY_GENERATOR key_generator_; // = STL styled iterator factory functions. /// Return forward iterator. virtual ACE_Iterator_Impl > *begin_impl (); virtual ACE_Iterator_Impl > *end_impl (); /// Return reverse iterator. virtual ACE_Reverse_Iterator_Impl > *rbegin_impl (); virtual ACE_Reverse_Iterator_Impl > *rend_impl (); private: // = Disallow these operations. void operator= (const ACE_Hash_Map_Manager_Ex_Adapter &) = delete; ACE_Hash_Map_Manager_Ex_Adapter (const ACE_Hash_Map_Manager_Ex_Adapter &) = delete; }; /** * @class ACE_Map_Manager_Iterator_Adapter * * @brief Defines a iterator implementation for the Map_Manager_Adapter. * * Implementation to be provided by ACE_Map_Manager::iterator. */ template class ACE_Map_Manager_Iterator_Adapter : public ACE_Iterator_Impl { public: // = Traits. typedef typename ACE_Map_Manager::iterator implementation; /// Constructor. ACE_Map_Manager_Iterator_Adapter (const ACE_Map_Iterator &impl); /// Destructor. virtual ~ACE_Map_Manager_Iterator_Adapter (); /// Clone. virtual ACE_Iterator_Impl *clone () const; /// Comparison. virtual int compare (const ACE_Iterator_Impl &rhs) const; /// Dereference. virtual T dereference () const; /// Advance. virtual void plus_plus (); /// Reverse. virtual void minus_minus (); /// Accessor to implementation object. ACE_Map_Iterator &impl (); protected: /// All implementation details are forwarded to this class. ACE_Map_Iterator implementation_; }; /** * @class ACE_Map_Manager_Reverse_Iterator_Adapter * * @brief Defines a reverse iterator implementation for the Map Manager. * * Implementation to be provided by ACE_Map_Manager::reverse_iterator. */ template class ACE_Map_Manager_Reverse_Iterator_Adapter : public ACE_Reverse_Iterator_Impl { public: // = Traits. typedef typename ACE_Map_Manager::reverse_iterator implementation; /// Constructor. ACE_Map_Manager_Reverse_Iterator_Adapter (const ACE_Map_Reverse_Iterator &impl); /// Destructor. virtual ~ACE_Map_Manager_Reverse_Iterator_Adapter (); /// Clone. virtual ACE_Reverse_Iterator_Impl *clone () const; /// Comparison. virtual int compare (const ACE_Reverse_Iterator_Impl &rhs) const; /// Dereference. virtual T dereference () const; /// Advance. virtual void plus_plus (); /// Reverse. virtual void minus_minus (); /// Accessor to implementation object. ACE_Map_Reverse_Iterator &impl (); protected: /// All implementation details are forwarded to this class. ACE_Map_Reverse_Iterator implementation_; }; /** * @class ACE_Map_Manager_Adapter * * @brief Defines a map implementation. * * Implementation to be provided by ACE_Map_Manager. */ template class ACE_Map_Manager_Adapter : public ACE_Map { public: // = Traits. typedef ACE_Map_Manager_Iterator_Adapter, KEY, VALUE> iterator_impl; typedef ACE_Map_Manager_Reverse_Iterator_Adapter, KEY, VALUE> reverse_iterator_impl; typedef ACE_Map_Manager implementation; /// Initialize with the ACE_DEFAULT_MAP_SIZE. ACE_Map_Manager_Adapter (ACE_Allocator *alloc = nullptr); /// Initialize with @a size entries. The @a size parameter is ignored /// by maps for which an initialize size does not make sense. ACE_Map_Manager_Adapter (size_t size, ACE_Allocator *alloc = nullptr); /// Close down and release dynamically allocated resources. virtual ~ACE_Map_Manager_Adapter (); /// Initialize a with size @a length. virtual int open (size_t length = ACE_DEFAULT_MAP_SIZE, ACE_Allocator *alloc = nullptr); /// Close down a and release dynamically allocated resources. virtual int close (); /** * Add @a key / @a value pair to the map. If @a key is already in the * map then no changes are made and 1 is returned. Returns 0 on a * successful addition. This function fails for maps that do not * allow user specified keys. @a key is an "in" parameter. */ virtual int bind (const KEY &key, const VALUE &value); /** * 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 * method. */ virtual int bind_modify_key (const VALUE &value, KEY &key); /** * Produce a key and return it through @a key which is an "out" * parameter. For maps that do not naturally produce keys, the map * adapters will use the @c KEY_GENERATOR class to produce a key. * However, the users are responsible for not jeopardizing this key * production scheme by using user specified keys with keys produced * by the key generator. */ virtual int create_key (KEY &key); /** * Add @a value to the map, and the corresponding key produced by the * Map is returned through @a key which is an "out" parameter. For * maps that do not naturally produce keys, the map adapters will * use the @c KEY_GENERATOR class to produce a key. However, the * users are responsible for not jeopardizing this key production * scheme by using user specified keys with keys produced by the key * generator. */ virtual int bind_create_key (const VALUE &value, KEY &key); /** * Add @a value to the map. The user does not care about the * corresponding key produced by the Map. For maps that do not * naturally produce keys, the map adapters will use the * @c KEY_GENERATOR class to produce a key. However, the users are * responsible for not jeopardizing this key production scheme by * using user specified keys with keys produced by the key * generator. */ virtual int bind_create_key (const VALUE &value); /// Recovers the original key potentially modified by the map during /// . virtual int recover_key (const KEY &modified_key, KEY &original_key); /** * Reassociate @a key with @a value. The function fails if @a key is * not in the map for maps that do not allow user specified keys. * However, for maps that allow user specified keys, if the key is * not in the map, a new @a key / @a value association is created. */ virtual int rebind (const KEY &key, const VALUE &value); /** * Reassociate @a key with @a value, storing the old value into the * "out" parameter @a old_value. The function fails if @a key is not * in the map for maps that do not allow user specified keys. * However, for maps that allow user specified keys, if the key is * not in the map, a new @a key / @a value association is created. */ virtual int rebind (const KEY &key, const VALUE &value, VALUE &old_value); /** * Reassociate @a key with @a value, storing the old key and value * into the "out" parameters @a old_key and @a old_value. The * function fails if @a key is not in the map for maps that do not * allow user specified keys. However, for maps that allow user * specified keys, if the key is not in the map, a new @a key / @a value * association is created. */ virtual int rebind (const KEY &key, const VALUE &value, KEY &old_key, VALUE &old_value); /** * Associate @a key with @a value if and only if @a key is not in the * map. If @a key is already in the map, then the @a value parameter * is overwritten with the existing value in the map. Returns 0 if a * new @a key / @a value association is created. Returns 1 if an * attempt is made to bind an existing entry. This function fails * for maps that do not allow user specified keys. */ virtual int trybind (const KEY &key, VALUE &value); /// Locate @a value associated with @a key. virtual int find (const KEY &key, VALUE &value); /// Is @a key in the map? virtual int find (const KEY &key); /// Remove @a key from the map. virtual int unbind (const KEY &key); /// Remove @a key from the map, and return the @a value associated with /// @a key. virtual int unbind (const KEY &key, VALUE &value); /// Return the current size of the map. virtual size_t current_size () const; /// Return the total size of the map. virtual size_t total_size () const; /// Dump the state of an object. virtual void dump () const; /// Accessor to implementation object. ACE_Map_Manager &impl (); /// Accessor to key generator. KEY_GENERATOR &key_generator (); protected: /// All implementation details are forwarded to this class. ACE_Map_Manager implementation_; /// Functor class used for generating key. KEY_GENERATOR key_generator_; // = STL styled iterator factory functions. /// Return forward iterator. virtual ACE_Iterator_Impl > *begin_impl (); virtual ACE_Iterator_Impl > *end_impl (); /// Return reverse iterator. virtual ACE_Reverse_Iterator_Impl > *rbegin_impl (); virtual ACE_Reverse_Iterator_Impl > *rend_impl (); private: // = Disallow these operations. void operator= (const ACE_Map_Manager_Adapter &) = delete; ACE_Map_Manager_Adapter (const ACE_Map_Manager_Adapter &) = delete; }; ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Map_T.inl" #endif /* __ACE_INLINE__ */ #include "ace/Map_T.cpp" #include /**/ "ace/post.h" #endif /* ACE_MAP_T_H */ ace-8.0.4+dfsg.orig/ace/Monitor_Base.inl0000644000175000017500000000160015027201773017001 0ustar sudipsudipACE_BEGIN_VERSIONED_NAMESPACE_DECL namespace ACE { namespace Monitor_Control { ACE_INLINE const char* Monitor_Base::name () const { return this->name_.c_str (); } ACE_INLINE void Monitor_Base::name (const char* new_name) { this->name_ = new_name; } ACE_INLINE Monitor_Base::CONSTRAINTS& Monitor_Base::constraints () { return this->constraints_; } ACE_INLINE void Monitor_Base::add_ref () { (void) this->increment (); } ACE_INLINE void Monitor_Base::remove_ref () { long const new_count = this->decrement (); if (new_count == 0) { delete this; } } ACE_INLINE Monitor_Control_Types::Information_Type Monitor_Base::type () const { return this->data_.type_; } } } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/OS_NS_sys_uio.cpp0000644000175000017500000000621015027201773017115 0ustar sudipsudip#include "ace/OS_NS_sys_uio.h" #if !defined (ACE_HAS_INLINED_OSCALLS) # include "ace/OS_NS_sys_uio.inl" #endif /* ACE_HAS_INLINED_OSCALLS */ #include "ace/OS_Memory.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" #ifdef ACE_HAS_ALLOC_HOOKS # include "ace/Global_Macros.h" # include "ace/Malloc_Base.h" #endif ACE_BEGIN_VERSIONED_NAMESPACE_DECL #if defined (ACE_LACKS_READV) // "Fake" readv for operating systems without it. Note that this is // thread-safe. ssize_t ACE_OS::readv_emulation (ACE_HANDLE handle, const iovec *iov, int n) { ACE_OS_TRACE ("ACE_OS::readv_emulation"); // In case there's a single element, skip the memcpy. if (1 == n) return ACE_OS::read (handle, iov[0].iov_base, iov[0].iov_len); ssize_t length = 0; int i; for (i = 0; i < n; ++i) if (static_cast (iov[i].iov_len) < 0) return -1; else length += iov[i].iov_len; char *buf; # ifdef ACE_HAS_ALLOC_HOOKS ACE_ALLOCATOR_RETURN (buf, (char *) ACE_Allocator::instance ()->malloc (length), -1); # else ACE_NEW_RETURN (buf, char[length], -1); # endif /* ACE_HAS_ALLOC_HOOKS */ length = ACE_OS::read (handle, buf, length); if (length != -1) { char *ptr = buf; ssize_t copyn = length; for (i = 0; i < n && copyn > 0; ++i) { ACE_OS::memcpy (iov[i].iov_base, ptr, // iov_len is int on some platforms, size_t on others copyn > (int) iov[i].iov_len ? (size_t) iov[i].iov_len : (size_t) copyn); ptr += iov[i].iov_len; copyn -= iov[i].iov_len; } } # ifdef ACE_HAS_ALLOC_HOOKS ACE_Allocator::instance ()->free (buf); # else delete [] buf; # endif /* ACE_HAS_ALLOC_HOOKS */ return length; } #endif /* ACE_LACKS_READV */ #if defined (ACE_LACKS_WRITEV) // "Fake" writev for operating systems without it. Note that this is // thread-safe. ssize_t ACE_OS::writev_emulation (ACE_HANDLE handle, const iovec *iov, int n) { ACE_OS_TRACE ("ACE_OS::writev_emulation"); // 'handle' may be a datagram socket (or similar) so this operation // must not be divided into multiple smaller writes. if (n == 1) return ACE_OS::write (handle, iov[0].iov_base, iov[0].iov_len); ssize_t length = 0; for (int i = 0; i < n; ++i) length += iov[i].iov_len; char *buf; # ifdef ACE_HAS_ALLOC_HOOKS ACE_ALLOCATOR_RETURN (buf, (char *) ACE_Allocator::instance ()->malloc (length), -1); # else ACE_NEW_RETURN (buf, char[length], -1); # endif /* ACE_HAS_ALLOC_HOOKS */ char *iter = buf; for (int i = 0; i < n; iter += iov[i++].iov_len) ACE_OS::memcpy (iter, iov[i].iov_base, iov[i].iov_len); const ssize_t result = ACE_OS::write (handle, buf, length); # ifdef ACE_HAS_ALLOC_HOOKS ACE_Allocator::instance ()->free (buf); # else delete[] buf; # endif /* ACE_HAS_ALLOC_HOOKS */ return result; } # endif /* ACE_LACKS_WRITEV */ ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Null_Mutex.cpp0000644000175000017500000000050315027201773016515 0ustar sudipsudip/** * @file Null_Mutex.cpp * * * * @author Justin Wilson */ #include "ace/Null_Mutex.h" #if defined (ACE_HAS_ALLOC_HOOKS) # include "ace/Malloc_Base.h" #endif /* ACE_HAS_ALLOC_HOOKS */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Null_Mutex) ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/OS_main.h0000644000175000017500000001603015027201773015415 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file OS_main.h * * @author Douglas C. Schmidt * @author Jesper S. M|ller * @author and a cast of thousands... */ //============================================================================= #include /**/ "ace/ACE_export.h" #ifndef ACE_OS_MAIN_H # define ACE_OS_MAIN_H # include /**/ "ace/pre.h" # if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once # endif /* ACE_LACKS_PRAGMA_ONCE */ #if defined (ACE_MQX) # include "ace/MQX_Filesystem.h" #endif # if !defined (ACE_DOESNT_DEFINE_MAIN) #if defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x640) && defined (__RTP__) # include #endif # if !defined (ACE_MAIN) # define ACE_MAIN main # endif /* ! ACE_MAIN */ # if !defined (ACE_WMAIN) # define ACE_WMAIN wmain # endif /* ! ACE_WMAIN */ # if defined (ACE_WIN32) && defined (ACE_USES_WCHAR) # define ACE_TMAIN wmain # else # if defined (ACE_USES_WCHAR) /* Not Win32, but uses wchar */ // Replace main() with a version that converts the char** argv to // ACE_TCHAR and calls the ACE_TMAIN entrypoint. # include "ace/Argv_Type_Converter.h" # define ACE_TMAIN \ ace_main_i (int, ACE_TCHAR *[]); /* forward declaration */ \ int main (int argc, char *argv[]) { \ ACE_Argv_Type_Converter wide_argv (argc, argv); \ return ace_main_i (argc, wide_argv.get_TCHAR_argv ()); \ } \ int ace_main_i # elif !defined (ACE_MQX) # define ACE_TMAIN main # endif /* ACE_USES_WCHAR */ # endif # if defined (ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER) # if !defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER) # define ACE_HAS_NONSTATIC_OBJECT_MANAGER # endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER */ # endif /* ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER */ # if defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER) \ && !defined (ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER) // Rename "main ()" on platforms that don't allow it to be called "main ()". # if defined (ACE_VXWORKS) && !defined (__RTP__) typedef int (*ace_main_proc_ptr)(int, char *[]); extern ace_main_proc_ptr vx_ace_main_i_ptr; // Declare ACE_MAIN as extern C so that it can be retrieved // using symFindByName extern "C" { int ACE_MAIN (int, char* []); } # define main \ ACE_MAIN (int, char *[]); /* forward decl to gobble up the 'int' if there is one */ \ ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ int ace_os_main_i (int, char *[]); \ ACE_END_VERSIONED_NAMESPACE_DECL \ int ace_main_i(int, char *[]); \ int \ ACE_MAIN (int argc, char *argv[]) /* user's entry point, e.g., main */ \ { \ vx_ace_main_i_ptr = ace_main_i; \ return ace_os_main_i (argc, argv); /* what the user calls "main" */ \ } \ int \ ace_main_i # elif defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x640) && defined (__RTP__) # define main \ ACE_MAIN (int, char *[]); /* forward decl to gobble up the 'int' if there is one */ \ ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ int ace_os_main_i (int, char *[]); \ ACE_END_VERSIONED_NAMESPACE_DECL \ int \ ACE_MAIN (int argc, char *argv[]) /* user's entry point, e.g., main */ \ { \ resolvInit(); \ return ace_os_main_i (argc, argv); /* what the user calls "main" */ \ } \ int \ ace_main_i # elif !defined (ACE_WIN32) # define main \ ACE_MAIN (int, char *[]); /* forward decl to gobble up the 'int' if there is one */ \ ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ ACE_Export int ace_os_main_i (int, char *[]); \ ACE_END_VERSIONED_NAMESPACE_DECL \ int \ ACE_MAIN (int argc, char *argv[]) /* user's entry point, e.g., main */ \ { \ return ace_os_main_i (argc, argv); /* what the user calls "main" */ \ } \ ACE_Proper_Export_Flag int \ ace_main_i # else # if defined (ACE_WIN32) && defined (ACE_USES_WCHAR) ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Export ACE_Main_Base { public: int run (int, ACE_TCHAR *[]); virtual int run_i (int, ACE_TCHAR *[]) = 0; }; ACE_END_VERSIONED_NAMESPACE_DECL # define wmain \ ace_wmain_i (int, ACE_TCHAR *[]); \ ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ ACE_Export int ace_os_wmain_i (ACE_Main_Base&, int, ACE_TCHAR *[]); \ class ACE_Main : public ACE_Main_Base {int run_i (int, ACE_TCHAR *[]);}; \ ACE_END_VERSIONED_NAMESPACE_DECL \ inline int ACE_Main::run_i (int argc, ACE_TCHAR *argv[]) \ { \ return ace_wmain_i (argc, argv); \ } \ int \ ACE_WMAIN (int argc, ACE_TCHAR *argv[]) /* user's entry point, e.g., wmain */ \ { \ ACE_Main m; \ return ace_os_wmain_i (m, argc, argv); /* what the user calls "main" */ \ } \ int \ ace_wmain_i # else /* ! (ACE_WIN32 && ACE_USES_WCHAR) */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Export ACE_Main_Base { public: ACE_Main_Base (); virtual ~ACE_Main_Base (); int run (int, char *[]); virtual int run_i (int, char *[]) = 0; }; ACE_END_VERSIONED_NAMESPACE_DECL /* ** LabVIEW RT cannot directly use an executable. Need to build the program ** as a DLL and call it from something else. The ACE test framework knows this ** trick and uses a LabVIEW RT target-resident control program to load a ** DLL, look up it's main() entrypoint, and call it. */ # if defined (ACE_BUILD_LABVIEW_EXE_AS_DLL) extern "C" __declspec (dllexport) int main (int, char *[]); # endif /* ACE_BUILD_LABVIEW_EXE_AS_DLL) */ # define main \ ace_main_i (int, char *[]); \ ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ ACE_Export int ace_os_main_i (ACE_Main_Base&, int, char *[]); \ class ACE_Main : public ACE_Main_Base {int run_i (int, char *[]);}; \ inline int ACE_Main::run_i (int argc, char *argv[]) \ { \ return ace_main_i (argc, argv); \ } \ ACE_END_VERSIONED_NAMESPACE_DECL \ int \ ACE_MAIN (int argc, char *argv[]) /* user's entry point, e.g., wmain */ \ { \ ACE_Main m; \ return m.run (argc, argv); /*ace_os_main_i (m, argc, argv); what the user calls "main" */ \ } \ int \ ace_main_i # endif /* ACE_WIN32 && ACE_USES_WCHAR */ # endif # endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER && !ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER */ # ifdef ACE_MQX # include # include "ace/MQX_Filesystem.h" # define ACE_TMAIN \ ace_main_i(int argc, ACE_TCHAR *argv[]); \ static void main_task(uint32_t param) { \ __iar_dynamic_initialization(); \ RTCS_create(); \ MQX_Filesystem::inst ().complete_initialization (); \ ace_main_i(0, 0); \ } \ static TASK_TEMPLATE_STRUCT MQX_template_list[] = { \ {1, main_task, 25000, 9, "Main", MQX_AUTO_START_TASK, 0, 0 }, { 0 } \ }; \ static const MQX_INITIALIZATION_STRUCT MQX_init_struct = { \ BSP_DEFAULT_PROCESSOR_NUMBER, BSP_DEFAULT_START_OF_KERNEL_MEMORY, \ BSP_DEFAULT_END_OF_KERNEL_MEMORY, BSP_DEFAULT_INTERRUPT_STACK_SIZE, \ MQX_template_list, BSP_DEFAULT_MQX_HARDWARE_INTERRUPT_LEVEL_MAX, \ BSP_DEFAULT_MAX_MSGPOOLS, BSP_DEFAULT_MAX_MSGQS, \ BSP_DEFAULT_IO_CHANNEL, (char const*)BSP_DEFAULT_IO_OPEN_MODE, 0, 0 \ }; \ int main() { return _mqx( (MQX_INITIALIZATION_STRUCT_PTR) &MQX_init_struct ); } \ int ace_main_i # endif /* ACE_MQX */ #endif /* ACE_DOESNT_DEFINE_MAIN */ # include /**/ "ace/post.h" #endif /* ACE_OS_MAIN_H */ ace-8.0.4+dfsg.orig/ace/config-vxworks21.03.h0000644000175000017500000000321215027201773017440 0ustar sudipsudip/* -*- C++ -*- */ // The following configuration file is designed to work for VxWorks // 21.03 platforms using one of these compilers: // 1) The llvm compiler that is shipped with VxWorks 21.03 #ifndef ACE_CONFIG_VXWORKS_21_03_H #define ACE_CONFIG_VXWORKS_21_03_H #include /**/ "ace/pre.h" #include "ace/config-vxworks7.0.h" #if defined (__RTP__) # include "semLibCommon.h" # define ACE_LACKS_IF_NAMEINDEX # define ACE_LACKS_FGETWC #else # undef ACE_MKDIR_LACKS_MODE # define ACE_LACKS_GETPID #endif #undef ACE_SIZEOF_WCHAR #define ACE_SIZEOF_WCHAR 4 #define ACE_HAS_SOCKLEN_T #undef ACE_LACKS_GETSERVBYNAME #undef ACE_LACKS_GETPROTOBYNAME #undef ACE_LACKS_GETPROTOBYNUMBER #undef ACE_LACKS_GETIPNODEBYADDR #undef ACE_LACKS_LSTAT #undef ACE_LACKS_MKFIFO #undef ACE_LACKS_MKSTEMP #undef ACE_LACKS_READLINK #undef ACE_LACKS_REALPATH #undef ACE_LACKS_PIPE #undef ACE_LACKS_UMASK #undef ACE_LACKS_TEMPNAM #undef ACE_HAS_SIGTIMEDWAIT #undef ACE_HAS_SIGSUSPEND #undef ACE_HAS_GETIFADDRS #undef ACE_LACKS_SETEGID #undef ACE_LACKS_SETUID #undef ACE_LACKS_SETEUID #undef ACE_LACKS_GETEUID #undef ACE_LACKS_GETUID #undef ACE_LACKS_GETEGID #undef ACE_LACKS_GETGID #undef ACE_LACKS_SETGID #undef ACE_LACKS_SYS_UIO_H #undef ACE_LACKS_TERMIOS_H #undef ACE_LACKS_FCNTL #undef ACE_HAS_CHARPTR_SOCKOPT #undef ACE_LACKS_INTPTR_T #undef ACE_LACKS_INTTYPES_H #undef ACE_LACKS_STDINT_H #undef ACE_LACKS_SYS_TIME_H #undef ACE_LACKS_SYS_SELECT_H #undef ACE_HAS_SIZET_PTR_ASCTIME_R_AND_CTIME_R #undef ACE_LACKS_SEARCH_H #undef ACE_LACKS_TZSET #undef ACE_LACKS_ISWCTYPE #undef ACE_LACKS_ISBLANK #undef ACE_LACKS_RAND_R #include /**/ "ace/post.h" #endif /* ACE_CONFIG_VXWORKS_21_03_H */ ace-8.0.4+dfsg.orig/ace/Typed_SV_Message_Queue.h0000644000175000017500000000372315027201773020402 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Typed_SV_Message_Queue.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef ACE_TYPED_MESSAGE_QUEUE_H #define ACE_TYPED_MESSAGE_QUEUE_H #include /**/ "ace/pre.h" #include "ace/SV_Message_Queue.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Typed_SV_Message.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_Typed_SV_Message_Queue * * @brief Defines the header file for the C++ wrapper facade for typed message queues. */ template class ACE_Typed_SV_Message_Queue { public: enum { ACE_CREATE = IPC_CREAT, ACE_OPEN = 0, ACE_NOWAIT = IPC_NOWAIT }; ACE_Typed_SV_Message_Queue (); ACE_Typed_SV_Message_Queue (key_t external_id, int create = ACE_OPEN, int perms = ACE_DEFAULT_FILE_PERMS); int open (key_t external_id, int create = ACE_OPEN, int perms = ACE_DEFAULT_FILE_PERMS); int close (); int remove (); ~ACE_Typed_SV_Message_Queue (); /// Send method. int send (const ACE_Typed_SV_Message &mb, int mflags = 0); /// Recv method. int recv (ACE_Typed_SV_Message &mb, int mflags = 0); /// Return the id of the underlying ACE_SV_Message_Queue. int get_id () const; /// Control the underlying message queue. int control (int option, void *arg = 0); /// Dump the state of an object. void dump () const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; private: ACE_SV_Message_Queue message_queue_; }; ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Typed_SV_Message_Queue.inl" #endif /* __ACE_INLINE__ */ #include "ace/Typed_SV_Message_Queue.cpp" #include /**/ "ace/post.h" #endif /* ACE_TYPED_MESSAGE_QUEUE_H */ ace-8.0.4+dfsg.orig/ace/Select_Reactor_Base.inl0000644000175000017500000000737515027201773020267 0ustar sudipsudip// -*- C++ -*- #include "ace/Reactor.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_Select_Reactor_Handler_Repository::size_type ACE_Select_Reactor_Handler_Repository::size () const { #ifdef ACE_SELECT_REACTOR_BASE_USES_HASH_MAP return this->event_handlers_.total_size (); #else return this->event_handlers_.size (); #endif /* ACE_SELECT_REACTOR_BASE_USES_HASH_MAP */ } ACE_INLINE ACE_Select_Reactor_Handler_Repository::max_handlep1_type ACE_Select_Reactor_Handler_Repository::max_handlep1 () const { #ifdef ACE_SELECT_REACTOR_BASE_USES_HASH_MAP return this->event_handlers_.current_size (); #else return this->max_handlep1_; #endif /* ACE_SELECT_REACTOR_BASE_USES_HASH_MAP */ } ACE_INLINE int ACE_Select_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, ACE_Reactor_Mask mask) { // Do not refactor this code to optimize the call to the unbind impl. // To resolve bug 2653, unbind must be called even when find_eh returns // event_handlers_.end(). return !this->handle_in_range (handle) ? -1 : this->unbind (handle, this->find_eh (handle), mask); } ACE_INLINE ACE_Event_Handler * ACE_Select_Reactor_Handler_Repository::find (ACE_HANDLE handle) { ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::find"); ACE_Event_Handler * eh = 0; if (this->handle_in_range (handle)) { map_type::iterator const pos = this->find_eh (handle); if (pos != this->event_handlers_.end ()) { #ifdef ACE_SELECT_REACTOR_BASE_USES_HASH_MAP eh = (*pos).item (); #else eh = *pos; #endif /* ACE_SELECT_REACTOR_BASE_USES_HASH_MAP */ } } // Don't bother setting errno. It isn't used in the select()-based // reactors and incurs a TSS access. // else // { // errno = ENOENT; // } return eh; } // ------------------------------------------------------------------ ACE_INLINE bool ACE_Select_Reactor_Handler_Repository_Iterator::done () const { #ifdef ACE_SELECT_REACTOR_BASE_USES_HASH_MAP return this->current_ == this->rep_->event_handlers_.end (); #else return this->current_ == (this->rep_->event_handlers_.begin () + this->rep_->max_handlep1 ()); #endif /* ACE_SELECT_REACTOR_BASE_USES_HASH_MAP */ } // ------------------------------------------------------------------ ACE_INLINE ACE_Event_Tuple::ACE_Event_Tuple () : handle_ (ACE_INVALID_HANDLE), event_handler_ (0) { } ACE_INLINE ACE_Event_Tuple::ACE_Event_Tuple (ACE_Event_Handler* eh, ACE_HANDLE h) : handle_ (h), event_handler_ (eh) { } ACE_INLINE bool ACE_Event_Tuple::operator== (const ACE_Event_Tuple &rhs) const { return this->handle_ == rhs.handle_; } ACE_INLINE bool ACE_Event_Tuple::operator!= (const ACE_Event_Tuple &rhs) const { return !(*this == rhs); } #if defined (_MSC_VER) # pragma warning (push) # pragma warning (disable:4355) /* Use of 'this' in initializer list */ #endif ACE_INLINE ACE_Select_Reactor_Impl::ACE_Select_Reactor_Impl (bool ms) : handler_rep_ (*this) , timer_queue_ (0) , signal_handler_ (0) , notify_handler_ (0) , delete_timer_queue_ (false) , delete_signal_handler_ (false) , delete_notify_handler_ (false) , initialized_ (false) , restart_ (false) , requeue_position_ (-1) // Requeue at end of waiters by default. , owner_ (ACE_OS::NULL_thread) , state_changed_ (false) , mask_signals_ (ms) , supress_renew_ (0) { } #if defined (_MSC_VER) # pragma warning (pop) #endif ACE_INLINE bool ACE_Select_Reactor_Impl::supress_notify_renew () { return this->supress_renew_; } ACE_INLINE void ACE_Select_Reactor_Impl::supress_notify_renew (bool sr) { this->supress_renew_ = sr; } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Barrier.cpp0000644000175000017500000001033715027201773016015 0ustar sudipsudip#include "ace/Barrier.h" #if defined (ACE_HAS_THREADS) #include "ace/Guard_T.h" #include "ace/OS_NS_errno.h" #if defined (ACE_HAS_ALLOC_HOOKS) # include "ace/Malloc_Base.h" #endif /* ACE_HAS_ALLOC_HOOKS */ #if defined (ACE_HAS_DUMP) # include "ace/Log_Category.h" #endif /* ACE_HAS_DUMP */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Sub_Barrier) void ACE_Sub_Barrier::dump () const { #if defined (ACE_HAS_DUMP) // ACE_TRACE ("ACE_Sub_Barrier::dump"); ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); this->barrier_finished_.dump (); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("running_threads_ = %d\n"), this->running_threads_.load())); ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } ACE_Sub_Barrier::ACE_Sub_Barrier (unsigned int count, ACE_Thread_Mutex &lock, const ACE_TCHAR *name, void *arg) : barrier_finished_ (lock, name, arg), running_threads_ (count) { // ACE_TRACE ("ACE_Sub_Barrier::ACE_Sub_Barrier"); } ACE_ALLOC_HOOK_DEFINE(ACE_Barrier) void ACE_Barrier::dump () const { #if defined (ACE_HAS_DUMP) // ACE_TRACE ("ACE_Barrier::dump"); ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); this->lock_.dump (); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("current_generation_ = %d"), this->current_generation_)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\ncount_ = %d"), this->count_)); this->sub_barrier_1_.dump (); this->sub_barrier_2_.dump (); ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } ACE_Barrier::ACE_Barrier (unsigned int count, const ACE_TCHAR *name, void *arg) : lock_ (name, (ACE_mutexattr_t *) arg), current_generation_ (0), count_ (count), sub_barrier_1_ (count, lock_, name, arg), sub_barrier_2_ (count, lock_, name, arg) { ACE_TRACE ("ACE_Barrier::ACE_Barrier"); this->sub_barrier_[0] = &this->sub_barrier_1_; this->sub_barrier_[1] = &this->sub_barrier_2_; } int ACE_Barrier::wait () { ACE_TRACE ("ACE_Barrier::wait"); ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); ACE_Sub_Barrier *sbp = this->sub_barrier_[this->current_generation_]; // Check for shutdown... if (sbp == nullptr) { errno = ESHUTDOWN; return -1; } int retval = 0; if (sbp->running_threads_ == 1) { // We're the last running thread, so swap generations and tell // all the threads waiting on the barrier to continue on their // way. sbp->running_threads_ = this->count_; // Swap generations. this->current_generation_ = 1 - this->current_generation_; sbp->barrier_finished_.broadcast (); } else { --sbp->running_threads_; // Block until all the other threads wait(). while (sbp->running_threads_ != this->count_) sbp->barrier_finished_.wait (); // We're awake and the count has completed. See if it completed // because all threads hit the barrier, or because the barrier // was shut down. if (this->sub_barrier_[this->current_generation_] == 0) { errno = ESHUTDOWN; retval = -1; } } return retval; } int ACE_Barrier::shutdown () { ACE_TRACE ("ACE_Barrier::shutdown"); ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); ACE_Sub_Barrier *sbp = this->sub_barrier_[this->current_generation_]; // Check for shutdown... if (sbp == nullptr) { errno = ESHUTDOWN; return -1; } // Flag the shutdown this->sub_barrier_[0] = nullptr; this->sub_barrier_[1] = nullptr; // Tell all the threads waiting on the barrier to continue on their way. sbp->running_threads_ = this->count_; sbp->barrier_finished_.broadcast (); return 0; } ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Barrier) ACE_Thread_Barrier::ACE_Thread_Barrier (unsigned int count, const ACE_TCHAR *name) : ACE_Barrier (count, name) { // ACE_TRACE ("ACE_Thread_Barrier::ACE_Thread_Barrier"); } void ACE_Thread_Barrier::dump () const { #if defined (ACE_HAS_DUMP) // ACE_TRACE ("ACE_Thread_Barrier::dump"); ACE_Barrier::dump (); #endif /* ACE_HAS_DUMP */ } ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_THREADS */ ace-8.0.4+dfsg.orig/ace/config-vxworks.h0000644000175000017500000000521315027201773017057 0ustar sudipsudip//* -*- C++ -*- */ // The following configuration file is designed to work for VxWorks // Based on ACE_VXWORKS it will select the correct config file #ifndef ACE_CONFIG_VXWORKS_H #define ACE_CONFIG_VXWORKS_H #include /**/ "ace/pre.h" #if !defined(ACE_VXWORKS_RELEASE) # define ACE_VXWORKS_RELEASE ACE_VXWORKS #endif // If ACE_VXWORKS is not defined try to figure out the VxWorks version #if !defined (ACE_VXWORKS) # include "vxWorks.h" # if !defined (_WRS_VXWORKS_MAJOR) && !defined (_WRS_VXWORKS_MINOR) # error You must define ACE_VXWORKS # else # if (_WRS_VXWORKS_MAJOR == 6) # if (_WRS_VXWORKS_MINOR == 0) # define ACE_VXWORKS 0x600 # elif (_WRS_VXWORKS_MINOR == 1) # define ACE_VXWORKS 0x610 # elif (_WRS_VXWORKS_MINOR == 2) # define ACE_VXWORKS 0x620 # elif (_WRS_VXWORKS_MINOR == 3) # define ACE_VXWORKS 0x630 # elif (_WRS_VXWORKS_MINOR == 4) # define ACE_VXWORKS 0x640 # elif (_WRS_VXWORKS_MINOR == 5) # define ACE_VXWORKS 0x650 # elif (_WRS_VXWORKS_MINOR == 6) # define ACE_VXWORKS 0x660 # elif (_WRS_VXWORKS_MINOR == 7) # define ACE_VXWORKS 0x670 # elif (_WRS_VXWORKS_MINOR == 8) # define ACE_VXWORKS 0x680 # elif (_WRS_VXWORKS_MINOR == 9) # define ACE_VXWORKS 0x690 # endif # elif (_WRS_VXWORKS_MAJOR == 7) # define ACE_VXWORKS 0x700 # endif # endif #endif /* ! ACE_VXWORKS */ #if (ACE_VXWORKS == 0x640) # include "ace/config-vxworks6.4.h" #elif (ACE_VXWORKS == 0x650) # include "ace/config-vxworks6.5.h" #elif (ACE_VXWORKS == 0x660) # include "ace/config-vxworks6.6.h" #elif (ACE_VXWORKS == 0x670) # 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" #elif (ACE_VXWORKS == 0x700) # if (ACE_VXWORKS_RELEASE == 0x2103) # include "ace/config-vxworks21.03.h" # elif (ACE_VXWORKS_RELEASE >= 0x2203) # include "ace/config-vxworks22.03.h" # else # include "ace/config-vxworks7.0.h" # endif #else # error Unknown or unsupported VxWorks version #endif // Adapt to system argument changes added at VxWorks 6.9 and 64-bit. // It would be nicer to typedef the data types, but without including the // applicable VxWorks headers here, that doesn't work. #if (ACE_VXWORKS < 0x690) # define ACE_VX_USR_ARG_T int # define ACE_VX_TASK_ID int # define ACE_VX_ARG_FORMAT "%x" # define ACE_VX_TASK_ID_ERROR ERROR #else # define ACE_VX_USR_ARG_T _Vx_usr_arg_t # define ACE_VX_TASK_ID TASK_ID # ifdef _WRS_CONFIG_LP64 # define ACE_VX_ARG_FORMAT "%lx" # else # define ACE_VX_ARG_FORMAT "%x" # endif # define ACE_VX_TASK_ID_ERROR TASK_ID_ERROR #endif #include /**/ "ace/post.h" #endif /* ACE_CONFIG_VXWORKS_H */ ace-8.0.4+dfsg.orig/ace/Cached_Connect_Strategy_T.cpp0000644000175000017500000005775315027201773021431 0ustar sudipsudip#ifndef ACE_CACHED_CONNECT_STRATEGY_T_CPP #define ACE_CACHED_CONNECT_STRATEGY_T_CPP #include "ace/Cached_Connect_Strategy_T.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/ACE.h" #include "ace/Service_Repository.h" #include "ace/Service_Types.h" #include "ace/Thread_Manager.h" #include "ace/WFMO_Reactor.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE_Tcoccc (ACE_Cached_Connect_Strategy_Ex) ACE_ALLOC_HOOK_DEFINE_Tcoccc (ACE_Bounded_Cached_Connect_Strategy) template ACE_Cached_Connect_Strategy_Ex::ACE_Cached_Connect_Strategy_Ex (CACHING_STRATEGY &caching_s, ACE_Creation_Strategy *cre_s, ACE_Concurrency_Strategy *con_s, ACE_Recycling_Strategy *rec_s, MUTEX *lock, int delete_lock) : CCSBASE (cre_s, con_s, rec_s, lock, delete_lock), connection_cache_ (caching_s) { if (this->open (cre_s, con_s, rec_s) == -1) ACELIB_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_Cached_Connect_Strategy_Ex\n"))); } template ACE_Cached_Connect_Strategy_Ex::~ACE_Cached_Connect_Strategy_Ex () { cleanup (); } template int ACE_Cached_Connect_Strategy_Ex::check_hint_i (SVC_HANDLER *&sh, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, const ACE_PEER_CONNECTOR_ADDR &local_addr, bool reuse_addr, int flags, int perms, ACE_Hash_Map_Entry, std::pair > *&entry, int &found) { ACE_UNUSED_ARG (remote_addr); ACE_UNUSED_ARG (timeout); ACE_UNUSED_ARG (local_addr); ACE_UNUSED_ARG (reuse_addr); ACE_UNUSED_ARG (flags); ACE_UNUSED_ARG (perms); found = 0; // Get the recycling act for the svc_handler CONNECTION_CACHE_ENTRY *possible_entry = (CONNECTION_CACHE_ENTRY *) sh->recycling_act (); // Check to see if the hint svc_handler has been closed down if (possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_CLOSED) { // If close, decrement refcount if (possible_entry->ext_id_.decrement () == 0) { // If refcount goes to zero, close down the svc_handler possible_entry->int_id_.first->recycler (0, 0); possible_entry->int_id_.first->close (); this->purge_i (possible_entry); } // Hint not successful found = 0; // Reset hint sh = 0; } // If hint is not closed, see if it is connected to the correct // address and is recyclable else if ((possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_AND_PURGABLE || possible_entry->ext_id_.recycle_state () == ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE) && possible_entry->ext_id_.subject () == remote_addr) { // Hint successful found = 1; // Tell the that it should prepare itself for // being recycled. this->prepare_for_recycling (sh); // // Update the caching attributes directly since we don't do a // find() on the cache map. // // Indicates successful find. int find_result = 0; int result = this->caching_strategy ().notify_find (find_result, possible_entry->int_id_.second); if (result == -1) return result; } else { // This hint will not be used. possible_entry->ext_id_.decrement (); // Hint not successful found = 0; // If is not connected to the correct address or is busy, // we will not use it. sh = 0; } if (found) entry = possible_entry; return 0; } template int ACE_Cached_Connect_Strategy_Ex::find_or_create_svc_handler_i (SVC_HANDLER *&sh, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, const ACE_PEER_CONNECTOR_ADDR &local_addr, bool reuse_addr, int flags, int perms, ACE_Hash_Map_Entry, std::pair > *&entry, int &found) { REFCOUNTED_HASH_RECYCLABLE_ADDRESS search_addr (remote_addr); // Try to find the address in the cache. Only if we don't find it // do we create a new and connect it with the server. while (this->find (search_addr, entry) != -1) { // We found a cached svc_handler. // Get the cached sh = entry->int_id_.first; // Is the connection clean? int const state_result = ACE::handle_ready (sh->peer ().get_handle (), &ACE_Time_Value::zero, true, // read ready false, // write ready true);// exception ready if (state_result == 1) { if (sh->close () == -1) return -1; sh = 0; // Cycle it once again.. } else if ((state_result == -1) && (errno == ETIME)) { // Found!!! // Set the flag found = 1; // Tell the that it should prepare itself for // being recycled. if (this->prepare_for_recycling (sh) == -1) return -1; return 0; } else { return -1; } } // Not found... // Set the flag found = 0; // We need to use a temporary variable here since we are not // allowed to change because other threads may use this // when we let go of the lock during the OS level connect. // // Note that making a new svc_handler, connecting remotely, // binding to the map, and assigning of the hint and recycler // should be atomic to the outside world. SVC_HANDLER *potential_handler = 0; // Create a new svc_handler if (this->make_svc_handler (potential_handler) == -1) return -1; // Connect using the svc_handler. if (this->cached_connect (potential_handler, remote_addr, timeout, local_addr, reuse_addr, flags, perms) == -1) { // Close the svc handler. potential_handler->close (0); return -1; } else { // Insert the new SVC_HANDLER instance into the cache. if (this->connection_cache_.bind (search_addr, potential_handler, entry) == -1) { // Close the svc handler and reset . potential_handler->close (0); return -1; } // Everything succeeded as planned. Assign to // . sh = potential_handler; // Set the recycler and the recycling act this->assign_recycler (sh, this, entry); } return 0; } template int ACE_Cached_Connect_Strategy_Ex::cached_connect (SVC_HANDLER *&sh, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, const ACE_PEER_CONNECTOR_ADDR &local_addr, bool reuse_addr, int flags, int perms) { // Actively establish the connection. This is a timed blocking // connect. if (this->new_connection (sh, remote_addr, timeout, local_addr, reuse_addr, flags, perms) == -1) { // If connect() failed because of timeouts, we have to reject // the connection entirely. This is necessary since currently // there is no way for the non-blocking connects to complete and // for the to notify the cache of the completion of // connect(). if (errno == EWOULDBLOCK || errno == ETIMEDOUT) errno = ENOTSUP; else if (ACE::out_of_handles (errno) || errno == EADDRINUSE) { // If the connect failed due to the process running out of // file descriptors then, auto_purging of some connections // are done from the CONNECTION_CACHE. This frees the // descriptors which get used in the connect process and // hence the same method is called again! if (this->purge_connections () == -1) return -1; // Try connecting again. if (this->new_connection (sh, remote_addr, timeout, local_addr, reuse_addr, flags, perms) == -1) { if (errno == EWOULDBLOCK || errno == ETIMEDOUT) errno = ENOTSUP; return -1; } } else { return -1; } } return 0; } template int ACE_Cached_Connect_Strategy_Ex::connect_svc_handler_i (SVC_HANDLER *&sh, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, const ACE_PEER_CONNECTOR_ADDR &local_addr, bool reuse_addr, int flags, int perms, int& found) { CONNECTION_CACHE_ENTRY *entry = 0; // Check if the user passed a hint svc_handler if (sh != 0) { int result = this->check_hint_i (sh, remote_addr, timeout, local_addr, reuse_addr, flags, perms, entry, found); if (result != 0) return result; } // If not found if (!found) { int result = this->find_or_create_svc_handler_i (sh, remote_addr, timeout, local_addr, reuse_addr, flags, perms, entry, found); if (result != 0) return result; // Increment the refcount entry->ext_id_.increment (); } if (entry) { // For all successful cases: mark the in the cache // as being . Therefore recyclable is BUSY. entry->ext_id_.recycle_state (ACE_RECYCLABLE_BUSY); } return 0; } template int ACE_Cached_Connect_Strategy_Ex::cache_i (const void *recycling_act) { // The wonders and perils of ACT CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; // Mark the in the cache as not being . // Therefore recyclable is IDLE. entry->ext_id_.recycle_state (ACE_RECYCLABLE_IDLE_AND_PURGABLE); return 0; } template int ACE_Cached_Connect_Strategy_Ex::recycle_state_i (const void *recycling_act, ACE_Recyclable_State new_state) { // The wonders and perils of ACT CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; // Mark the in the cache as not being . // Therefore recyclable is IDLE. entry->ext_id_.recycle_state (new_state); return 0; } template ACE_Recyclable_State ACE_Cached_Connect_Strategy_Ex::recycle_state_i (const void *recycling_act) const { // The wonders and perils of ACT CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; // Mark the in the cache as not being . // Therefore recyclable is IDLE. return entry->ext_id_.recycle_state (); } template int ACE_Cached_Connect_Strategy_Ex::purge_i (const void *recycling_act) { // The wonders and perils of ACT CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; return this->connection_cache_.unbind (entry); } template int ACE_Cached_Connect_Strategy_Ex::mark_as_closed_i (const void *recycling_act) { // The wonders and perils of ACT CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; // Mark the in the cache as CLOSED. entry->ext_id_.recycle_state (ACE_RECYCLABLE_CLOSED); return 0; } template int ACE_Cached_Connect_Strategy_Ex::cleanup_hint_i (const void *recycling_act, void **act_holder) { // Reset the <*act_holder> in the confines and protection of the // lock. if (act_holder) *act_holder = 0; // The wonders and perils of ACT CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) recycling_act; // Decrement the refcount on the . int refcount = entry->ext_id_.decrement (); // If the svc_handler state is closed and the refcount == 0, call // close() on svc_handler. if (entry->ext_id_.recycle_state () == ACE_RECYCLABLE_CLOSED && refcount == 0) { entry->int_id_.first->recycler (0, 0); entry->int_id_.first->close (); this->purge_i (entry); } return 0; } template int ACE_Cached_Connect_Strategy_Ex::purge_connections () { return this->connection_cache_.purge (); } template CACHING_STRATEGY & ACE_Cached_Connect_Strategy_Ex::caching_strategy () { return this->connection_cache_.caching_strategy (); } template int ACE_Cached_Connect_Strategy_Ex::find (ACE_Refcounted_Hash_Recyclable &search_addr, ACE_Hash_Map_Entry, std::pair > *&entry) { typedef ACE_Hash_Map_Bucket_Iterator, ACE_Hash, ACE_Equal_To, ACE_Null_Mutex> CONNECTION_CACHE_BUCKET_ITERATOR; CONNECTION_CACHE_BUCKET_ITERATOR iterator (this->connection_cache_.map (), search_addr); CONNECTION_CACHE_BUCKET_ITERATOR end (this->connection_cache_.map (), search_addr, 1); for (; iterator != end; ++iterator) { REFCOUNTED_HASH_RECYCLABLE_ADDRESS &addr = (*iterator).ext_id_; if (addr.recycle_state () != ACE_RECYCLABLE_IDLE_AND_PURGABLE && addr.recycle_state () != ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE) continue; if (addr.subject () != search_addr.subject ()) continue; entry = &(*iterator); // // Update the caching attributes directly since we don't do a // find() on the cache map. // // Indicates successful find. int find_result = 0; int result = this->caching_strategy ().notify_find (find_result, entry->int_id_.second); if (result == -1) return result; return 0; } return -1; } template void ACE_Cached_Connect_Strategy_Ex::cleanup () { // Excluded other threads from changing the cache while we cleanup ACE_GUARD (MUTEX, ace_mon, *this->lock_); // Close down all cached service handlers. typename CONNECTION_CACHE::ITERATOR iter = this->connection_cache_.begin (); while (iter != this->connection_cache_.end ()) { if ((*iter).second () != 0) { // save entry for future use CONNECTION_CACHE_ENTRY *entry = (CONNECTION_CACHE_ENTRY *) (*iter).second ()->recycling_act (); // close handler (*iter).second ()->recycler (0, 0); (*iter).second ()->close (); // remember next iter typename CONNECTION_CACHE::ITERATOR next_iter = iter; ++next_iter; // purge the item from the hash this->purge_i (entry); // assign next iter iter = next_iter; } else ++iter; } } ///////////////////////////////////////////////////////////////////////// template ACE_Bounded_Cached_Connect_Strategy::ACE_Bounded_Cached_Connect_Strategy (size_t max_size, CACHING_STRATEGY &caching_s, ACE_Creation_Strategy *cre_s, ACE_Concurrency_Strategy *con_s, ACE_Recycling_Strategy *rec_s, MUTEX *lock, int delete_lock) : CCSEBASE (caching_s, cre_s, con_s, rec_s, lock, delete_lock), max_size_ (max_size) { } template int ACE_Bounded_Cached_Connect_Strategy::find_or_create_svc_handler_i (SVC_HANDLER *&sh, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, const ACE_PEER_CONNECTOR_ADDR &local_addr, bool reuse_addr, int flags, int perms, ACE_Hash_Map_Entry, std::pair > *&entry, int &found) { REFCOUNTED_HASH_RECYCLABLE_ADDRESS search_addr (remote_addr); // Try to find the address in the cache. Only if we don't find it // do we create a new and connect it with the server. while (this->find (search_addr, entry) != -1) { // We found a cached svc_handler. // Get the cached sh = entry->int_id_.first (); // Is the connection clean? int state_result= ACE::handle_ready (sh->peer ().get_handle (), &ACE_Time_Value::zero, true, // read ready false, // write ready true);// exception ready if (state_result == 1) { // The connection was disconnected during idle. // close the svc_handler down. if (sh->close () == -1) { ACE_ASSERT (0); return -1; } sh = 0; // and rotate once more... } else if ((state_result == -1) && (errno == ETIME)) { // Found!!! // Set the flag found = 1; // Tell the that it should prepare itself for // being recycled. if (this->prepare_for_recycling (sh) == -1) { ACE_ASSERT (0); return -1; } return 0; } else // some other return value or error... { ACE_ASSERT (0); // just to see it coming ACELIB_ERROR ((LM_ERROR, ACE_TEXT ("(%t)ACE_Bounded_Cached_Connect_Strategy<>::") ACE_TEXT ("find_or_create_svc_handler_i - ") ACE_TEXT ("error polling server socket state.\n"))); return -1; } } // Not found... // Set the flag found = 0; // Check the limit of handlers... if ((this->max_size_ > 0) && (this->connection_cache_.current_size () >= this->max_size_)) { // Try to purge idle connections if (this->purge_connections () == -1) return -1; // Check limit again. if (this->connection_cache_.current_size () >= this->max_size_) // still too much! return -1; // OK, we have room now... } // We need to use a temporary variable here since we are not // allowed to change because other threads may use this // when we let go of the lock during the OS level connect. // // Note that making a new svc_handler, connecting remotely, // binding to the map, and assigning of the hint and recycler // should be atomic to the outside world. SVC_HANDLER *potential_handler = 0; // Create a new svc_handler if (this->make_svc_handler (potential_handler) == -1) return -1; // Connect using the svc_handler. if (this->cached_connect (potential_handler, remote_addr, timeout, local_addr, reuse_addr, flags, perms) == -1) { // Close the svc handler. potential_handler->close (0); return -1; } else { // Insert the new SVC_HANDLER instance into the cache. if (this->connection_cache_.bind (search_addr, potential_handler, entry) == -1) { // Close the svc handler and reset . potential_handler->close (0); return -1; } // Everything succeeded as planned. Assign to // . sh = potential_handler; // Set the recycler and the recycling act this->assign_recycler (sh, this, entry); } return 0; } ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_CACHED_CONNECT_STRATEGY_T_CPP */ ace-8.0.4+dfsg.orig/ace/config-macosx.h0000644000175000017500000000232615027201773016630 0ustar sudipsudip#ifndef ACE_CONFIG_MACOSX_ALL_H #define ACE_CONFIG_MACOSX_ALL_H #include #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 #include "config-macosx-mojave.h" #elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 #include "config-macosx-highsierra.h" #elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 101200 #include "config-macosx-sierra.h" #elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 101100 #include "config-macosx-elcapitan.h" #elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 #include "config-macosx-yosemite.h" #elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090 #include "config-macosx-mavericks.h" #elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 #include "config-macosx-mountainlion.h" #elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 #include "config-macosx-lion.h" #elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 #include "config-macosx-snowleopard.h" #elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 #include "config-macosx-leopard.h" #elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 #include "config-macosx-tiger.h" #elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 #include "config-macosx-panther.h" #elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 #include "config-macosx-jaguar.h" #else #error Cannot detect MacOSX SDK version #endif #endif // ACE_CONFIG_MACOSX_ALL_H ace-8.0.4+dfsg.orig/ace/Dynamic_Service_Dependency.cpp0000644000175000017500000000233615027201773021631 0ustar sudipsudip#include "ace/ACE.h" #include "ace/DLL_Manager.h" #include "ace/Dynamic_Service_Dependency.h" #include "ace/Service_Config.h" #include "ace/Log_Category.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Dynamic_Service_Dependency::ACE_Dynamic_Service_Dependency (const ACE_TCHAR *principal) { this->init (ACE_Service_Config::current (), principal); } ACE_Dynamic_Service_Dependency::ACE_Dynamic_Service_Dependency (const ACE_Service_Gestalt *cfg, const ACE_TCHAR *principal) { this->init (cfg, principal); } ACE_Dynamic_Service_Dependency::~ACE_Dynamic_Service_Dependency () { if (ACE::debug ()) ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) DSD, this=%@ - destroying\n"), this)); } void ACE_Dynamic_Service_Dependency::init (const ACE_Service_Gestalt *cfg, const ACE_TCHAR *principal) { const ACE_Service_Type* st = ACE_Dynamic_Service_Base::find_i (cfg, principal,false); if (ACE::debug ()) { ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) DSD, this=%@ - creating dependency on "), this)); st->dump (); } this->tracker_ = st->dll (); } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/OS_NS_sys_socket.cpp0000644000175000017500000002405715027201773017622 0ustar sudipsudip#include "ace/OS_NS_sys_socket.h" #if !defined (ACE_HAS_INLINED_OSCALLS) # 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) int ACE_OS::socket_initialized_; #endif /* ACE_WIN32 */ ACE_HANDLE ACE_OS::accept (ACE_HANDLE handle, struct sockaddr *addr, int *addrlen, const ACE_Accept_QoS_Params &qos_params) { # if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) ACE_SOCKCALL_RETURN (::WSAAccept ((ACE_SOCKET) handle, addr, (ACE_SOCKET_LEN *) addrlen, (LPCONDITIONPROC) qos_params.qos_condition_callback (), qos_params.callback_data ()), ACE_HANDLE, ACE_INVALID_HANDLE); # else ACE_UNUSED_ARG (qos_params); return ACE_OS::accept (handle, addr, addrlen); # endif /* ACE_HAS_WINSOCK2 */ } int ACE_OS::connect (ACE_HANDLE handle, const sockaddr *addr, int addrlen, const ACE_QoS_Params &qos_params) { ACE_OS_TRACE ("ACE_OS::connect"); # if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) ACE_SOCKCALL_RETURN (::WSAConnect ((ACE_SOCKET) handle, (const sockaddr *) addr, (ACE_SOCKET_LEN) addrlen, (WSABUF *) qos_params.caller_data (), (WSABUF *) qos_params.callee_data (), (QOS *) qos_params.socket_qos (), (QOS *) qos_params.group_socket_qos ()), int, -1); # else ACE_UNUSED_ARG (qos_params); return ACE_OS::connect (handle, const_cast (addr), addrlen); # endif /* ACE_HAS_WINSOCK2 */ } ACE_HANDLE ACE_OS::join_leaf (ACE_HANDLE socket, const sockaddr *name, int namelen, const ACE_QoS_Params &qos_params) { # if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) QOS qos; // Construct the WinSock2 QOS structure. qos.SendingFlowspec = *(qos_params.socket_qos ()->sending_flowspec ()); qos.ReceivingFlowspec = *(qos_params.socket_qos ()->receiving_flowspec ()); qos.ProviderSpecific = (WSABUF) qos_params.socket_qos ()->provider_specific (); ACE_SOCKCALL_RETURN (::WSAJoinLeaf ((ACE_SOCKET) socket, name, namelen, (WSABUF *) qos_params.caller_data (), (WSABUF *) qos_params.callee_data (), &qos, (QOS *) qos_params.group_socket_qos (), qos_params.flags ()), ACE_HANDLE, ACE_INVALID_HANDLE); # else ACE_UNUSED_ARG (socket); ACE_UNUSED_ARG (name); ACE_UNUSED_ARG (namelen); ACE_UNUSED_ARG (qos_params); ACE_NOTSUP_RETURN (ACE_INVALID_HANDLE); # endif /* ACE_HAS_WINSOCK2 */ } int ACE_OS::socket_init (int version_high, int version_low) { # if defined (ACE_WIN32) && !defined(ACE_DONT_INIT_WINSOCK) if (ACE_OS::socket_initialized_ == 0) { WORD version_requested = MAKEWORD (version_high, version_low); WSADATA wsa_data; int error = WSAStartup (version_requested, &wsa_data); if (error != 0) { ACE_OS::fprintf (stderr, "ACE_OS::socket_init; WSAStartup failed, " "WSAGetLastError returned %d\n", error); } ACE_OS::socket_initialized_ = 1; } # else ACE_UNUSED_ARG (version_high); ACE_UNUSED_ARG (version_low); # endif /* ACE_WIN32 */ return 0; } int ACE_OS::socket_fini () { # if defined (ACE_WIN32) if (ACE_OS::socket_initialized_ != 0) { if (WSACleanup () != 0) { int error = ::WSAGetLastError (); ACE_OS::fprintf (stderr, "ACE_OS::socket_fini; WSACleanup failed, " "WSAGetLastError returned %d\n", error); } ACE_OS::socket_initialized_ = 0; } # endif /* ACE_WIN32 */ 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_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(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); ACE_NOTSUP_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 (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); ACE_NOTSUP_RETURN (-1); #endif /* ACE_LACKS_SEND && ACE_WIN32 */ } #if !defined ACE_LACKS_RECVMSG && defined ACE_HAS_WINSOCK2 && ACE_HAS_WINSOCK2 int ACE_OS::recvmsg_win32_i (ACE_HANDLE handle, msghdr *msg, int flags, unsigned long &bytes_received) { static GUID wsaRcvMsgGuid = WSAID_WSARECVMSG; LPFN_WSARECVMSG wsaRcvMsg = 0; unsigned long ioctlN = 0; SOCKET const sock = reinterpret_cast (handle); if (::WSAIoctl (sock, SIO_GET_EXTENSION_FUNCTION_POINTER, &wsaRcvMsgGuid, sizeof wsaRcvMsgGuid, &wsaRcvMsg, sizeof wsaRcvMsg, &ioctlN, 0, 0)) { ACE_OS::set_errno_to_wsa_last_error (); return -1; } if (!wsaRcvMsg) ACE_NOTSUP_RETURN (-1); WSAMSG wsaMsg = { msg->msg_name, msg->msg_namelen, reinterpret_cast (msg->msg_iov), static_cast (msg->msg_iovlen), { static_cast (msg->msg_controllen), static_cast (msg->msg_control), }, static_cast (flags), }; if (wsaRcvMsg (sock, &wsaMsg, &bytes_received, 0, 0)) { ACE_OS::set_errno_to_wsa_last_error (); return -1; } msg->msg_namelen = wsaMsg.namelen; msg->msg_controllen = static_cast (wsaMsg.Control.len); return 0; } int ACE_OS::sendmsg_win32_i (ACE_HANDLE handle, msghdr const *msg, int flags, unsigned long &bytes_sent) { # if _WIN32_WINNT >= 0x0600 WSAMSG wsaMsg = { msg->msg_name, msg->msg_namelen, reinterpret_cast (msg->msg_iov), static_cast (msg->msg_iovlen), { static_cast (msg->msg_controllen), static_cast (msg->msg_control), }, static_cast (flags), }; SOCKET const sock = reinterpret_cast (handle); if (::WSASendMsg (sock, &wsaMsg, wsaMsg.dwFlags, &bytes_sent, 0, 0)) { ACE_OS::set_errno_to_wsa_last_error (); return -1; } return 0; # else ACE_UNUSED_ARG (handle); ACE_UNUSED_ARG (msg); ACE_UNUSED_ARG (flags); ACE_UNUSED_ARG (bytes_sent); ACE_NOTSUP_RETURN (-1); # endif } #endif ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Asynch_IO_Impl.h0000644000175000017500000006132315027201773016672 0ustar sudipsudip/* -*- C++ -*- */ //============================================================================= /** * @file Asynch_IO_Impl.h * * This class contains asbtract base classes for all the concrete * implementation classes for the various asynchronous operations * that are used with the Praoctor. * * @author Irfan Pyarali (irfan@cs.wustl.edu) * @author Tim Harrison (harrison@cs.wustl.edu) * @author Alexander Babu Arulanthu * @author Roger Tragin * @author Alexander Libman */ //============================================================================= #ifndef ACE_ASYNCH_IO_IMPL_H #define ACE_ASYNCH_IO_IMPL_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_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) // This only works on Win32 platforms and on Unix platforms supporting // aio calls. #include "ace/Asynch_IO.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Forward declaration. class ACE_Proactor_Impl; /** * @class ACE_Asynch_Result_Impl * * @brief Abstract base class for the all the classes that provide * concrete implementations for ACE_Asynch_Result. */ class ACE_Asynch_Result_Impl { public: virtual ~ACE_Asynch_Result_Impl () = default; /// Number of bytes transferred by the operation. virtual size_t bytes_transferred () const = 0; /// ACT associated with the operation. virtual const void *act () const = 0; /// Did the operation succeed? virtual int success () const = 0; /// This ACT is not the same as the ACT associated with the /// asynchronous operation. virtual const void *completion_key () const = 0; /// Error value if the operation fail. virtual u_long error () const = 0; /// Event associated with the OVERLAPPED structure. virtual ACE_HANDLE event () const = 0; /// This really make sense only when doing file I/O. virtual u_long offset () const = 0; virtual u_long offset_high () const = 0; /// Priority of the operation. virtual int priority () const = 0; /** * POSIX4 real-time signal number to be used for the * operation. signal_number ranges from SIGRTMIN to SIGRTMAX. By * default, SIGRTMIN is used to issue calls. This is a no-op * on non-POSIX4 systems and returns 0. */ virtual int signal_number () const = 0; // protected: // // These two should really be protected. But sometimes it // simplifies code to be able to "fake" a result. Use carefully. /// This is called when the asynchronous operation completes. virtual void complete (size_t bytes_transferred, int success, const void *completion_key, u_long error = 0) = 0; /// Post @c this to the Proactor's completion port. virtual int post_completion (ACE_Proactor_Impl *proactor) = 0; protected: ACE_Asynch_Result_Impl () = default; }; /** * @class ACE_Asynch_Operation_Impl * * @brief Abstract base class for all the concrete implementation * classes that provide different implementations for the * ACE_Asynch_Operation. */ class ACE_Asynch_Operation_Impl { public: virtual ~ACE_Asynch_Operation_Impl () = default; /** * Initializes the factory with information which will be used with * each asynchronous call. If @a handle == ACE_INVALID_HANDLE, * ACE_Handler::handle() will be called on the proxied handler to get the * correct handle. */ virtual int open (const ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, const void *completion_key, ACE_Proactor *proactor) = 0; /** * This cancels all pending accepts operations that were issued by * the calling thread. The function does not cancel asynchronous * operations issued by other threads. */ virtual int cancel () = 0; // = Access methods. /// Return the underlying proactor. virtual ACE_Proactor* proactor () const = 0; protected: ACE_Asynch_Operation_Impl () = default; }; /** * @class ACE_Asynch_Read_Stream_Impl * * @brief Abstract base class for all the concrete implementation * classes that provide different implementations for the * ACE_Asynch_Read_Stream */ class ACE_Asynch_Read_Stream_Impl : public virtual ACE_Asynch_Operation_Impl { public: virtual ~ACE_Asynch_Read_Stream_Impl () = default; /// This starts off an asynchronous read. Upto @a bytes_to_read will /// be read and stored in the @a message_block. virtual int read (ACE_Message_Block &message_block, size_t bytes_to_read, const void *act, int priority, int signal_number) = 0; #if defined (ACE_WIN32) /** * Same as above but with scatter support, through chaining of composite * message blocks using the continuation field. */ virtual int readv (ACE_Message_Block &message_block, size_t bytes_to_read, const void *act, int priority, int signal_number) = 0; #endif /* defined (ACE_WIN32) */ protected: ACE_Asynch_Read_Stream_Impl () = default; }; /** * @class ACE_Asynch_Read_Stream_Result_Impl * * @brief Abstract base class for all the concrete implementation * classes that provide different implementations for the * ACE_Asynch_Read_Stream::Result class. */ class ACE_Asynch_Read_Stream_Result_Impl : public virtual ACE_Asynch_Result_Impl { public: virtual ~ACE_Asynch_Read_Stream_Result_Impl () = default; /// The number of bytes which were requested at the start of the /// asynchronous read. virtual size_t bytes_to_read () const = 0; /// Message block which contains the read data. virtual ACE_Message_Block &message_block () const = 0; /// I/O handle used for reading. virtual ACE_HANDLE handle () const = 0; protected: ACE_Asynch_Read_Stream_Result_Impl () = default; }; /** * @class ACE_Asynch_Write_Stream_Impl * * @brief Abstract base class for all the concrete implementation * classes that provide different implementations for the * ACE_Asynch_Write_Stream class. */ class ACE_Asynch_Write_Stream_Impl : public virtual ACE_Asynch_Operation_Impl { public: virtual ~ACE_Asynch_Write_Stream_Impl () = default; /// This starts off an asynchronous write. Upto @a bytes_to_write /// will be written from the @a message_block. virtual int write (ACE_Message_Block &message_block, size_t bytes_to_write, const void *act, int priority, int signal_number) = 0; #if defined (ACE_WIN32) /** * Same as above but with gather support, through chaining of composite * message blocks using the continuation field. */ virtual int writev (ACE_Message_Block &message_block, size_t bytes_to_write, const void *act, int priority, int signal_number) = 0; #endif /* defined (ACE_WIN32) */ protected: ACE_Asynch_Write_Stream_Impl () = default; }; /** * @class ACE_Asynch_Write_Stream_Result_Impl * * @brief Abstract base class for all the concrete implementation * classes that provide different implementations for the * ACE_Asynch_Write_Stream::Result. */ class ACE_Asynch_Write_Stream_Result_Impl : public virtual ACE_Asynch_Result_Impl { public: virtual ~ACE_Asynch_Write_Stream_Result_Impl () = default; /// The number of bytes which were requested at the start of the /// asynchronous write. virtual size_t bytes_to_write () const = 0; /// Message block that contains the data to be written. virtual ACE_Message_Block &message_block () const = 0; /// I/O handle used for writing. virtual ACE_HANDLE handle () const = 0; protected: ACE_Asynch_Write_Stream_Result_Impl () = default; }; /** * @class ACE_Asynch_Read_File_Impl * * @brief Abstract base class for all the concrete implementation * classes that provide different implementations for the * ACE_Asynch_Read_File::Result. */ class ACE_Asynch_Read_File_Impl : public virtual ACE_Asynch_Read_Stream_Impl { public: virtual ~ACE_Asynch_Read_File_Impl () = default; /** * This starts off an asynchronous read. Upto @a bytes_to_read will * be read and stored in the @a message_block. The read will start * at @a offset from the beginning of the file. */ virtual int read (ACE_Message_Block &message_block, size_t bytes_to_read, u_long offset, u_long offset_high, const void *act, int priority, int signal_number) = 0; #if defined (ACE_WIN32) /** * Same as above but with scatter support, through chaining of composite * message blocks using the continuation field. * @note In win32 Each data block payload must be at least the size of a system * memory page and must be aligned on a system memory page size boundary */ virtual int readv (ACE_Message_Block &message_block, size_t bytes_to_read, u_long offset, u_long offset_high, const void *act, int priority, int signal_number) = 0; #endif /* defined (ACE_WIN32) */ /// This starts off an asynchronous read. Upto @a bytes_to_read will /// be read and stored in the @a message_block. virtual int read (ACE_Message_Block &message_block, size_t bytes_to_read, const void *act, int priority, int signal_number) = 0; #if defined (ACE_WIN32) /** * Same as above but with scatter support, through chaining of composite * message blocks using the continuation field. */ virtual int readv (ACE_Message_Block &message_block, size_t bytes_to_read, const void *act, int priority, int signal_number) = 0; #endif /* defined (ACE_WIN32) */ protected: ACE_Asynch_Read_File_Impl () = default; }; /** * @class ACE_Asynch_Read_File_Result_Impl * * @brief This is the abstract base class for all the concrete * implementation classes for ACE_Asynch_Read_File::Result. */ class ACE_Asynch_Read_File_Result_Impl : public virtual ACE_Asynch_Read_Stream_Result_Impl { public: /// Destructor. virtual ~ACE_Asynch_Read_File_Result_Impl () = default; protected: ACE_Asynch_Read_File_Result_Impl () = default; }; /** * @class ACE_Asynch_Write_File_Impl * * @brief Abstract base class for all the concrete implementation * classes that provide different implementations for the * ACE_Asynch_Write_File. */ class ACE_Asynch_Write_File_Impl : public virtual ACE_Asynch_Write_Stream_Impl { public: virtual ~ACE_Asynch_Write_File_Impl () = default; /** * This starts off an asynchronous write. Upto @a bytes_to_write * will be write and stored in the @a message_block. The write will * start at @a offset from the beginning of the file. */ virtual int write (ACE_Message_Block &message_block, size_t bytes_to_write, u_long offset, u_long offset_high, const void *act, int priority, int signal_number) = 0; #if defined (ACE_WIN32) /** * Same as above but with gather support, through chaining of composite * message blocks using the continuation field. * @note In win32 Each data block payload must be at least the size of a system * memory page and must be aligned on a system memory page size boundary */ virtual int writev (ACE_Message_Block &message_block, size_t bytes_to_write, u_long offset, u_long offset_high, const void *act, int priority, int signal_number) = 0; #endif /* defined (ACE_WIN32) */ /// This starts off an asynchronous write. Upto @a bytes_to_write /// will be written from the @a message_block. virtual int write (ACE_Message_Block &message_block, size_t bytes_to_write, const void *act, int priority, int signal_number) = 0; #if defined (ACE_WIN32) /** * Same as above but with gather support, through chaining of composite * message blocks using the continuation field. */ virtual int writev (ACE_Message_Block &message_block, size_t bytes_to_write, const void *act, int priority, int signal_number) = 0; #endif /* defined (ACE_WIN32) */ protected: ACE_Asynch_Write_File_Impl () = default; }; /** * @class ACE_Asynch_Write_File_Result_Impl * * @brief This is the abstract base class for all the concrete * implementation classes that provide different implementations * for the ACE_Asynch_Write_File::Result. */ class ACE_Asynch_Write_File_Result_Impl : public virtual ACE_Asynch_Write_Stream_Result_Impl { public: virtual ~ACE_Asynch_Write_File_Result_Impl () = default; protected: ACE_Asynch_Write_File_Result_Impl () = default; }; /** * @class ACE_Asynch_Accept_Impl * * @brief Abstract base class for all the concrete implementation * classes that provide different implementations for the * ACE_Asynch_Accept. */ class ACE_Asynch_Accept_Impl : public virtual ACE_Asynch_Operation_Impl { public: virtual ~ACE_Asynch_Accept_Impl () = default; /** * This starts off an asynchronous accept. The asynchronous accept * call also allows any initial data to be returned to the * . Upto @a bytes_to_read will be read and stored in the * @a message_block. The @a accept_handle will be used for the * call. If (@a accept_handle == INVALID_HANDLE), a new * handle will be created. * * @a message_block must be specified. This is because the address of * the new connection is placed at the end of this buffer. */ virtual int accept (ACE_Message_Block &message_block, size_t bytes_to_read, ACE_HANDLE accept_handle, const void *act, int priority, int signal_number, int addr_family) = 0; protected: ACE_Asynch_Accept_Impl () = default; }; /** * @class ACE_Asynch_Accept_Result_Impl * * @brief Abstract base class for all the concrete implementation * classes that provide different implementations for the * ACE_Asynch_Accept. */ class ACE_Asynch_Accept_Result_Impl : public virtual ACE_Asynch_Result_Impl { public: virtual ~ACE_Asynch_Accept_Result_Impl () = default; /// The number of bytes which were requested at the start of the /// asynchronous accept. virtual size_t bytes_to_read () const = 0; /// Message block which contains the read data. virtual ACE_Message_Block &message_block () const = 0; /// I/O handle used for accepting new connections. virtual ACE_HANDLE listen_handle () const = 0; /// I/O handle for the new connection. virtual ACE_HANDLE accept_handle () const = 0; protected: ACE_Asynch_Accept_Result_Impl () = default; }; /** * @class ACE_Asynch_Connect_Impl * * @brief Abstract base class for all the concrete implementation * classes that provide different implementations for the * ACE_Asynch_Connect. */ class ACE_Asynch_Connect_Impl : public virtual ACE_Asynch_Operation_Impl { public: virtual ~ACE_Asynch_Connect_Impl () = default; /** * This starts off an asynchronous connect */ virtual int connect (ACE_HANDLE connect_handle, const ACE_Addr & remote_sap, const ACE_Addr & local_sap, int reuse_addr, const void *act, int priority, int signal_number) = 0; protected: ACE_Asynch_Connect_Impl () = default; }; /** * @class ACE_Asynch_Connect_Result_Impl * * @brief Abstract base class for all the concrete implementation * classes that provide different implementations for the * ACE_Asynch_Connect. */ class ACE_Asynch_Connect_Result_Impl : public virtual ACE_Asynch_Result_Impl { public: virtual ~ACE_Asynch_Connect_Result_Impl () = default; /// I/O handle for the connection. virtual ACE_HANDLE connect_handle () const = 0; protected: ACE_Asynch_Connect_Result_Impl () = default; }; /** * @class ACE_Asynch_Transmit_File_Impl * * @brief Abstract base class for all the concrete implementation * classes that provide different implementations for the * ACE_Asynch_Transmit_File. */ class ACE_Asynch_Transmit_File_Impl : public virtual ACE_Asynch_Operation_Impl { public: virtual ~ACE_Asynch_Transmit_File_Impl () = default; /// This starts off an asynchronous transmit file. virtual int transmit_file (ACE_HANDLE file, ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, size_t bytes_to_write, u_long offset, u_long offset_high, size_t bytes_per_send, u_long flags, const void *act, int priority, int signal_number) = 0; protected: ACE_Asynch_Transmit_File_Impl () = default; }; /** * @class ACE_Asynch_Transmit_File_Result_Impl * * @brief Abstract base class for all the concrete implementation * classes that provide different implementations for the * ACE_Asynch_Transmit_File::Result. */ class ACE_Asynch_Transmit_File_Result_Impl : public virtual ACE_Asynch_Result_Impl { public: virtual ~ACE_Asynch_Transmit_File_Result_Impl () = default; /// Socket used for transmitting the file. virtual ACE_HANDLE socket () const = 0; /// File from which the data is read. virtual ACE_HANDLE file () const = 0; /// Header and trailer data associated with this transmit file. virtual ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer () const = 0; /// The number of bytes which were requested at the start of the /// asynchronous transmit file. virtual size_t bytes_to_write () const = 0; /// Number of bytes per send requested at the start of the transmit /// file. virtual size_t bytes_per_send () const = 0; /// Flags which were passed into transmit file. virtual u_long flags () const = 0; protected: ACE_Asynch_Transmit_File_Result_Impl () = default; }; /** * @class ACE_Asynch_Read_Dgram_Impl * * @brief Abstract base class for all the concrete implementation * classes that provide different implementations for the * ACE_Asynch_Read_Dgram */ class ACE_Asynch_Read_Dgram_Impl : public virtual ACE_Asynch_Operation_Impl { public: virtual ~ACE_Asynch_Read_Dgram_Impl () = default; /** This starts off an asynchronous read. Upto * total_size()> will be read and stored in the * @a message_block. @a message_block's will be updated to reflect * the added bytes if the read operation is successful completed. * Return code of 1 means immediate success and * will contain number of bytes read. The * method will still be called. Return code of 0 means the IO will * complete proactively. Return code of -1 means there was an error, use * errno to get the error code. * * Scatter/gather is supported on WIN32 by using the cont()> * method. Up to ACE_IOV_MAX @a message_block's are supported. Upto * size()> bytes will be read into each for * a total of total_size()> bytes. All @a message_block's * 's will be updated to reflect the added bytes for each * @a message_block * * Priority of the operation is specified by @a priority. On POSIX4-Unix, * this is supported. Works like in Unix. Negative values are not * allowed. 0 means priority of the operation same as the process * priority. 1 means priority of the operation is one less than * process. And so forth. On Win32, @a priority is a no-op. * @a signal_number is the POSIX4 real-time signal number to be used * for the operation. @a signal_number ranges from ACE_SIGRTMIN to * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. */ virtual ssize_t recv (ACE_Message_Block *message_block, size_t &number_of_bytes_recvd, int flags, int protocol_family, const void *act, int priority, int signal_number) = 0; protected: ACE_Asynch_Read_Dgram_Impl () = default; }; /** * @class ACE_Asynch_Read_Dgram_Result_Impl * * @brief Abstract base class for all the concrete implementation * classes that provide different implementations for the * ACE_Asynch_Read_Dgram::Result class. */ class ACE_Asynch_Read_Dgram_Result_Impl : public virtual ACE_Asynch_Result_Impl { public: virtual ~ACE_Asynch_Read_Dgram_Result_Impl () = default; /// Message block which contains the read data virtual ACE_Message_Block *message_block () const = 0; /// The number of bytes which were requested at the start of the /// asynchronous read. virtual size_t bytes_to_read () const = 0; /// The address of where the packet came from virtual int remote_address (ACE_Addr& addr) const = 0; /// The flags used in the read virtual int flags () const = 0; /// I/O handle used for reading. virtual ACE_HANDLE handle () const = 0; protected: ACE_Asynch_Read_Dgram_Result_Impl () = default; }; /** * @class ACE_Asynch_Write_Dgram_Impl * * @brief Abstract base class for all the concrete implementation * classes that provide different implementations for the * ACE_Asynch_Write_Dgram class. */ class ACE_Asynch_Write_Dgram_Impl : public virtual ACE_Asynch_Operation_Impl { public: virtual ~ACE_Asynch_Write_Dgram_Impl () = default; /** This starts off an asynchronous send. Upto * total_length()> will be sent. @a message_block's * will be updated to reflect the sent bytes if the send operation * is successful completed. * Return code of 1 means immediate success and * is updated to number of bytes sent. The * method will still be called. Return code of 0 means the IO will * complete proactively. Return code of -1 means there was an error, use * errno to get the error code. * * Scatter/gather is supported on WIN32 by using the cont()> * method. Up to ACE_IOV_MAX @a message_block's are supported. Upto * length()> bytes will be sent from each * for a total of total_length()> bytes. All * @a message_block's 's will be updated to reflect the bytes sent * from each @a message_block. * * Priority of the operation is specified by @a priority. On POSIX4-Unix, * this is supported. Works like in Unix. Negative values are not * allowed. 0 means priority of the operation same as the process * priority. 1 means priority of the operation is one less than * process. And so forth. On Win32, this argument is a no-op. * @a signal_number is the POSIX4 real-time signal number to be used * for the operation. @a signal_number ranges from ACE_SIGRTMIN to * ACE_SIGRTMAX. This argument is a no-op on non-POSIX4 systems. */ virtual ssize_t send (ACE_Message_Block *message_block, size_t &number_of_bytes_sent, int flags, const ACE_Addr &addr, const void *act, int priority, int signal_number) = 0; protected: ACE_Asynch_Write_Dgram_Impl () = default; }; /** * @class ACE_Asynch_Write_Dgram_Result_Impl * * @brief Abstract base class for all the concrete implementation * classes that provide different implementations for the * ACE_Asynch_Write_Dgram::Result class. */ class ACE_Asynch_Write_Dgram_Result_Impl : public virtual ACE_Asynch_Result_Impl { public: virtual ~ACE_Asynch_Write_Dgram_Result_Impl () = default; /// The number of bytes which were requested at the start of the /// asynchronous write. virtual size_t bytes_to_write () const = 0; /// Message block which contains the sent data virtual ACE_Message_Block *message_block () const = 0; /// The flags using in the write virtual int flags () const = 0; /// I/O handle used for writing. virtual ACE_HANDLE handle () const = 0; protected: ACE_Asynch_Write_Dgram_Result_Impl () = default; }; ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */ #include /**/ "ace/post.h" #endif /* ACE_ASYNCH_IO_IMPL_H */ ace-8.0.4+dfsg.orig/ace/MEM_Stream.inl0000644000175000017500000000266415027201773016364 0ustar sudipsudip// -*- C++ -*- #include "ace/MEM_Stream.h" #include "ace/OS_NS_sys_socket.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_MEM_Stream::ACE_MEM_Stream () { // ACE_TRACE ("ACE_MEM_Stream::ACE_MEM_Stream"); } ACE_INLINE ACE_MEM_Stream::ACE_MEM_Stream (ACE_HANDLE h) { // ACE_TRACE ("ACE_MEM_Stream::ACE_MEM_Stream"); this->set_handle (h); } ACE_INLINE ACE_MEM_Stream::~ACE_MEM_Stream () { // ACE_TRACE ("ACE_MEM_Stream::~ACE_MEM_Stream"); } ACE_INLINE int ACE_MEM_Stream::close_reader () { ACE_TRACE ("ACE_MEM_Stream::close_reader"); if (this->get_handle () != ACE_INVALID_HANDLE) return ACE_OS::shutdown (this->get_handle (), ACE_SHUTDOWN_READ); else return 0; } // Shut down just the writing end of a ACE_SOCK. ACE_INLINE int ACE_MEM_Stream::close_writer () { ACE_TRACE ("ACE_MEM_Stream::close_writer"); if (this->get_handle () != ACE_INVALID_HANDLE) return ACE_OS::shutdown (this->get_handle (), ACE_SHUTDOWN_WRITE); else return 0; } ACE_INLINE ssize_t ACE_MEM_Stream::send_n (const void *buf, size_t n) { return this->send (buf, n); } ACE_INLINE ssize_t ACE_MEM_Stream::recv_n (void *buf, size_t n) { return this->recv (buf, n); } ACE_INLINE ssize_t ACE_MEM_Stream::send_n (const void *buf, size_t n, int flags) { return this->send (buf, n, flags); } ACE_INLINE ssize_t ACE_MEM_Stream::recv_n (void *buf, size_t n, int flags) { return this->recv (buf, n, flags); } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/SOCK_SEQPACK_Acceptor.inl0000644000175000017500000000034415027201773020152 0ustar sudipsudip// -*- C++ -*- ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_SOCK_SEQPACK_Acceptor::~ACE_SOCK_SEQPACK_Acceptor () { ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::~ACE_SOCK_SEQPACK_Acceptor"); } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Netlink_Addr.inl0000644000175000017500000000177215027201773016770 0ustar sudipsudip// -*- C++ -*- #ifdef ACE_HAS_NETLINK ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_Netlink_Addr::ACE_Netlink_Addr () : ACE_Addr (this->determine_type (), sizeof (sockaddr_nl)) { this->nl_.nl_family = AF_NETLINK; } ACE_INLINE void ACE_Netlink_Addr::set(int pid, int gid) { this->nl_.nl_pid = static_cast (pid); this->nl_.nl_groups = static_cast (gid); } ACE_INLINE void ACE_Netlink_Addr::reset () { ACE_OS::memset (&this->nl_, 0, sizeof (this->nl_)); this->nl_.nl_family = AF_NETLINK; } ACE_INLINE int ACE_Netlink_Addr::determine_type () const { return AF_NETLINK; } ACE_INLINE void *ACE_Netlink_Addr::get_addr () const { return const_cast (&this->nl_); } ACE_INLINE int ACE_Netlink_Addr::get_addr_size () const { return sizeof (this->nl_); } ACE_INLINE void ACE_Netlink_Addr::set_addr (const void *addr, int len) { ACE_OS::memcpy (&this->nl_, addr, static_cast (len)); } ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_NETLINK */ ace-8.0.4+dfsg.orig/ace/Cached_Connect_Strategy_T.h0000644000175000017500000002470515027201773021065 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Cached_Connect_Strategy_T.h * * @author Kirthika Parameswaran */ //============================================================================= #ifndef CACHED_CONNECT_STRATEGY_T_H #define CACHED_CONNECT_STRATEGY_T_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/Strategies_T.h" #include "ace/Hash_Cache_Map_Manager_T.h" #include "ace/Caching_Strategies_T.h" #include "ace/Functor_T.h" #include "ace/Pair_T.h" // For linkers which cant grok long names... #define ACE_Cached_Connect_Strategy_Ex ACCSE ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_Cached_Connect_Strategy_Ex * * @brief A connection strategy which caches connections to peers * (represented by SVC_HANDLER instances), thereby allowing * subsequent re-use of unused, but available, connections. * * is intended to be used as a * plug-in connection strategy for ACE_Strategy_Connector. * It's added value is re-use of established connections and * tweaking the role of the cache as per the caching strategy. */ template class ACE_Cached_Connect_Strategy_Ex : public ACE_Cached_Connect_Strategy { public: /// Constructor ACE_Cached_Connect_Strategy_Ex ( CACHING_STRATEGY &caching_s, ACE_Creation_Strategy *cre_s = 0, ACE_Concurrency_Strategy *con_s = 0, ACE_Recycling_Strategy *rec_s = 0, MUTEX *lock = 0, int delete_lock = 0); /// Destructor virtual ~ACE_Cached_Connect_Strategy_Ex (); /// Explicit purging of connection entries from the connection cache. virtual int purge_connections (); /// Mark as closed (non-locking version). This is used during the cleanup of the /// connections purged. virtual int mark_as_closed_i (const void *recycling_act); /** * Since g++ version < 2.8 arent happy with templates, this special * method had to be devised to avoid memory leaks and perform * cleanup of the . */ void cleanup (); // = Typedefs for managing the map typedef ACE_Refcounted_Hash_Recyclable REFCOUNTED_HASH_RECYCLABLE_ADDRESS; typedef ACE_Hash_Cache_Map_Manager, ACE_Equal_To, CACHING_STRATEGY, ATTRIBUTES> CONNECTION_CACHE; typedef typename CONNECTION_CACHE::CACHE_ENTRY CONNECTION_CACHE_ENTRY; typedef typename CONNECTION_CACHE::key_type KEY; typedef typename CONNECTION_CACHE::mapped_type VALUE; typedef ACE_Recyclable_Handler_Cleanup_Strategy, ACE_Hash_Map_Manager_Ex, ACE_Hash, ACE_Equal_To, MUTEX> > CLEANUP_STRATEGY; typedef ACE_Cached_Connect_Strategy CCSBASE; // = Accessor. CACHING_STRATEGY &caching_strategy (); /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; protected: /// Find an idle handle. int find (ACE_Refcounted_Hash_Recyclable &search_addr, ACE_Hash_Map_Entry, std::pair > *&entry); /// Remove from cache (non-locking version). virtual int purge_i (const void *recycling_act); /// Add to cache (non-locking version). virtual int cache_i (const void *recycling_act); /// Get/Set recycle_state (non-locking version). virtual int recycle_state_i (const void *recycling_act, ACE_Recyclable_State new_state); virtual ACE_Recyclable_State recycle_state_i (const void *recycling_act) const; /// Cleanup hint and reset @c *act_holder to zero if @a act_holder != 0. virtual int cleanup_hint_i (const void *recycling_act, void **act_holder); // = Helpers int check_hint_i (SVC_HANDLER *&sh, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, const ACE_PEER_CONNECTOR_ADDR &local_addr, bool reuse_addr, int flags, int perms, ACE_Hash_Map_Entry, std::pair > *&entry, int &found); virtual int find_or_create_svc_handler_i (SVC_HANDLER *&sh, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, const ACE_PEER_CONNECTOR_ADDR &local_addr, bool reuse_addr, int flags, int perms, ACE_Hash_Map_Entry, std::pair > *&entry, int &found); virtual int connect_svc_handler_i (SVC_HANDLER *&sh, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, const ACE_PEER_CONNECTOR_ADDR &local_addr, bool reuse_addr, int flags, int perms, int &found); /** * Connection of the svc_handler with the remote host. This method * also encapsulates the connection done with auto_purging under the * hood. If the connect failed due to the process running out of * file descriptors then, auto_purging of some connections are done * from the CONNECTION_CACHE. This frees the descriptors which get * used in the connect process and hence the connect operation can * succeed. */ virtual int cached_connect (SVC_HANDLER *&sh, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, const ACE_PEER_CONNECTOR_ADDR &local_addr, bool reuse_addr, int flags, int perms); /// Table that maintains the cache of connected SVC_HANDLERs. CONNECTION_CACHE connection_cache_; }; ///////////////////////////////////////////////////////////////////////////// // For linkers which cant grok long names... #define ACE_Bounded_Cached_Connect_Strategy ABCCS /** * @class ACE_Bounded_Cached_Connect_Strategy * * @brief * A connection strategy which caches connections to peers * (represented by SVC_HANDLER instances), thereby allowing * subsequent re-use of unused, but available, connections. * This strategy should be used when the cache is bounded by * maximum size. * * Bounded_Cached_Connect_Strategy is intended to be used as a * plug-in connection strategy for ACE_Strategy_Connector. * It's added value is re-use of established connections and * tweaking the role of the cache as per the caching strategy. * Thanks to Edan Ayal for contributing this * class and Susan Liebeskind for * brainstorming about it. */ template class ACE_Bounded_Cached_Connect_Strategy : public ACE_Cached_Connect_Strategy_Ex { typedef ACE_Cached_Connect_Strategy_Ex CCSEBASE; // = Typedefs for managing the map typedef ACE_Refcounted_Hash_Recyclable REFCOUNTED_HASH_RECYCLABLE_ADDRESS; public: /// Constructor ACE_Bounded_Cached_Connect_Strategy (size_t max_size, CACHING_STRATEGY &caching_s, ACE_Creation_Strategy *cre_s = 0, ACE_Concurrency_Strategy *con_s = 0, ACE_Recycling_Strategy *rec_s = 0, MUTEX *lock = 0, int delete_lock = 0); /// Destructor virtual ~ACE_Bounded_Cached_Connect_Strategy () = default; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; protected: virtual int find_or_create_svc_handler_i (SVC_HANDLER *&sh, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, const ACE_PEER_CONNECTOR_ADDR &local_addr, bool reuse_addr, int flags, int perms, ACE_Hash_Map_Entry, std::pair > *&entry, int &found); protected: /// Max items in the cache, used as a bound for the creation of svc_handlers. size_t max_size_; }; ACE_END_VERSIONED_NAMESPACE_DECL #include "ace/Cached_Connect_Strategy_T.cpp" #include /**/ "ace/post.h" #endif /* CACHED_CONNECT_STRATEGY_T_H */ ace-8.0.4+dfsg.orig/ace/SV_Message.inl0000644000175000017500000000110515027201773016414 0ustar sudipsudip// -*- C++ -*- #include "ace/Global_Macros.h" #include "ace/config-all.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_SV_Message::ACE_SV_Message (long t) : type_ (t) { ACE_TRACE ("ACE_SV_Message::ACE_SV_Message"); } ACE_INLINE ACE_SV_Message::~ACE_SV_Message () { ACE_TRACE ("ACE_SV_Message::~ACE_SV_Message"); } ACE_INLINE long ACE_SV_Message::type () const { ACE_TRACE ("ACE_SV_Message::type"); return this->type_; } ACE_INLINE void ACE_SV_Message::type (long t) { ACE_TRACE ("ACE_SV_Message::type"); this->type_ = t; } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Test_and_Set.h0000644000175000017500000000317215027201773016447 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Test_and_Set.h */ //============================================================================= #ifndef ACE_TEST_AND_SET_H #define ACE_TEST_AND_SET_H #include /**/ "ace/pre.h" #include "ace/Event_Handler.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_Test_and_Set * * @brief Implements the classic ``test and set'' operation. * * This class keeps track of the status of , which can be * set based on various events (such as receipt of a signal). * This class is derived from ACE_Event_Handler so that it can be * "signaled" by a Reactor when a signal occurs. We assume that * is a data type that can be assigned the value 0 or 1. */ template class ACE_Test_and_Set : public ACE_Event_Handler { public: ACE_Test_and_Set (TYPE initial_value = 0); /// Returns true if we are set, else false. TYPE is_set () const; /// Sets the status, returning the original value of /// . TYPE set (TYPE); /// Called when object is signaled by OS (either via UNIX signals or /// when a Win32 object becomes signaled). virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); private: /// Keeps track of our state. TYPE is_set_; /// Protect the state from race conditions. ACE_LOCK lock_; }; ACE_END_VERSIONED_NAMESPACE_DECL #include "ace/Test_and_Set.cpp" #include /**/ "ace/post.h" #endif /* ACE_TEST_AND_SET_H */ ace-8.0.4+dfsg.orig/ace/config-integritySCA.h0000644000175000017500000001055715027201773017710 0ustar sudipsudip// -*- C++ -*- #ifndef ACE_CONFIG_INTEGRITYSCA_H #define ACE_CONFIG_INTEGRITYSCA_H /* * This config.h file is for version 11.4.x of the * INTEGRITY RTOS with POSIX APIs from Green Hills Software * http://www.ghs.com/products/rtos/integrity.html * */ // This config uses the POSIX calls provided by libraries in INTEGRITY. // All network utility and socket functions from the GHnet stack // are also assumed to be available. #define ACE_INTEGRITY /* compilation defines */ #define ACE_LACKS_GETPGID #define ACE_LACKS_SETREUID #define ACE_LACKS_SETREGID #define ACE_LACKS_PWD_FUNCTIONS #define ACE_LACKS_ALPHASORT #ifndef ACE_HAS_EXCEPTIONS # define ACE_HAS_EXCEPTIONS #endif #define ACE_MT_SAFE 1 #define ACE_HAS_SHM_OPEN /***** Operating System Defines *****/ /***** ANSI defines *****/ #define ACE_LACKS_TEMPNAM /* believe it or not, this is ANSI C */ #define ACE_HAS_STRERROR #define ACE_LACKS_SENDMSG /***** End Stack Defines *****/ /* SCA STUFF */ #if defined(INTEGRITY_VERSION) && (INTEGRITY_VERSION >= 40108) # define ACE_HAS_SIG_ATOMIC_T #endif /* INTEGRITY_VERSION */ #define ACE_HAS_SIGINFO_T #define ACE_LACKS_SIGINFO_H #define ACE_LACKS_UCONTEXT_H #define ACE_HAS_SIG_C_FUNC #define ACE_LACKS_SI_ADDR #define ACE_HAS_AIO_CALLS #define ACE_HAS_POSIX_NONBLOCK #define ACE_HAS_DIRENT #define ACE_HAS_THREADS #define ACE_HAS_PTHREADS #define ACE_HAS_THREAD_SPECIFIC_STORAGE /***** End Threading Defines *****/ /***** Hardware Defines *****/ #define ACE_PAGE_SIZE 4096 /***** End Hardware Defines *****/ /****** SYSV_IPC STUFF *****/ #define ACE_LACKS_KEY_T #define ACE_HAS_WCHAR #define ACE_LACKS_ISCTYPE #define ACE_LACKS_WCSICMP #define ACE_LACKS_WCSNICMP #define ACE_LACKS_WCSDUP #define ACE_LACKS_WCSTOK #define ACE_LACKS_ITOW #define ACE_LACKS_STRPTIME #define ACE_LACKS_SYSTEM /****** Posix Defines *****/ #define ACE_LACKS_SUSECONDS_T #define ACE_LACKS_USECONDS_T #define ACE_LACKS_WAIT #define ACE_LACKS_WAITPID #define ACE_HAS_POSIX_TIME #define ACE_HAS_POSIX_SEM #define ACE_HAS_STRDUP_EMULATION #define ACE_HAS_MSG #define ACE_LACKS_CONDATTR_PSHARED #define ACE_LACKS_EXEC #define ACE_LACKS_FORK #define ACE_LACKS_MKFIFO #define ACE_LACKS_MKTEMP #define ACE_LACKS_MKSTEMP #define ACE_LACKS_MPROTECT #define ACE_LACKS_MUTEXATTR_PSHARED #define ACE_LACKS_PIPE #define ACE_LACKS_RLIMIT #define ACE_LACKS_RWLOCK_T #define ACE_LACKS_SEMBUF_T #define ACE_LACKS_UNIX_DOMAIN_SOCKETS #define ACE_LACKS_USER #define ACE_LACKS_FILE_FCNTL #define ACE_LACKS_SHARED_MEMORY #define ACE_LACKS_UMASK #define ACE_LACKS_SEEK #define ACE_LACKS_IPC_H #define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS #define ACE_LACKS_SETGID #define ACE_LACKS_SYS_PARAM_H #define ACE_LACKS_SYS_MSG_H #define ACE_LACKS_ISATTY #define ACE_LACKS_GETOPT #define ACE_LACKS_STRCASECMP #define ACE_LACKS_TRUNCATE #define ACE_LACKS_PUTENV #define ACE_HAS_4_4BSD_SENDMSG_RECVMSG #define ACE_HAS_CLOCK_GETTIME #define ACE_HAS_CLOCK_SETTIME #define ACE_LACKS_STRRECVFD #define ACE_LACKS_WRITEV #define ACE_LACKS_MALLOC_H /* netbsd's just includes stdlib.h */ #define ACE_LACKS_READV #define ACE_LACKS_MSYNC /* below refers to fcntl style locking */ #define ACE_LACKS_FILELOCKS #define ACE_LACKS_REALPATH #define ACE_LACKS_SWAB #define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES /***** Not tied to standards AFAIK ****/ #define ACE_LACKS_MADVISE /* paging optimization not needed with INTEGRITY */ #define ACE_LACKS_INTTYPES_H #define ACE_LACKS_SYS_RESOURCE_H #define ACE_LACKS_SEARCH_H #define ACE_LACKS_SYS_IPC_H #define ACE_LACKS_SYS_SEM_H #define ACE_LACKS_STROPTS_H #define ACE_LACKS_SYS_SHM_H #include typedef void (*__sighandler_t)(int); #ifdef ppc #define ACE_HAS_POWERPC_TIMER #endif /* MIKEC Addtions */ #define ACE_HAS_NONCONST_SELECT_TIMEVAL #define ACE_LACKS_READLINK #define ACE_LACKS_GETPPID #define NSIG (SIGRTMAX+1) #define ACE_LACKS_CUSERID #define ACE_NEEDS_HUGE_THREAD_STACKSIZE 0x5000 #define ACE_DEFAULT_THREAD_PRIORITY 127 #define PRI_FIFO_MIN 1 #define PRI_FIFO_MAX 127 #define ACE_THR_PRI_FIFO_DEF 127 #define PRI_RR_MIN 1 #define PRI_RR_MAX 127 #define ACE_THR_PRI_RR_DEF 127 #define PRI_OTHER_MIN 1 #define PRI_OTHER_MAX 127 #define ACE_THR_PRI_OTHER_DEF 127 #undef ACE_LACKS_UNLINK #define ACE_HAS_TIMED_MESSAGE_BLOCKS #define ACE_HAS_VOIDPTR_GETTIMEOFDAY #define ACE_LACKS_UNIX_SYSLOG #define ACE_LACKS_TELLDIR #define ACE_LACKS_SEEKDIR #define ACE_LACKS_GETHOSTENT /* end MIKEC Addtions */ #endif /* ACE_CONFIG_INTEGRITYSCA_H */ ace-8.0.4+dfsg.orig/ace/MEM_Acceptor.inl0000644000175000017500000000441715027201773016667 0ustar sudipsudip// -*- C++ -*- ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_MEM_Acceptor::open (const ACE_Addr &local_sap, ACE_Protocol_Info *protocolinfo, ACE_SOCK_GROUP g, u_long flags, int reuse_addr, int protocol_family, int backlog, int protocol) { return this->ACE_SOCK_Acceptor::open (local_sap, protocolinfo, g, flags, reuse_addr, protocol_family, backlog, protocol); } ACE_INLINE int ACE_MEM_Acceptor::accept (ACE_SOCK_Stream &new_stream, ACE_Addr *remote_addr, ACE_Time_Value *timeout, bool restart, bool reset_new_handle) const { return this->ACE_SOCK_Acceptor::accept (new_stream, remote_addr, timeout, restart, reset_new_handle); } ACE_INLINE int ACE_MEM_Acceptor::accept (ACE_SOCK_Stream &new_stream, ACE_Accept_QoS_Params qos_params, ACE_Addr *remote_addr, ACE_Time_Value *timeout, bool restart, bool reset_new_handle) const { return this->ACE_SOCK_Acceptor::accept (new_stream, qos_params, remote_addr, timeout, restart, reset_new_handle); } ACE_INLINE int ACE_MEM_Acceptor::get_local_addr (ACE_MEM_Addr &sap) const { ACE_INET_Addr temp; this->ACE_SOCK_Acceptor::get_local_addr (temp); sap.set_port_number (temp.get_port_number ()); return 0; } ACE_INLINE const ACE_TCHAR * ACE_MEM_Acceptor::mmap_prefix () const { return this->mmap_prefix_; } ACE_INLINE void ACE_MEM_Acceptor::mmap_prefix (const ACE_TCHAR *prefix) { if (prefix == 0) { this->mmap_prefix_ = 0; } else { this->mmap_prefix_ = ACE::strnew (prefix); } } ACE_INLINE ACE_MEM_IO::Signal_Strategy ACE_MEM_Acceptor::preferred_strategy () const { return this->preferred_strategy_; } ACE_INLINE void ACE_MEM_Acceptor::preferred_strategy (ACE_MEM_IO::Signal_Strategy strategy) { this->preferred_strategy_ = strategy; } ACE_INLINE void ACE_MEM_Acceptor::init_buffer_size (ACE_OFF_T bytes) { this->malloc_options_.minimum_bytes_ = bytes; } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/FILE_IO.inl0000644000175000017500000000770015027201773015535 0ustar sudipsudip// -*- C++ -*- #include "ace/ACE.h" #include "ace/OS_NS_sys_uio.h" #include "ace/OS_NS_unistd.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ssize_t ACE_FILE_IO::sendv_n (const iovec iov[], int n) const { ACE_TRACE ("ACE_FILE_IO::sendv_n"); return ACE::writev_n (this->get_handle (), iov, n); } ACE_INLINE ssize_t ACE_FILE_IO::send_n (const ACE_Message_Block *message_block, const ACE_Time_Value *timeout, size_t *bytes_transferred) { ACE_TRACE ("ACE_FILE_IO::send_n"); ACE_UNUSED_ARG (timeout); return ACE::write_n (this->get_handle (), message_block, bytes_transferred); } // Recv an n byte message from the file. ACE_INLINE ssize_t ACE_FILE_IO::recvv_n (iovec iov[], int n) const { ACE_TRACE ("ACE_FILE_IO::recvv_n"); // @@ Carlos, can you please update this to call the // new ACE::recvv_n() method that you write? return ACE_OS::readv (this->get_handle (), iov, n); } // Send an of size to the file. ACE_INLINE ssize_t ACE_FILE_IO::sendv (const iovec iov[], int n) const { ACE_TRACE ("ACE_FILE_IO::sendv"); return ACE_OS::writev (this->get_handle (), iov, n); } // Send exactly N bytes from BUF to this file. Keeping trying until // this many bytes are sent. ACE_INLINE ssize_t ACE_FILE_IO::send_n (const void *buf, size_t n) const { ACE_TRACE ("ACE_FILE_IO::send_n"); return ACE::write_n (this->get_handle (), buf, n); } // Receive exactly N bytes from this file into BUF. Keep trying until // this many bytes are received. ACE_INLINE ssize_t ACE_FILE_IO::recv_n (void *buf, size_t n) const { ACE_TRACE ("ACE_FILE_IO::recv_n"); return ACE::read_n (this->get_handle (), buf, n); } ACE_INLINE ssize_t ACE_FILE_IO::send (const void *buf, size_t n) const { ACE_TRACE ("ACE_FILE_IO::send"); return ACE_OS::write (this->get_handle (), buf, n); } ACE_INLINE ssize_t ACE_FILE_IO::recv (void *buf, size_t n) const { ACE_TRACE ("ACE_FILE_IO::recv"); return ACE_OS::read (this->get_handle (), buf, n); } ACE_INLINE ssize_t ACE_FILE_IO::send (const iovec iov[], int n) const { ACE_TRACE ("ACE_FILE_IO::send"); return ACE_OS::writev (this->get_handle (), iov, n); } ACE_INLINE ssize_t ACE_FILE_IO::recv (iovec iov[], int n) const { ACE_TRACE ("ACE_FILE_IO::recv"); return ACE_OS::readv (this->get_handle (), iov, n); } #if defined (ACE_HAS_STREAM_PIPES) ACE_INLINE ssize_t ACE_FILE_IO::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *band, int *flags) const { ACE_TRACE ("ACE_FILE_IO::recv"); return ACE_OS::getpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags); } ACE_INLINE ssize_t ACE_FILE_IO::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int band, int flags) const { ACE_TRACE ("ACE_FILE_IO::send"); return ACE_OS::putpmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, band, flags); } ACE_INLINE ssize_t ACE_FILE_IO::recv (ACE_Str_Buf *cntl, ACE_Str_Buf *data, int *flags) const { ACE_TRACE ("ACE_FILE_IO::recv"); return ACE_OS::getmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags); } ACE_INLINE ssize_t ACE_FILE_IO::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int flags) const { ACE_TRACE ("ACE_FILE_IO::send"); return ACE_OS::putmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags); } ACE_INLINE ssize_t ACE_FILE_IO::send (const void *buf, size_t n, ACE_OVERLAPPED *overlapped) const { ACE_TRACE ("ACE_FILE_IO::send"); return ACE_OS::write (this->get_handle (), buf, n, overlapped); } ACE_INLINE ssize_t ACE_FILE_IO::recv (void *buf, size_t n, ACE_OVERLAPPED *overlapped) const { ACE_TRACE ("ACE_FILE_IO::recv"); return ACE_OS::read (this->get_handle (), buf, n, overlapped); } #endif /* ACE_HAS_STREAM_PIPES */ ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/OS_NS_poll.h0000644000175000017500000000261615027201773016044 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file OS_NS_poll.h * * @author Douglas C. Schmidt * @author Jesper S. M|ller * @author and a cast of thousands... */ //============================================================================= #ifndef ACE_OS_NS_POLL_H # define ACE_OS_NS_POLL_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/os_include/os_poll.h" #include /**/ "ace/ACE_export.h" #if defined (ACE_EXPORT_MACRO) # undef ACE_EXPORT_MACRO #endif #define ACE_EXPORT_MACRO ACE_Export ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Time_Value; namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION int poll (struct pollfd *pollfds, unsigned long len, const ACE_Time_Value *tv = 0); ACE_NAMESPACE_INLINE_FUNCTION int poll (struct pollfd *pollfds, unsigned long len, const ACE_Time_Value &tv); } /* namespace ACE_OS */ ACE_END_VERSIONED_NAMESPACE_DECL # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE # endif /* ACE_INLINE */ # define ACE_INLINE inline # include "ace/OS_NS_poll.inl" # endif /* ACE_HAS_INLINED_OSCALLS */ # include /**/ "ace/post.h" #endif /* ACE_OS_NS_POLL_H */ ace-8.0.4+dfsg.orig/ace/OS_Thread_Adapter.cpp0000644000175000017500000001132315027201773017673 0ustar sudipsudip#include "ace/OS_Thread_Adapter.h" #include "ace/Thread_Hook.h" #include "ace/Object_Manager_Base.h" #include "ace/Global_Macros.h" #include "ace/OS_NS_Thread.h" #if defined (ACE_HAS_ALLOC_HOOKS) # include "ace/Malloc_Base.h" #endif /* ACE_HAS_ALLOC_HOOKS */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_OS_Thread_Adapter::ACE_OS_Thread_Adapter ( ACE_THR_FUNC user_func , void *arg , ACE_THR_C_FUNC entry_point #if defined (ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS) , ACE_SEH_EXCEPT_HANDLER selector , ACE_SEH_EXCEPT_HANDLER handler #endif /* ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS */ , long cancel_flags ) : ACE_Base_Thread_Adapter (user_func, arg, entry_point , 0 #if defined (ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS) , selector , handler #endif /* ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS */ , cancel_flags ) { } ACE_OS_Thread_Adapter::~ACE_OS_Thread_Adapter () { } ACE_ALLOC_HOOK_DEFINE(ACE_OS_Thread_Adapter) ACE_THR_FUNC_RETURN ACE_OS_Thread_Adapter::invoke () { // Inherit the logging features if the parent thread has an // ACE_Log_Msg instance in thread-specific storage. this->inherit_log_msg (); // Extract the arguments. ACE_THR_FUNC_INTERNAL func = reinterpret_cast (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 anymore. Make sure // not to access anywhere below this point. delete this; 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 { ACE_SEH_TRY { ACE_Thread_Hook *hook = ACE_OS_Object_Manager::thread_hook (); if (hook) // Invoke the start hook to give the user a chance to // perform some initialization processing before the // is invoked. status = hook->start (reinterpret_cast (func), arg); else { // Call thread entry point. status = (*func) (arg); } } #if defined (ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS) ACE_SEH_EXCEPT (ACE_OS_Object_Manager::seh_except_selector ()( (void *) GetExceptionInformation ())) { ACE_OS_Object_Manager::seh_except_handler ()(0); } #endif /* ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS */ } ACE_SEH_FINALLY { // If we changed this to 1, change the respective if in // Task::svc_run to 0. #if 0 // Call the close> hook. if (func == reinterpret_cast (ACE_Task_Base::svc_run)) { ACE_Task_Base *task_ptr = (ACE_Task_Base *) arg; ACE_Thread_Manager *thr_mgr_ptr = task_ptr->thr_mgr (); // This calls the Task->close () hook. task_ptr->cleanup (task_ptr, 0); // This prevents a second invocation of the cleanup code // (called later by . thr_mgr_ptr->at_exit (task_ptr, 0, 0); } #endif /* 0 */ #if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION) // Call TSS destructors. ACE_OS::cleanup_tss (0 /* not main thread */); # if defined (ACE_WIN32) // Exit the thread. Allow CWinThread-destructor to be invoked // from AfxEndThread. _endthreadex will be called from // AfxEndThread so don't exit the thread now if we are running // an MFC thread. # if defined (ACE_HAS_MFC) && (ACE_HAS_MFC != 0) // Not spawned by ACE_Thread_Manager, use the old buggy // version. You should seriously consider using // ACE_Thread_Manager to spawn threads. The following code // is know to cause some problem. CWinThread *pThread = ::AfxGetThread (); if (!pThread || pThread->m_nThreadID != ACE_OS::thr_self ()) ACE_ENDTHREADEX (status); else ::AfxEndThread (status); # else ACE_ENDTHREADEX (status); # endif /* ACE_HAS_MFC && ACE_HAS_MFS != 0*/ # endif /* ACE_WIN32 */ #endif /* ACE_WIN32 || ACE_HAS_TSS_EMULATION */ } return status; } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Sig_Handler.inl0000644000175000017500000000032215027201773016577 0ustar sudipsudip// -*- C++ -*- ACE_INLINE ACE_Sig_Handler::ACE_Sig_Handler () { } ACE_INLINE int ACE_Sig_Handler::in_range (int signum) { ACE_TRACE ("ACE_Sig_Handler::in_range"); return signum > 0 && signum < ACE_NSIG; } ace-8.0.4+dfsg.orig/ace/LSOCK_CODgram.h0000644000175000017500000000630715027201773016305 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file LSOCK_CODgram.h * * @author Douglas C. Schmidt */ //============================================================================= #ifndef ACE_LOCAL_SOCK_CODGRAM_H #define ACE_LOCAL_SOCK_CODGRAM_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_LACKS_UNIX_DOMAIN_SOCKETS) #include "ace/LSOCK.h" #include "ace/SOCK_CODgram.h" #include "ace/Addr.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_LSOCK_CODgram * * @brief Defines a fully specified (sometimes called "connected") UNIX-domain * datagram abstraction. * * ACE_LSOCK_CODgram provides a way to use a UNIX-domain datagram socket in * a situation where the local and peer addresses are fully known in advance. * The "connection-oriented" part of "CODgram" is a misnomer. There is no * connection used on this type of socket. It merely specifies that both * endpoint addresses are known in advance of use. Furthermore, this class * is more suited for use cases where a local endpoint wishes to communicate * with a single, known peer and may or may not have a specified local address. * * If your use case requires receiving datagrams from multiple peers without * previously known addresses, consider using ACE_LSOCK_Dgram instead. */ class ACE_Export ACE_LSOCK_CODgram : public ACE_SOCK_CODgram, public ACE_LSOCK { public: /// Default constructor; requires a call to open() prior to communication. ACE_LSOCK_CODgram (); /** * @name Initialization methods */ //@{ /** * Initialize a fully-specified datagram socket. * * @param remote_sap Remote/peer address. This should be an ACE_UNIX_Addr * object. It specifies where all sent datagrams will * be sent to. * @param local_sap Local address. The local address to receive datagrams * at. If not specified, an unused address is selected. * If specified, should be an ACE_UNIX_Addr object. * * @sa ACE_UNIX_Addr */ ACE_LSOCK_CODgram (const ACE_Addr &remote_sap, const ACE_Addr &local_sap = ACE_Addr::sap_any, int protocol_family = PF_UNIX, int protocol = 0); /** * Initialize a fully-specified datagram socket. * * @retval 0 if no error. * @retval -1 on error; check errno for an error reason. */ int open (const ACE_Addr &remote_sap, const ACE_Addr &local_sap = ACE_Addr::sap_any, int protocol_family = PF_UNIX, int protocol = 0); //@} /// Get underlying handle. ACE_HANDLE get_handle () const; /// Set underlying handle. void set_handle (ACE_HANDLE); /// Dump the state of an object. void dump () const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; }; ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/LSOCK_CODgram.inl" #endif /* __ACE_INLINE__ */ #endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ #include /**/ "ace/post.h" #endif /* ACE_LOCAL_SOCK_CODGRAM_H */ ace-8.0.4+dfsg.orig/ace/Svc_Conf_Lexer.h0000644000175000017500000000431215027201773016727 0ustar sudipsudip// -*- C++ -*- //========================================================================= /** * @file Svc_Conf_Lexer.h * * This class is a hand-coded replacement for the lexer generated from * Svc_Conf.l that correctly supports Unicode. * * @author Chad Elliott */ //========================================================================= #ifndef SVC_CONF_LEXER_H #define SVC_CONF_LEXER_H #include /**/ "ace/pre.h" #include "ace/Svc_Conf.h" #if (ACE_USES_CLASSIC_SVC_CONF == 1) #include "ace/Encoding_Converter_Factory.h" class ACE_Encoding_Converter; ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** This class lexes the classic ACE Service Configurator language. * The entry point is similar to what flex would generate. However, it * is a static method in this class (which is really just name space). */ class ACE_Svc_Conf_Lexer { public: /// This is similar to the C function, ace_yylex, which a bison /// generated parser expects. It returns information in the ace_yylval /// parameter and uses input stored in the param parameter. static int yylex (ACE_YYSTYPE* ace_yylval, ACE_Svc_Conf_Param* param); private: static size_t input(ACE_Svc_Conf_Param* param, char* buf, size_t max_size); static int scan (ACE_YYSTYPE* ace_yylval, ACE_Svc_Conf_Param* param); #if defined (ACE_USES_WCHAR) static bool convert_to_utf8 ( ACE_Svc_Conf_Param* param, size_t skip_bytes, ACE_Encoding_Converter_Factory::Encoding_Hint hint); static bool convert_from_utf8 (ACE_Encoding_Converter* converter, const char* source, size_t source_size, ACE_TCHAR* target, size_t target_size, size_t& length); static ACE_Encoding_Converter_Factory::Encoding_Hint locate_bom (char* source, size_t source_size, size_t& bytes_used); #endif /* ACE_USES_WCHAR */ }; ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_USES_CLASSIC_SVC_CONF = 1 */ #include /**/ "ace/post.h" #endif /* SVC_CONF_LEXER_H */ ace-8.0.4+dfsg.orig/ace/Token_Request_Reply.cpp0000644000175000017500000001217515027201773020374 0ustar sudipsudip#include "ace/Token_Request_Reply.h" #if defined (ACE_HAS_TOKENS_LIBRARY) #if !defined (__ACE_INLINE__) #include "ace/Token_Request_Reply.inl" #endif /* __ACE_INLINE__ */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Create a ACE_Token_Request message. ACE_Token_Request::ACE_Token_Request (int token_type, int proxy_type, ACE_UINT32 operation_type, const ACE_TCHAR token_name[], const ACE_TCHAR client_id[], const ACE_Synch_Options &options) { this->token_type (token_type); this->proxy_type (proxy_type); this->operation_type (operation_type); this->requeue_position (0); // to avoid Purify UMR this->notify (0); // to avoid Purify UMR transfer_.arg_ = 0; // to avoid Purify UMR ACE_OS::memset (transfer_.data_, 0, sizeof transfer_.data_); // to avoid Purify UMR this->token_name (token_name, client_id); this->options (options); } // Encode the transfer buffer into network byte order // so that it can be sent to the server. int ACE_Token_Request::encode (void *&buf) { buf = (void *) &this->transfer_; return this->length (); } // Decode the transfer buffer into host byte byte order // so that it can be used by the server. int ACE_Token_Request::decode () { this->token_name_ = this->transfer_.data_; options_.set (transfer_.use_timeout_ == 1 ? ACE_Synch_Options::USE_TIMEOUT : 0, ACE_Time_Value (transfer_.sec_, transfer_.usec_), (void *) transfer_.arg_); // Decode the variable-sized portion. size_t token_len = ACE_OS::strlen (this->token_name_); // Check to make sure this->tokenName_ isn't too long! if (token_len >= ACE_MAXTOKENNAMELEN) { errno = ENAMETOOLONG; return -1; } else // Skip this->tokenName_ + '\0' + ':'. this->client_id_ = &this->token_name_[(token_len + 2) * sizeof (ACE_TCHAR)]; // Fixed size header // token_name_ plus '\0' // ':' // client_id_ plus '\0' size_t data_size = ACE_TOKEN_REQUEST_HEADER_SIZE + ACE_OS::strlen (this->token_name_) + 1 + ACE_OS::strlen (this->client_id_) + 1 + 1; // Make sure the message was correctly received and framed. return this->length () == data_size ? 0 : -1; } // Print out the current values of the ACE_Token_Request. void ACE_Token_Request::dump () const { #if defined (ACE_HAS_DUMP) ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("*******\nlength = %d\ntoken name = %s\nclient id = %s\n"), this->length (), this->token_name (), this->client_id ())); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("type = "))); if (this->token_type () == ACE_Tokens::MUTEX) ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("MUTEX\n"))); else // == ACE_Tokens::RWLOCK { if (this->proxy_type () == ACE_RW_Token::READER) ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("RLOCK\n"))); else // == WRITER ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("WLOCK\n"))); } ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("operation = "))); switch (this->operation_type ()) { case ACE_Token_Request::ACQUIRE: ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("ACQUIRE\n"))); break; case ACE_Token_Request::RELEASE: ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("RELEASE\n"))); break; case ACE_Token_Request::RENEW: ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("RENEW\n"))); break; default: ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT (" = %d\n"), this->operation_type ())); break; } if (this->options ()[ACE_Synch_Options::USE_TIMEOUT] == 0) ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("blocking forever\n"))); else { ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("waiting for %d secs and %d usecs\n"), this->options ().timeout ().sec (), this->options ().timeout ().usec ())); } ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } // ************************************************************ // ************************************************************ // ************************************************************ // Create a ACE_Token_Reply message. ACE_Token_Reply::ACE_Token_Reply () // Type of reply. { this->arg (0); this->errnum (0); this->length (sizeof (Transfer)); } // Encode the transfer buffer into network byte order // so that it can be sent to the client. int ACE_Token_Reply::encode (void *&buf) { buf = (void *) &this->transfer_; return this->length (); } // Decode the transfer buffer into host byte order // so that it can be used by the client. int ACE_Token_Reply::decode () { return 0; } // Print out current values of the ACE_Token_Reply object. void ACE_Token_Reply::dump () const { #if defined (ACE_HAS_DUMP) ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("*******\nlength = %d\nerrnum = %d"), this->length (), this->errnum ())); ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("arg = %d"), this->arg ())); #endif /* ACE_HAS_DUMP */ } ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_TOKENS_LIBRARY */ ace-8.0.4+dfsg.orig/ace/FILE.inl0000644000175000017500000000044415027201773015144 0ustar sudipsudip// -*- C++ -*- ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_FILE::disable (int signum) const { #if defined (ACE_WIN32) ACE_UNUSED_ARG (signum) ; return 0 ; #else /* ACE_WIN32 */ return ACE_IO_SAP::disable (signum) ; #endif /* ACE_WIN32 */ } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/IPC_SAP.inl0000644000175000017500000000135515027201773015545 0ustar sudipsudip// -*- C++ -*- #include "ace/OS_NS_stropts.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_IPC_SAP::~ACE_IPC_SAP () { // ACE_TRACE ("ACE_IPC_SAP::~ACE_IPC_SAP"); } ACE_INLINE ACE_HANDLE ACE_IPC_SAP::get_handle () const { ACE_TRACE ("ACE_IPC_SAP::get_handle"); return this->handle_; } // Used to set the underlying handle_. ACE_INLINE void ACE_IPC_SAP::set_handle (ACE_HANDLE handle) { ACE_TRACE ("ACE_IPC_SAP::set_handle"); this->handle_ = handle; } // Provides access to the ACE_OS::ioctl system call. ACE_INLINE int ACE_IPC_SAP::control (int cmd, void *arg) const { ACE_TRACE ("ACE_IPC_SAP::control"); return ACE_OS::ioctl (this->handle_, static_cast (cmd), arg); } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Hash_Map_With_Allocator_T.inl0000644000175000017500000000605215027201773021364 0ustar sudipsudip// -*- C++ -*- ACE_BEGIN_VERSIONED_NAMESPACE_DECL template ACE_INLINE int ACE_Hash_Map_With_Allocator::close (ACE_Allocator *alloc) { ACE_TRACE ("ACE_Hash_Map_With_Allocator::close"); this->table_allocator_ = alloc; this->entry_allocator_ = alloc; return this->close_i (); } template ACE_INLINE int ACE_Hash_Map_With_Allocator::bind (const EXT_ID &ext_id, const INT_ID &int_id, ACE_Allocator *alloc) { ACE_TRACE ("ACE_Hash_Map_With_Allocator::bind"); this->table_allocator_ = alloc; this->entry_allocator_ = alloc; return this->bind_i (ext_id, int_id); } template ACE_INLINE int ACE_Hash_Map_With_Allocator::unbind (const EXT_ID &ext_id, INT_ID &int_id, ACE_Allocator *alloc) { ACE_TRACE ("ACE_Hash_Map_With_Allocator::unbind"); this->table_allocator_ = alloc; this->entry_allocator_ = alloc; return this->unbind_i (ext_id, int_id); } template ACE_INLINE int ACE_Hash_Map_With_Allocator::unbind (const EXT_ID &ext_id, ACE_Allocator *alloc) { ACE_TRACE ("ACE_Hash_Map_With_Allocator::unbind"); this->table_allocator_ = alloc; this->entry_allocator_ = alloc; return this->unbind_i (ext_id); } template ACE_INLINE int ACE_Hash_Map_With_Allocator::rebind (const EXT_ID &ext_id, const INT_ID &int_id, EXT_ID &old_ext_id, INT_ID &old_int_id, ACE_Allocator *alloc) { ACE_TRACE ("ACE_Hash_Map_With_Allocator::rebind"); this->table_allocator_ = alloc; this->entry_allocator_ = alloc; return this->rebind_i (ext_id, int_id, old_ext_id, old_int_id); } template ACE_INLINE int ACE_Hash_Map_With_Allocator::find (const EXT_ID &ext_id, INT_ID &int_id, ACE_Allocator *alloc) { ACE_TRACE ("ACE_Hash_Map_With_Allocator::find"); this->table_allocator_ = alloc; this->entry_allocator_ = alloc; return this->find_i (ext_id, int_id); } template ACE_INLINE int ACE_Hash_Map_With_Allocator::find (const EXT_ID &ext_id, ACE_Allocator *alloc) { ACE_TRACE ("ACE_Hash_Map_With_Allocator::find"); this->table_allocator_ = alloc; this->entry_allocator_ = alloc; return this->find_i (ext_id); } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Token_Collection.h0000644000175000017500000002036615027201773017332 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Token_Collection.h * * The ACE_Token class offers methods for acquiring, renewing, * and releasing a synchronization token on a per-token basis. The * ACE_Token_Collection offers an interface for performing * operations on groups of tokens as a whole, or on a single token * within the collection. * * The atomic group operations are not yet implemented. * * @author Douglas C. Schmidt (d.schmidt@vanderbilt.edu) * @author Tim Harrison (harrison@cs.wustl.edu) */ //============================================================================= #ifndef ACE_TOKEN_COLLECTION_H #define ACE_TOKEN_COLLECTION_H #include /**/ "ace/pre.h" #include "ace/Map_Manager.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #if defined (ACE_HAS_TOKENS_LIBRARY) #include "ace/Local_Tokens.h" #include "ace/Null_Mutex.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_Token_Collection * * @brief Allows atomic token group operations AND * provides a ACE_Token manager interface. * * There are two types of operations offered by * ACE_Token_Collection. The first is atomic operations on * collections of Token_Proxies. In this respect, the * ACE_Token_Collection can be thought of as a single token * consisting of multiple Token_Proxies. The second role of the * ACE_Token_Collection is as a ACE_Token manager. * ACE_Token_Collection allows individual operations on single * members of a collection of Token_Proxies. This provides a * single access point for operations on multiple tokens. * * @bug Although ACE_Token_Collection inherits from ACE_Token_Proxy, it * can not be including in a collection. This is because * returns zero for now. */ class ACE_Export ACE_Token_Collection : public ACE_Token_Proxy { public: /** * @a debug print out verbose debugging messages. @a name will give a * name to the collection. Collections don't really need names, but * are sometimes useful for debugging. */ ACE_Token_Collection (bool debug = false, const ACE_TCHAR *name = 0); // Collection Management operations /** * Insert a Token into the collection. All ACE_Token type * operations performed on the collection will also be performed on * the new_proxy until it is removed. Note that no operations * performed prior to the insertion will be performed. Returns: 0 * on success, -1 on failure with @c errno == problem. If a token * proxy already exists in the collection with the same name, the * insertion will fail. Also, is copied. Note that during * the copy, client_id's are *not* inherited. The client ID of the * thread using the collection will be used. Client ID's can be * changed explicity on each proxy using is_member. */ int insert (ACE_Token_Proxy &token); /** * Removes the ACE_Token matching the given token_name from the * collection. On success, extract returns 0. On failure * (token_name was not in the collection,) extract returns -1. On * success, the state of the token found is copied into proxy. * The returned ACE_Token_Proxy* must be deleted by the user. */ int extract (const ACE_TCHAR *token_name, ACE_Token_Proxy *&proxy); /// Returns the proxy if true. 0 otherwise. ACE_Token_Proxy *is_member (const ACE_TCHAR *token_name); /** * Is the specified token in the collection? * 1, yes. * 0, no. */ int is_member (const ACE_Token_Proxy &token); // = Collective operation semantics. // For acquire, renew, and release, there are two interfaces. Once // interface allows an operation on a single token in the // collection. The collective interfaces perform atomic operations // on the entire collection. For instance, a collective acquire // will perform an acquire for each and every token in the // collection or the operation will fail. Currently, these // operations are performed with no ordering heuristics. That is, // the Collection steps through the tokens in the order they were // inserted. For each one it performs the operation (acquire, // renew, or release). /** * Acquire "atomically" all resources in the collection. This is * only successfull if all tokens in the collection could be * acquired. options contains the blocking semantics, timeout * value, etc. Returns: 0 on success, -1 on failure with @c errno == * problem. If and error or deadlock occurs for one of the tokens, * all the tokens will be released and the method will return -1. * Note that returning on detection of deadlock prevents livelock * between competing collections. If a collection returns after * detecting deadlock, it is the application's responsibility to not * to blindly loop on the collection::acquire operation. In other * words, once the collection reports deadlock, it is out of our * hands. */ virtual int acquire (int notify = 0, void (*sleep_hook)(void *) = 0, ACE_Synch_Options &options = ACE_Synch_Options::defaults); /// Acquire the token corresponding to @a token_name. The other /// parameters are passed to ::acquire. virtual int acquire (const ACE_TCHAR *token_name, int notify = 0, void (*sleep_hook)(void *) = 0, ACE_Synch_Options &options = ACE_Synch_Options::defaults); /// Try to acquire all tokens in collection. virtual int tryacquire (void (*sleep_hook)(void *) = 0); /// Try to acquire @a token_name. virtual int tryacquire (const ACE_TCHAR *token_name, void (*sleep_hook)(void *) = 0); /** * Renews "atomically" all resources in the collection. This is * only successfull if all tokens in the collection could be * renewed. options contains the blocking semantics, timeout * value, etc. Returns: 0 on success, -1 on failure with @c errno == * problem. */ virtual int renew (int requeue_position = 0, ACE_Synch_Options &options = ACE_Synch_Options::defaults); /// Renew the token corresponding to @a token_name. The other /// parameters are passed to ::renew. virtual int renew (const ACE_TCHAR *token_name, int requeue_position = 0, ACE_Synch_Options &options = ACE_Synch_Options::defaults); /** * Releases "atomically" all resources in the collection. This is * only successfull if all tokens in the collection could be * released. options contains the blocking semantics, timeout * value, etc. Returns: 0 on success, -1 on failure with @c errno == * problem. */ virtual int release (ACE_Synch_Options &options = ACE_Synch_Options::defaults); /// Release the token corresponding to . The other /// parameters are passed to ::release. virtual int release (const ACE_TCHAR *token_name, ACE_Synch_Options &options = ACE_Synch_Options::defaults); ~ACE_Token_Collection (); /// Dump the state of the class. void dump () const; /// Return the name of the collection. Not very functionally /// important, but sometimes a useful debugging tool. virtual const ACE_TCHAR *name () const; protected: typedef ACE_Token_Name TOKEN_NAME; /// COLLECTION maintains a mapping from token names to ACE_Tokens* typedef ACE_Map_Manager COLLECTION; /// COLLECTION maintains a mapping from token names to ACE_Tokens*. COLLECTION collection_; /// Whether to print out debug messages or not. bool debug_; /// Name of the collection. ACE_TCHAR name_[ACE_MAXTOKENNAMELEN]; // = I'm not sure what these mean, but they have to be defined since they're // pure virtual in ACE_Token_Proxy. virtual ACE_Token_Proxy *clone () const; virtual ACE_Tokens *create_token (const ACE_TCHAR *name); }; ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Token_Collection.inl" #endif /* __ACE_INLINE__ */ #endif /* ACE_HAS_TOKENS_LIBRARY */ #include /**/ "ace/post.h" #endif /* ACE_TOKEN_COLLECTION_H */ ace-8.0.4+dfsg.orig/ace/XTI_ATM_Mcast.inl0000644000175000017500000000431115027201773016716 0ustar sudipsudip// -*- C++ -*- ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_XTI_ATM_Mcast::ACE_XTI_ATM_Mcast (ACE_TLI_Stream &new_stream, const ACE_Addr &remote_sap, ACE_Time_Value *timeout, const ACE_Addr &local_sap, int reuse_addr, int flags, int perms, const char device[], struct t_info *info, int rw_flag, struct netbuf *udata, struct netbuf *opt) { ACE_TRACE ("ACE_XTI_ATM_Mcast::ACE_XTI_ATM_Mcast"); if (this->connect (new_stream, remote_sap, timeout, local_sap, reuse_addr, flags, perms, device, info, rw_flag, udata, opt) == ACE_INVALID_HANDLE && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) ACELIB_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_TLI_Stream::ACE_TLI_Stream"))); } // Connect the to the , waiting up to // amount of time if necessary. This is simple a pass- // through function to ACE_TLI_Connector::connect(). It is over- // ridden to change the default device from TCP to XTI/ATM. ACE_INLINE int ACE_XTI_ATM_Mcast::connect (ACE_TLI_Stream &new_stream, const ACE_Addr &remote_sap, ACE_Time_Value *timeout, const ACE_Addr &local_sap, int reuse_addr, int flags, int perms, const char device[], struct t_info *info, int rw_flag, struct netbuf *udata, struct netbuf *opt) { ACE_TRACE ("ACE_XTI_ATM_Mcast::connect"); return ACE_TLI_Connector::connect(new_stream, remote_sap, timeout, local_sap, reuse_addr, flags, perms, device, info, rw_flag, udata, opt); } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Time_Value.inl0000644000175000017500000003331715027201773016464 0ustar sudipsudip// -*- C++ -*- #include "ace/Truncate.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL /// Returns the value of the object as a timeval. ACE_INLINE ACE_Time_Value::operator timeval () const { // ACE_OS_TRACE ("ACE_Time_Value::operator timeval"); #if defined (ACE_HAS_TIME_T_LONG_MISMATCH) // Recall that on some Windows we substitute another type for timeval in tv_ ACE_Time_Value *me = const_cast (this); me->ext_tv_.tv_sec = ACE_Utils::truncate_cast (this->tv_.tv_sec); me->ext_tv_.tv_usec = ACE_Utils::truncate_cast (this->tv_.tv_usec); return this->ext_tv_; #else return this->tv_; #endif /* ACE_HAS_TIME_T_LONG_MISMATCH */ } ACE_INLINE void ACE_Time_Value::set (const timeval &tv) { // ACE_OS_TRACE ("ACE_Time_Value::set"); this->tv_.tv_sec = tv.tv_sec; this->tv_.tv_usec = tv.tv_usec; this->normalize (); } ACE_INLINE ACE_Time_Value::ACE_Time_Value (const struct timeval &tv) { // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); this->set (tv); } ACE_INLINE ACE_Time_Value::operator const timeval * () const { // ACE_OS_TRACE ("ACE_Time_Value::operator const timeval *"); #if defined (ACE_HAS_TIME_T_LONG_MISMATCH) // Recall that on some Windows we substitute another type for timeval in tv_ ACE_Time_Value *me = const_cast (this); me->ext_tv_.tv_sec = ACE_Utils::truncate_cast (this->tv_.tv_sec); me->ext_tv_.tv_usec = ACE_Utils::truncate_cast (this->tv_.tv_usec); return (const timeval *) &this->ext_tv_; #else return (const timeval *) &this->tv_; #endif /* ACE_HAS_TIME_T_LONG_MISMATCH */ } ACE_INLINE void ACE_Time_Value::set (time_t sec, suseconds_t usec) { // ACE_OS_TRACE ("ACE_Time_Value::set"); this->tv_.tv_sec = sec; this->tv_.tv_usec = usec; #ifdef __GNUC__ if ((__builtin_constant_p(sec) & __builtin_constant_p(usec)) && (sec >= 0 && usec >= 0 && usec < ACE_ONE_SECOND_IN_USECS)) return; #endif this->normalize (); } ACE_INLINE void ACE_Time_Value::set (double d) { // ACE_OS_TRACE ("ACE_Time_Value::set"); if (d < ACE_Numeric_Limits::min()) { this->tv_.tv_sec = ACE_Numeric_Limits::min(); this->tv_.tv_usec = -ACE_ONE_SECOND_IN_USECS + 1; } else if (d > ACE_Numeric_Limits::max()) { this->tv_.tv_sec = ACE_Numeric_Limits::max(); this->tv_.tv_usec = ACE_ONE_SECOND_IN_USECS - 1; } else { 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 + (d < 0 ? -0.5 : 0.5)); } } /// Initializes a timespec_t. Note that this approach loses precision /// since it converts the nano-seconds into micro-seconds. But then /// again, do any real systems have nano-second timer precision?! ACE_INLINE void ACE_Time_Value::set (const timespec_t &tv) { // ACE_OS_TRACE ("ACE_Time_Value::set"); this->set (tv.tv_sec, tv.tv_nsec / 1000); // Convert nanoseconds into microseconds. } ACE_INLINE ACE_Time_Value::ACE_Time_Value () // : tv_ () { // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); this->set (0, 0); } ACE_INLINE ACE_Time_Value::ACE_Time_Value (time_t sec, suseconds_t usec) { // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); this->set (sec, usec); } /// Returns number of seconds. ACE_INLINE time_t ACE_Time_Value::sec () const { // ACE_OS_TRACE ("ACE_Time_Value::sec"); return this->tv_.tv_sec; } /// Sets the number of seconds. ACE_INLINE void ACE_Time_Value::sec (time_t sec) { // ACE_OS_TRACE ("ACE_Time_Value::sec"); this->tv_.tv_sec = sec; } /// Converts from Time_Value format into milli-seconds format. ACE_INLINE unsigned long ACE_Time_Value::msec () const { // ACE_OS_TRACE ("ACE_Time_Value::msec"); // Note - we're truncating a value here, which can lose data. This is // called out in the user documentation for this with a recommendation to // use msec(ACE_UINT64&) instead, so just go ahead and truncate. time_t secs = this->tv_.tv_sec * 1000 + this->tv_.tv_usec / 1000; return ACE_Utils::truncate_cast (secs); } ACE_INLINE ACE_UINT64 ACE_Time_Value::get_msec () const { // ACE_OS_TRACE ("ACE_Time_Value::get_msec"); ACE_UINT64 ms = ACE_Utils::truncate_cast (this->tv_.tv_sec); ms *= 1000; ms += static_cast (this->tv_.tv_usec / 1000); return ms; } ACE_INLINE void ACE_Time_Value::msec (ACE_UINT64 &ms) const { // ACE_OS_TRACE ("ACE_Time_Value::msec"); ms = this->get_msec (); } ACE_INLINE void ACE_Time_Value::msec (ACE_UINT64 &ms) /*const*/ { // ACE_OS_TRACE ("ACE_Time_Value::msec"); const ACE_Time_Value *tv = this; tv->msec (ms); } ACE_INLINE void ACE_Time_Value::set_msec (const ACE_UINT64 &ms) { // ACE_OS_TRACE ("ACE_Time_Value::set_msec"); // Convert millisecond units to seconds; ACE_UINT64 secs = ms / 1000; this->tv_.tv_sec = static_cast (secs); // Convert remainder to microseconds; this->tv_.tv_usec = static_cast((ms - (secs * 1000)) * 1000); } /// Converts from milli-seconds format into Time_Value format. ACE_INLINE void ACE_Time_Value::msec (long milliseconds) { // ACE_OS_TRACE ("ACE_Time_Value::msec"); // Convert millisecond units to seconds; long secs = milliseconds / 1000; this->tv_.tv_sec = secs; // Convert remainder to microseconds; this->tv_.tv_usec = (milliseconds - (secs * 1000)) * 1000; } /// Converts from milli-seconds format into Time_Value format. ACE_INLINE void ACE_Time_Value::msec (int milliseconds) { ACE_Time_Value::msec (static_cast (milliseconds)); } /// Returns number of micro-seconds. ACE_INLINE suseconds_t ACE_Time_Value::usec () const { // ACE_OS_TRACE ("ACE_Time_Value::usec"); return this->tv_.tv_usec; } /// Sets the number of micro-seconds. ACE_INLINE void ACE_Time_Value::usec (suseconds_t usec) { // ACE_OS_TRACE ("ACE_Time_Value::usec"); this->tv_.tv_usec = usec; } ACE_INLINE void ACE_Time_Value::to_usec (ACE_UINT64 &usec) const { // ACE_OS_TRACE ("ACE_Time_Value::to_usec"); usec = static_cast (this->tv_.tv_sec); usec *= 1000000; usec += static_cast (this->tv_.tv_usec); } ACE_INLINE ACE_Time_Value operator * (double d, const ACE_Time_Value &tv) { return ACE_Time_Value (tv) *= d; } ACE_INLINE ACE_Time_Value operator * (const ACE_Time_Value &tv, double d) { return ACE_Time_Value (tv) *= d; } /// True if tv1 > tv2. ACE_INLINE bool operator > (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2) { // ACE_OS_TRACE ("operator >"); if (tv1.sec () > tv2.sec ()) return 1; else if (tv1.sec () == tv2.sec () && tv1.usec () > tv2.usec ()) return 1; else return 0; } /// True if tv1 >= tv2. ACE_INLINE bool operator >= (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2) { // ACE_OS_TRACE ("operator >="); if (tv1.sec () > tv2.sec ()) return 1; else if (tv1.sec () == tv2.sec () && tv1.usec () >= tv2.usec ()) return 1; else return 0; } /// Returns the value of the object as a timespec_t. ACE_INLINE ACE_Time_Value::operator timespec_t () const { // ACE_OS_TRACE ("ACE_Time_Value::operator timespec_t"); timespec_t tv; tv.tv_sec = this->sec (); // Convert microseconds into nanoseconds. tv.tv_nsec = this->tv_.tv_usec * 1000; return tv; } /// Initializes the ACE_Time_Value object from a timespec_t. ACE_INLINE ACE_Time_Value::ACE_Time_Value (const timespec_t &tv) // : tv_ () { // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); this->set (tv); } /// True if tv1 < tv2. ACE_INLINE bool operator < (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2) { // ACE_OS_TRACE ("operator <"); return tv2 > tv1; } /// True if tv1 >= tv2. ACE_INLINE bool operator <= (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2) { // ACE_OS_TRACE ("operator <="); return tv2 >= tv1; } /// True if tv1 == tv2. ACE_INLINE bool operator == (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2) { // ACE_OS_TRACE ("operator =="); return tv1.sec () == tv2.sec () && tv1.usec () == tv2.usec (); } /// True if tv1 != tv2. ACE_INLINE bool operator != (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2) { // ACE_OS_TRACE ("operator !="); return !(tv1 == tv2); } /// Add TV to this. ACE_INLINE ACE_Time_Value & ACE_Time_Value::operator+= (const ACE_Time_Value &tv) { // ACE_OS_TRACE ("ACE_Time_Value::operator+="); this->sec (this->sec () + tv.sec ()); this->usec (this->usec () + tv.usec ()); this->normalize (); return *this; } ACE_INLINE ACE_Time_Value & ACE_Time_Value::operator+= (time_t tv) { // ACE_OS_TRACE ("ACE_Time_Value::operator+="); this->sec (this->sec () + tv); return *this; } ACE_INLINE ACE_Time_Value & ACE_Time_Value::operator= (time_t tv) { // ACE_OS_TRACE ("ACE_Time_Value::operator="); this->sec (tv); this->usec (0); return *this; } /// Subtract TV to this. ACE_INLINE ACE_Time_Value & ACE_Time_Value::operator-= (const ACE_Time_Value &tv) { // ACE_OS_TRACE ("ACE_Time_Value::operator-="); this->sec (this->sec () - tv.sec ()); this->usec (this->usec () - tv.usec ()); this->normalize (); return *this; } ACE_INLINE ACE_Time_Value & ACE_Time_Value::operator-= (time_t tv) { // ACE_OS_TRACE ("ACE_Time_Value::operator-="); this->sec (this->sec () - tv); return *this; } /// Adds two ACE_Time_Value objects together, returns the sum. ACE_INLINE ACE_Time_Value operator + (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2) { // ACE_OS_TRACE ("operator +"); ACE_Time_Value sum (tv1); sum += tv2; return sum; } /// Subtracts two ACE_Time_Value objects, returns the difference. ACE_INLINE ACE_Time_Value operator - (const ACE_Time_Value &tv1, const ACE_Time_Value &tv2) { // ACE_OS_TRACE ("operator -"); ACE_Time_Value delta (tv1); delta -= tv2; return delta; } ACE_END_VERSIONED_NAMESPACE_DECL // Additional chrono streaming operators. namespace std { namespace chrono { ACE_INLINE nanoseconds& operator <<(nanoseconds &ns, ACE_Time_Value const &tv) { ns = duration_cast(seconds{tv.sec ()}) + duration_cast(microseconds{tv.usec()}); return ns; } ACE_INLINE microseconds& operator <<(microseconds &us, ACE_Time_Value const &tv) { us= duration_cast(seconds{tv.sec ()}) + microseconds{tv.usec()}; return us; } ACE_INLINE milliseconds& operator <<(milliseconds &ms, ACE_Time_Value const &tv) { ms = duration_cast(seconds{tv.sec ()}) + duration_cast(microseconds{tv.usec()}); return ms; } ACE_INLINE seconds& operator <<(seconds &s, ACE_Time_Value const &tv) { s = seconds{tv.sec ()} + duration_cast(microseconds{tv.usec()}); return s; } ACE_INLINE minutes& operator <<(minutes &m, ACE_Time_Value const &tv) { m = duration_cast(seconds{tv.sec ()}) + duration_cast(microseconds{tv.usec()}); return m; } ACE_INLINE hours& operator <<(hours &h, ACE_Time_Value const &tv) { h = duration_cast(seconds{tv.sec ()}) + duration_cast(microseconds{tv.usec()}); return h; } ACE_INLINE nanoseconds& operator +=(nanoseconds &ns, ACE_Time_Value const &tv) { ns += duration_cast(seconds{tv.sec ()}) + duration_cast(microseconds{tv.usec()}); return ns; } ACE_INLINE microseconds& operator +=(microseconds &us, ACE_Time_Value const &tv) { us += duration_cast(seconds{tv.sec ()}) + microseconds{tv.usec()}; return us; } ACE_INLINE milliseconds& operator +=(milliseconds &ms, ACE_Time_Value const &tv) { ms += duration_cast(seconds{tv.sec ()}) + duration_cast(microseconds{tv.usec()}); return ms; } ACE_INLINE seconds& operator +=(seconds &s, ACE_Time_Value const &tv) { s += seconds{tv.sec ()} + duration_cast(microseconds{tv.usec()}); return s; } ACE_INLINE minutes& operator +=(minutes &m, ACE_Time_Value const &tv) { m += duration_cast(seconds{tv.sec ()}) + duration_cast(microseconds{tv.usec()}); return m; } ACE_INLINE hours& operator +=(hours &h, ACE_Time_Value const &tv) { h += duration_cast(seconds{tv.sec ()}) + duration_cast(microseconds{tv.usec()}); return h; } ACE_INLINE nanoseconds& operator -=(nanoseconds &ns, ACE_Time_Value const &tv) { ns -= duration_cast(seconds{tv.sec ()}) + duration_cast(microseconds{tv.usec()}); return ns; } ACE_INLINE microseconds& operator -=(microseconds &us, ACE_Time_Value const &tv) { us -= duration_cast(seconds{tv.sec ()}) + microseconds{tv.usec()}; return us; } ACE_INLINE milliseconds& operator -=(milliseconds &ms, ACE_Time_Value const &tv) { ms -= duration_cast(seconds{tv.sec ()}) + duration_cast(microseconds{tv.usec()}); return ms; } ACE_INLINE seconds& operator -=(seconds &s, ACE_Time_Value const &tv) { s -= seconds{tv.sec ()} + duration_cast(microseconds{tv.usec()}); return s; } ACE_INLINE minutes& operator -=(minutes &m, ACE_Time_Value const &tv) { m -= duration_cast(seconds{tv.sec ()}) + duration_cast(microseconds{tv.usec()}); return m; } ACE_INLINE hours& operator -=(hours &h, ACE_Time_Value const &tv) { h -= duration_cast(seconds{tv.sec ()}) + duration_cast(microseconds{tv.usec()}); return h; } } } ace-8.0.4+dfsg.orig/ace/Process_Semaphore.cpp0000644000175000017500000000607215027201773020051 0ustar sudipsudip#include "ace/Process_Semaphore.h" #include "ace/Log_Category.h" #include "ace/OS_Memory.h" #if defined (ACE_HAS_ALLOC_HOOKS) # include "ace/Malloc_Base.h" #endif /* ACE_HAS_ALLOC_HOOKS */ #if !defined (__ACE_INLINE__) #include "ace/Process_Semaphore.inl" #endif /* __ACE_INLINE__ */ #include "ace/ACE.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Process_Semaphore) void ACE_Process_Semaphore::dump () const { #if defined (ACE_HAS_DUMP) // ACE_TRACE ("ACE_Process_Semaphore::dump"); ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); this->lock_.dump (); ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } ACE_Process_Semaphore::ACE_Process_Semaphore (u_int count, const ACE_TCHAR *name, void *arg, int max) #if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) : lock_ (count, USYNC_PROCESS, name, arg, max) #else : lock_ (ACE_TEXT_ALWAYS_CHAR (name), ACE_SV_Semaphore_Complex::ACE_CREATE, count) #endif /* ACE_WIN32 || ACE_HAS_POSIX_SEM */ { ACE_UNUSED_ARG (arg); ACE_UNUSED_ARG (max); // ACE_TRACE ("ACE_Process_Semaphore::ACE_Process_Semaphore"); } // Explicitly destroy the semaphore. int ACE_Process_Semaphore::remove () { // ACE_TRACE ("ACE_Process_Semaphore::remove"); return this->lock_.remove (); } // Block the thread until the semaphore count becomes // greater than 0, then decrement it. int ACE_Process_Semaphore::acquire () { // ACE_TRACE ("ACE_Process_Semaphore::acquire"); #if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) return this->lock_.acquire (); #else return this->lock_.acquire (0, SEM_UNDO); #endif /* defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) */ } // Conditionally decrement the semaphore if count is greater // than 0 (i.e., won't block). int ACE_Process_Semaphore::tryacquire () { // ACE_TRACE ("ACE_Process_Semaphore::tryacquire"); #if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) return this->lock_.tryacquire (); #else return this->lock_.tryacquire (0, SEM_UNDO); #endif /* defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) */ } // Increment the semaphore, potentially unblocking // a waiting thread. int ACE_Process_Semaphore::release () { // ACE_TRACE ("ACE_Process_Semaphore::release"); #if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) return this->lock_.release (); #else return this->lock_.release (0, SEM_UNDO); #endif /* defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) */ } /*****************************************************************************/ ACE_Process_Semaphore * ACE_Malloc_Lock_Adapter_T::operator () (const ACE_TCHAR *name) { ACE_Process_Semaphore *p = 0; if (name == 0) ACE_NEW_RETURN (p, ACE_Process_Semaphore (1, name), 0); else ACE_NEW_RETURN (p, ACE_Process_Semaphore (1, ACE::basename (name, ACE_DIRECTORY_SEPARATOR_CHAR)), 0); return p; } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/LSOCK_Dgram.cpp0000644000175000017500000000331715027201773016414 0ustar sudipsudip#include "ace/LSOCK_Dgram.h" #if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) #include "ace/Log_Category.h" #if defined (ACE_HAS_ALLOC_HOOKS) # include "ace/Malloc_Base.h" #endif /* ACE_HAS_ALLOC_HOOKS */ #if !defined (__ACE_INLINE__) #include "ace/LSOCK_Dgram.inl" #endif /* __ACE_INLINE__ */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_LSOCK_Dgram) void ACE_LSOCK_Dgram::dump () const { #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_LSOCK_Dgram::dump"); ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_SOCK_Dgram::dump (); ACE_LSOCK::dump (); ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } // The "do nothing" constructor. ACE_LSOCK_Dgram::ACE_LSOCK_Dgram () { ACE_TRACE ("ACE_LSOCK_Dgram::ACE_LSOCK_Dgram"); } // Here's the general-purpose open routine. int ACE_LSOCK_Dgram::open (const ACE_Addr &local, int protocol_family, int protocol) { ACE_TRACE ("ACE_LSOCK_Dgram::open"); if (ACE_SOCK_Dgram::open (local, protocol_family, protocol) == -1) return -1; ACE_LSOCK::set_handle (this->ACE_SOCK_Dgram::get_handle ()); return 0; } // Create a local ACE_SOCK datagram. ACE_LSOCK_Dgram::ACE_LSOCK_Dgram (const ACE_Addr &local, int protocol_family, int protocol) { ACE_TRACE ("ACE_LSOCK_Dgram::ACE_LSOCK_Dgram"); if (this->open (local, protocol_family, protocol) == -1) ACELIB_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("ACE_LSOCK_Dgram"))); } ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ ace-8.0.4+dfsg.orig/ace/Get_Opt.h0000644000175000017500000004522315027201773015437 0ustar sudipsudip// -*- C++ -*- //========================================================================== /** * @file Get_Opt.h * * @author Douglas C. Schmidt * @author Don Hinton (added long option support) */ //========================================================================== #ifndef ACE_GET_OPT_H #define ACE_GET_OPT_H #include /**/ "ace/pre.h" #include "ace/SStringfwd.h" #include "ace/Containers.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #undef optind #undef optarg #undef opterr ACE_BEGIN_VERSIONED_NAMESPACE_DECL /* * These definitions are for backward compatibility with previous versions. * of ACE_Get_Opt. */ /** * @class ACE_Get_Opt * * @brief Iterator for parsing command-line arguments. * * This is a C++ wrapper for getopt(3c) and getopt_long(3c). */ class ACE_Export ACE_Get_Opt { public: /// Mutually exclusive ordering values. enum { /** * REQUIRE_ORDER means that processing stops and @c EOF is * returned as soon as a non-option argument is found. @c opt_ind() * will return the index of the next @a argv element so the program * can continue processing the rest of the @a argv elements. */ REQUIRE_ORDER = 1, /** * PERMUTE_ARGS means the @a argv elements are reordered dynamically * (permuted) so that all options appear first. When the elements are * permuted, the order of the options and the following arguments are * maintained. When the last option has been processed, @c EOF is * returned and @c opt_ind() returns the index into the next non-option * element. */ PERMUTE_ARGS = 2, /** * RETURN_IN_ORDER means each @a argv element is processed in the * order is it seen. If the element is not recognized as an option, '1' * is returned and @c opt_arg() refers to the @a argv element found. */ RETURN_IN_ORDER = 3 }; /// Mutually exclusive option argument mode used by long options. enum OPTION_ARG_MODE { /// Doesn't take an argument. NO_ARG = 0, /// Requires an argument, same as passing ":" after a short option /// character in @a optstring. ARG_REQUIRED = 1, /// Argument is optional, same as passing "::" after a short /// option character in @a optstring. ARG_OPTIONAL = 2 }; /** * Constructor initializes the command line to be parsed. All information * for parsing must be supplied to this constructor. * * @param argc The number of @a argv elements to parse. * @param argv Command line tokens, such as would be passed * to @c main(). * @param optstring Nul-terminated string containing the legitimate * short option characters. A single colon ":" * following an option character means the option * requires an argument. A double colon "::" following * an option character means the argument is optional. * The argument is taken from the rest of the current * @a argv element, or from the following @a argv * element (only valid for required arguments; * optional arguments must always reside in the same * @a argv element). The argument value, if any is * returned by the @c opt_arg() method. * @a optstring can be extended by adding long options * with corresponding short options via the * @c long_option() method. If the short option * already appears in @a optstring, the argument * characteristics must match, otherwise it is added. * See @c long_option() for more information. * If 'W', followed by a semi-colon ';' appears in * @a optstring, then any time a 'W' appears on the * command line, the following argument is treated as * a long option. For example, if the command line * contains "program -W foo", "foo" is treated as a * long option, that is, as if "program --foo" had * been passed. * The following characters can appear in @a optstring * before any option characters, with the described * effect: * - '+' changes the @a ordering to @a REQUIRE_ORDER. * - '-' changes the @a ordering to @a RETURN_IN_ORDER. * - ':' changes the return value from @c operator() * and get_opt() from '?' to ':' when an option * requires an argument but none is specified. * * @param skip_args Optional (default 1). The specified number of * initial elements in @a argv are skipped before * parsing begins. Thus, the default prevents * @a argv[0] (usually the command name) from being * parsed. @a argc includes all @a argv elements, * including any skipped elements. * @param report_errors Optional, if non-zero then parsing errors cause * an error message to be displayed from the * @c operator() method before it returns. The * error message is suppressed if this argument is 0. * This setting also controls whether or not an error * message is displayed in @c long_option() encounters * an error. * @param ordering Optional (default is @c PERMUTE_ARGS); determines * how the @a argv elements are processed. This argument * is overridden by two factors: * -# The @c POSIXLY_CORRECT environment variable. If * this environment variable is set, the ordering * is changed to @c REQUIRE_ORDER. * -# Leading characters in @a optstring (see above). * Any leading ordering characters override both * the @a ordering argument and any effect of the * @c POSIXLY_CORRECT environment variable. * @param long_only Optional. If non-zero, then long options can be * specified using a single '-' on the command line. * If the token is not a long option, it is processed * as usual, that is, as a short option or set of * short options. * * Multiple short options can be combined as long as only the last * one can takes an argument. For example, if @a optstring is defined as * @c "abc:" or @c "abc::" then the command line @e "program -abcxxx" short * options @e a, @e b, and @e c are found with @e "xxx" as the argument for * @e c. * However, if the command line is specified as @e "program -acb" only * options @e a and @e c are found with @e "b" as the argument for @e c. * Also, for options with optional arguments, that is, those followed by * "::", the argument must be in the same @a argv element, so "program -abc * xxx" will only find "xxx" as the argument for @e c if @a optstring is * specified as @c "abc:" not @c "abc::". */ #ifndef ACE_USES_WCHAR ACE_Get_Opt (int argc, ACE_TCHAR **argv, const ACE_TCHAR *optstring = ACE_TEXT (""), int skip_args = 1, int report_errors = 0, int ordering = PERMUTE_ARGS, int long_only = 0); #else private: void ACE_Get_Opt_Init (const ACE_TCHAR *optstring); public: ACE_Get_Opt (int argc, ACE_TCHAR **argv, const ACE_TCHAR *optstring = ACE_TEXT (""), int skip_args = 1, int report_errors = 0, int ordering = PERMUTE_ARGS, int long_only = 0); ACE_Get_Opt (int argc, ACE_TCHAR **argv, const char *optstring, int skip_args = 1, int report_errors = 0, int ordering = PERMUTE_ARGS, int long_only = 0); #endif /// Default dtor. ~ACE_Get_Opt (); /** * Scan elements of @a argv (whose length is @a argc) for short option * characters given in @a optstring or long options (with no short * option equivalents). * * If an element of @a argv starts with '-', and is not exactly "-" * or "--", then it is a short option element. The characters of this * element (aside from the initial '-') are option characters. If * it starts with "--" followed by other characters it is treated as * a long option. If @c operator() is called repeatedly, it returns * each of the option characters from each of the option elements. * * @return The parsed option character. The following characters have * special significance. * @retval 0 A long option was found * @retval '\?' Either an unknown option character was found, or the * option is known but requires an argument, none was * specified, and @a optstring did not contain a leading * colon. * @retval ':' A known option character was found but it requires an * argument and none was supplied, and the first character * of @a optstring was a colon. @c opt_opt() indicates * which option was specified. * @retval '1' @c RETURN_IN_ORDER was specified and a non-option argument * was found. * @retval EOF No more option characters were found. @c opt_ind() will * return the index in @a argv of the first @a argv element * that is not an option. If @c PERMUTE_ARGS was * specified, the @a argv elements have been permuted so that * those that are not options now come last. * * @note The standards are unclear with respect to the conditions under * which '?' and ':' are returned, so we scan the initial characters of * @a optstring up unto the first short option character for '+', '-', * and ':' in order to determine ordering and missing argument behavior. */ int operator () (); /** * For communication from @c operator() to the caller. When * @c operator() finds an option that takes an argument, the argument * value is returned from this method, otherwise it returns 0. */ ACE_TCHAR *opt_arg () const; /** * Returns the most recently matched option character. Especially * useful when operator() returns ':' for an unspecified argument * that's required, since this allows the caller to learn what option * was specified without its required argument. */ int opt_opt (); /** * Index in @a argv of the next element to be scanned. This is used * for communication to and from the caller and for communication * between successive calls to @c operator(). On entry to * @c operator(), zero means this is the first call; initialize. * * When @c operator() returns @c EOF, this is the index of the first of * the non-option elements that the caller should itself scan. * * Otherwise, @c opt_ind() communicates from one call to the next how * much of @a argv has been scanned so far. */ int &opt_ind (); /// Adds a long option with no corresponding short option. /** * If the @a name option is seen, @c operator() returns 0. * * @param name The long option to add. * @param has_arg Defines the argument requirements for * the new option. * * @retval 0 Success * @retval -1 The long option can not be added. */ int long_option (const ACE_TCHAR *name, OPTION_ARG_MODE has_arg = NO_ARG); /// Adds a long option with a corresponding short option. /** * @param name The long option to add. * @param short_option A character, the short option that corresponds * to @a name. * @param has_arg Defines the argument requirements for * the new option. If the short option has already * been supplied in the @a optstring, @a has_arg * must match or an error is returned; otherwise, the * new short option is added to the @a optstring. * * @retval 0 Success * @retval -1 The long option can not be added. */ int long_option (const ACE_TCHAR *name, int short_option, OPTION_ARG_MODE has_arg = NO_ARG); /// Returns the name of the long option found on the last call to /// @c operator() or 0 if none was found. const ACE_TCHAR *long_option () const; /// The number of arguments in the internal @c argv_. int argc () const; /// Accessor for the internal @c argv_ pointer. ACE_TCHAR **argv () const; /// Accessor for the @c last_option that was processed. This allows /// applications to know if the found option was a short or long /// option, and is especially useful in cases where it was invalid /// and the caller wants to print out the invalid value. const ACE_TCHAR *last_option () const; /// Dump the state of an object. void dump () const; /// Return the @a optstring. This is handy to verify that calls to /// long_option added short options as expected. const ACE_TCHAR *optstring () const; public: /* * The following five data members should be private, but that * would break backwards compatibility. However, we recommend not * writing code that uses these fields directly. */ /// Holds the @a argc count. /** * @deprecated This is public for backwards compatibility only. * It will be made private in a release of ACE past 5.3. Do not * write code that relies on this member being public; use the * @c argc() accessor method instead. */ int argc_; /// Holds the @a argv pointer. /** * @deprecated This is public for backwards compatibility only. * It will be made private in a release of ACE past 5.3. Do not * write code that relies on this member being public; use the * @c argv() accessor method instead. */ ACE_TCHAR **argv_; /// Index in @c argv_ of the next element to be scanned. /** * @deprecated This is public for backwards compatibility only. * It will be made private in a release of ACE past 5.3. Do not * write code that relies on this member being public; use the * @c opt_ind() accessor method instead. */ int optind; /// Callers store zero here to inhibit the error message for /// unrecognized options. /** * @deprecated This is public for backwards compatibility only. * It will be made private in a release of ACE past 5.3. Do not * write code that relies on this member being public; use the * @a report_errors argument to this class's constructor instead. */ int opterr; /// Points to the option argument when one is found on last call to /// @c operator(). /** * @deprecated This is public for backwards compatibility only. * It will be made private in a release of ACE past 5.3. Do not * write code that relies on this member being public; use the * @c opt_arg() accessor method instead. */ ACE_TCHAR *optarg; private: /** * @class ACE_Get_Opt_Long_Option This class is for internal use * in the ACE_Get_Opt class, and is inaccessible to users. */ class ACE_Get_Opt_Long_Option { public: /// ctor ACE_Get_Opt_Long_Option (const ACE_TCHAR *name, int has_arg, int val = 0); /// Dtor. ~ACE_Get_Opt_Long_Option (); bool operator < (const ACE_Get_Opt_Long_Option &rhs); /// Long option name. const ACE_TCHAR *name_; /// Contains value for . int has_arg_; /// Contains a valid short option character or zero if it doesn't /// have a corresponding short option. It can also contain a /// non-printable value that cannot be passed to but /// will be returned by . This is handy for /// simplifying long option handling, see tests/Get_Opt_Test.cpp /// for an example of this technique. int val_; ACE_ALLOC_HOOK_DECLARE; }; /// Updates nextchar_. int nextchar_i (); /// Handles long options. int long_option_i (); /// Handles short options. int short_option_i (); /// If permuting args, this functions manages the nonopt_start_ and /// nonopt_end_ indexes and makes calls to permute to actually /// reorder the -elements. void permute_args (); /// Handles reordering -elements. int permute (); /// Set last_option. void last_option (const ACE_TString &s); ACE_Get_Opt (const ACE_Get_Opt &) = delete; ACE_Get_Opt &operator= (const ACE_Get_Opt &) = delete; ACE_Get_Opt (ACE_Get_Opt &&) = delete; ACE_Get_Opt &operator= (ACE_Get_Opt &&) = delete; private: /// Holds the option string. ACE_TString *optstring_; /// Treat all options as long options. int long_only_; /// Keeps track of whether or not a colon was passed in . /// This is used to determine the return value when required /// arguments are missing. int has_colon_; /// This is the last option, short or long, that was processed. This /// is handy to have in cases where the option passed was invalid. ACE_TString *last_option_; /** * The next char to be scanned in the option-element in which the * last option character we returned was found. This allows us to * pick up the scan where we left off * * If this is zero, or a null string, it means resume the scan * by advancing to the next -element. */ ACE_TCHAR *nextchar_; /// Most recently matched short option character. int optopt_; /// Keeps track of ordering mode (default ). int ordering_; /// Index of the first non-option -element found (only valid /// when permuting). int nonopt_start_; /// Index of the -element following the last non-option element /// (only valid when permuting). int nonopt_end_; /// Points to the long_option found on last call to . ACE_Get_Opt_Long_Option *long_option_; /// Array of long options. ACE_Array long_opts_; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; }; ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Get_Opt.inl" #endif /* __ACE_INLINE__ */ #include /**/ "ace/post.h" #endif /* ACE_GET_OPT_H */ ace-8.0.4+dfsg.orig/ace/OS_NS_regex.h0000644000175000017500000000256215027201773016210 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file OS_NS_regex.h * * @author Douglas C. Schmidt * @author Jesper S. M|ller * @author and a cast of thousands... */ //============================================================================= #ifndef ACE_OS_NS_REGEX_H # define ACE_OS_NS_REGEX_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/ACE_export.h" #if defined (ACE_EXPORT_MACRO) # undef ACE_EXPORT_MACRO #endif #define ACE_EXPORT_MACRO ACE_Export ACE_BEGIN_VERSIONED_NAMESPACE_DECL namespace ACE_OS { // non=standard.. //@{ @name A set of wrappers for regular expressions. ACE_NAMESPACE_INLINE_FUNCTION char *compile (const char *instring, char *expbuf, char *endbuf); ACE_NAMESPACE_INLINE_FUNCTION int step (const char *str, char *expbuf); //@} } /* namespace ACE_OS */ ACE_END_VERSIONED_NAMESPACE_DECL # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE # endif /* ACE_INLINE */ # define ACE_INLINE inline # include "ace/OS_NS_regex.inl" # endif /* ACE_HAS_INLINED_OSCALLS */ # include /**/ "ace/post.h" #endif /* ACE_OS_NS_REGEX_H */ ace-8.0.4+dfsg.orig/ace/Typed_SV_Message.inl0000644000175000017500000000437015027201773017570 0ustar sudipsudip// -*- C++ -*- #include "ace/config-all.h" #include "ace/Global_Macros.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL template ACE_INLINE ACE_Typed_SV_Message::ACE_Typed_SV_Message (long t, int l, int m) : type_ (t) { ACE_TRACE ("ACE_Typed_SV_Message::ACE_Typed_SV_Message"); this->length (l); this->max_size (m); } template ACE_INLINE ACE_Typed_SV_Message::ACE_Typed_SV_Message (const T &d, long t, int l, int m) : type_ (t), data_ (d) { ACE_TRACE ("ACE_Typed_SV_Message::ACE_Typed_SV_Message"); this->length (l); this->max_size (m); } template ACE_INLINE ACE_Typed_SV_Message::~ACE_Typed_SV_Message () { ACE_TRACE ("ACE_Typed_SV_Message::~ACE_Typed_SV_Message"); } template ACE_INLINE long ACE_Typed_SV_Message::type () const { ACE_TRACE ("ACE_Typed_SV_Message::type"); return this->type_; } template ACE_INLINE void ACE_Typed_SV_Message::type (long t) { ACE_TRACE ("ACE_Typed_SV_Message::type"); this->type_ = t; } template ACE_INLINE int ACE_Typed_SV_Message::length () const { ACE_TRACE ("ACE_Typed_SV_Message::length"); return this->length_; } template ACE_INLINE void ACE_Typed_SV_Message::length (int len) { ACE_TRACE ("ACE_Typed_SV_Message::length"); this->length_ = len + (sizeof *this - (sizeof this->type_ + sizeof this->data_)); } template ACE_INLINE int ACE_Typed_SV_Message::max_size () const { ACE_TRACE ("ACE_Typed_SV_Message::max_size"); return this->max_; } template ACE_INLINE void ACE_Typed_SV_Message::max_size (int m) { ACE_TRACE ("ACE_Typed_SV_Message::max_size"); this->max_ = m + (sizeof *this - (sizeof this->type_ + sizeof this->data_)); } template T & ACE_Typed_SV_Message::data () { ACE_TRACE ("ACE_Typed_SV_Message::data"); return this->data_; } template void ACE_Typed_SV_Message::data (const T &d) { ACE_TRACE ("ACE_Typed_SV_Message::data"); this->data_ = d; } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Mutex.h0000644000175000017500000001411315027201773015172 0ustar sudipsudip// -*- C++ -*- //========================================================================== /** * @file Mutex.h * * @author Douglas C. Schmidt */ //========================================================================== #ifndef ACE_MUTEX_H #define ACE_MUTEX_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" #include "ace/OS_NS_unistd.h" #include "ace/os_include/os_fcntl.h" #if !defined (ACE_DEFAULT_MUTEX_A) # define ACE_DEFAULT_MUTEX_A "ACE_MUTEX" #endif /* ACE_DEFAULT_MUTEX_A */ #if defined (ACE_HAS_WCHAR) # define ACE_DEFAULT_MUTEX_W ACE_TEXT_WIDE (ACE_DEFAULT_MUTEX_A) #endif /* ACE_HAS_WCHAR */ #define ACE_DEFAULT_MUTEX ACE_TEXT (ACE_DEFAULT_MUTEX_A) ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Time_Value; /** * @class ACE_Mutex * * @brief @c ACE_Mutex wrapper (valid in same process or across * processes (depending on @a TYPE flag)). In general, * however, we recommend using @a ACE_Process_Mutex or @a * ACE_Thread_Mutex rather than @a ACE_Mutex. */ class ACE_Export ACE_Mutex { public: /// Initialize the mutex. ACE_Mutex (int type = USYNC_THREAD, const ACE_TCHAR *name = 0, ACE_mutexattr_t *arg = 0, mode_t mode = ACE_DEFAULT_FILE_PERMS); /// Implicitly destroy the mutex. ~ACE_Mutex (); /// Explicitly destroy the mutex. /** * @note Only one thread should call this method since it doesn't * protect against race conditions. */ int remove (); /// Acquire lock ownership (wait on queue if necessary). int acquire (); /// Block the thread until the mutex is acquired or @a tv times out, /// in which case -1 is returned and @c errno == @c ETIME. /** * @note @a tv is assumed to be in "absolute" rather than * " relative" time. The value of @a tv is updated upon return * to show the actual(absolute) acquisition time. */ int acquire (ACE_Time_Value &tv); /// Block the thread until the mutex is acquired or @a *tv times /// out, in which case -1 is returned and @c errno == @c ETIME. /** * If @a tv == 0 then call @c acquire() directly. Otherwise, block * the thread until the mutex is acquired or @a tv times out, in * which case -1 is returned and @c errno == @c ETIME. * * @note @a *tv is assumed to be in "absolute" rather than * "relative" time. The value of @a *tv is updated upon * return to show the actual (absolute) acquisition time. */ int acquire (ACE_Time_Value *tv); /// Conditionally acquire lock (i.e., don't wait on queue). /** * @return -1 on failure. If we "failed" because someone * else already had the lock, @c errno is set to @c EBUSY. */ int tryacquire (); /// Release lock and unblock a thread at head of queue. int release (); /// Acquire mutex ownership. /** * This calls @c acquire and is only here to make the @c ACE_Mutex * interface consistent with the other synchronization APIs. */ int acquire_read (); /// Acquire mutex ownership. /** * This calls @c acquire and is only here to make the @c ACE_Mutex * interface consistent with the other synchronization APIs. */ int acquire_write (); /// Conditionally acquire mutex (i.e., won't block). /** * This calls @c tryacquire and is only here to make the @c ACE_Mutex * interface consistent with the other synchronization APIs. * * @return -1 on failure. If we "failed" because someone else * already had the lock, @c errno is set to @c EBUSY. */ int tryacquire_read (); /// Conditionally acquire mutex (i.e., won't block). /** * This calls @c tryacquire and is only here to make the @c ACE_Mutex * interface consistent with the other synchronization APIs. * * @return -1 on failure. If we "failed" because someone else * already had the lock, @c errno is set to @c EBUSY. */ int tryacquire_write (); /** * This is only here for consistency with the other synchronization * APIs and usability with Lock adapters. Assumes the caller already has * acquired the mutex and returns 0 in all cases. */ int tryacquire_write_upgrade (); /// Return the underlying mutex. const ACE_mutex_t &lock () const; ACE_mutex_t &lock (); /// If a file was created as the underlying storage for the mutex, /// remove it from the filesystem (for process-shared mutexes). static int unlink (const ACE_TCHAR *name); /// Dump the state of an object. void dump () const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; // = This should be protected but some C++ compilers complain... public: #if defined ACE_HAS_PTHREADS && defined ACE_LACKS_MUTEXATTR_PSHARED # define ACE_MUTEX_USE_PROCESS_LOCK # define ACE_MUTEX_PROCESS_LOCK_IS_SEMA ACE_sema_t process_sema_; typedef ACE_sema_t Process_Lock; #elif defined ACE_HAS_PTHREADS # define ACE_MUTEX_USE_PROCESS_LOCK # define ACE_MUTEX_PROCESS_LOCK_IS_MUTEX typedef ACE_mutex_t Process_Lock; #endif #ifdef ACE_MUTEX_USE_PROCESS_LOCK /// This lock resides in shared memory. Process_Lock *process_lock_; /** * Remember the name of the mutex if we created it so we can unlink * it when we go away (only the actor that initialized the memory * can destroy it). */ const ACE_TCHAR *lockname_; #endif /* ACE_MUTEX_USE_PROCESS_LOCK */ /// Mutex type supported by the OS. ACE_mutex_t lock_; /// Keeps track of whether @c remove has been called yet to avoid /// multiple @c 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 /// @c remove on the same object, which is a bad idea anyway. bool removed_; private: ACE_Mutex &operator= (const ACE_Mutex &) = delete; ACE_Mutex (const ACE_Mutex &) = delete; }; ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Mutex.inl" #endif /* __ACE_INLINE__ */ #include /**/ "ace/post.h" #endif /* ACE_MUTEX_H */ ace-8.0.4+dfsg.orig/ace/OS_NS_sys_shm.h0000644000175000017500000000312715027201773016561 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file OS_NS_sys_shm.h * * @author Douglas C. Schmidt * @author Jesper S. M|ller * @author and a cast of thousands... */ //============================================================================= #ifndef ACE_OS_NS_SYS_SHM_H # define ACE_OS_NS_SYS_SHM_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/os_include/sys/os_shm.h" #include /**/ "ace/ACE_export.h" #if defined (ACE_EXPORT_MACRO) # undef ACE_EXPORT_MACRO #endif #define ACE_EXPORT_MACRO ACE_Export 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, const void *shmaddr, int shmflg); ACE_NAMESPACE_INLINE_FUNCTION int shmctl (int int_id, int cmd, struct shmid_ds *buf); ACE_NAMESPACE_INLINE_FUNCTION int shmdt (const void *shmaddr); ACE_NAMESPACE_INLINE_FUNCTION int shmget (key_t key, size_t size, int flags); //@} } /* namespace ACE_OS */ ACE_END_VERSIONED_NAMESPACE_DECL # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE # endif /* ACE_INLINE */ # define ACE_INLINE inline # include "ace/OS_NS_sys_shm.inl" # endif /* ACE_HAS_INLINED_OSCALLS */ # include /**/ "ace/post.h" #endif /* ACE_OS_NS_SYS_SHM_H */ ace-8.0.4+dfsg.orig/ace/OS_NS_dlfcn.cpp0000644000175000017500000000021315027201773016506 0ustar sudipsudip#include "ace/OS_NS_dlfcn.h" #if !defined (ACE_HAS_INLINED_OSCALLS) # include "ace/OS_NS_dlfcn.inl" #endif /* ACE_HAS_INLINED_OSCALLS */ ace-8.0.4+dfsg.orig/ace/config-macosx-lion.h0000644000175000017500000000050215027201773017561 0ustar sudipsudip#ifndef ACE_CONFIG_MACOSX_LION_H #define ACE_CONFIG_MACOSX_LION_H #include "ace/config-macosx-leopard.h" #if defined (__x86_64__) # define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%ld" # define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu" #endif /* __x86_64__ */ #define ACE_LACKS_UCONTEXT_H #endif // ACE_CONFIG_MACOSX_LION_H ace-8.0.4+dfsg.orig/ace/OS_NS_wctype.cpp0000644000175000017500000000023415027201773016736 0ustar sudipsudip// -*- C++ -*- #include "ace/OS_NS_wctype.h" #if !defined (ACE_HAS_INLINED_OSCALLS) # include "ace/OS_NS_wctype.inl" #endif /* ACE_HAS_INLINED_OSCALLS */ ace-8.0.4+dfsg.orig/ace/Timer_Queue_Iterator.h0000644000175000017500000001106215027201773020165 0ustar sudipsudip#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 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 ACE_Timer_Node_T { public: /// Default constructor ACE_Timer_Node_T (); /// Destructor ~ACE_Timer_Node_T (); /// Useful typedef .. typedef ACE_Timer_Node_Dispatch_Info_T 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 *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 *p, ACE_Timer_Node_T *n, long timer_id); // = Accessors /// Get the type. TYPE &get_type (); /// Set the type. void set_type (TYPE &type); /// Get the asynchronous completion token. const void *get_act (); /// Set the asynchronous completion token. void set_act (void *act); /// Get the timer value. const ACE_Time_Value &get_timer_value () 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 () const; /// Set the timer interval. void set_interval (const ACE_Time_Value &interval); /// Get the previous pointer. ACE_Timer_Node_T *get_prev (); /// Set the previous pointer. void set_prev (ACE_Timer_Node_T *prev); /// Get the next pointer. ACE_Timer_Node_T *get_next (); /// Set the next pointer. void set_next (ACE_Timer_Node_T *next); /// Get the timer_id. long get_timer_id () const; /// Set the timer_id. void set_timer_id (long timer_id); /// Get the dispatch info. The dispatch information is got /// through @a 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 &info); /// Dump the state of an TYPE. void dump () const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; 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 *prev_; /// Pointer to next timer. ACE_Timer_Node_T *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 ACE_Timer_Queue_Iterator_T { public: /// Constructor. ACE_Timer_Queue_Iterator_T () = default; /// Destructor. virtual ~ACE_Timer_Queue_Iterator_T (); /// Positions the iterator at the earliest node in the Timer Queue virtual void first () = 0; /// Positions the iterator at the next node in the Timer Queue virtual void next () = 0; /// Returns true when there are no more nodes in the sequence virtual bool isdone () const = 0; /// Returns the node at the current position in the sequence virtual ACE_Timer_Node_T *item () = 0; }; ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Timer_Queue_Iterator.inl" #endif /* __ACE_INLINE__ */ #include "ace/Timer_Queue_Iterator.cpp" #include /**/ "ace/post.h" #endif /* ACE_TIMER_QUEUE_ITERATOR_H */ ace-8.0.4+dfsg.orig/ace/Message_Queue_Vx.inl0000644000175000017500000000171615027201773017635 0ustar sudipsudip// -*- C++ -*- ACE_BEGIN_VERSIONED_NAMESPACE_DECL #if defined (ACE_VXWORKS) // Specialization to use native VxWorks Message Queues. ACE_INLINE MSG_Q_ID ACE_Message_Queue_Vx::msgq () { // Hijack the tail_ field to store the MSG_Q_ID. return static_cast ( #if defined __LP64__ && defined __RTP__ // In RTP-mode only MSG_Q_ID is an int; in a 64-bit build the size of MSG_Q_ID // doesn't match the size of a pointer, tail_, so first treat it as 64-bit. reinterpret_cast (tail_) #elif defined __RTP__ reinterpret_cast (tail_) #else reinterpret_cast (tail_) #endif /* __RTP__ */ ); } ACE_INLINE int ACE_Message_Queue_Vx::peek_dequeue_head (ACE_Message_Block *&, ACE_Time_Value *) { ACE_NOTSUP_RETURN (-1); } #endif /* ACE_VXWORKS */ ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Vector_T.h0000644000175000017500000001721215027201773015620 0ustar sudipsudip// -*- C++ -*- //========================================================================== /** * @file Vector_T.h * * @author Craig L. Ching * @author Gonzalo Diethelm */ //========================================================================== #ifndef ACE_VECTOR_T_H #define ACE_VECTOR_T_H #include /**/ "ace/pre.h" #include "ace/Containers_T.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL /* * Default size for an ACE_Vector. */ static constexpr size_t ACE_VECTOR_DEFAULT_SIZE = 32; // Forward declaration. template class ACE_Vector_Iterator; /** * @class ACE_Vector * * @brief Defines an STL-like vector container. * * This is an STL-like template vector container, a wrapper around * ACE_Array. It provides at least the basic std::vector look and * feel: push_back(), clear(), resize(), capacity(). This template * class uses the copy semantic paradigm, though it is okay to use * reference counted smart pointers (see ACE_Ptr<T>) with this * template class. * * Requirements and Performance Characteristics * - Internal Structure * ACE_Array * - Duplicates allowed? * Yes * - Random access allowed? * No * - Search speed * N/A * - Insert/replace speed * Linear * - Iterator still valid after change to container? * Yes * - Frees memory for removed elements? * No * - Items inserted by * Value * - Requirements for contained type * -# Default constructor * -# Copy constructor * -# operator= */ template class ACE_Vector : public ACE_Array { public: /** * A short name for iterator for ACE_Vector. */ typedef ACE_Vector_Iterator Iterator; /** * General constructor. * * @param init_size Initial size of the vector with the default * value of DEFAULT_SIZE * @param alloc Pointer to an ACE allocator. If it is NULL then the * default ACE allocator is used */ ACE_Vector (const size_t init_size = DEFAULT_SIZE, ACE_Allocator* alloc = 0); /** * Destructor. */ ~ACE_Vector () = default; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; /** * Returns the current vector capacity, that is, the currently * allocated buffer size. * * @return Current buffer size of the vector */ size_t capacity () const; /** * Returns the vector's dynamic size / actual current size of the * vector. Do not confuse it with ACE_Array::size(), which returns * the array's capacity. Unfortunately, ACE is not very consistent * with the function names. * * @return Dynamic size / actual current size of the vector. */ size_t size () const; /** * Clears out the vector. It does not reallocate the vector's * buffer, it is just sets the vector's dynamic size to 0. */ void clear (); /** * Resizes the vector to the new capacity. If the vector's current * capacity is smaller than the size to be specified, then the * buffer gets reallocated. If the new capacity is less than the * current capacity of the vector, the buffer size stays the same. * * @param new_size New capacity of the vector * @param t A filler value (of the class T) for initializing the * elements of the vector with. By default, if this * parameter is not specified, the default value of the * class T will be used (for more detail, see the * initialization clause for this parameter). */ void resize (const size_t new_size, const T& t); /** * Appends a new element to the vector ("push back"). If the * dynamic size of the vector is equal to the capacity of the vector * (vector is at capacity), the vector automatically doubles its * capacity. * * @param elem A reference to the new element to be appended. By * default, this parameters gets initialized with the * default value of the class T. */ void push_back (const T& elem); /** * Deletes the last element from the vector ("pop back"). What this * function really does is decrement the dynamic size of the * vector. The vector's buffer does not get reallocated for * performance. */ void pop_back (); /** * This function dumps the content of the vector. TO BE MOVED out * of this class. It needs to be implemented as a global template * function that accepts a const ACE_Vector<T>, in order to * make instances of this class compile on Linux. G++ and xlC * have template instantiation algoriths, which are different from * the one in Visual C++. The algorithms try to instantiate ALL * methods declared in the template class, regardless of whether the * functions are used or not. That is, all of the classes, that are * used as elements in ACE_Vector's, have to have the dump() methods * defined in them (seems to be overkill). * * This function calls T::dump() for each element of the vector. */ void dump () const; // = Compare operators /// Equality comparison operator. /** * Compare this vector with @arg s for equality. Two vectors are equal * if their sizes are equal and all the elements are equal. */ bool operator== (const ACE_Vector &s) const; /// Inequality comparison operator. /** * Compare this vector with @arg s for inequality such that @c *this != * @arg s is always the complement of the boolean return value of * @c *this == @arg s. */ bool operator!= (const ACE_Vector &s) const; void swap (ACE_Vector &rhs); /* * Implement our own end functions because Array_Base's end functions use the * current capacity, not the Vector's actual element count! */ /// C++ Standard End Iterator ///{ typename ACE_Array_Base::iterator end (); typename ACE_Array_Base::const_iterator end () const; ///} protected: /** * Dynamic size (length) of the vector. */ size_t length_; /** * Current capacity (buffer size) of the vector. */ size_t curr_max_size_; friend class ACE_Vector_Iterator; }; /** * @class ACE_Vector_Iterator * * @brief Implement an iterator over an ACE_Vector. * * This iterator is safe in the face of vector element deletions. * But it is NOT safe if the vector is resized via the assignment * operator during iteration. That would be very odd, and dangerous. */ template class ACE_Vector_Iterator { public: ACE_Vector_Iterator (ACE_Vector &); // = Iteration methods. /// Pass back the @a next_item that hasn't been seen in the vector. /// Returns 0 when all items have been seen, else 1. int next (T *&next_item); /// Move forward by one element in the vector. Returns 0 when all the /// items in the vector have been seen, else 1. int advance (); /// Returns 1 when all items have been seen, else 0. int done () const; /// Dump the state of an object. void dump () const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; private: /// Pointer to the current item in the iteration. size_t current_; /// Reference to the vector we're iterating over. ACE_Vector &vector_; }; ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Vector_T.inl" #endif /* __ACE_INLINE__ */ #include "ace/Vector_T.cpp" #include /**/ "ace/post.h" #endif /* ACE_VECTOR_T_H */ ace-8.0.4+dfsg.orig/ace/Hash_Map_With_Allocator_T.cpp0000644000175000017500000000226415027201773021365 0ustar sudipsudip#ifndef ACE_HASH_MAP_WITH_ALLOCATOR_T_CPP #define ACE_HASH_MAP_WITH_ALLOCATOR_T_CPP #include "ace/Hash_Map_With_Allocator_T.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #if !defined (__ACE_INLINE__) #include "ace/Hash_Map_With_Allocator_T.inl" #endif /* __ACE_INLINE__ */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL template ACE_Hash_Map_With_Allocator::ACE_Hash_Map_With_Allocator (ACE_Allocator *alloc) : ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_Null_Mutex> (alloc) { ACE_TRACE ("ACE_Hash_Map_With_Allocator::ACE_Hash_Map_With_Allocator"); } template ACE_Hash_Map_With_Allocator::ACE_Hash_Map_With_Allocator (size_t size, ACE_Allocator *alloc) : ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_Null_Mutex> (size, alloc) { ACE_TRACE ("ACE_Hash_Map_With_Allocator::ACE_Hash_Map_With_Allocator"); } ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HASH_MAP_WITH_ALLOCATOR_T_CPP */ ace-8.0.4+dfsg.orig/ace/SOCK_Dgram.inl0000644000175000017500000001175315027201773016303 0ustar sudipsudip// -*- C++ -*- // SOCK_Dgram.i #include "ace/OS_NS_sys_socket.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Here's the simple-minded constructor. ACE_INLINE ACE_SOCK_Dgram::ACE_SOCK_Dgram () { ACE_TRACE ("ACE_SOCK_Dgram::ACE_SOCK_Dgram"); } ACE_INLINE ACE_SOCK_Dgram::~ACE_SOCK_Dgram () { ACE_TRACE ("ACE_SOCK_Dgram::~ACE_SOCK_Dgram"); } // an N byte datagram to (connectionless version). ACE_INLINE ssize_t ACE_SOCK_Dgram::send (const void *buf, size_t n, const ACE_Addr &addr, int flags) const { ACE_TRACE ("ACE_SOCK_Dgram::send"); sockaddr *saddr = (sockaddr *) addr.get_addr (); int len = addr.get_size (); return ACE_OS::sendto (this->get_handle (), (const char *) buf, n, flags, (struct sockaddr *) saddr, len); } // an n byte datagram (connectionless version). ACE_INLINE ssize_t ACE_SOCK_Dgram::recv (void *buf, size_t n, ACE_Addr &addr, int flags) const { ACE_TRACE ("ACE_SOCK_Dgram::recv"); sockaddr *saddr = (sockaddr *) addr.get_addr (); int addr_len = addr.get_size (); ssize_t const status = ACE_OS::recvfrom (this->get_handle (), (char *) buf, n, flags, (sockaddr *) saddr, &addr_len); addr.set_size (addr_len); addr.set_type (saddr->sa_family); return status; } ACE_INLINE ssize_t ACE_SOCK_Dgram::send (const iovec buffers[], int buffer_count, size_t &number_of_bytes_sent, int flags, const ACE_Addr &addr, ACE_OVERLAPPED *overlapped, ACE_OVERLAPPED_COMPLETION_FUNC func) const { ACE_TRACE ("ACE_SOCK_Dgram::send"); sockaddr *saddr = (sockaddr *) addr.get_addr (); int len = addr.get_size (); return ACE_OS::sendto (this->get_handle (), buffers, buffer_count, number_of_bytes_sent, flags, (const sockaddr *) saddr, len, overlapped, func); } ACE_INLINE ssize_t ACE_SOCK_Dgram::recv (iovec buffers[], int buffer_count, size_t &number_of_bytes_recvd, int &flags, ACE_Addr &addr, ACE_OVERLAPPED *overlapped, ACE_OVERLAPPED_COMPLETION_FUNC func) const { ACE_TRACE ("ACE_SOCK_Dgram::recv"); sockaddr *saddr = (sockaddr *) addr.get_addr (); int addr_len = addr.get_size (); ssize_t status = ACE_OS::recvfrom (this->get_handle (), buffers, buffer_count, number_of_bytes_recvd, flags, (sockaddr *) saddr, &addr_len, overlapped, func); addr.set_size (addr_len); addr.set_type (saddr->sa_family); return status; } // an N byte datagram to (connectionless version). ACE_INLINE ssize_t ACE_SOCK_Dgram::send (const void *buf, size_t n, const ACE_Addr &addr, int flags, ACE_OVERLAPPED *overlapped, ACE_OVERLAPPED_COMPLETION_FUNC func) const { ACE_TRACE ("ACE_SOCK_Dgram::send"); iovec buffer[1]; buffer[0].iov_len = static_cast (n); // Betting on < 4G buffer[0].iov_base = (char *) const_cast (buf); size_t number_of_bytes_sent = 0; return this->send (buffer, 1, number_of_bytes_sent, flags, addr, overlapped, func); } // an n byte datagram (connectionless version). ACE_INLINE ssize_t ACE_SOCK_Dgram::recv (void *buf, size_t n, ACE_Addr &addr, int flags, ACE_OVERLAPPED *overlapped, ACE_OVERLAPPED_COMPLETION_FUNC func) const { ACE_TRACE ("ACE_SOCK_Dgram::recv"); iovec buffer[1]; buffer[0].iov_len = static_cast (n); // Betting on < 4G buffer[0].iov_base = (char *) buf; size_t number_of_bytes_recvd = 0; return this->recv (buffer, 1, number_of_bytes_recvd, flags, addr, overlapped, func); } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/SOCK_CODgram.h0000644000175000017500000001211715027201773016165 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file SOCK_CODgram.h * * @author Doug Schmidt */ //============================================================================= #ifndef ACE_SOCK_CODGRAM_H #define ACE_SOCK_CODGRAM_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/SOCK_IO.h" #include "ace/Addr.h" #include "ace/INET_Addr.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_SOCK_CODgram * * @brief Defines the member functions for the ACE_SOCK connected * datagram abstraction. */ class ACE_Export ACE_SOCK_CODgram : public ACE_SOCK_IO { public: /// Default constructor. ACE_SOCK_CODgram (); /** * Constructor with addresses specified. Calls open(). * This constructor binds and/or connects to a specified address, * optionally binding an unused port number. * * @param remote_sap The remote address. * @param local_sap The local address. * @param protocol_family The protocol family for the new socket. If * either @p remote_sap or @p local_sap is * specified (i.e., not ACE_Addr::sap_any) its * address type is used instead of this value. * If both addresses are specified, their address * types must match. If neither address is specified, * the platform's default IP address type is used. * @param protocol Protocol value for the new socket. * @param reuse_addr Reuse the local address or not. * * There are four possible combinations of remote_sap and local_sap. The * behavior in these combinations is: * * @li remote_addr == ACE_Addr::sap_any && local_addr == ACE_Addr::sap_any: * If @p protocol_family specifies PF_INET or PF_INET6, * bind the local address to a randomly generated port number. * * @li remote_addr == ACE_Addr::sap_any && local_addr != ACE_Addr::sap_any: * Bind the local address (used primarily by servers). * * @li remote_addr != ACE_Addr::sap_any && local_addr == ACE_Addr::sap_any: * Connect to the remote address without binding a local address * (used primarily by clients). * * @li remote_addr != ACE_Addr::sap_any && local_addr != ACE_Addr::sap_any: * Bind to the local address and connect to the remote address. */ ACE_SOCK_CODgram (const ACE_Addr &remote_sap, const ACE_Addr &local_sap = ACE_Addr::sap_any, int protocol_family = ACE_PROTOCOL_FAMILY_INET, int protocol = 0, int reuse_addr = 0); /// Default dtor. ~ACE_SOCK_CODgram (); // Initiate a connected dgram. /** * Initiate a connected datagram socket, optionally binding an * unused port number. * * @param remote_sap The remote address. * @param local_sap The local address. * @param protocol_family The protocol family for the new socket. If * either @p remote_sap or @p local_sap is * specified (i.e., not ACE_Addr::sap_any) its * address type is used instead of this value. * If both addresses are specified, their address * types must match. If neither address is specified, * the platform's default IP address type is used. * @param protocol Protocol value for the new socket. * @param reuse_addr Reuse the local address or not. * * There are four possible combinations of remote_sap and local_sap. The * behavior in these combinations is: * * @li remote_addr == ACE_Addr::sap_any && local_addr == ACE_Addr::sap_any: * If @p protocol_family specifies PF_INET or PF_INET6, * bind the local address to a randomly generated port number. * * @li remote_addr == ACE_Addr::sap_any && local_addr != ACE_Addr::sap_any: * Bind the local address (used primarily by servers). * * @li remote_addr != ACE_Addr::sap_any && local_addr == ACE_Addr::sap_any: * Connect to the remote address without binding a local address * (used primarily by clients). * * @li remote_addr != ACE_Addr::sap_any && local_addr != ACE_Addr::sap_any: * Bind to the local address and connect to the remote address. */ int open (const ACE_Addr &remote_sap, const ACE_Addr &local_sap = ACE_Addr::sap_any, int protocol_family = ACE_PROTOCOL_FAMILY_INET, int protocol = 0, int reuse_addr = 0); // = Meta-type info. typedef ACE_INET_Addr PEER_ADDR; /// Dump the state of an object. void dump () const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; }; ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/SOCK_CODgram.inl" #endif /* __ACE_INLINE__ */ #include /**/ "ace/post.h" #endif /* ACE_SOCK_CODGRAM_H */ ace-8.0.4+dfsg.orig/ace/Task.inl0000644000175000017500000000322515027201773015327 0ustar sudipsudip// -*- C++ -*- ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Get the current group id. ACE_INLINE int ACE_Task_Base::grp_id () const { ACE_TRACE ("ACE_Task_Base::grp_id"); return this->grp_id_; } // Set the current group id. ACE_INLINE void ACE_Task_Base::grp_id (int identifier) { ACE_TRACE ("ACE_Task_Base::grp_id"); ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, this->lock_)); // Cache the group id in the task and then set it in the // Thread_Manager, if there is one. this->grp_id_ = identifier; if (this->thr_mgr ()) this->thr_mgr ()->set_grp (this, identifier); } ACE_INLINE ACE_Thread_Manager * ACE_Task_Base::thr_mgr () const { ACE_TRACE ("ACE_Task_Base::thr_mgr"); return this->thr_mgr_; } ACE_INLINE void ACE_Task_Base::thr_mgr (ACE_Thread_Manager *thr_mgr) { ACE_TRACE ("ACE_Task_Base::thr_mgr"); this->thr_mgr_ = thr_mgr; } ACE_INLINE int ACE_Task_Base::is_reader () const { ACE_TRACE ("ACE_Task_Base::is_reader"); return (ACE_BIT_ENABLED (this->flags_, ACE_Task_Flags::ACE_READER)); } ACE_INLINE int ACE_Task_Base::is_writer () const { ACE_TRACE ("ACE_Task_Base::is_writer"); return (ACE_BIT_DISABLED (this->flags_, ACE_Task_Flags::ACE_READER)); } // Return the count of the current number of threads. ACE_INLINE size_t ACE_Task_Base::thr_count () const { ACE_TRACE ("ACE_Task_Base::thr_count"); ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); return this->thr_count_; } // Return the thread ID of the last thread to exit svc(). ACE_INLINE ACE_thread_t ACE_Task_Base::last_thread () const { ACE_TRACE ("ACE_Task_Base::last_thread"); return this->last_thread_id_; } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/OS_NS_unistd.inl0000644000175000017500000007515615027201773016750 0ustar sudipsudip// -*- C++ -*- #include "ace/OS_NS_sys_utsname.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_errno.h" #include "ace/OS_NS_macros.h" #include "ace/OS_NS_fcntl.h" #include "ace/Default_Constants.h" #include "ace/OS_Memory.h" #include "ace/Truncate.h" #if defined (ACE_HAS_CLOCK_GETTIME) # include "ace/os_include/os_time.h" #endif /* ACE_HAS_CLOCK_GETTIME */ #if defined (ACE_LACKS_ACCESS) # include "ace/OS_NS_stdio.h" #endif /* ACE_LACKS_ACCESS */ #if defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x690) # if defined (__RTP__) # include "ace/os_include/os_strings.h" # else # include "ace/os_include/os_string.h" # endif #endif #ifdef ACE_MQX # include "ace/MQX_Filesystem.h" #endif ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_OS::access (const char *path, int amode) { ACE_OS_TRACE ("ACE_OS::access"); #if defined (ACE_LACKS_ACCESS) ACE_UNUSED_ARG (path); ACE_UNUSED_ARG (amode); ACE_NOTSUP_RETURN (-1); #elif defined(ACE_WIN32) // Windows doesn't support checking X_OK(6) # if defined (ACE_ACCESS_EQUIVALENT) return ACE_ACCESS_EQUIVALENT (path, amode & 6); # else return ::access (path, amode & 6); # endif #else return ::access (path, amode); #endif /* ACE_LACKS_ACCESS */ } #if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::access (const wchar_t *path, int amode) { #if defined (ACE_WIN32) return ::_waccess (path, amode); #else /* ACE_WIN32 */ return ACE_OS::access (ACE_Wide_To_Ascii (path).char_rep (), amode); #endif /* ACE_WIN32 */ } #endif /* ACE_HAS_WCHAR */ ACE_INLINE u_int ACE_OS::alarm (u_int secs) { ACE_OS_TRACE ("ACE_OS::alarm"); #if defined (ACE_LACKS_ALARM) ACE_UNUSED_ARG (secs); ACE_NOTSUP_RETURN (0); #else return ::alarm (secs); #endif /* ACE_LACKS_ALARM */ } ACE_INLINE long ACE_OS::getpagesize () { ACE_OS_TRACE ("ACE_OS::getpagesize"); #if defined (ACE_WIN32) SYSTEM_INFO sys_info; ::GetSystemInfo (&sys_info); return (long) sys_info.dwPageSize; #elif defined (_SC_PAGESIZE) return ACE_OS::sysconf (_SC_PAGESIZE); #elif defined (ACE_HAS_GETPAGESIZE) return ::getpagesize (); #else // Use the default set in config.h return ACE_PAGE_SIZE; #endif /* ACE_WIN32 */ } ACE_INLINE long ACE_OS::allocation_granularity () { #if defined (ACE_WIN32) SYSTEM_INFO sys_info; ::GetSystemInfo (&sys_info); return sys_info.dwAllocationGranularity; #else return ACE_OS::getpagesize (); #endif /* ACE_WIN32 */ } ACE_INLINE int ACE_OS::chdir (const char *path) { ACE_OS_TRACE ("ACE_OS::chdir"); #if defined (ACE_LACKS_CHDIR) ACE_UNUSED_ARG (path); ACE_NOTSUP_RETURN (-1); #elif defined (ACE_CHDIR_EQUIVALENT) return ACE_CHDIR_EQUIVALENT (path); #else return ::chdir (path); #endif /* ACE_CHDIR_EQUIVALENT */ } #if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::chdir (const wchar_t *path) { #if defined (ACE_WIN32) return ::_wchdir (path); #else /* ACE_WIN32 */ return ACE_OS::chdir (ACE_Wide_To_Ascii (path).char_rep ()); #endif /* ACE_WIN32 */ } #endif /* ACE_HAS_WCHAR */ ACE_INLINE int ACE_OS::rmdir (const char *path) { #if defined (ACE_LACKS_RMDIR) ACE_UNUSED_ARG (path); ACE_NOTSUP_RETURN (-1); #elif defined (ACE_RMDIR_EQUIVALENT) return ACE_RMDIR_EQUIVALENT (path); #else return ::rmdir (path); #endif /* ACE_WIN32 */ } #if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::rmdir (const wchar_t *path) { #if defined (ACE_WIN32) return ::_wrmdir (path); #else ACE_Wide_To_Ascii n_path (path); return ACE_OS::rmdir (n_path.char_rep ()); #endif /* ACE_WIN32 */ } #endif /* ACE_HAS_WCHAR */ // @todo: which 4 and why??? dhinton // NOTE: The following four function definitions must appear before // ACE_OS::sema_init (). ACE_INLINE int ACE_OS::close (ACE_HANDLE handle) { ACE_OS_TRACE ("ACE_OS::close"); #if defined (ACE_WIN32) ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::CloseHandle (handle), ace_result_), int, -1); #elif defined (ACE_MQX) return MQX_Filesystem::inst ().close (handle); #elif defined (ACE_LACKS_CLOSE) ACE_UNUSED_ARG (handle); ACE_NOTSUP_RETURN (-1); #else return ::close (handle); #endif /* ACE_WIN32 */ } ACE_INLINE ACE_HANDLE ACE_OS::dup (ACE_HANDLE handle) { ACE_OS_TRACE ("ACE_OS::dup"); #if defined (ACE_LACKS_DUP) ACE_UNUSED_ARG (handle); ACE_NOTSUP_RETURN (ACE_INVALID_HANDLE); #elif defined (ACE_WIN32) ACE_HANDLE new_fd; if (::DuplicateHandle(::GetCurrentProcess (), handle, ::GetCurrentProcess(), &new_fd, 0, TRUE, DUPLICATE_SAME_ACCESS)) return new_fd; else ACE_FAIL_RETURN (ACE_INVALID_HANDLE); /* NOTREACHED */ #else return ::dup (handle); #endif /* ACE_LACKS_DUP */ } ACE_INLINE ACE_HANDLE ACE_OS::dup(ACE_HANDLE handle, pid_t pid) { ACE_OS_TRACE("ACE_OS::dup"); #if defined (ACE_LACKS_DUP) ACE_UNUSED_ARG (handle); ACE_UNUSED_ARG (pid); ACE_NOTSUP_RETURN (ACE_INVALID_HANDLE); #elif defined (ACE_WIN32) ACE_HANDLE new_fd; ACE_HANDLE hTargetProcess = ::OpenProcess (PROCESS_DUP_HANDLE, FALSE, pid); if(::DuplicateHandle(::GetCurrentProcess (), handle, hTargetProcess, &new_fd, 0, TRUE, DUPLICATE_SAME_ACCESS)) { ::CloseHandle (hTargetProcess); return new_fd; } else ACE_FAIL_RETURN (ACE_INVALID_HANDLE); /*NOTREACHED*/ #else ACE_UNUSED_ARG (pid); return ::dup(handle); #endif /* ACE_LACKS_DUP */ } ACE_INLINE int ACE_OS::dup2 (ACE_HANDLE oldhandle, ACE_HANDLE newhandle) { ACE_OS_TRACE ("ACE_OS::dup2"); #if defined (ACE_LACKS_DUP2) // msvcrt has _dup2 ?! ACE_UNUSED_ARG (oldhandle); ACE_UNUSED_ARG (newhandle); ACE_NOTSUP_RETURN (-1); #else return ::dup2 (oldhandle, newhandle); #endif /* ACE_LACKS_DUP2 */ } ACE_INLINE int ACE_OS::execv (const char *path, char *const argv[]) { ACE_OS_TRACE ("ACE_OS::execv"); #if defined (ACE_LACKS_EXEC) ACE_UNUSED_ARG (path); ACE_UNUSED_ARG (argv); ACE_NOTSUP_RETURN (-1); #elif defined (ACE_WIN32) # if defined (__BORLANDC__) return ::execv (path, argv); # elif defined (__MINGW32__) return ::_execv (path, (char *const *) argv); # else // Why this odd-looking code? If execv() returns at all, it's an error. // Windows defines this as returning an intptr_t rather than a simple int, // and the conversion triggers compile warnings. So just return -1 if // the call returns. ::_execv (path, (const char *const *) argv); return -1; # endif /* __BORLANDC__ */ #else return ::execv (path, argv); #endif /* ACE_LACKS_EXEC */ } ACE_INLINE int ACE_OS::execve (const char *path, char *const argv[], char *const envp[]) { ACE_OS_TRACE ("ACE_OS::execve"); #if defined (ACE_LACKS_EXEC) ACE_UNUSED_ARG (path); ACE_UNUSED_ARG (argv); ACE_UNUSED_ARG (envp); ACE_NOTSUP_RETURN (-1); #elif defined (ACE_WIN32) # if defined (__BORLANDC__) return ::execve (path, argv, envp); # elif defined (__MINGW32__) return ::_execve (path, (char *const *) argv, (char *const *) envp); # else // Why this odd-looking code? If execv() returns at all, it's an error. // Windows defines this as returning an intptr_t rather than a simple int, // and the conversion triggers compile warnings. So just return -1 if // the call returns. ::_execve (path, (const char *const *) argv, (const char *const *) envp); return -1; # endif /* __BORLANDC__ */ #else return ::execve (path, argv, envp); #endif /* ACE_LACKS_EXEC */ } ACE_INLINE int ACE_OS::execvp (const char *file, char *const argv[]) { ACE_OS_TRACE ("ACE_OS::execvp"); #if defined (ACE_LACKS_EXEC) || defined (ACE_LACKS_EXECVP) ACE_UNUSED_ARG (file); ACE_UNUSED_ARG (argv); ACE_NOTSUP_RETURN (-1); #elif defined (ACE_WIN32) # if defined (__BORLANDC__) return ::execvp (file, argv); # elif defined (__MINGW32__) return ::_execvp (file, (char *const *) argv); # else // Why this odd-looking code? If execv() returns at all, it's an error. // Windows defines this as returning an intptr_t rather than a simple int, // and the conversion triggers compile warnings. So just return -1 if // the call returns. ::_execvp (file, (const char *const *) argv); return -1; # endif /* __BORLANDC__ */ #else return ::execvp (file, argv); #endif /* ACE_LACKS_EXEC */ } ACE_INLINE pid_t ACE_OS::fork () { ACE_OS_TRACE ("ACE_OS::fork"); #if defined (ACE_LACKS_FORK) ACE_NOTSUP_RETURN (pid_t (-1)); #else return ::fork (); #endif /* ACE_LACKS_FORK */ } ACE_INLINE int ACE_OS::fsync (ACE_HANDLE handle) { ACE_OS_TRACE ("ACE_OS::fsync"); # if defined (ACE_LACKS_FSYNC) ACE_UNUSED_ARG (handle); ACE_NOTSUP_RETURN (-1); # elif defined (ACE_WIN32) ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::FlushFileBuffers (handle), ace_result_), int, -1); # else return ::fsync (handle); # endif /* ACE_LACKS_FSYNC */ } ACE_INLINE int ACE_OS::ftruncate (ACE_HANDLE handle, ACE_OFF_T offset) { ACE_OS_TRACE ("ACE_OS::ftruncate"); #if defined (ACE_WIN32) LARGE_INTEGER loff; loff.QuadPart = offset; if (::SetFilePointerEx (handle, loff, 0, FILE_BEGIN)) ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::SetEndOfFile (handle), ace_result_), int, -1); else ACE_FAIL_RETURN (-1); #elif defined (ACE_LACKS_FTRUNCATE) ACE_UNUSED_ARG (handle); ACE_UNUSED_ARG (offset); ACE_NOTSUP_RETURN (-1); #else return ::ftruncate (handle, offset); #endif /* ACE_WIN32 */ } ACE_INLINE char * ACE_OS::getcwd (char *buf, size_t size) { ACE_OS_TRACE ("ACE_OS::getcwd"); #if defined (ACE_LACKS_GETCWD) ACE_UNUSED_ARG (buf); ACE_UNUSED_ARG (size); ACE_NOTSUP_RETURN (0); #elif defined (ACE_GETCWD_EQUIVALENT) return ACE_GETCWD_EQUIVALENT (buf, static_cast (size)); #elif defined (ACE_WIN32) return ::getcwd (buf, static_cast (size)); #else return ::getcwd (buf, size); #endif /* ACE_LACKS_GETCWD */ } #if defined (ACE_HAS_WCHAR) ACE_INLINE wchar_t * ACE_OS::getcwd (wchar_t *buf, size_t size) { # if defined (ACE_WIN32) return ::_wgetcwd (buf, static_cast (size)); # else char *narrow_buf = new char[size]; char *result = 0; result = ACE_OS::getcwd (narrow_buf, size); ACE_Ascii_To_Wide wide_buf (result); delete [] narrow_buf; if (result != 0) ACE_OS::strsncpy (buf, wide_buf.wchar_rep (), size); return result == 0 ? 0 : buf; # endif /* ACE_WIN32 */ } #endif /* ACE_HAS_WCHAR */ ACE_INLINE gid_t ACE_OS::getgid () { ACE_OS_TRACE ("ACE_OS::getgid"); #if defined (ACE_LACKS_GETGID) ACE_NOTSUP_RETURN (static_cast (-1)); # else return ::getgid (); # endif /* ACE_LACKS_GETGID */ } ACE_INLINE gid_t ACE_OS::getegid () { ACE_OS_TRACE ("ACE_OS::getegid"); #if defined (ACE_LACKS_GETEGID) ACE_NOTSUP_RETURN (static_cast (-1)); # else return ::getegid (); # endif /* ACE_LACKS_GETEGID */ } ACE_INLINE int ACE_OS::getopt (int argc, char *const *argv, const char *optstring) { ACE_OS_TRACE ("ACE_OS::getopt"); #if defined (ACE_LACKS_GETOPT) ACE_UNUSED_ARG (argc); ACE_UNUSED_ARG (argv); ACE_UNUSED_ARG (optstring); ACE_NOTSUP_RETURN (-1); # else return ::getopt (argc, argv, optstring); # endif /* ACE_LACKS_GETOPT */ } ACE_INLINE pid_t ACE_OS::getpgid (pid_t pid) { ACE_OS_TRACE ("ACE_OS::getpgid"); #if defined (ACE_LACKS_GETPGID) ACE_UNUSED_ARG (pid); ACE_NOTSUP_RETURN (-1); #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 // that is visible (ugh). return ::__getpgid (pid); #else return ::getpgid (pid); #endif /* ACE_LACKS_GETPGID */ } ACE_INLINE pid_t ACE_OS::getpid () { // ACE_OS_TRACE ("ACE_OS::getpid"); #if defined (ACE_LACKS_GETPID) ACE_NOTSUP_RETURN (-1); #elif defined (ACE_WIN32) return ::GetCurrentProcessId (); #else return ::getpid (); #endif /* ACE_LACKS_GETPID */ } ACE_INLINE pid_t ACE_OS::getppid () { ACE_OS_TRACE ("ACE_OS::getppid"); #if defined (ACE_LACKS_GETPPID) ACE_NOTSUP_RETURN (-1); #else return ::getppid (); #endif /* ACE_LACKS_GETPPID */ } ACE_INLINE uid_t ACE_OS::getuid () { ACE_OS_TRACE ("ACE_OS::getuid"); #if defined (ACE_LACKS_GETUID) ACE_NOTSUP_RETURN (static_cast (-1)); # else return ::getuid (); # endif /* ACE_LACKS_GETUID*/ } ACE_INLINE uid_t ACE_OS::geteuid () { ACE_OS_TRACE ("ACE_OS::geteuid"); #if defined (ACE_LACKS_GETEUID) ACE_NOTSUP_RETURN (static_cast (-1)); # else return ::geteuid (); # endif /* ACE_LACKS_GETEUID */ } ACE_INLINE int ACE_OS::hostname (char name[], size_t maxnamelen) { ACE_OS_TRACE ("ACE_OS::hostname"); #if defined (ACE_VXWORKS) return ::gethostname (name, maxnamelen); #elif defined (ACE_WIN32) if (::gethostname (name, ACE_Utils::truncate_cast (maxnamelen)) == 0) { return 0; } else { ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::GetComputerNameA (name, LPDWORD (&maxnamelen)), ace_result_), int, -1); } #elif defined (ACE_MQX) const int enet_device = 0; IPCFG_IP_ADDRESS_DATA ip_data; if (ipcfg_get_ip (enet_device, &ip_data)) { ACE_OS::snprintf(name, maxnamelen, "%d.%d.%d.%d", IPBYTES(ip_data.ip)); return 0; } return -1; #elif defined (ACE_LACKS_GETHOSTNAME) ACE_NOTSUP_RETURN (-1); #else /* ACE_VXWORKS */ ACE_utsname host_info; if (ACE_OS::uname (&host_info) == -1) return -1; else { ACE_OS::strsncpy (name, host_info.nodename, maxnamelen); return 0; } #endif /* ACE_VXWORKS */ } #if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::hostname (wchar_t name[], size_t maxnamelen) { #if defined (ACE_WIN32) ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (GetComputerNameW (name, LPDWORD (&maxnamelen)), ace_result_), int, -1); #else /* ACE_WIN32 */ // Emulate using the char version char *char_name = 0; ACE_NEW_RETURN (char_name, char[maxnamelen], -1); int result = ACE_OS::hostname(char_name, maxnamelen); ACE_OS::strcpy (name, ACE_Ascii_To_Wide (char_name).wchar_rep ()); delete [] char_name; return result; #endif /* ACE_WIN32 */ } #endif /* ACE_HAS_WCHAR */ ACE_INLINE int ACE_OS::isatty (int handle) { ACE_OS_TRACE ("ACE_OS::isatty"); #if defined (ACE_LACKS_ISATTY) ACE_UNUSED_ARG (handle); return 0; # elif defined (ACE_WIN32) return ::_isatty (handle); # else return ::isatty (handle); # endif /* ACE_LACKS_ISATTY */ } #if defined (ACE_WIN32) ACE_INLINE int ACE_OS::isatty (ACE_HANDLE handle) { #if defined (ACE_LACKS_ISATTY) ACE_UNUSED_ARG (handle); return 0; #else int const fd = ::_open_osfhandle (intptr_t (handle), 0); int status = 0; if (fd != -1) { status = ::_isatty (fd); ::_close (fd); } return status; #endif /* ACE_LACKS_ISATTY */ } #endif /* ACE_WIN32 */ ACE_INLINE ACE_OFF_T ACE_OS::lseek (ACE_HANDLE handle, ACE_OFF_T offset, int whence) { ACE_OS_TRACE ("ACE_OS::lseek"); #if defined (ACE_WIN32) # if SEEK_SET != FILE_BEGIN || SEEK_CUR != FILE_CURRENT || SEEK_END != FILE_END //#error Windows NT is evil AND rude! switch (whence) { case SEEK_SET: whence = FILE_BEGIN; break; case SEEK_CUR: whence = FILE_CURRENT; break; case SEEK_END: whence = FILE_END; break; default: errno = EINVAL; return static_cast (-1); // rather safe than sorry } # endif /* SEEK_SET != FILE_BEGIN || SEEK_CUR != FILE_CURRENT || SEEK_END != FILE_END */ LONG low_offset = ACE_LOW_PART(offset); LONG high_offset = ACE_HIGH_PART(offset); DWORD const result = ::SetFilePointer (handle, low_offset, &high_offset, whence); if (result == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) ACE_FAIL_RETURN (static_cast (-1)); else return result; #elif defined (ACE_MQX) switch (whence) { case SEEK_SET: whence = IO_SEEK_SET; break; case SEEK_CUR: whence = IO_SEEK_CUR; break; case SEEK_END: whence = IO_SEEK_END; break; default: errno = EINVAL; return static_cast (-1); } return static_cast (MQX_Filesystem::inst ().lseek (handle, offset, whence)); #elif defined (ACE_LACKS_LSEEK) ACE_UNUSED_ARG (handle); ACE_UNUSED_ARG (offset); ACE_UNUSED_ARG (whence); ACE_NOTSUP_RETURN (static_cast (-1)); #else return ::lseek (handle, offset, whence); #endif /* ACE_WIN32 */ } #if defined (ACE_HAS_LLSEEK) || defined (ACE_HAS_LSEEK64) ACE_INLINE ACE_LOFF_T ACE_OS::llseek (ACE_HANDLE handle, ACE_LOFF_T offset, int whence) { ACE_OS_TRACE ("ACE_OS::llseek"); #if ACE_SIZEOF_LONG == 8 /* The native lseek is 64 bit. Use it. */ return ACE_OS::lseek (handle, offset, whence); #elif defined (ACE_HAS_LLSEEK) && defined (ACE_HAS_LSEEK64) # error Either ACE_HAS_LSEEK64 and ACE_HAS_LLSEEK should be defined, not both! #elif defined (ACE_HAS_LSEEK64) return ::lseek64 (handle, offset, whence); #elif defined (ACE_HAS_LLSEEK) # if defined (ACE_WIN32) LARGE_INTEGER distance, new_file_pointer; distance.QuadPart = offset; return (::SetFilePointerEx (handle, distance, &new_file_pointer, whence) ? new_file_pointer.QuadPart : static_cast (-1)); # else return ::llseek (handle, offset, whence); # endif /* WIN32 */ #endif } #endif /* ACE_HAS_LLSEEK || ACE_HAS_LSEEK64 */ ACE_INLINE ssize_t ACE_OS::read (ACE_HANDLE handle, void *buf, size_t len) { ACE_OS_TRACE ("ACE_OS::read"); #if defined (ACE_WIN32) DWORD ok_len; if (::ReadFile (handle, buf, static_cast (len), &ok_len, 0)) return (ssize_t) ok_len; else ACE_FAIL_RETURN (-1); #elif defined (ACE_LACKS_READ) ACE_UNUSED_ARG (handle); ACE_UNUSED_ARG (buf); ACE_UNUSED_ARG (len); ACE_NOTSUP_RETURN (-1); #elif defined (ACE_MQX) return MQX_Filesystem::inst ().read (handle, reinterpret_cast (buf), len); #else ssize_t result; # if defined (ACE_HAS_CHARPTR_SOCKOPT) ACE_OSCALL (::read (handle, static_cast (buf), len), ssize_t, result); # else ACE_OSCALL (::read (handle, buf, len), ssize_t, result); # endif /* ACE_HAS_CHARPTR_SOCKOPT */ # if !(defined (EAGAIN) && defined (EWOULDBLOCK) && EAGAIN == EWOULDBLOCK) // Optimize this code out if we can detect that EAGAIN == // EWOULDBLOCK at compile time. If we cannot detect equality at // compile-time (e.g. if EAGAIN or EWOULDBLOCK are not preprocessor // macros) perform the check at run-time. The goal is to avoid two // TSS accesses in the _REENTRANT case when EAGAIN == EWOULDBLOCK. if (result == -1 # if !defined (EAGAIN) || !defined (EWOULDBLOCK) && EAGAIN != EWOULDBLOCK # endif /* !EAGAIN || !EWOULDBLOCK */ && errno == EAGAIN) { errno = EWOULDBLOCK; } # endif /* EAGAIN != EWOULDBLOCK*/ return result; #endif /* ACE_WIN32 */ } ACE_INLINE ssize_t ACE_OS::read (ACE_HANDLE handle, void *buf, size_t len, ACE_OVERLAPPED *overlapped) { ACE_OS_TRACE ("ACE_OS::read"); #if defined (ACE_WIN32) DWORD ok_len; DWORD short_len = static_cast (len); if (::ReadFile (handle, buf, short_len, &ok_len, overlapped)) return (ssize_t) ok_len; else ACE_FAIL_RETURN (-1); #else ACE_UNUSED_ARG (overlapped); return ACE_OS::read (handle, buf, len); #endif /* ACE_WIN32 */ } ACE_INLINE ssize_t ACE_OS::readlink (const char *path, char *buf, size_t bufsiz) { ACE_OS_TRACE ("ACE_OS::readlink"); # if defined (ACE_LACKS_READLINK) ACE_UNUSED_ARG (path); ACE_UNUSED_ARG (buf); ACE_UNUSED_ARG (bufsiz); ACE_NOTSUP_RETURN (-1); # elif defined(ACE_HAS_NONCONST_READLINK) return ::readlink (const_cast (path), buf, bufsiz); # else return ::readlink (path, buf, bufsiz); # endif /* ACE_LACKS_READLINK */ } ACE_INLINE int ACE_OS::pipe (ACE_HANDLE fds[]) { ACE_OS_TRACE ("ACE_OS::pipe"); # if defined (ACE_LACKS_PIPE) ACE_UNUSED_ARG (fds); ACE_NOTSUP_RETURN (-1); # elif defined (ACE_WIN32) ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::CreatePipe (&fds[0], &fds[1], 0, 0), ace_result_), int, -1); # else return ::pipe (fds); # endif /* ACE_LACKS_PIPE */ } ACE_INLINE void * ACE_OS::sbrk (intptr_t brk) { #if defined (ACE_LACKS_SBRK) ACE_UNUSED_ARG (brk); ACE_NOTSUP_RETURN (0); #else return ::sbrk (brk); #endif /* ACE_LACKS_SBRK */ } ACE_INLINE int ACE_OS::setgid (gid_t gid) { ACE_OS_TRACE ("ACE_OS::setgid"); #if defined (ACE_LACKS_SETGID) ACE_UNUSED_ARG (gid); ACE_NOTSUP_RETURN (-1); # else return ::setgid (gid); # endif /* ACE_LACKS_SETGID */ } ACE_INLINE int ACE_OS::setegid (gid_t gid) { ACE_OS_TRACE ("ACE_OS::setegid"); #if defined (ACE_LACKS_SETEGID) ACE_UNUSED_ARG (gid); ACE_NOTSUP_RETURN (-1); # else return ::setegid (gid); # endif /* ACE_LACKS_SETEGID */ } ACE_INLINE int ACE_OS::setpgid (pid_t pid, pid_t pgid) { ACE_OS_TRACE ("ACE_OS::setpgid"); #if defined (ACE_LACKS_SETPGID) ACE_UNUSED_ARG (pid); ACE_UNUSED_ARG (pgid); ACE_NOTSUP_RETURN (-1); #else return ::setpgid (pid, pgid); #endif /* ACE_LACKS_SETPGID */ } ACE_INLINE int ACE_OS::setregid (gid_t rgid, gid_t egid) { ACE_OS_TRACE ("ACE_OS::setregid"); #if defined (ACE_LACKS_SETREGID) ACE_UNUSED_ARG (rgid); ACE_UNUSED_ARG (egid); ACE_NOTSUP_RETURN (-1); #else return ::setregid (rgid, egid); #endif /* ACE_LACKS_SETREGID */ } ACE_INLINE int ACE_OS::setreuid (uid_t ruid, uid_t euid) { ACE_OS_TRACE ("ACE_OS::setreuid"); #if defined (ACE_LACKS_SETREUID) ACE_UNUSED_ARG (ruid); ACE_UNUSED_ARG (euid); ACE_NOTSUP_RETURN (-1); #else return ::setreuid (ruid, euid); #endif /* ACE_LACKS_SETREUID */ } ACE_INLINE pid_t ACE_OS::setsid () { ACE_OS_TRACE ("ACE_OS::setsid"); #if defined (ACE_LACKS_SETSID) ACE_NOTSUP_RETURN (-1); #else return ::setsid (); # endif /* ACE_LACKS_SETSID */ } ACE_INLINE int ACE_OS::setuid (uid_t uid) { ACE_OS_TRACE ("ACE_OS::setuid"); #if defined (ACE_LACKS_SETUID) ACE_UNUSED_ARG (uid); ACE_NOTSUP_RETURN (-1); # else return ::setuid (uid); # endif /* ACE_LACKS_SETUID */ } ACE_INLINE int ACE_OS::seteuid (uid_t uid) { ACE_OS_TRACE ("ACE_OS::seteuid"); #if defined (ACE_LACKS_SETEUID) ACE_UNUSED_ARG (uid); ACE_NOTSUP_RETURN (-1); # else return ::seteuid (uid); # endif /* ACE_LACKS_SETEUID */ } ACE_INLINE int ACE_OS::sleep (u_int seconds) { ACE_OS_TRACE ("ACE_OS::sleep"); #if defined (ACE_HAS_CLOCK_GETTIME) struct timespec rqtp; // Initializer doesn't work with Green Hills 1.8.7 rqtp.tv_sec = seconds; rqtp.tv_nsec = 0L; //FUZZ: disable check_for_lack_ACE_OS return ::nanosleep (&rqtp, 0); //FUZZ: enable check_for_lack_ACE_OS #elif defined (ACE_LACKS_SLEEP) ACE_UNUSED_ARG (seconds); ACE_NOTSUP_RETURN (-1); #elif defined (ACE_WIN32) ::Sleep (seconds * ACE_ONE_SECOND_IN_MSECS); return 0; #elif defined (ACE_MQX) _time_delay (seconds * ACE_ONE_SECOND_IN_MSECS); return 0; #else return ::sleep (seconds); #endif /* ACE_WIN32 */ } ACE_INLINE int ACE_OS::sleep (const ACE_Time_Value &tv) { ACE_OS_TRACE ("ACE_OS::sleep"); #if defined (ACE_WIN32) ::Sleep (tv.msec ()); return 0; #elif defined (ACE_MQX) _time_delay (tv.msec ()); return 0; #elif defined (ACE_HAS_CLOCK_GETTIME) timespec_t rqtp = tv; //FUZZ: disable check_for_lack_ACE_OS return ::nanosleep (&rqtp, 0); //FUZZ: enable check_for_lack_ACE_OS #else # if !defined (ACE_LACKS_SELECT) # if defined (ACE_HAS_NONCONST_SELECT_TIMEVAL) // Copy the timeval, because this platform doesn't declare the timeval // as a pointer to const. timeval tv_copy = tv; // FUZZ: disable check_for_lack_ACE_OS return ::select (0, 0, 0, 0, &tv_copy); // FUZZ: enable check_for_lack_ACE_OS # else const timeval* tvp = tv; // FUZZ: disable check_for_lack_ACE_OS return ::select (0, 0, 0, 0, tvp); // FUZZ: enable check_for_lack_ACE_OS # endif # else ACE_UNUSED_ARG (tv); ACE_NOTSUP_RETURN (-1); # endif #endif /* ACE_WIN32 */ } ACE_INLINE void ACE_OS::swab (const void *src, void *dest, ssize_t length) { #if defined (ACE_LACKS_SWAB) // ------------------------------------------------------------ // The following copyright notice applies to the swab() // implementation within this "ACE_LACKS_SWAB" block of code. // ------------------------------------------------------------ /* Copyright (c) 1994-2006 Red Hat, Inc. All rights reserved. This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions of the BSD License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license is available at http://www.opensource.org/licenses. Any Red Hat trademarks that are incorporated in the source code or documentation are not subject to the BSD License and may only be used or replicated with the express permission of Red Hat, Inc. */ const char *from = static_cast (src); char *to = static_cast (dest); ssize_t ptr = 0; for (ptr = 1; ptr < length; ptr += 2) { char p = from[ptr]; char q = from[ptr-1]; to[ptr-1] = p; to[ptr ] = q; } if (ptr == length) /* I.e., if length is odd, */ to[ptr-1] = 0; /* then pad with a NUL. */ #elif defined (ACE_HAS_NONCONST_SWAB) const char *tmp = static_cast (src); char *from = const_cast (tmp); char *to = static_cast (dest); # if defined (ACE_HAS_INT_SWAB) int ilength = ACE_Utils::truncate_cast (length); # if defined (ACE_SWAB_EQUIVALENT) ACE_SWAB_EQUIVALENT (from, to, ilength); # else ::swab (from, to, ilength); # endif # else ::swab (from, to, length); # endif /* ACE_HAS_INT_SWAB */ #else ::swab (src, dest, length); #endif /* ACE_LACKS_SWAB */ } ACE_INLINE long ACE_OS::sysconf (int name) { ACE_OS_TRACE ("ACE_OS::sysconf"); #if defined (ACE_INTEGRITY) if (name == _SC_PAGESIZE) return ACE_PAGE_SIZE; ACE_NOTSUP_RETURN (-1); #elif defined (ACE_LACKS_SYSCONF) ACE_UNUSED_ARG (name); ACE_NOTSUP_RETURN (-1); #else return ::sysconf (name); #endif /* ACE_LACKS_SYSCONF */ } ACE_INLINE long ACE_OS::sysinfo (int /*cmd*/, char * /*buf*/, long /*count*/) { ACE_OS_TRACE ("ACE_OS::sysinfo"); ACE_NOTSUP_RETURN (0); } ACE_INLINE int ACE_OS::truncate (const ACE_TCHAR *filename, ACE_OFF_T offset) { ACE_OS_TRACE ("ACE_OS::truncate"); #if defined (ACE_WIN32) ACE_HANDLE handle = ACE_OS::open (filename, O_WRONLY, ACE_DEFAULT_FILE_PERMS); LARGE_INTEGER loffset; loffset.QuadPart = offset; if (handle == ACE_INVALID_HANDLE) { ACE_FAIL_RETURN (-1); } else if (::SetFilePointerEx (handle, loffset, 0, FILE_BEGIN)) { BOOL result = ::SetEndOfFile (handle); ::CloseHandle (handle); ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (result, ace_result_), int, -1); } else { ::CloseHandle (handle); ACE_FAIL_RETURN (-1); } /* NOTREACHED */ #elif !defined (ACE_LACKS_TRUNCATE) return ::truncate (ACE_TEXT_ALWAYS_CHAR (filename), offset); #else ACE_UNUSED_ARG (filename); ACE_UNUSED_ARG (offset); ACE_NOTSUP_RETURN (-1); #endif /* ACE_WIN32 */ } ACE_INLINE useconds_t ACE_OS::ualarm (useconds_t usecs, useconds_t interval) { ACE_OS_TRACE ("ACE_OS::ualarm"); #if defined (ACE_HAS_UALARM) return ::ualarm (usecs, interval); #elif !defined (ACE_LACKS_UNIX_SIGNALS) && !defined (ACE_LACKS_ALARM) ACE_UNUSED_ARG (interval); # if defined (ACE_VXWORKS) && ACE_VXWORKS >= 0x690 && defined (_WRS_CONFIG_LP64) return ::alarm (static_cast (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); ACE_NOTSUP_RETURN (0); #endif /* ACE_HAS_UALARM */ } ACE_INLINE useconds_t ACE_OS::ualarm (const ACE_Time_Value &tv, const ACE_Time_Value &tv_interval) { ACE_OS_TRACE ("ACE_OS::ualarm"); #if defined (ACE_HAS_UALARM) useconds_t usecs = (tv.sec () * ACE_ONE_SECOND_IN_USECS) + tv.usec (); useconds_t interval = (tv_interval.sec () * ACE_ONE_SECOND_IN_USECS) + tv_interval.usec (); return ::ualarm (usecs, interval); #elif !defined (ACE_LACKS_UNIX_SIGNALS) && !defined (ACE_LACKS_ALARM) ACE_UNUSED_ARG (tv_interval); # if defined (ACE_VXWORKS) && ACE_VXWORKS >= 0x690 && defined (_WRS_CONFIG_LP64) return ::alarm (static_cast (tv.sec ())); # else return ::alarm (tv.sec ()); # endif #else ACE_UNUSED_ARG (tv_interval); ACE_UNUSED_ARG (tv); ACE_NOTSUP_RETURN (0); #endif /* ACE_HAS_UALARM */ } ACE_INLINE int ACE_OS::unlink (const char *path) { ACE_OS_TRACE ("ACE_OS::unlink"); #if defined (ACE_LACKS_UNLINK) ACE_UNUSED_ARG (path); ACE_NOTSUP_RETURN (-1); #elif defined (ACE_UNLINK_EQUIVALENT) return ACE_UNLINK_EQUIVALENT (path); #else return ::unlink (path); #endif /* ACE_LACKS_UNLINK */ } #if defined (ACE_HAS_WCHAR) ACE_INLINE int ACE_OS::unlink (const wchar_t *path) { ACE_OS_TRACE ("ACE_OS::unlink"); # if defined (ACE_WIN32) return ::_wunlink (path); # else ACE_Wide_To_Ascii npath (path); return ACE_OS::unlink (npath.char_rep ()); # endif /* ACE_WIN32 */ } #endif /* ACE_HAS_WCHAR */ ACE_INLINE ssize_t ACE_OS::write (ACE_HANDLE handle, const void *buf, size_t nbyte) { ACE_OS_TRACE ("ACE_OS::write"); #if defined (ACE_WIN32) DWORD bytes_written; // This is set to 0 byte WriteFile. // Strictly correctly, we should loop writing all the data if more // than a DWORD length can hold. DWORD short_nbyte = static_cast (nbyte); if (::WriteFile (handle, buf, short_nbyte, &bytes_written, 0)) return (ssize_t) bytes_written; else ACE_FAIL_RETURN (-1); #elif defined (ACE_MQX) return MQX_Filesystem::inst ().write (handle, reinterpret_cast (buf), nbyte); #elif defined (ACE_LACKS_WRITE) ACE_UNUSED_ARG (handle); ACE_UNUSED_ARG (buf); ACE_UNUSED_ARG (nbyte); ACE_NOTSUP_RETURN (-1); #else # if defined (ACE_HAS_CHARPTR_SOCKOPT) return ::write (handle, static_cast (const_cast (buf)), nbyte); # else return ::write (handle, buf, nbyte); # endif /* ACE_HAS_CHARPTR_SOCKOPT */ #endif /* ACE_WIN32 */ } ACE_INLINE ssize_t ACE_OS::write (ACE_HANDLE handle, const void *buf, size_t nbyte, ACE_OVERLAPPED *overlapped) { ACE_OS_TRACE ("ACE_OS::write"); #if defined (ACE_WIN32) DWORD bytes_written; // This is set to 0 byte WriteFile. DWORD short_nbyte = static_cast (nbyte); if (::WriteFile (handle, buf, short_nbyte, &bytes_written, overlapped)) return (ssize_t) bytes_written; else ACE_FAIL_RETURN (-1); #else ACE_UNUSED_ARG (overlapped); return ACE_OS::write (handle, buf, nbyte); #endif /* ACE_WIN32 */ } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/POSIX_CB_Proactor.h0000644000175000017500000000507515027201773017216 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file POSIX_CB_Proactor.h * * @author Alexander Libman */ //============================================================================= #ifndef ACE_POSIX_CB_PROACTOR_H #define ACE_POSIX_CB_PROACTOR_H #include /**/ "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #if defined (ACE_HAS_AIO_CALLS) #include "ace/Synch_Traits.h" #include "ace/Thread_Semaphore.h" #include "ace/Null_Semaphore.h" #include "ace/POSIX_Proactor.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_POSIX_CB_Proactor * * @brief Implementation of Callback-based Proactor */ class ACE_Export ACE_POSIX_CB_Proactor : public ACE_POSIX_AIOCB_Proactor { public: virtual Proactor_Type get_impl_type (); /// Destructor. virtual ~ACE_POSIX_CB_Proactor (); /// Constructor defines max number asynchronous operations that can /// be started at the same time. ACE_POSIX_CB_Proactor (size_t max_aio_operations = ACE_AIO_DEFAULT_SIZE); // This only public so the "extern C" completion function can see it // when needed. static void aio_completion_func (sigval cb_data); protected: /** * Dispatch a single set of events. If @a wait_time elapses before * any events occur, return 0. Return 1 on success i.e., when a * completion is dispatched, non-zero (-1) on errors and errno is * set accordingly. */ virtual int handle_events (ACE_Time_Value &wait_time); /** * Block indefinitely until at least one event is dispatched. * Dispatch a single set of events. If @a wait_time elapses before * any events occur, return 0. Return 1 on success i.e., when a * completion is dispatched, non-zero (-1) on errors and errno is * set accordingly. */ virtual int handle_events (); /// Find free slot to store result and aiocb pointer virtual ssize_t allocate_aio_slot (ACE_POSIX_Asynch_Result *result); /// Notify queue of "post_completed" ACE_POSIX_Asynch_Results /// called from post_completion method virtual int notify_completion (int sig_num); /** * Dispatch a single set of events. If @a milli_seconds elapses * before any events occur, return 0. Return 1 if a completion is * dispatched. Return -1 on errors. */ int handle_events_i (u_long milli_seconds); /// Semaphore variable to notify /// used to wait the first AIO start ACE_SYNCH_SEMAPHORE sema_; }; ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_AIO_CALLS */ #endif /* ACE_POSIX_CB_PROACTOR_H*/ ace-8.0.4+dfsg.orig/ace/Shared_Object.cpp0000644000175000017500000000164615027201773017126 0ustar sudipsudip#include "ace/Shared_Object.h" #include "ace/Global_Macros.h" #include "ace/config-all.h" /* Provide the abstract base class used to access dynamic linking facilities */ #if !defined (__ACE_INLINE__) #include "ace/Shared_Object.inl" #endif /* __ACE_INLINE__ */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Initializes object when dynamic linking occurs. int ACE_Shared_Object::init (int, ACE_TCHAR *[]) { ACE_TRACE ("ACE_Shared_Object::init"); return 0; } // Terminates object when dynamic unlinking occurs. int ACE_Shared_Object::fini () { ACE_TRACE ("ACE_Shared_Object::fini"); return 0; } // Returns information on active object. int ACE_Shared_Object::info (ACE_TCHAR **, size_t) const { ACE_TRACE ("ACE_Shared_Object::info"); return 0; } // Need to give a default implementation. ACE_Shared_Object::~ACE_Shared_Object () { ACE_TRACE ("ACE_Shared_Object::~ACE_Shared_Object"); } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Msg_WFMO_Reactor.h0000644000175000017500000000742215027201773017132 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Msg_WFMO_Reactor.h * * @author Beskrovny Evgeny * @author Irfan Pyarali */ //============================================================================= #ifndef ACE_MSG_WFMO_REACTOR_H #define ACE_MSG_WFMO_REACTOR_H #include /**/ "ace/pre.h" #include /**/ "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #if defined (ACE_WIN32) #include "ace/WFMO_Reactor.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_Msg_WFMO_Reactor * * @brief An OO event demultiplexor and event handler dispatcher for * Win32 . * * The ACE_Msg_WFMO_Reactor is an OO event demultiplexor and * event handler Reactor. It differs from ACE_WFMO_Reactor by * its ability to react on Windows messages. It is needed when * the task should serve also as a COM/DCOM server. */ class ACE_Export ACE_Msg_WFMO_Reactor : public ACE_WFMO_Reactor { public: /// Initialize ACE_Msg_WFMO_Reactor with the default size. ACE_Msg_WFMO_Reactor (ACE_Sig_Handler * = 0, ACE_Timer_Queue * = 0); /** * Initialize ACE_Msg_WFMO_Reactor with size @a size. Two slots will be * added to the @a size parameter which will store handles used for * internal management purposes. */ ACE_Msg_WFMO_Reactor (size_t size, int unused = 0, ACE_Sig_Handler * = 0, ACE_Timer_Queue * = 0); /// Close down the ACE_Msg_WFMO_Reactor and release all of its resources. virtual ~ACE_Msg_WFMO_Reactor () = default; /** * This event loop driver blocks for up to @a max_wait_time before * returning. It will return earlier if timer events, I/O events, * window events, or signal events occur. Note that @a max_wait_time * can be 0, in which case this method blocks indefinitely until * events occur. * * @a max_wait_time is decremented to reflect how much time this call * took. For instance, if a time value of 3 seconds is passed to * handle_events and an event occurs after 2 seconds, * @a max_wait_time will equal 1 second. This can be used if an * application wishes to handle events for some fixed amount of * time. * * is used as the demultiplexing call * * Returns the total number of ACE_Event_Handlers that were * dispatched, 0 if the @a max_wait_time elapsed without dispatching * any handlers, or -1 if an error occurs. * * The only difference between and * is that in the alertable case, MWMO_ALERTABLE is * passed to for the * option. */ 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 * NULL. */ virtual int handle_events (ACE_Time_Value &max_wait_time); virtual int alertable_handle_events (ACE_Time_Value &max_wait_time); protected: /// Wait for timer and I/O events to occur. virtual DWORD wait_for_multiple_events (int timeout, int alertable); /// Check for activity on remaining handles. virtual DWORD poll_remaining_handles (DWORD index); /// Dispatches window messages. virtual int dispatch_window_messages (); }; ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Msg_WFMO_Reactor.inl" #endif /* __ACE_INLINE__ */ #endif /* ACE_WIN32 */ #include /**/ "ace/post.h" #endif /* ACE_MSG_WFMO_REACTOR_H */ ace-8.0.4+dfsg.orig/ace/Monitor_Size.cpp0000644000175000017500000000143315027201773017045 0ustar sudipsudip#include "ace/Monitor_Size.h" #if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) #include "ace/Guard_T.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL namespace ACE { namespace Monitor_Control { Size_Monitor::Size_Monitor () : Monitor_Base ("", Monitor_Control_Types::MC_NUMBER) { } Size_Monitor::Size_Monitor (const char* name) : Monitor_Base (name, Monitor_Control_Types::MC_NUMBER) { } void Size_Monitor::update () { // No platform-specific or periodic code is needed, receive() can be // called directly whenever the size changes. } void Size_Monitor::clear () { this->Monitor_Base::clear (); } } } ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ ace-8.0.4+dfsg.orig/ace/config-netbsd.h0000644000175000017500000001023515027201773016613 0ustar sudipsudip/* -*- C++ -*- */ #ifndef ACE_CONFIG_H #define ACE_CONFIG_H #ifndef ACE_MT_SAFE #define ACE_MT_SAFE 1 #endif #if defined (__GNUG__) # include "ace/config-g++-common.h" #endif /* __GNUG__ */ #if defined(ACE_MT_SAFE) && (ACE_MT_SAFE != 0) # define ACE_HAS_THREADS 1 # define ACE_HAS_PTHREADS 1 # define ACE_HAS_PTHREADS_UNIX98_EXT 1 # define ACE_HAS_PTHREAD_RESUME_NP 1 # define ACE_HAS_PTHREAD_SUSPEND_NP 1 # define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1 # define ACE_LACKS_PTHREAD_YIELD 1 #endif /* ACE_MT_SAFE */ #define ACE_HAS_CLOCK_SETTIME 1 #define ACE_HAS_CLOCK_GETTIME 1 #define ACE_HAS_SETTIMEOFDAY 1 #define ACE_HAS_GETTIMEOFDAY 1 #define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R 1 #define ACE_HAS_3_PARAM_WCSTOK 1 #define ACE_HAS_4_4BSD_SENDMSG_RECVMSG 1 #define ACE_HAS_ALT_CUSERID 1 #define ACE_HAS_AUTOMATIC_INIT_FINI 1 #define ACE_HAS_CLOCK_GETTIME 1 #define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES 1 #define ACE_HAS_DIRENT 1 #define ACE_HAS_GETIFADDRS 1 #define ACE_HAS_GETPAGESIZE 1 #define ACE_HAS_GETPROGNAME 1 #define ACE_HAS_GETRUSAGE 1 #define ACE_HAS_GETRUSAGE_PROTOTYPE 1 #define ACE_HAS_GPERF 1 #define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT 1 #define ACE_HAS_IP_MULTICAST 1 #define ACE_HAS_MSG 1 #define ACE_HAS_NONCONST_SELECT_TIMEVAL 1 #define ACE_HAS_ONLY_SCHED_OTHER 1 #define ACE_HAS_POLL 1 #define ACE_HAS_POSIX_NONBLOCK 1 #define ACE_HAS_POSIX_TIME 1 #define ACE_HAS_P_READ_WRITE 1 #define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS 1 #define ACE_HAS_REENTRANT_FUNCTIONS 1 #define ACE_HAS_SCANDIR 1 #define ACE_HAS_SETPROGNAME 1 #define ACE_HAS_SIGACTION_CONSTP2 1 #define ACE_HAS_SIGINFO_T 1 #define ACE_HAS_SIGSUSPEND 1 #define ACE_HAS_SIGTIMEDWAIT 1 #define ACE_HAS_SIGWAIT 1 #define ACE_HAS_SIG_ATOMIC_T 1 #define ACE_HAS_SIG_C_FUNC 1 #define ACE_HAS_SOCKADDR_IN_SIN_LEN 1 #define ACE_HAS_SOCKADDR_IN6_SIN6_LEN 1 #define ACE_HAS_SOCKADDR_MSG_NAME 1 #define ACE_HAS_SOCKLEN_T 1 #define ACE_HAS_SSIZE_T 1 #define ACE_HAS_STRINGS 1 #define ACE_HAS_SVR4_DYNAMIC_LINKING 1 #define ACE_HAS_SYSV_IPC #define ACE_HAS_SYS_FILIO_H 1 #define ACE_HAS_STRSIGNAL #define ACE_HAS_SYS_SOCKIO_H 1 #define ACE_HAS_SYS_SYSCALL_H 1 #define ACE_HAS_SYSCTL #define ACE_HAS_TERMIOS 1 #define ACE_HAS_THREAD_SPECIFIC_STORAGE 1 #define ACE_HAS_TIMEZONE 1 #define ACE_HAS_TIMEZONE_GETTIMEOFDAY 1 #define ACE_HAS_UALARM 1 #define ACE_HAS_UCONTEXT_T 1 #define ACE_HAS_VOIDPTR_MMAP 1 #define ACE_HAS_VOIDPTR_SOCKOPT 1 #define ACE_HAS_WCHAR 1 #define ACE_HAS_XPG4_MULTIBYTE_CHAR 1 #define ACE_IOCTL_TYPE_ARG2 u_long #define ACE_LACKS_CONDATTR_PSHARED 1 #define ACE_LACKS_GETHOSTENT 1 #define ACE_LACKS_GETIPNODEBYADDR 1 #define ACE_LACKS_GETIPNODEBYNAME 1 #define ACE_LACKS_IOSTREAM_FX 1 #define ACE_LACKS_ITOW 1 #define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 #define ACE_LACKS_LOG2 1 #define ACE_LACKS_MSG_ACCRIGHTS 1 #define ACE_LACKS_MUTEXATTR_PSHARED 1 #define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS 1 #define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 #define ACE_LACKS_PTHREAD_THR_SIGSETMASK 1 #define ACE_LACKS_PTHREAD_YIELD 1 #define ACE_LACKS_RWLOCKATTR_PSHARED 1 #define ACE_LACKS_RWLOCK_T 1 #define ACE_LACKS_SETSCHED 1 #define ACE_LACKS_SIGINFO_H 1 #define ACE_LACKS_STROPTS_H 1 #define ACE_LACKS_STRRECVFD 1 #define ACE_LACKS_TIMEDWAIT_PROTOTYPES 1 #define ACE_LACKS_TIMESPEC_T 1 #define ACE_LACKS_UNBUFFERED_STREAMBUF 1 #define ACE_LACKS_WCSDUP 1 #define ACE_LACKS_WCSICMP 1 #define ACE_LACKS_WCSNICMP 1 #define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR 1 #define ACE_LACKS_ISCTYPE #if defined(__x86_64__) #define ACE_SIZEOF_DOUBLE 8 #define ACE_SIZEOF_FLOAT 4 #define ACE_SIZEOF_INT 4 #define ACE_SIZEOF_LONG 8 #define ACE_SIZEOF_LONG_DOUBLE 16 #define ACE_SIZEOF_LONG_LONG 8 #define ACE_SIZEOF_SHORT 2 #define ACE_SIZEOF_VOID_P 8 #define ACE_SIZEOF_WCHAR 4 #define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%ld" #define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu" #elif defined(__i386__) #define ACE_SIZEOF_DOUBLE 8 #define ACE_SIZEOF_FLOAT 4 #define ACE_SIZEOF_INT 4 #define ACE_SIZEOF_LONG 4 #define ACE_SIZEOF_LONG_DOUBLE 12 #define ACE_SIZEOF_LONG_LONG 8 #define ACE_SIZEOF_SHORT 2 #define ACE_SIZEOF_VOID_P 4 #define ACE_SIZEOF_WCHAR 4 #else # error unknown CPU architecture #endif #endif /* ACE_CONFIG_H */ // Local Variables: // mode:C++ // End: ace-8.0.4+dfsg.orig/ace/filecache.mpb0000644000175000017500000000014115027201773016316 0ustar sudipsudip// -*- MPC -*- feature(ace_filecache) { Source_Files(ACE_COMPONENTS) { Filecache.cpp } } ace-8.0.4+dfsg.orig/ace/Framework_Component.inl0000644000175000017500000000212515027201773020402 0ustar sudipsudip// -*- C++ -*- #include "ace/ACE.h" #include "ace/Guard_T.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_Framework_Component::ACE_Framework_Component (void *_this, const ACE_TCHAR *dll_name, const ACE_TCHAR *name) : this_ (_this), dll_name_ (ACE::strnew (dll_name ? dll_name : ACE_TEXT (""))), name_ (ACE::strnew (name ? name : ACE_TEXT (""))) { ACE_TRACE ("ACE_Framework_Component::ctor"); } /***************************************************************/ ACE_INLINE int ACE_Framework_Repository::current_size () const { ACE_TRACE ("ACE_Framework_Repository::current_size"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, const_cast (this->lock_), -1); return this->current_size_; } ACE_INLINE int ACE_Framework_Repository::total_size () const { ACE_TRACE ("ACE_Framework_Repository::total_size"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, const_cast (this->lock_), -1); return this->total_size_; } ACE_END_VERSIONED_NAMESPACE_DECL ace-8.0.4+dfsg.orig/ace/Proactor.h0000644000175000017500000006050715027201773015671 0ustar sudipsudip// -*- C++ -*- //============================================================================= /** * @file Proactor.h * * @author Irfan Pyarali * @author Tim Harrison * @author Alexander Babu Arulanthu * @author Alexander Libman */ //============================================================================= #ifndef ACE_PROACTOR_H #define ACE_PROACTOR_H #include /**/ "ace/pre.h" #include /**/ "ace/config-all.h" #include /**/ "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS) // This only works on Win32 platforms and on Unix platforms supporting // POSIX aio calls. # include "ace/Asynch_IO.h" # include "ace/Asynch_IO_Impl.h" # include "ace/Thread_Manager.h" # include "ace/Timer_Queue.h" # include "ace/Timer_List.h" # include "ace/Timer_Heap.h" # include "ace/Timer_Wheel.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Forward declarations. class ACE_Proactor_Impl; class ACE_Proactor_Timer_Handler; /// Type def for the timer queue. typedef ACE_Abstract_Timer_Queue ACE_Proactor_Timer_Queue; /** * @class ACE_Proactor_Handle_Timeout_Upcall * * @brief Functor for ACE_Timer_Queue. * * This class implements the functor required by the Timer * Queue to call on ACE_Handlers. */ class ACE_Export ACE_Proactor_Handle_Timeout_Upcall { /// The main Proactor class has special permissions. friend class ACE_Proactor; public: /// Constructor. ACE_Proactor_Handle_Timeout_Upcall (); /// This method is called when a timer is registered. int registration (ACE_Proactor_Timer_Queue &timer_queue, ACE_Handler *handler, const void *arg); /// This method is called before the timer expires. int preinvoke (ACE_Proactor_Timer_Queue &timer_queue, ACE_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_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 (ACE_Proactor_Timer_Queue &timer_queue, ACE_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 canceled. 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 (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 (ACE_Proactor_Timer_Queue &timer_queue, ACE_Handler *handler, const void *arg); protected: /// Set the proactor. This will fail, if one is already set! int proactor (ACE_Proactor &proactor); /// Handle to the proactor. This is needed for posting a timer result /// to the Proactor's completion queue. ACE_Proactor *proactor_; }; /** * @class ACE_Proactor * * @brief A manager for asynchronous event demultiplexing. * * See the Proactor pattern description at * http://www.dre.vanderbilt.edu/~schmidt/PDF/proactor.pdf for more * details. */ class ACE_Export ACE_Proactor { // = Here are the private typedefs that the ACE_Proactor uses. typedef ACE_Timer_Queue_Iterator_T TIMER_QUEUE_ITERATOR; typedef ACE_Timer_List_T TIMER_LIST; typedef ACE_Timer_List_Iterator_T TIMER_LIST_ITERATOR; typedef ACE_Timer_Heap_T TIMER_HEAP; typedef ACE_Timer_Heap_Iterator_T TIMER_HEAP_ITERATOR; typedef ACE_Timer_Wheel_T TIMER_WHEEL; typedef ACE_Timer_Wheel_Iterator_T TIMER_WHEEL_ITERATOR; // = Friendship. /// Timer handler runs a thread and manages the timers, on behalf of /// the Proactor. friend class ACE_Proactor_Timer_Handler; public: /** * Constructor. If @a implementation is 0, the correct implementation * object will be created. @a delete_implementation flag determines * whether the implementation object should be deleted by the * Proactor or not. If @a tq is 0, a new TIMER_QUEUE is created. */ ACE_Proactor (ACE_Proactor_Impl *implementation = 0, bool delete_implementation = false, ACE_Proactor_Timer_Queue *tq = 0); /// Destruction. ~ACE_Proactor (); /// Get pointer to a process-wide ACE_Proactor. @a threads should /// be part of another method. static ACE_Proactor *instance (size_t threads = 0); /// Set pointer to a process-wide ACE_Proactor and return existing /// pointer. static ACE_Proactor *instance (ACE_Proactor * proactor, bool delete_proactor = false); /// Delete the dynamically allocated Singleton. static void close_singleton (); /// Cleanup method, used by the ACE_Object_Manager to destroy the /// singleton. static void cleanup (void *instance, void *arg); /// Name of dll in which the singleton instance lives. static const ACE_TCHAR *dll_name (); /// Name of component--ACE_Proactor in this case. static const ACE_TCHAR *name (); // = Proactor event loop management methods. /// Run the event loop until the method /// returns -1 or the method is invoked. static int run_event_loop (); /** * Run the event loop until the method * returns -1, the method is invoked, or the * ACE_Time_Value expires, in which case 0 is returned. */ static int run_event_loop (ACE_Time_Value &tv); /** * Instruct the to terminate its event * loop. * This method wakes up all the threads blocked on waiting for * completions and end the event loop. */ static int end_event_loop (); /** * Resets the static so that the * method can be restarted. */ static int reset_event_loop (); /** * The singleton proactor is used by the ACE_Service_Config. * Therefore, we must check for the reconfiguration request and * handle it after handling an event. */ static int check_reconfiguration (ACE_Proactor *); /// Report if the event loop is finished. static int event_loop_done (); /// Close the associated @c ACE_Proactor_Impl implementation object. /** * If @arg delete_implementation was specified to the @c open() method, * the implementation object is also deleted. */ int close (); /** * You can add a hook to various run_event methods and the hook will * be called after handling every proactor event. If this function * returns 0, proactor_run_event_loop will check for the return value of * handle_events. If it is -1, the the proactor_run_event_loop will return * (pre-maturely.) */ typedef int (*PROACTOR_EVENT_HOOK)(ACE_Proactor *); // These methods work with an instance of a proactor. /** * Run the event loop until the * * method returns -1 or the method is invoked. */ int proactor_run_event_loop (PROACTOR_EVENT_HOOK = 0); /** * Run the event loop until the * method returns -1, the * method is invoked, * or the ACE_Time_Value * expires, in which case a 0 is returned. */ int proactor_run_event_loop (ACE_Time_Value &tv, PROACTOR_EVENT_HOOK = 0); /** * Instruct the ACE_Proactor to terminate its event loop * and notifies the ACE_Proactor so that it can wake up * and close down gracefully. */ int proactor_end_event_loop (); /// Report if the ACE_Proactor event loop is finished. int proactor_event_loop_done (); /// Resets the static so that the /// method can be restarted. int proactor_reset_event_loop (); /// This method adds the @a handle to the I/O completion port. This /// function is a no-op function for Unix systems and returns 0; int register_handle (ACE_HANDLE handle, const void *completion_key); // = Timer management. /** * Schedule a @a handler that will expire after